diff --git a/api/docCleanRunner/runner_test.go b/api/docCleanRunner/runner_test.go deleted file mode 100644 index f08ed34c..00000000 --- a/api/docCleanRunner/runner_test.go +++ /dev/null @@ -1,169 +0,0 @@ -package doccleanrunner_test - -import ( - "fmt" - "io" - "regexp" - "strings" - "testing" - "time" - - doccleanrunner "queryorchestration/api/docCleanRunner" - "queryorchestration/internal/database/repository" - documentclean "queryorchestration/internal/document/clean" - "queryorchestration/internal/server/runner" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/queue/documenttext" - "queryorchestration/internal/test" - objectstoremock "queryorchestration/mocks/objectstore" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -type DocCleanConfig struct { - runner.BaseConfig[doccleanrunner.Body] - documenttext.DocTextConfig - objectstore.ObjectStoreConfig -} - -func TestDocCleanRunner(t *testing.T) { - cfg := &DocCleanConfig{} - test.CreateDB(t, cfg) - acfg := test.CreateAWSContainer(t, cfg) - - test.SetQueueClient(t, t.Context(), cfg, acfg.ExternalEndpoint) - cfg.DocumentTextURL = test.CreateQueue(t, cfg, test.DocTextRunnerName) - - mockStore := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockStore - - runner := doccleanrunner.New(&doccleanrunner.Services{ - Clean: documentclean.New(cfg), - }) - - err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{ - Clientid: "clientid", - Name: "client_name", - }) - require.NoError(t, err) - docId, err := cfg.GetDBQueries().CreateDocument(t.Context(), &repository.CreateDocumentParams{ - Clientid: "clientid", - Hash: "hash", - }) - require.NoError(t, err) - part := uint16(1) - filetype := "pdf" - key := objectstore.BucketKey{ - CreatedAt: time.Now().UTC(), - ClientID: "clientid", - EntityID: uuid.New(), - Location: objectstore.Import, - Part: &part, - FileType: &filetype, - } - err = cfg.GetDBQueries().AddDocumentEntry(t.Context(), &repository.AddDocumentEntryParams{ - Documentid: docId, - Bucket: "bucket", - Key: key.String(), - }) - require.NoError(t, err) - - mimeType := "application/pdf" - mockStore.EXPECT(). - HeadObject( - mock.Anything, - mock.MatchedBy(func(in *s3.HeadObjectInput) bool { - return *in.Bucket == "bucket" && *in.Key == key.String() - }), - mock.Anything, - ). - Return(&s3.HeadObjectOutput{ - ContentType: &mimeType, - }, nil) - - bodyMsg := io.NopCloser(strings.NewReader(pdfHelloWorld)) - mockStore.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == "bucket" && *in.Key == key.String() - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: bodyMsg, - }, nil) - - bod := doccleanrunner.Body{ - DocumentID: docId, - } - assert.True(t, runner.Process(t.Context(), bod)) - - test.AssertMessageBody(t, cfg, cfg.GetDocumentTextURL(), regexp.MustCompile(fmt.Sprintf("{\"id\":\"%s\"}", docId.String()))) -} - -const pdfHelloWorld = `%PDF-1.4 -%���� -1 0 obj -<< - /Type /Catalog - /Pages 2 0 R - /Version /1.4 ->> -endobj -2 0 obj -<< - /Type /Pages - /Kids [3 0 R] - /Count 1 ->> -endobj -3 0 obj -<< - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - >> - >> - /Contents 4 0 R ->> -endobj -4 0 obj -<< - /Length - 44 ->> -stream -BT -/F1 24 Tf -100 700 Td -(Hello World!) Tj -ET -endstream -endobj -xref -0 5 -0000000000 65535 f -0000000015 00000 n -0000000086 00000 n -0000000151 00000 n -0000000376 00000 n -trailer -<< - /Size 5 - /Root 1 0 R ->> -startxref -472 -%%EOF` diff --git a/api/docTextRunner/runner.go b/api/docTextRunner/runner.go deleted file mode 100644 index 1a778d9e..00000000 --- a/api/docTextRunner/runner.go +++ /dev/null @@ -1,40 +0,0 @@ -package doctextrunner - -import ( - "context" - "log/slog" - - documenttext "queryorchestration/internal/document/text" - - "github.com/google/uuid" -) - -const Name = "docTextRunner" - -type Services struct { - Text *documenttext.Service -} - -type Runner struct { - svc *Services -} - -func New(svc *Services) Runner { - return Runner{ - svc: svc, - } -} - -type Body struct { - DocumentID uuid.UUID `json:"id" validate:"required,uuid"` -} - -func (s Runner) Process(ctx context.Context, body Body) bool { - err := s.svc.Text.Extract(ctx, body.DocumentID) - if err != nil { - slog.Error("unable to process", "error", err) - return false - } - - return true -} diff --git a/api/docTextRunner/runner_test.go b/api/docTextRunner/runner_test.go deleted file mode 100644 index b3788734..00000000 --- a/api/docTextRunner/runner_test.go +++ /dev/null @@ -1,198 +0,0 @@ -package doctextrunner_test - -import ( - "io" - "strings" - "testing" - "time" - - doctextrunner "queryorchestration/api/docTextRunner" - "queryorchestration/internal/database/repository" - documenttext "queryorchestration/internal/document/text" - "queryorchestration/internal/server/runner" - "queryorchestration/internal/serviceconfig/aws" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/textract" - "queryorchestration/internal/test" - objectstoremock "queryorchestration/mocks/objectstore" - textractmock "queryorchestration/mocks/textract" - - "github.com/aws/aws-sdk-go-v2/service/s3" - awstextract "github.com/aws/aws-sdk-go-v2/service/textract" - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -// Note: Query sync functionality has been removed. See remove_query_plan.md for details. -type DocTextConfig struct { - runner.BaseConfig[doctextrunner.Body] - aws.AWSConfig - textract.TextractConfig - objectstore.ObjectStoreConfig -} - -func TestDocTextRunner(t *testing.T) { - cfg := &DocTextConfig{} - test.CreateDB(t, cfg) - acfg := test.CreateAWSContainer(t, cfg) - - test.SetQueueClient(t, t.Context(), cfg, acfg.ExternalEndpoint) - - mockStore := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockStore - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - runner := doctextrunner.New(&doctextrunner.Services{ - Text: documenttext.New(cfg), - }) - - err := cfg.GetDBQueries().CreateClient(t.Context(), &repository.CreateClientParams{ - Clientid: "clientid", - Name: "client_name", - }) - require.NoError(t, err) - docId, err := cfg.GetDBQueries().CreateDocument(t.Context(), &repository.CreateDocumentParams{ - Clientid: "clientid", - Hash: "hash", - }) - require.NoError(t, err) - part := uint16(1) - filetype := "pdf" - key := objectstore.BucketKey{ - CreatedAt: time.Now().UTC(), - ClientID: "clientid", - EntityID: uuid.New(), - Location: objectstore.Import, - Part: &part, - FileType: &filetype, - } - err = cfg.GetDBQueries().AddDocumentEntry(t.Context(), &repository.AddDocumentEntryParams{ - Documentid: docId, - Bucket: "bucket", - Key: key.String(), - }) - require.NoError(t, err) - bucket := "bucket" - hash := "hash" - keyStr := key.String() - cleanId, err := cfg.GetDBQueries().AddDocumentClean(t.Context(), &repository.AddDocumentCleanParams{ - Documentid: docId, - Bucket: &bucket, - Hash: &hash, - Key: &keyStr, - Mimetype: repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.CleanmimetypeApplicationPdf, - }, - }) - require.NoError(t, err) - err = cfg.GetDBQueries().AddDocumentCleanEntry(t.Context(), &repository.AddDocumentCleanEntryParams{ - Cleanid: cleanId, - Version: 1, - }) - require.NoError(t, err) - - bodyMsg := io.NopCloser(strings.NewReader(pdfHelloWorld)) - mockStore.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == "bucket" && *in.Key == key.String() - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: bodyMsg, - }, nil) - filename := "../../assets/textract/helloWorld.gen" - textractBaseOut := test.GetTextractFileResponse(t, filename) - mockTextract.EXPECT(). - AnalyzeDocument( - mock.Anything, - mock.MatchedBy(func(in *awstextract.AnalyzeDocumentInput) bool { - return true - }), - mock.Anything, - ). - Return(textractBaseOut[0]["base"], nil).Once() - mockStore.EXPECT(). - PutObject( - mock.Anything, - mock.MatchedBy(func(in *s3.PutObjectInput) bool { - return *in.Bucket == "bucket" - }), - mock.Anything, - ). - Return(&s3.PutObjectOutput{}, nil) - - doc := doctextrunner.Body{ - DocumentID: docId, - } - // Note: Query sync functionality has been removed. Text extraction is now the terminal step. - assert.True(t, runner.Process(t.Context(), doc)) -} - -const pdfHelloWorld = `%PDF-1.4 -%���� -1 0 obj -<< - /Type /Catalog - /Pages 2 0 R - /Version /1.4 ->> -endobj -2 0 obj -<< - /Type /Pages - /Kids [3 0 R] - /Count 1 ->> -endobj -3 0 obj -<< - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - >> - >> - /Contents 4 0 R ->> -endobj -4 0 obj -<< - /Length - 44 ->> -stream -BT -/F1 24 Tf -100 700 Td -(Hello World!) Tj -ET -endstream -endobj -xref -0 5 -0000000000 65535 f -0000000015 00000 n -0000000086 00000 n -0000000151 00000 n -0000000376 00000 n -trailer -<< - /Size 5 - /Root 1 0 R ->> -startxref -472 -%%EOF` diff --git a/api/queryAPI/api.gen.go b/api/queryAPI/api.gen.go index e23c734d..def28473 100644 --- a/api/queryAPI/api.gen.go +++ b/api/queryAPI/api.gen.go @@ -507,7 +507,7 @@ type ClientUpdate struct { // CodeVersion The desired code version. type CodeVersion = int64 -// Collector Collector model. +// Collector Collector model. Note - minimum_text_version has been removed since text extraction is deprecated. type Collector struct { // ActiveVersion The desired version. ActiveVersion Version `json:"active_version"` @@ -520,24 +520,18 @@ type Collector struct { // MinimumCleanerVersion The desired code version. MinimumCleanerVersion CodeVersion `json:"minimum_cleaner_version"` - - // MinimumTextVersion The desired code version. - MinimumTextVersion CodeVersion `json:"minimum_text_version"` } // CollectorFieldName The output field name. type CollectorFieldName = string -// CollectorSet Payload for updating a Collector. +// CollectorSet Payload for updating a Collector. Note - minimum_text_version has been removed. type CollectorSet struct { // ActiveVersion The desired version. ActiveVersion *Version `json:"active_version,omitempty"` // MinimumCleanerVersion The desired code version. MinimumCleanerVersion *CodeVersion `json:"minimum_cleaner_version,omitempty"` - - // MinimumTextVersion The desired code version. - MinimumTextVersion *CodeVersion `json:"minimum_text_version,omitempty"` } // DocClient The properties of a client. @@ -2127,220 +2121,220 @@ func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+y9C3PbuLIg/FdQ+u5X48zoYct2Ht66tdfjx4zv5uG1nZ29Z+zrgkhIwoQCdADQjpLK", - "f99CAyBBEqQoR3KSOT51qiYW8Wg0+oVGo/tzJ+KzOWeEKdk5+NyZEhwTAf+8wIq8pjOq9B8xkZGgc0U5", - "6xzAJ5Tob4iyMRczrD8gypD5A1134Ov/uKcs5vf/ruiM9My/rzudbod8xLN5QjoHnZ3tbddoZ7vT7cho", - "SmZYzxhs81y3meGPrwmbqGnnYHfY7cyxUkRosP77z+3eq5tfXGPz1791uh21mOuBpBKUTTpfvnzRvQSe", - "EWXX+itW0fTsuLrSqylBI/0RpfOE4xidHfc73Q7V3+ZYTTvdDsMzPTi0uqVxp9sR5J8pFSTuHCiREn9R", - "/ybIuHPQ+f8GOdYH5qscOBg0dEcJJUzVARTB13pQvgKIbGINxTGP0lkDHLH9vhFIvMk1LCcf51zUQkLg", - "60bgyCbWULyXRJzMME2qYLy/eN0jLOIxiVEqiUBEt0M4jgWRsgYuaNMImmEor2mB+reDtC2InHMmiSXt", - "+DesyD1e6L8izhRhwNJ4Pk9oBJw7+EvqNXxuixIhuHhDpMQTYmYsouLko2ZInCBJxB2NCCK6g0ZBnXgJ", - "zWbbDvKGMNURZ+OERurRVnNBJE9FRBBOBMHxApGPVCqJuEBSaUEYWYjWtMBTLkY0jgl7tBWeMZmOxzQC", - "qTInYkalpJxJpLj+U5MgUlMqEY50jzWt84wZKgHoHnGtHm1qLl0jaZ6xO5zQ+IL8MyVSPeKSYFokzLxo", - "xOPFmlb0lqtTnrL48ZmNcYXGeuo1reSK8zeYLezeyMdcEMhilM45Q4pzNMNs4fZKrmF13c4FUWLROxwr", - "Iqp66W06GxGB+BhJEnEWSzQiYy4IUmJB2QThCabA0pnBtaPVSkADUaZ2h0YD0Vk66xy8fL63vd3tzCgz", - "f+faiDJFJkRohGityXCqplzQTyR+fMTfTwlDqQfCWijqi0MRjHEYzyjTxsEhSEg3d8BydlCNubBmAsOj", - "hAxiKvV/rYiV6J6qKZJpFBEpQc+kEmEWI21KS4Vn8063Mxd8ToSiRtGbntUpDUhOkBNtCRGmt+vPjp0U", - "foF/3Pi2ef61ZGN0OxGfMKr4rUxHf5FIabO3Mu+RaYNsG0RjwhQdUyJg8WrqFoucvVI4GeCd0TDajfd6", - "ZH/8vPfi5avtHh5FcY+Md4a7e/vP9S9Fc2i4/7xwGuiHbP+uNaQq4IJZp9lEAwY7gyOlbbk5ZwXA/uJT", - "1o85+Q/7Uz/is053ZUOt27G7WwXljylRU1JAEbQlsdk9B4qxFe24I84TgpkeOKeRqrHsPrmVWqrxFzjc", - "Hu73drZ7O8+vdvYOhvsHu7v/8BcYY0V6eo7iIvcDxqhv2f6ZLbib4cjOfpP15EArehEZSx0JglWQlXJ1", - "BxQV6YYg0hAj92YPgY1gti7SNncXmEhwzWlS0gmbwcm3zEs1NPK+YtejrVSSGGGJHLnrafVMz9ZCNP7h", - "Fvc+Hfb+sd171b/9/3+5vu7d/PIf3m/ww/V13/5083nY/RKk/zEVUt2aA0hogT9JNKF3hAG+ALE4injK", - "lEVwiVr+k09ZEfAdqxSyv9twZYKXATXGM5osWkJ1zMkagNJ0EuDP11QqzT9ARh/IAgxlQ06IMnSuLWjV", - "pxxtkf6k30UynRNxizVBd4E+3L9xGlPFRdee6G/1t2d9dKGnRbNUKnPW0IMueCq8kQm7o4ID9fZRZgBC", - "v7EmT0kTwlSyQD0UTUn0wXy7NUCSWI/opG5B9//ZyeHT/GkA1AxKFZkBLspIXY7GGf54Znrvm02wf+1k", - "bbEQeFGRF44pPIr1CcXtTwvp0UIhY20++TJEI6KLKIuSNNa/lPXZ2THIErlgkVXQFTHSSk0CgMZn8JMn", - "Rhj9Z0oCyvNxlGRkoLrFqkmHgGmV6ct7LJHtp+lL/y4XUpFZk3bZPdjbf6B26bYX05tR4MZoipsVeOTt", - "L6LS2nuAIbvXbVR6k9AuUVAuvNvI6a+SzKWZPQndQhgvnxlcEepWc1gTljPis/bFOE2ShU+Judh0hwDj", - "rzbU2UdnYzTGiSRda5Eb/06+QWgrwgz6aiaMsCLP0ChVcEYtyvsploiVphl4HpVnffQGsxQnRmxwgYQ+", - "u6EZXqARQU749duQRFGiByQbaAM1xQrdE0GK2PEVQQa/Bg7gwFruSGKUnDGziFMvdIwk1yoY04TEfXTE", - "Z3MsiLG0yo1BrmvtGBOlxVhuc0H/VBAJ6GdpkmhskNlcLboahaY/AJ7BugXbY3FcxOo7lizQXBCph6Zj", - "VCAdzXYai4+t6YrKrduxWqL2pATLy1RJzj+n7y6OTm6Pfj98+9vJ7fnh5eUf7y6Oq+JxGXgl7RpQTrlh", - "niu0Ag82qtpjkpBWqjY7+8a6h+ZEc9o1p9yx4DNEcDS1/Im2HH60us2I9dnDtG39odQeiAAmK9MeR9fa", - "GW/1wqsQHzsc1aCnDg0t5KVbKgy5gjIyNLHqBNnOLZ8iTKkZNQbJsM2xvnZvH/dMn5H9xk71boYmy+vF", - "wc7+ps71BZJeIjQUpklQKGqwlbUt/Wtmn1yLMsGz1q3+8T1mD7PP37e0yw1YnpGQWxjfr8nuztCe6R4m", - "mf2r7VcHO/sHu9vrNtZPCu6Uov8NgHtk2/0oFUIbEc5Ot2LXB2x9pnvV36LtQUruGqTyRiz5gI+lBSQP", - "Nexr/CrGYg2apkXLzRltd5Tck29ks1kyKdhujp0CNtzRu7enZxdvTh5gt3U76Txuwdp8jPQOI9O6SfRv", - "H+xsr0f0tzMiHbM1aoLXVAaWd44nlMFBLrFeN41pez+iuMIJMjjXon5uGmvJOyMKx1jhisyfYnk744LU", - "q2j9VQ8F5xeC8B2mibsmWWoa4QmpJxb9FTG4kCtcuHUbLtl2trcLl2w71Us2M+2tpJ9I0/2fQdycCIDD", - "B0BLyEYIls0PGxGgTdgfVoJghlU01Tp6TBNVwsTeiyZIhjt7L/Ze7j7XrZpuHbtwtmvw3BpA4NLA25qO", - "J0earh4rxktBigC6Gv2aBjiHNUs0/iY28sl7w97L70NADmg8G9mklKCjVBGJtkAl2fsQEBnFqxFZPVs1", - "KjEjncq3Bk5dlnQXw2qKN31jYCEqXxkEQTrmpHc5oxCWtaELg8yWTdreHPTQxcn568Ojk0uEk8S4pHKz", - "dotxpU0mqugdedZHV1z/hTB8dj5rAj0dfZuO8ySVgAVG7hFnBLoKMuN3JOvNIaxTGa0PV4SaiMO3El9z", - "IeGuH2wjLtCYQmCOwor00TsNBkQdjSlJYqStakES8CYlBN8RO3rKoilmk5LT7JvfY1T5V3861UvRvao0", - "cknZJNGLutcEYhxnZuVajaGtnZ2h+RtwNdPEwBm0r3IrxoIockwEvSPxIdAJZxdYkSNAlTYZEspICQvD", - "7ZChXBjrKMF0drWYk6M4hMLmzqeEXEZTEqfJA2b2Ov8fIqSNdFgNgN8ET+dEhPu3gOE1H63e6S1R91x8", - "WL3jueBxauIcV+44EXj2oI53V9Bi1Z4XhM5Gb4ia8rhdZ0uTx0RG1X1s6vEGfzwlRNPyGYsK4UkxT42R", - "lpkLr7L/9V+9CloM1hYrjn8eqdbj9/Xoy4ZO1VRrb6VxG1jxfnDBI5okK3Ba3rz1DBEWd4SnquUMrvmZ", - "CQes2r6RFg7ZQtuOqjtdwkHhIT3aL3au9s4Fj9pOkjVfeYY3fLUp3vD2c8RkjNOkfgtiiictV2iatp9Z", - "Ti3frZHpYjmtX4qcWkZcDxeSj1M6ourcHtCW4se2v6Kqoq7CGBrjiCZULQ7jv1KptCF0RcSsVdfJjKwf", - "uZMZqUXuZEbWitwJ+A7Fu3H9jEb3HiYQfq3t1tfkjiTvxkdYtFM4doRfsVw7pszILRkna92ad2yP33G0", - "DD1r3hQY84JoK9jclC6b/4LKD+/Gb7hQWJPyZTqKEizlKni5JHdEULV4SJ9l4F0JzOSYiKXtqkZMeH66", - "CcajDYxH18x4CZGyke8SPrKG5AVJwDUmp3TeiuFMV21KrtyVxW0VLbRszUlM4fn6N0yPWotA/XGtW8ZT", - "lVAiTj5GSaqZsiWiqt1aY812PaVCqmOeJLiegbKmH/VxR8q3I3GMF/JqKoic8iRuifV+WyxkE606wwpz", - "vHF9NzTwKUS9sGixbuRsguxa2yRzrChh6nBC3uCPlR7NHShr1SHBEXk3vjSPBFuyQblTayaYC353OScR", - "xYlatJ2s2Gelua7wR874bJWp8i6tZxKYTYhl0lbzCKzIiYxwghUXK0zj9aoVHoVWb/BHe4o+N06Mryfh", - "wvhhd9Za2E8QOhsdcXZnHEWnOFLmhWK70duNfzIek0jbwccl7Ji7u2XMA2OsXxXCsGuVO2ZEwe/eWlf9", - "cmLLesxpxdpoan9FWev2reVg1treLD50u+4IS9sKuax1awa1L61br0oqPtdq9xjTZGFZdY1k5IZf1cip", - "9GuPANuzjZGTt92g8eEmWb/1URp5/eaHm8DKgXfs5GNEpDyaYjGx14FfLRbcHBclBbbWBbRmByXoZGJ8", - "C5ugBTv8EZ5nox/O1BonSKP1q4K03luRRmtVESmj6t34DcEyFW3O7aHrtfYZXGjxprCzvfNq/+V2PO6R", - "8fP93ovnL573XsbkVe/V3t7uPn61u7v7AvuxMmkKQS5+hNnzAEkBQJc10UMaqDywDBcA9N7nzgXXjKdH", - "7EKiHoiq1MBA8L3+EbOIJMXYmhIM72FUL84SJ8m7cefgzxbpaEzfy3Q2w2LR+dL9XA4LADhuxzQhDM+a", - "3splTcyLBNMRFRboXd7GPNrtz+Nxp6v/ufMC/l1zebu3/er5are3NqRm2Z3tTbcSiq0M2H40Kh7xVJW2", - "0ItDtQvNMVTclnDQk0OaP6a5Isf2qWDlyheamn+2imEJbm9zFIsNWLk1UZlLg30sRDbwgsoc8jzuaH8d", - "0T6l6BqHiSK4N3Uyw+CgxasFQVQqGIlNCG15wyXCUUTmEHXCRZGwAztlQ41b5YPygxCXdrASJ+t0m4pw", - "siKkuI3EMAsJxCwOzI4NDg8PBy7X0wBaD1YWmoL2BBkTQVhUtpd3hsuiDL3cWhmY3vKW7K2j72rIhfmw", - "lJ3XsYX2he/yPnkGLk/kByM//3Ch3AVKzPoUabBNqCdLExPoWAxvbBdiHoamGFj+oLhxq2McAcqmEMes", - "UQstM1xPpCE1sU63+ks7IBlnvfPjU9AJ0iS5QZQhLKIpvSOtA0Pbg8gFnVCGk0xPV6F7Z5tkiioLeId9", - "JDH6x9l5CMROtuT+JzovbmdbzWz3Z/VNzjoiydEYF+L69ta0v3PBJ4JIeTsnIiIhxXeekRdyjZFtXIqz", - "bYZpZ1kynQcqAqMGG1Bb1tw5gqnH0gXC3N7elOY2Yj4XlyHy9dRAeXFhagpIkVrODWx5QfKFtI0R2keY", - "XS5M1FApQ5fhJZu3UdsKScLvIc0AuADhNbDshALK7cg1OVD0OSJXTV4WFJOlrai1VtM9Tk4sbw+OvfJe", - "ws7BGPX4WpLfkrg0grT4KOnw8LB6/louZdycv/J40TivOSA+HHdVTNSjQFv6LWzPiDOFKTOJKVwQMYT3", - "wiiyCrD9UH+2sA2KmRr6bUPgj3lkFtDiZGWZ9KjdscFb0doFjENKAaL6zXkbVJUepVQyHRweClL2B7d8", - "vmemrHMYwC3UmBITve27Dgwofc9rcPb29vK/3h51up23767gn/DqyP1x9va3oLPAByDMI4du3XZ+3242", - "uKvSYTuNVVh85Xmp+bl+n+peRJSkI5iENtOCfVEV4BvM4LF7O4idxH+YvKwuh8d+dHMg4y6RGiso4jFB", - "9nqqzCnP9wouuOFwd/fFcHv3+cv9vRcvnrd4THTEk4S4K6/yQwb7Cc14TJJ+MAndHbm9yxfRhA+31oee", - "jxKsiFQPmM0i4DbSapaItiP4++ONoshH9aAhguLJGD11ENbMWsFFt7wVQfZx2wnvEurFHU/VPFX2OYIm", - "9P7DRJyb7pIEX/ot4MhYeLqEUdZpjcT2/Wx/ZUtyxbpMnJWk/5rE2DcyErs5xDdhrIB1fsIEjaahZ9vu", - "S56UPDYeb/NS1IX346T+ZeiDRJA+k1zST+TXhQq5v09pQpCkn4i2s0YLeH0HyW40lSdkgqNFftx61ijJ", - "94av9l49fzF8tb/slPiAY76DIXSAr3pkeBITcRaHeBgem5kG6Oy4azL70PxMqU8/Nm8Stu2aL1eCPqEp", - "llfko7ogERcNmaEw0rypDxLC5tHcso/Jsl+eIQGDuKxPmbfaw0j1VDbFcrqMSn7XbVpxlJ/qXgvyEQkl", - "xDhMEmS+IciaS2KkeAXWVtb7az2MRV7Ffq+a7+4Afo7VtIGm5lhNtYC6o7Hmw1TA21PjB9yis1mq8CiB", - "vJjLSUwVdrdpLaC6TrL9zA5TQVnja1jYwzIpZehvkkJL6yHUXjGOdscvey929172XuHRTm+H7O+Pdsc7", - "L0n84gFXjBk87NQwUjV5kINIC0GP5WxeVCcznUhEWwmdTJXJ0DvDqovIR3hK6i5vbmkMr4TNQ8TQM+En", - "aVgvDR9T0D1JtX8dqfZwSVZ7NVYQZ9Lek+W83g+l1dgQ7dSuOLSwQlb4QC617C/N6lD7wRfUnzsz17Wz", - "4Kl57J69pkfu45fy4md1E1pIkPl1pEkHHME4LeXdzaeb0DuCZgRNOC8EGjzgxFXCnIMyiDeoclObjMs/", - "m9laOzamqZBGeA32tDlq3ibcZNAKU6b7qtXI/ZRGU8CqBewTnYNAR/c0SdCI5GUkcmzL3YPBAA8OB6bP", - "YLg93N8e7uwOtFjuR/KuhO3tvZcFdEP//i/6/3YEKDb1+eWXQf+X62s9QvAE3M4bZjajxhvmmzANnrFW", - "9ZJq7BTS24v3d3ovdnaj3quXhPT2nu+Rl7svd3bGO7sPsFMK6wkfa7mUdJRkgEEOCOk7Nf3oJ8pu3RVN", - "Hgt1UzvxlaHUZqq25Aw+B2bB6AfsG5JAuJMKppc5hQ/GRRvxOUEjLEmMOLOuE+tHucNJalbXSq+BLjBD", - "F/UaCIGyWqNsQqSG5yFgZp1RXh+tigXC4tt6jysklNGftYjNBuy3uP7fHYZZRqja6SA9iFjjhFWfTMhL", - "U1HPWcWfcE4exW0UhK1NUD6F2gSoJgWINrC9/B/VtIU4SyUSMqigJ0TcleYAYkNbOEmMppniO7hZklQq", - "49UXaaRSAcZMu0RIxZwmba6C7EXqr4uGVJ2QryjLxG5Eu1tFQV7phl+dCdCZOWcrWrRmt/JtaOp56bct", - "S3QPgNKo3cJW+8i7aUOUddeKp0Hqsx7Mks2xPsrbPFEdqpoU5RoGv3DOJnKirkDa91OepSeHk873SN6h", - "XKgVwoEz7TpDqYOIfTindTt3dddp1gvvbp63dnqgBZ+1jr8qBbbvLL19hrUWmD2/rGnD9odqVRFQe5dY", - "2UjH/O6op02iKZWKi0XVrv/BuS3H+hOrlZfwg7DLihxhjecaQ9jcM0Y8SWcskCKamZujFaz0o6wPuB/1", - "kaHVRVn1NlbvCBwWwqa2+abJfJwmxm9GbFbNwuli9avaVdJZeivsevjKQF+yLUc+hhuOhsaqGGdbls1U", - "OCcmRMpbm2HSZqVxf0YJlyS+1fQm7iDxJp8T5v+dkLG6rTYTdDIN/W49Q8AC5l+hQ2idb978XsxszgXi", - "YoIZ/aRXWIpJrLhWzlYLJv9hxHZeUagsurMLwzVL7qAE9tz2G5e7M6IEjVZ4nmWge2O6nTF4/159seSF", - "JtsZ8qsAg0tXOoXP0wTwDK9bbON/VyIl14xKJG38WVbZyVZ66aO3ULpFTYm4p5L0rzWnFR8SmGrrGb0u", - "vSNZCdmj5che+qxhHrwBsPsP/v8tODCDK8IclgZQpo1ngE+xNC2vO4PrTtGrlr2dkYPh9nCvkma2mHt0", - "0P95uSsXlmlLiWeyYCW1CGAvK61YcVuYxT6GmFrVriMbkw31tPtubkNK5l9JxA+RGA8k2veSGBqFXRQ5", - "CW+cZmvJtZFEmx9IGtCXPI20jZaO0kcnOJq6XbTKXSKqJESyaPi7Ns28oYj+NdMyoJeQO5JksIBbzTVB", - "kgAbaRnUR0c25jrCTNPwNcuaKQ43tsz44Dx6RlNKBBbRdDFQgpDcSWckbTsHsuGMVm9gC4adRVz97rzJ", - "1VYrxYOL2PWlh0njX5UhowXc64JmzIK4zksb3Jg8f/mzmpqgCQMRGi3MDXXxpvAYy+mIYxHfXhAcL6yh", - "fAbuZ42+Hc21744ubs/dexSorG02wYffN7Bz/NZHFbw3FWgC5ZQDEnBDwgfC548f+KKoCibg6it3MUi7", - "IGZKwHYzklpK19auqr7ngd+9d4VhIt/KomccNEhSFhFE1U8SmUsWwtSzJ5o3uP/+qeoBpHRRE3zk2VjC", - "BB/BvaPN85+tpkgYYaX/NjfN1q34ewa2eG0GQAhRv9vYkYYQFBvi0nQnX+PJOItrw0EO3Y0b3PrXvPlq", - "I3z1H2rRX/lqvN1LsbPYjL/aOzF3iP5J+rXQpoQKv3RmZdEtSl57JZqsyykvtR6aoJWNki2SJ2RVB1R9", - "GejCqIH99wrBh1ajTb8mZBWGqz0dxMWoIzg982I5oY6Wpz2uT+IYaulpWO4oufdknN4/E5cgy9w43AsQ", - "/gdSE9flio8M6opK22IZxUmGLyvV6Ld7r257N2G2Cwu939MZZj1BcKwP5AaS6iO60Pwt/Zb+btUSsdcI", - "TQRm+gQ5WhivSHln8uvZAw2255I+SPTRRDfVe2K+1tUXqUfewTJE+kVHljGC3vLsQYWPihBvgOI6nM8T", - "Whdq5akoPJ9r2kT3XHwYJ/zeWAfwxY/TLN0Wm4DO5Ud5GN0JrYrdsZ5jfOIsqhJNwDpA/27hZD7FLJ0R", - "QSNgt5Tp80/EBUGaNwuXHSU7p7EM3p+HvX/Ybb5pEajnMJDjr3b/6gKDze/mjZDZKi+6dvmWHS6vIWlG", - "vcdZ3O7GXMZtyKjgMs6Wqhl6Q+S0zrs+Q4M2YvtxvEc13PBHkb2/L7aoXghWGaXrUXCQaahUTScMz+bM", - "nsbnb+zaPo0vxFYvD9m7LMU3hApD9eAyzasA5XFx4YHTzsEOEl6+9mXVoWaExXqQt2mgKFX21Z26YtNL", - "q8tDbN+6N975LjuGFoAp5cQtvz1msEpEXCsUqnO519ve6W3vlIVNGznjg1LJ+FoDjMrboZqym8Pe7oPA", - "SRW/IIzc48QmYiztTaq4Pp7pBoiyWKtxsJqqDzu8oVxKzIax9JJk+bAVrsRTnyXhrfecJvPLLq+hY9Ga", - "VV0pqyCV5KPatm3GHdOEvF3+Bqhqi7pJbjVl2YyErWbTI9l8xKU14I/ozBreNordpjaCgntejptleYzn", - "eEHEcuxDszZgQ8NLFY60vee9hGjJbWKzTQYCyHRnh/dK3ZbSswwrQv/m8/BLXSaoO6jSphdwmiYBFaV/", - "Re6xln2XIxAU/mi1yGwGk1y64rb2xkNvz8/a7IMbMrjfpSGvzt62HPKdmprtbYEHuH/NsNEWD2aGEB7e", - "FcZbAQ/QMYiH0pDt8aCbr06VOSpywnz7Xw8kzFAIeKs8HTUpOh6czEaSKBVULS61rVGoYX+YhjyDh8Vy", - "9Cn4qg9n+BPPSpijs+PzPjrTKDJWz8Xp0csXw330n39coZE+/s3BtohsfikHAqwp4ffGpEjVlAv6CaY5", - "4jGp/PheJJ2DzlSpuTwYDGIefVr0dYN+KnsES9Xb6WOAy65HG+YDrlsMB24gSPwV8bl9hWDqyXcOM4eJ", - "dXc5G57PCdPmduc3otC7s+MjpPgHYkO8tJwNdXafwB39gXwV3GY6n3rgdz32X/fK7diIYEHEqSOP//zj", - "qlP2zuutgMEQHylMGYkRHmuqd3uIC/v80O0ECxZMBwAp5wO9/M6XL/C6ZMxtWJzCpq6D24c5FXiC77DA", - "8/Q/jC1lT1fGF9QxBiM6Y5GeLC0g1mtfuZs4PD/LTN08Tkqrtv+dErFA70Q0JVIJ881mwoegsIRGxDpM", - "qzBAIJfW/KkkS+BRxhzphOY7BNmYxU12tvvb/R14yTYnDGvh2tntb/d3bcAGkO4A6tIOsiLVE1Jzxy1d", - "pWptGhz+cZltOLgn83Ln3TwuzlxRSy7gHkGmc/eSSR8BoLE+ssLoWUlp8GxmD34g9qhShd0VLrdK380M", - "YXCdg84/NWryvbYlrc2ZyKwNKhd+fbHzL936zJCCyDRRhRrndcCZQttBCPe/rhp6FcBLgkU0BbvaXBdo", - "jhmYqtRu22pAldC1AOfqr0Br3n+NFsZlkuVSDAKQ5dutIqqDk8QLvXRV/rudmEr3T93kphVMJAHnlKZc", - "NFrUgcOFuoWvIXic5M8gsn972Rv9uuFt4LrU4MRUkKiB2gEqLoy9EUSUjDywzF96nhAIN92Oe1MLwmG4", - "ve0krk0LhHOn7eAvaWyQfNZWleshrAYkekOBfC01pgS74JkLrMhrOqOqbhbbdpA3hBn2zAJCPbKFDmzJ", - "cPeSDrrtLO/2nmXGQWw67S7vdMrFiMYxgbPx3vDV8h5XnL/BbGGhg4cl++1WZXQMPEsvWHAgZDMr4M8b", - "ve3SvcY325BayazwRMvkDmyeLXzVudHWMZd1wbxE2pA94HDK0IiraUGDaC2Rl2836R9tsiTubq686zGT", - "4lefXGdzDs8FezYjukTD7W307n8h6rz5iSA4XrjcE+YmLTbmSYKwUoKOUkVk/5pds59/zoKPTxN+f/Dz", - "z9dsB26rBaJZ7mi9Ah/4rbmg8E6laPjYZTy7ZsM+OhtnzV1OVEgILbsoU4XmBwPi71dX52h/e4i2GPee", - "IJL42TXbDUKUo2+rYOsOAG8ZLHsAS964DI0VwtTV+QfHowN9lCpzX6UgOxaJ/32ME0mu2b6ryI+Fd4VZ", - "hErbez0yHnOhuuAvoSwlEHmip04Fkc/MHuiR0GG20ehXMsV3lAvYjl6w9P+CpyJc/x9tkf6k39W2hyvB", - "bxbp/m0vGLsuqYz+9kzPY4XAgHHWg4n0aObKWQOMJE0IU8nCPpElKOGTCYnB5iOiJ2lM9DAQ0SxTMO3H", - "aaLbO/zY++v5nGCRhTLr327zJu4yHXyteryraiPzPtcmk8RIpiNJVHa7a8REPp1uDOszSVvzFXXL47qc", - "BZAVB0yFuVqgLSCRKZaIcf/20u7eORaK4gRdmiWjy4gwLCiXbvssnwKFD7d3ELkjTLNrgCb1kYDPSIX1", - "AVw92BHUDCiQpMHUAQLKdK5I8y5FwA0R4yrINzAen831VpYQcScraFQcxUSRSJWBy6hZjwd8GmHmiwaC", - "tiw/PQOG0vuW4OgDKrAt2soAe6axoxdneLRiPRsZm2nTjrmoIFK5xKnr1dY2Tjugr6/cvZfLducuTAqx", - "22kOo7lMsWH5m7czDORe+prKCt7XqYwZVtEU3mZlGgNt0Uz/PFuTdTI0ZsY3WbbjCV9W/WsYXdstjK4j", - "zsYJNd62x7TSdK/h8l6/4vg3rMi9jcNoZ9gd+c8pLFvW2HdfugU/weAznGa+GIMvISF/qJZfmBkVadpI", - "y/3Gg9BsBPYR5NPIjSMqERWCgG9jlJA+ujACRGpbYkzFDN4HITgM5QlDqr6GYwDFl5aNzoY32s4YERc6", - "D3NoaWbmNAurP4vZZhVx5x/Myjdkj3PmMmhYKhTMxm1EKAy3X3yzZc2NkZJRZoy2ZmmiaM94GJ79i8i9", - "veU93nJ1ylMWf7enU7PjRq7Mc5HTdFQNejgviBKU3DlL0ZkwLUQVGi2MFw3hOBZEyqrQ+Y2oon22efY2", - "ydPq+Rq+P9H5D0PnvxHjhMmorYnC9T4FnDH6tCT1acLq4eoJH7N4wP2jtLZ+eaqsewVeA+jToEc/pcOI", - "niMjwxOYoIbiA2RpAFoDVXY7/7enR+wZCHp2ffVJS8P46DQq6vIkBmtn71rPkqG5eZ4fhsVCgoYTc+TO", - "fDWEAiqMR2pN8ud7ZFjjm3B+SOI4od6BWjRDQ0DlTQbAXSAG9KxzqIlV3QEoLGI1mn9yhTR1cO/QRdkV", - "xLOSIEAzzPCEyKr7xSfdPjrxdR+KMNPbPSIogoL4MTiMrII0+WvdKrQhbcP+ze3PM+uFPXSgIrsC6zvK", - "wQb4MsjB/WarqJS8s+CCm1HlghUXPEUxZz8pdI+ZeVQOYGZ+QsJiCCTN/Ty2AfztuyjfAHqMk/Hi5Pz1", - "4dEJulQCKzJZPLMQm4Abk9TF878h2/4SXHDZQyvTYkvjzzy1uyPgirzi+m87xEGWBPbw9WsUpULkjsnz", - "1+8vweunT3T6J9tbkBm/I5UBYJ2Z1xFw47DygZB5qbNzFh4YJGFmHYJmRX/eOFRnifKsaxEu0xKC70Kk", - "lDJLJhvw/a7Ri+tOFH1/TXLK76VNc8NwYsN+TDBEfmDyl1vwMRaHbPQx5j5FjaQTE0SEeugQqEJjBRB0", - "5BPDAfrzuuM5ta87N9fMUtK1e1dz3bG7WdOl6ze9uWYXcKm9vF0RzAsyT3BE0GGSmC2sgTYbQQ8XAN1y", - "ouLoL00C1x3Pqx9YSeFrEfjiJ7RlZwYq8Ca2tA+ZpYp2jhFMj+Z0tVWlmpyunnxX3ErDb+NnXXb4cJL6", - "X9DT+Hc4iRharBAddry3shdxYEM0zKPir7CCglfQx2bwzPlYtA+6aC7InbZBtI4uRa4ZCxYrnC8OdMRc", - "ENAPsX8HHXA1mpkf9+R/WM7RX+MAsFExT0z4g7q9zP49zG0/MNFRm+G3C9Izw2uO08xFeSqTRU5xAS7s", - "awNLcaH7FIMoIjzHI5pQtWjmtRP23bKaDUV74rQfk9MMZbVgtCgrldcmFspWL3WJCryqLrWuNeh/5N4v", - "bcLeLBR4rjE2Gy/3Ix+6JrNzZ80w21LKAZjN97/N9fZ36eryL5IzEnCsYuvpBnhl8JnGX2pjzvMbGexS", - "PkaObUYLmwoteNfi8ciGdIBXcrqW4n7gO5bv9QIEe/sPb9PraGxVd2qe9HG5N9VPjeRLcU38tcLbdH4E", - "4d3sKXDCe2UPQZDC/y4H+e/4lI1XlqeDyC+ZvYJkzcppW+FqabtOxrrmvy6O8iyaGxO4eR3wkMDNQH+S", - "uZuQuT5lZFThU2ReS3uTAviSKDd9DtJy0XtZT6wbEMJ+WfHlQthGlrk3hJFfX3yZXN5rKomvR30Sy+vn", - "iMsiRzQzQVkyZ5mOlgtmSD5l3z/lSWBGCy+HRVAyF3LKPI5oLqaxabCHs2XohT0R5BpfZ6lCqqBSAmpH", - "oNkerUtKB70c7001WuzSWUIqE5vM0Fyqlt51eSXwyyazHuk4zw5WL68heHOOhRqMuZj1YDioDRjxmLKJ", - "qwbt9bqyaY88qjcJVcjHeQI5A+ABSbcj1QKeW+uBzbZkTFEtNx1OwOBQYAr1+ukXRpRhiBcuJKZ6sfti", - "b+flcK8xn0tDjscolaqYvSVPO+GopJo+xpQJzh/w9n9ZmgQLllzNbFWVALZEMSBipLfvQaeOLC+wGY7E", - "TzJkXWcNy7OwoY0So06lDUbOZlt64nBqDXrYvZSZCZQX98gEWL2G+1UPQZZmDHhj3st72ZpN+UlId6xS", - "URe+nwCNBF9RD9f9Lv9tFTb5gc5rIOPjsSQ1oG2vJb/LJl8hwLYZolv29rtAJE/svj6Tocp9395k+MfZ", - "OcIimtK7QvZoo90Tgs6PT8tmDryLNGvJM+AvMSWA/L7WnrBwNpsUn+j8a0wKb456q2JEMn2IsCxisb2t", - "sUzVuwHbaPuabSzsXgsLYLgJedN0W/urxxKQ+nquSOwyeOWk9SSC1mZx1HA2liUifrBBMvgM/7m190x1", - "bxWPMItIopnHF4tITbGCNAsmUjFZNMkYM0ZVxizz2RSoLoJBytECP2KwwN/h6t9saYkqlqnHJfavcf7p", - "DYanhpWSi55HvjRrxQW/hNY2Yq81xHYWCNn6OJ8o99s57guiLEudtRHTrru0LRAHWIFlgW1KFqwei9bC", - "sDxjVFG4szV1+/VEToRXXadXgk4mRJwYeDZzPWAGtzPV3Q9YQK19ZJIdPWpITV6mJgChWQJSZg1Pt78b", - "4V9LISbWwNKj41yzAfUWkFdisE4XQQYenOR1Akck4WwCD3d4dhDsm2RDLgVRVoSQ5JUJf5LXLFSPMC8/", - "2dXz8Ps8WEK2qS8YrmYICYmgpCE2SYm84ofX7I9ysVjk14rt+mCbkdwzqGrptGu2VSoFaB+cjUiCRoLg", - "DzG/Z89skgocxxLxOyI0NSPJkZzyNLHPyEbkmqWyVMsWosgZITGJTenEqovLiLdTu5dLHFywdEgs0bAo", - "k+7RQ0Jlja7Q2rP+NTs27iTYLZNLCQ5CRIC5wiJNGFhyJm3tx4CTytURDnqp7Fn4UbNfeFU8G1xOfh3P", - "YsmFJ1PmW3mramqrOpFoNnYtTqqyNLWGU7sbW/BGWcO+VRTNJbR9pBAaEzdkZmwOlrVLeIqmWbtRbsnB", - "I5TNRDHmZNzCEMiuZLRJ4LS0TUho3un3G3SU3DzR6smaPHdOdDvYheXKJ+N0YxLZI5UlsYmZR65ltLfy", - "QqSgZlhmpliRSuOuV7PZxQ/orZ4iLK+ZURbd7AK8a6waaQxUF3hgn75DOhNFPhYKF5nyVyHTzHO7rG6U", - "yWUzZllAHa2HDSvd2RZb+25sK4eVEyZoNNXU+6W+sO+PnH7o7+IeikubkXPXer1Efsm5G18eyMHnvIDa", - "l4Hh0TYRBEliGdo46OFAOCKEhcsKdhEkQzd1wmZcKs1rcESlQqp+E4e/NiB9JdcU7/TyZbYq4OYXVqzU", - "zA9U4Fx6OedUpYHjiQO/ZWR1TsjFGnoeA8L+NzBfQ5lqCNEG9QHFrjPtUahaWJ+XcrUqjvVOWKjqCoE/", - "TfVazWlb4OiD1ume8wKSqlS5VI9qy51vxlNbqUhb46zN16IhelQ3bUE2BDi9UGr1h399/Hfg+kNbuThc", - "sLiG57XONE7gZgvapvcDl5VNrWMyEmkj2vmRAy/njTtZucdgG7IPzTQN14f2XmGKpVHmegzIzfp0bFtn", - "Qjp7uZSJ1bpbhVXNPNM/M/IgQ1YvP+C09aAVDTSSxP4hqaglw8/SDOVDBZ+TrGfnYXqzdOzamOLcnMO7", - "iIYmF4rLxlVG+pOu+JbewppN8V3fxS1etSRPhcfgcYb0yzybzHgCL8IFn+sSVVRZcBNmWoXCLemEjbXK", - "au3Dk8ez2VbgyNMysH+bCg1/i9gwP+fFQ/gzqCUHUyoVF4uWbhBb6RH8pGUYynz6AD9ICfbfLWx/Y2Va", - "9NU49Lb21pQQ5sryrsVxUxEHllSeJMA3VNAVhWJJxm3OwwXBXV7SuX0OBzd7QBy0MZ5LIP66cAT8HXN8", - "NwSMw4N98GXeeQG6amC7yxbaAjDK1PM9/1HVq+Fwd/fFcHv3+cv9vRcvni+vG/udGP2nISIpvsLzqoY/", - "SZnvRcqMFiin2HYCJg8KbHUsMBFimhy4mGBGP1E2yV9o1Nr80G1Tpj4M/hXJ6cY+dI9k7pspQ6xnMPyU", - "lu6xTHS3+XUxYx6XDD6bf5wZb+tS3ZcFu4YvXNxg675uaU5T5oXVanCgxHeVby8gQuIR+NZMVMe3nsyx", - "uHu8vOVLeVQA6E/n7u+CqQ0d+dJ8NYbOww9anrHzZ4n3VE0p8+1tF2mURyO5mKM8Xlz2r9m7POaodShQ", - "Fq2dmezXzI/Ym0wVEb17ov+BjPRAaooZ+u3kChWDrtAW+WhntcUNaGxKHfDZPFWuaK58VhPxZDB77L3d", - "XXvgU2W131noU9ExUKChVp6BLAqGOXFT9gl8VTRHTqSUWap8klDfQXAV7EcLWdX9Po2MGhHqHnYsF6Be", - "IMdc8AlUiPKfowTx1K+XQW+yJyUbNgfcRPVWgV3GE5t9y4OxNRkrb51+TFabcpPXqzFaX2vS36/evEYz", - "wlI0xxPzMsuvMG9qLITrkP7OZ+QcT1rEemhVO5iqWVLknSJUAIntlHmP9DoMZBpGPwkJDFdKQbL3cv9F", - "IfPYf/d//rdA7rEKI/6eTaOheDo0r42tgnuYVT5I1bRoZJsafmrRinSrdPqTtCXSssJnUHQ3K+nmm9dQ", - "KUF/kObeayIwU+ZKC6xH3b+PDtkiMA+KMEORNunVlEpEWDzn1FS7i6mM+B0B6qUC8XtmIAly0Jlb7gaV", - "kJtjaXERW5SIxQW0PL1/+ZpS++uJd9ODNjyjPzVZQLyriSDxPzBgxNTYsUQULs1VYWNzWh18hv++xTPy", - "NWflUmS+wlBVEYJLvPMzTNUYgi9/9aJ8v4Pz26VF96aOb7YeDJU5bp5Ydn3h9iVEl0nxqwLvTVCvzbga", - "MBszvmq0Gwum0XbBLPrzsPcP3Pu03Xt1e/NLyEIK3oVmD5DhJT9NFBGFNGwhL0tUTJIehrRNUR5n2SZ8", - "Quvvsot5WqAtgocCowUSJKaCRMrmpnD1ic+Oz21DbaMEnqfChCWhsWvke1mCmQn80fORi/z3mtvHAFWv", - "+8Vrl+U4OEjoYCBo0RQebu+9LGz4VKm5PBgM+j8HU/E+SYNGaaDZITJ7YYWCphEGpzFXQX8uuEliXHrh", - "Cltn99NTLM36U3fqaQNzhKMPtcT+O2ZxYkn9nR5liFwfFKfCWbmWemyyInRBIkJdkLRDsS2Rx2NirAaf", - "ObTOJx9NxVyJqD2c8Q+EyRpuOXKQL5F1h82z14kUHrcWfBVGyCXf9XWvrfCDJw1etXGNgKPLi1ONVEVc", - "nF4IVqlClXFqpfRwb2Vgb1aVTB4RVitMJ1bYrSKpnFytH+3hIut/1smsfyXpUxAoZUZ3h89lAoWn9cUi", - "XvOJEQdg7PPUvI83iMNZEXZJ4ExozgBhXWrmyWAKigcNyFdoUz0+OBO4KJBy5mX4OupNHIBPNLuhlA9m", - "C0HOt9aJMLq4C2uRc8Hj1FwBmkadbicVCfgIjdUT8+jToh/x2eBuB5L82WmqdQ8srUokSALuHsW93BRW", - "qBdTU1TVRc0wrqqLP1K50kvbwXyz245VeWC/6lhZaiTIbWFitdy+2DmKHvCVJ7BPlPX42Qte91I3n6Rw", - "Xlp9EeXgdQ/6cFhb2ynMezdvvOJDt7bDFMsS56P5JN92LJDXM8zwBJI7mgc28YwyKpUoj+/Xmf1y8+X/", - "BQAA//+IlZPWJEMBAA==", + "H4sIAAAAAAAC/+y9C3PbuLIg/FdQ+u5XY8/oYct2Ht66tdfjx4zv5uG1nZ29Z5zrgkhIwoQCdADQjpLK", + "f99CAyBBEqQoR3KSOT51qiYW8Wg0+oVGo/tzJ+KzOWeEKdk5/NyZEhwTAf+8xIq8ojOq9B8xkZGgc0U5", + "6xzCJ5Tob4iyMRczrD8gypD5A9104Ov/uKcs5vf/ruiM9My/bzqdbod8xLN5QjqHnd2dHddod6fT7cho", + "SmZYzxhs80y3meGPrwibqGnncG/Y7cyxUkRosP77z53ey/e/uMbmr3/rdDtqMdcDSSUom3S+fPmiewk8", + "I8qu9Vesoun5SXWl11OCRvojSucJxzE6P+l3uh2qv82xmna6HYZnenBodUvjTrcjyD9TKkjcOVQiJf6i", + "/k2Qceew8/8NcqwPzFc5cDBo6I4TSpiqAyiCr/WgfAUQ2cQaihMepbMGOGL7fSOQeJNrWE4/zrmohYTA", + "143AkU2soXgniTidYZpUwXh3+apHWMRjEqNUEoGIbodwHAsiZQ1c0KYRNMNQXtMC9e8EaVsQOedMEkva", + "8W9YkXu80H9FnCnCgKXxfJ7QCDh38JfUa/jcFiVCcPGaSIknxMxYRMXpR82QOEGSiDsaEUR0B42COvES", + "ms22HeQNYapjzsYJjdSjreaSSJ6KiCCcCILjBSIfqVQScYGk0oIwshCtaYFnXIxoHBP2aCs8ZzIdj2kE", + "UmVOxIxKSTmTSHH9pyZBpKZUIhzpHmta5zkzVALQPeJaPdrUXLpG0jxndzih8SX5Z0qkesQlwbRImHnR", + "iMeLNa3oDVdnPGXx4zMb4wqN9dRrWsk1568xW9i9kY+5IJDFKJ1zhhTnaIbZwu2VXMPqup1LosSidzRW", + "RFT10pt0NiIC8TGSJOIslmhExlwQpMSCsgnCE0yBpTODa1erlYAGokztDY0GorN01jl88Wx/Z6fbmVFm", + "/s61EWWKTIjQCNFak+FUTbmgn0j8+Ii/nxKGUg+EtVDUF4ciGOMonlGmjYMjkJBu7oDl7KAac2HNBIZH", + "CRnEVOr/WhEr0T1VUyTTKCJSgp5JJcIsRtqUlgrP5p1uZy74nAhFjaI3PatTGpCcICfaEiJMb9efHTsp", + "/AL/eO/b5vnXko3R7UR8wqjitzId/UUipc3eyrzHpg2ybRCNCVN0TImAxaupWyxy9krhZIB3R8NoL97v", + "kYPxs97zFy93engUxT0y3h3u7R88078UzaHhwbPCaaAfsv271pCqgAtmnWYTDRjsDI6UtuXmnBUA+4tP", + "WT/m5D/sT/2IzzrdlQ21bsfubhWUP6ZETUkBRdCWxGb3HCjGVrTjjjhPCGZ64JxGqsay++RWaqnGX+Bw", + "Z3jQ293p7T673t0/HB4c7u39w19gjBXp6TmKizwIGKO+ZftntuBuhiM7+/usJwda0YvIWOpYEKyCrJSr", + "O6CoSDcEkYYYuTd7CGwEs3WRtrm7wESCa06Tkk7YDE6+ZV6qoZF3FbsebaWSxAhL5MhdT6tn2l4L0fiH", + "W9z7dNT7x07vZf/2///l5qb3/pf/8H6DH25u+van95+H3S9B+h9TIdWtOYCEFviTRBN6RxjgCxCLo4in", + "TFkEl6jlP/mUFQHftUoh+7sNVyZ4GVBjPKPJoiVUJ5ysAShNJwH+fEWl0vwDZPSBLMBQNuSEKEMX2oJW", + "fcrRFulP+l0k0zkRt1gTdBfow/0bpzFVXHTtif5Wf9vuo0s9LZqlUpmzhh50wVPhjUzYHRUcqLePMgMQ", + "+o01eUqaEKaSBeqhaEqiD+bbrQGSxHpEJ3ULuv/PTg6f5k8DoGZQqsgMcFFG6nI0zvDHc9P7wGyC/Ws3", + "a4uFwIuKvHBM4VGsTyhuf1pIjxYKGWvzyZchGhFdRFmUpLH+pazPzk9AlsgFi6yCroiRVmoSADQ+g588", + "McLoP1MSUJ6PoyQjA9UtVk06BEyrTF/eY4lsP01f+ne5kIrMmrTL3uH+wQO1S7e9mN6MAjdGU9yswCNv", + "fxGV1t4DDNm9bqPSm4R2iYJy4d1GTn+VZC7N7EnoFsJ4+czgilC3msOasJwRn7UvxmmSLHxKzMWmOwQY", + "f7Whzj46H6MxTiTpWovc+HfyDUJbEWbQVzNhhBXZRqNUwRm1KO+nWCJWmmbgeVS2++g1ZilOjNjgAgl9", + "dkMzvEAjgpzw67chiaJED0g20AZqihW6J4IUseMrggx+DRzAgbXckcQoOWNmEade6BhJrlUwpgmJ++iY", + "z+ZYEGNplRuDXNfaMSZKi7Hc5oL+qSAS0M/SJNHYILO5WnQ1Ck1/ADyDdQu2x+K4iNW3LFmguSBSD03H", + "qEA6mu00Fh9b0xWVW7djtUTtSQmWl6mSnH/O3l4en94e/3705rfT24ujq6s/3l6eVMXjMvBK2jWgnHLD", + "PFdoBR5sVLUnJCGtVG129o11D82J5rRrTrljwWeI4Ghq+RNtOfxodZsR6/bDtG39odQeiAAmK9MeR9fa", + "GW/1wqsQnzgc1aCnDg0t5KVbKgy5gjIyNLHqBNnOLZ8iTKkZNQbJsM2xvnZvH/dMn5H9xk71boYmy+v5", + "4e7Bps71BZJeIjQUpklQKGqwlbUt/Wtmn1yLMsGz1q3+8T1mD7PP37W0yw1YnpGQWxjfr8nuztCe6R4m", + "mYPrnZeHuweHezvrNtZPC+6Uov8NgHtk2/04FUIbEc5Ot2LXB2x9pnvV36LtQUruGqTyRiz5gI+lBSQP", + "Nexr/CrGYg2apkXLzRltd5Tck29ks1kyKdhujp0CNtzx2zdn55evTx9gt3U76Txuwdp8jPQOI9O6SfTv", + "HO7urEf0tzMiHbM1aoJXVAaWd4EnlMFBLrFeN41pez+iuMIJMjjXon5uGmvJOyMKx1jhisyfYnk744LU", + "q2j9VQ8F5xeC8B2mibsmWWoa4QmpJxb9FTG4kCtcuHUbLtl2d3YKl2y71Us2M+2tpJ9I0/2fQdycCIDD", + "B0BLyEYIls0PGxGgTdgfVoJghlU01Tp6TBNVwsT+8yZIhrv7z/df7D3TrZpuHbtwtmvw3BpA4NLA25qO", + "J0earh4rxktBigC6Gv2aBjiHNUs0/iY28sk7w97L70NADmg8G9mklKCjVBGJtkAl2fsQEBnFqxFZPVs1", + "KjEjncq3Bk5dlnQXw2qKN31jYCEqXxkEQTrhpHc1oxCWtaELg8yWTdreHPTQ5enFq6Pj0yuEk8S4pHKz", + "dotxpU0mqugd2e6ja67/Qhg+O581gZ6Ovk3HeZJKwAIj94gzAl0FmfE7kvXmENapjNaHK0JNxOFbia+5", + "kHDXD7YRF2hMITBHYUX66K0GA6KOxpQkMdJWtSAJeJMSgu+IHT1l0RSzSclp9s3vMar8qz+d6aXoXlUa", + "uaJskuhF3WsCMY4zs3KtxtDW7u7Q/A24mmli4AzaV7kVY0EUOSGC3pH4COiEs0usyDGgSpsMCWWkhIXh", + "TshQLox1nGA6u17MyXEcQmFz5zNCrqIpidPkATN7nf8PEdJGOqwGwG+Cp3Miwv1bwPCKj1bv9Iaoey4+", + "rN7xQvA4NXGOK3ecCDx7UMe7a2ixas9LQmej10RNedyus6XJEyKj6j429XiNP54Romn5nEWF8KSYp8ZI", + "y8yFl9n/+i9fBi0Ga4sVx7+IVOvx+3r0ZUOnaqq1t9K4Daz4ILjgEU2SFTgtb956hgiLO8JT1XIG1/zc", + "hANWbd9IC4dsoW1H1Z2u4KDwkB7tFztX+xeCR20nyZqvPMNrvtoUr3n7OWIyxmlSvwUxxZOWKzRN288s", + "p5bv1sh0sZzWL0VOLSOuhwvJxykdUXVhD2hL8WPbX1NVUVdhDI1xRBOqFkfxX6lU2hC6JmLWqutkRtaP", + "3MmM1CJ3MiNrRe4EfIfi7bh+RqN7jxIIv9Z26ytyR5K342Ms2ikcO8KvWK4dU2bkloyTtW7NO7bH7zha", + "hp41bwqMeUm0FWxuSpfNf0nlh7fj11worEn5Kh1FCZZyFbxckTsiqFo8pM8y8K4FZnJMxNJ2VSMmPD/d", + "BOPRBsaja2a8hEjZyHcJH1lD8pIk4BqTUzpvxXCmqzYlV+7K4raKFlq25iSm8Hz9G6ZHrUWg/rjWLeOp", + "SigRpx+jJNVM2RJR1W6tsWa7nlEh1QlPElzPQFnTj/q4I+WbkTjBC3k9FUROeRK3xHq/LRayiVadYYU5", + "Xru+Gxr4DKJeWLRYN3I2QXatbZI5VpQwdTQhr/HHSo/mDpS16pDgiLwdX5lHgi3ZoNypNRPMBb+7mpOI", + "4kQt2k5W7LPSXNf4I2d8tspUeZfWMwnMJsQyaat5BFbkVEY4wYqLFabxetUKj0Kr1/ijPUVfGCfG15Nw", + "YfywO2st7CcInY2OObszjqIzHCnzQrHd6O3GPx2PSaTt4JMSdszd3TLmgTHWrwph2LXKHTOi4HdvrKt+", + "ObFlPea0Ym00tb+mrHX71nIwa21vFh+6XXeEpW2FXNa6NYPal9atVyUVn2u1e4JpsrCsukYycsOvauRU", + "+rVHgO3ZxsjJ227Q+HCTrN/6KI28fvPDTWDlwFt2+jEiUh5PsZjY68CvFgtujsuSAlvrAlqzgxJ0MjG+", + "hU3Qgh3+GM+z0Y9mao0TpNH6VUFa761Io7WqiJRR9Xb8mmCZijbn9tD1WvsMLrR4U9jZ2X158GInHvfI", + "+NlB7/mz5896L2Lysvdyf3/vAL/c29t7jv1YmTSFIBc/wuxZgKQAoKua6CENVB5YhgsAeu9z54JrxtMj", + "diFRD0RVamAg+F7/iFlEkmJsTQmGdzCqF2eJk+TtuHP4Z4t0NKbvVTqbYbHofOl+LocFABy3Y5oQhmdN", + "b+WyJuZFgumICgv0Lm9jHu315/G409X/3H0O/665vN3feflstdtbG1Kz7M72fbcSiq0M2H40Kh7xVJW2", + "0ItDtQvNMVTclnDQk0OaP6a5Isf2qWDlyheamn+2imEJbm9zFIsNWLk1UZlLg30sRDbwgsoc8jzu6GAd", + "0T6l6BqHiSK47+tkhsFBi1cLgqhUMBKbENryhkuEo4jMIeqEiyJhB3bKhhq3ygflByEu7WAlTtbpNhXh", + "ZEVIcRuJYRYSiFkcmB0bHB0dDVyupwG0HqwsNAXtCTImgrCobC/vDpdFGXq5tTIwveUt2VtH39WQC/Nh", + "KTuvYwvtC9/lffIMXJ7ID0Z+/uFCuQuUmPUp0mCbUE+WJibQsRje2C7EPAxNMbD8QXHjVsc4ApRNIY5Z", + "oxZaZrieSENqYp1u9Zd2QDLOehcnZ6ATpElygyhDWERTekdaB4a2B5ELOqEMJ5merkL31jbJFFUW8A77", + "SGL0j/OLEIidbMn9T3Re3M62mtnuz+qbnHVEkqMxLsT17a9pf+eCTwSR8nZORERCiu8iIy/kGiPbuBRn", + "2wzT7rJkOg9UBEYNNqC2rLlzBFOPpQuEubOzKc1txHwuLkPk66mB8uLC1BSQIrWcG9jyguQLaRsjtI8x", + "u1qYqKFShi7DSzZvo7YVkoTfQ5oBcAHCa2DZCQWU25FrcqDoc0SumrwsKCZLW1FrraZ7nJxY3h4ce+W9", + "hJ2DMerxtSS/JXFpBGnxUdLR0VH1/LVcyrg5f+XxonFec0B8OO6qmKhHgbb0W9ieEWcKU2YSU7ggYgjv", + "hVFkFWD7of5sYRsUMzX024bAn/DILKDFycoy6XG7Y4O3orULGIeUAkT1m/MmqCo9SqlkOjg6EqTsD275", + "fM9MWecwgFuoMSUmett3HRhQ+p7X4PzN7dV/vTnudDtv3l7DP+HVkfvj/M1vQWeBD0CYR47cuu38vt1s", + "cFelw3Yaq7D4yvNS83P9PtW9iChJRzAJbaYF+6IqwDeYwWP3dhA7if8weVldDo/96OZAxl0iNVZQxGOC", + "7PVUmVOe7RdccMPh3t7z4c7esxcH+8+fP2vxmOiYJwlxV17lhwz2E5rxmCR99IYrgnrIDniryEd1a+GC", + "RA0jQph9YBAjSVlEkG6jZbuwqc2oRDGZCxKFN8RoSDfoMgw77D30xJVgRaR6wGwOA5FW3ES0HcHf8bC0", + "MjZQ3fAViLtlhAXZxm0jvEeoF3M8VfNU2WcImsD7DxNtbrorEnzht4CjYuHJEkZZp9WIbI0EtKYtrWA/", + "153LJFZJwK9JUn0jO7CbQ/w+jBUwwE+ZoNE09DLbfcnzjsfGqW0eg7oIfpzUP/58kEzQx44r+on8ulAh", + "D/cZTQiS9BPRptRoAQ/sIJ+NJuiETHC0yE9U243Cen/4cv/ls+fDlwfLDoIPOMk7GEJn9KrThScxEedx", + "iF3hPZlpgM5PuiZ5D82PjVqi29RI2LZrvj8Jun2mWF6Tj+qSRFw0JH/CFX2yZd+LZb9sIwGDuMROmUPa", + "w0j14DXFcrqMSn7XbVpxlJ/NXsvsEQnlvDhKEmS+IUiMS2KkeAXWVgb6Kz2MRV7FRK9a6O6MfYHVtIGm", + "5lhNtYC6o7Hmw1TA81Lj6tuis1mq8CiB1JfLSUwVdrdpLaClTrP9zM5LQVnja03YwzIpZehvkkJLSx7U", + "3iKO9sYves/39l/0XuLRbm+XHByM9sa7L0j8/AG3iBk87MwwUjU/kINIC0GP5WzqUycznUhEWwmdTJVJ", + "wjvDqovIR3gt6u5nbmkMD4HNW8PQS+AnaVgvDR9T0D1JtX8dqfZwSVZ7+1UQZ9JeheW83g9lztgQ7dSu", + "OLSwQuL3QLq07C/N6lDewRfUnzsz17Wz4Kl5z549mEfu45fy4md1E1pIkPl1pEkHfL04LaXWzaeb0DuC", + "ZgRNOC/EEjzgcFXCnIMyiDcoZFObb8s/htlyOjZsqZApeA32tDlV3ibcJMkKU6b7qtXI/ZRGU8CqBewT", + "nYNAR/c0SdCI5JUicmzLvcPBAA+OBqbPYLgzPNgZ7u4NtFjuR/KuhO2d/RcFdEP//i/6/3YEqCf1+cWX", + "Qf+Xmxs9QvCw287hZTajxuHlmzANzq9WJZFq7BTS248PdnvPd/ei3ssXhPT2n+2TF3svdnfHu3sPsFMK", + "6wkfa7mUdJRkgEGaB+n7Lf0AJ8pu3S1MHu70vnbia0OpzVRtyRncC8yC0Q/YNySBiCYVzCBzBh+MFzbi", + "c4JGWJIYcWa9JNZlcoeT1KyulV4DXWCGLuo1EAJltUbZhEgNz0PAzDqjvARaFQuExbf1TlXIGaM/axGb", + "DdhvccO/NwyzjFC100EGELHGCas+mZCXpqKes6I+4bQ7ittAB1t+oHwKtTlOTZYPbWB7KT6qmQlxli0k", + "ZFBBTwiqK80BxIa2cJIYTTPFd3B5JKlUxnEv0kilAoyZdrmOimlL2tz22LvSXxcN2TghJVGWbN2IdreK", + "grzSDb862Z8zc85XtGjNbuXb0NTzym9blugeAKVRu4Wt9pH3vg1R1t0cngWpzzlNizbH+ihv80R1pGqy", + "kGsY/No4m0h7ugJp3095loEcTjrfI3mH0p1WCAfOtOuMlg4i9uGc1u3c1d2YWS+8u1ze2u2BFtxuHWJV", + "il3fXXrBDGstMHt+L9OG7Y/UqiKg9rqwspGO+d1RT5tEUyoVF4uqXf+Dc1uO9SdWKy/hB2GXFTnCGs81", + "hrC5Uox4ks5YIAs0MzdHK1jpx1kfcD/qI0Ori7LqxaveETgshE1t802T+ThNjN+M2MSZhdPF6reyq2Ss", + "9FbY9fCVgb5kW459DDccDY1VMc62LJupcE5MiJS3NomkTTzj/owSLkl8q+lN3EFuTT4nzP87IWN1W20m", + "6GQa+t16hoAFzL9Ch9A637z5vZi8nAvExQQz+kmvsBR2WHGtnK8WL/7DiO28aFBZdGcXhmuW3EEJ7Lnt", + "Ny53Z0QJGq3wAstA99p0O2fwxL36KMmLPrYz5FcBBpeuOgqfpwngGR6w2Mb/rkRKbhiVSNoQs6x4ky3m", + "0kdvoDqLmhJxTyXp32hOK74VMAXVM3pdekeyErJHy5G99OXCPHgDYPcf/P9bcGAGV4Q5LA2gEhvPAJ9i", + "aVredAY3naJXLXseIwfDneF+JZNsMb3ooP/zclcuLNNWC89kwUpqEcBeVj2x4rYwi30MMbWqXUc2Jhvq", + "afft3IaUzL+SiB8iMR5ItO8kMTQKuyhyEt44zdaSayOJNr+BNKAvef1oGy0dpY9OcTR1u2iVu0RUSYhk", + "0fB3bSZ5QxH9G6ZlQC8hdyTJYAG3mmuCJAE20jKoj45tWHWEmabhG5Y1UxxubJnxwXn0jKaUCCyi6WKg", + "BCG5k85I2nYOZMMZrZ65Fgw7i7j63Xmdq61WigcXsetLD5OpvypDRgu41wXNmAVxXZQ2uDE//vKXMzVB", + "EwYiNFqYG+riTeEJltMRxyK+vSQ4XlhD+Rzczxp9u5pr3x5f3l64JydQPNtsgg+/b2Dn+K2PKnhniswE", + "KiYHJOCGhA9EyJ888NFQFUzA1VfuYpB2QcyUgO1mJLWUrq1dVX2yA797TwfDRL6VRc84aGyUM1U/SWQu", + "WQhT2080b3D//VPVA0jpsib4yLOxhAk+gntHm8o/W02RMMJK/01umq1b8fcMbPHaDIAQon63sSMNISg2", + "xKXpTr7Gk3Ee14aDHLkbN7j1r3nW1Ub46j/Uor/y1Xi7x2DnsRl/tadg7hD9k/TLnU0JFX51zMqiW1S1", + "9qowWZdTXk09NEErGyVbJE/Iqg6o+krPhVED++/Veg+tRpt+TcgqDFd7OoiLUUdweubFikEdLU97XJ/E", + "MZTL07DcUXLvyTi9fyYuQZa5cbgfIPwPpCauy9UXGdTVjbb1MIqTDF9UCs7v9F7e9t6H2S4s9H5PZ5j1", + "BMGxPpAbSKrv5ELzt/Rb+rtVS8ReIzQRmOkT5GhhvCLlncmvZw812J5L+jDRRxPdVO+J+VpXQqQeeYfL", + "EOnXFVnGCHrLswcVPipCvAGK62g+T2hdqJWnovB8rmkT3XPxYZzwe2MdwBc/TrN0W2wCOpcf5WF0J7Qq", + "dsd6jvGJs6hKNAHrAP27hZP5FLN0RgSNgN1Sps8/ERcEad4sXHaU7JzGSnd/HvX+Ybf5fYtAPYeBHH+1", + "+1cXGGx+N2+EzFZ50bXLt+xoeZlIM+o9zuJ2N+YybkNGBZdxtlTN0Bsip3Xe9RkatBHbj+M9quGGP4rs", + "/X2xRfVCsMooXY+Cg0xDpWo6YXg2Z/b6PX9j1/b1eyG2ennI3lUpviFU+6kHl2lekSePiwsPnHYPd5Hw", + "UrIvKwA1IyzWg7xJA3Wnsq/u1BWbXlpdHmH7nL3xznfZMbQATCntbfl5MYNVIuJaoVApy/3ezm5vZ7cs", + "bNrIGR+USlLXGmBU3g7VVNYc9vYeBE6q+CVh5B4nNtdiaW9SxfXxTDdAlMVajYPVVH3Y4Q3lsl42jKWX", + "JMuHrXCxnfpECG+85zSZX3Z5mRyL1qywSlkFqSQf1bZtM+6YJuTN8jdAVVvUTXKrKcsmHWw1mx7Jphwu", + "rQF/ROfW8LZR7DZ7EdTU89LYLEtVPMcLIpZjH5q1ARsaXqlwpO097yVES24Tm22SDEAyOzu8V822lIFl", + "WBH67z8Pv9Qle7qDQmx6AWdpElBR+lfkHmvZdzkCQW2PVovMZjD5oytua2889ObivM0+uCGD+10a8vr8", + "Tcsh36qp2d4WeID71wwbbfFgZgjh4W1hvBXwAB2DeCgN2R4PuvnqVJmjIifMN//1QMIMhYC3SsVRk4Xj", + "wflqJIlSQdXiStsahTL1R2nIM3hUrDifgq/6aIY/8axKOTo/ueijc40iY/Vcnh2/eD48QP/5xzUa6ePf", + "HGyLyKaQciDAmhJ+b0yKVE25oJ9gmmMek8qP70TSOexMlZrLw8Eg5tGnRV836KeyR7BUvd0+BrjserRh", + "PuC6xXDgBoLcXhGf21cIpmR85yhzmFh3l7Ph+ZwwbW53fiMKvT0/OUaKfyA2xEvL2VBn9wnc0R/IV8Ft", + "pvOpB37XY/91r9yOjQgWRJw58vjPP647Ze+83goYDPGRwpSRGOGxpnq3h7iwzw/dTrBgwXQAkHI+0Mvv", + "fPkCr0vG3IbFKWxKN7h9mFOBJ/gOCzxP/8PYUvZ0ZXxBHWMwonMW6cnSAmK99pW7iaOL88zUzeOktGr7", + "3ykRC/RWRFMilTDfbLJ7CApLaESsw7QKAwRyac2fSrIEHmXMkU5oviOQjVncZGenv9PfhZdsc8KwFq6d", + "vf5Of88GbADpDqD07CCrQz0hNXfc0hWj1qbB0R9X2YaDezKvaN7N4+LMFbXkAu4RZDp3L5n0EQAa6yMr", + "jJ5VjQbPZvbgB2KPKoXWXW1yq/TdzBAG1zns/FOjJt9rW7XanInM2qA44dfXM//SrU/+KIhME1UoY14H", + "nKmlHYTw4OsKnlcBvCJYRFOwq811geaYgSk87batBlQJXQtwrv4KtOb912hhXCZZusQgAFlK3SqiOjhJ", + "vNBLV8i/24mpdP/UTd63gokk4JzSlItGizpwuFC38DUEj5P8GUT2by9Bo18avA1cVxqcmAoSNVA7QMWF", + "sTeCiJKRB5b5S88TAuF9t+Pe1IJwGO7sOIlr0wLh3Gk7+EsaGySftVVxegirAYneUANfS40pwS545hIr", + "8orOqKqbxbYd5A1hhn2zgFCPbKEDWxXcvaSDbrvLu71jmXEQm057yzudcTGicUzgbLw/fLm8xzXnrzFb", + "WOjgYclBu1UZHQPP0gsWHAjZzAr4873edule45ttSK1kVniiZbIp8m9rW3Xea+uYy7pgXiJtyB5wOGVo", + "xNW0oEG0lsgrtJsMjzZZEnc3V971mMniq0+uszmH54I9m/RcouHODnr7vxB13vxEEBwvXO4Jc5MWG/Mk", + "QVgpQUepIrJ/w27Yzz9nwcdnCb8//PnnG7YLt9UC0Sw9tF6BD/zWXFB4p1I0fOwytm/YsI/Ox1lzl/YU", + "cj7LLspUofnBgPj79fUFOtgZoi3GvSeIJN6+YXtBiHL0bRVs3QHgLYNlH2DJG5ehsUKYulL+4Hh0oI9S", + "Ze6rFGTHIvG/j3EiyQ07cEX3sfCuMItQaXuvR8ZjLlQX/CWUpQQiT/TUqSBy2+yBHgkdZRuNfiVTfEe5", + "gO3oBav7L3gqwiX+0RbpT/pdbXu4Kvtmke7f9oKx65LK6G/beh4rBAaMsx5MpEczV84aYCRpQphKFvaJ", + "LEEJn0xIDDYfET1JY6KHgYhmmYJpP04T3d7hx95fz+cEiyyUWf92mzdxl+nga9XjXVcbmfe5Nl8kRjId", + "SaKy210jJvLpdGNYn8nLmq+oWx7X5SyArDhgKszVAm0BiUyxRIz7t5d29y6wUBQn6MosGV1FhGFBuXTb", + "Z/kUKHy4s4vIHWGaXQM0qY8EfEYqrA/g6sGOoSxAgSQNpg4RUKZzRZp3KQJuiBhXQb6B8fhsrreyhIg7", + "WUGj4igmikSqDFxGzXo84NMIM180ELRl+WkbGErvW4KjD6jAtmgrA2xbY0cvzvBoxXo2MjbTph1zUUGk", + "crlR16utbZx2QF9fu3svl+3OXZgUYrfTHEZzmWLD8jdvZxjIvfQ1lRW8q1MZM6yiKbzNyjQG2qKZ/tle", + "k3UyNGbGN1m24wlfVv1rGF07LYyuY87GCTXetse00nSv4fJev+L4N6zIvY3DaGfYHfvPKSxb1th3X7oF", + "P8HgM5xmvhiDLyEhf6iWX5gZFWnaSMv9xoPQbAT2EeTTyI0jKhEVgoBvY5SQPro0AkRqW2JMxQzeByE4", + "DOUJQ6q+hhMAxZeWjc6G19rOGBEXOg9zaGlm5jQLqz+L2WYVcecfzMo3ZI9z5jJoWCoUzMZtRCgMd55/", + "s2XNjZGSUWaMtmZpomjPeBi2/0Xk3v7yHm+4OuMpi7/b06nZcSNX5rnIaTqqBj2cl0QJSu6cpehMmBai", + "Co0WxouGcBwLImVV6PxGVNE+2zx7m+Rp9XwN35/o/Ieh89+IccJk1NZE4XqfAs4YfVqS+jRh9XD1hI9Z", + "POD+UVpbvzxV1r0CrwH0adCjn9JhRM+RkeEpTFBD8QGyNACtgSq7nf/b0yP2DAQ9u776pKVhfHQaFXV5", + "EoO187etZ8nQ3DzPD8NiIUHDiTlyZ74aQgEVxiO1JvnzPTKs8U04PyRxnFDvQC2aoSGg8iYD4C4QA3rW", + "OZS9qu4A1A6xGs0/uUKaOrh36KLsCmK7JAjQDDM8IbLqfvFJt49Ofd2HIsz0do8IiqDmfQwOI6sgTf5a", + "twptSNuwf3P7s229sEcOVGRXYH1HOdgAXwY5uN9soZSSdxZccDOqXLDigqco5uwnhe4xM4/KAczMT0hY", + "DIGkuZ/HNoC/fRfla0CPcTJenl68Ojo+RVdKYEUmi20LsQm4MUldPP8bsu2vwAWXPbQyLbY0/sxTuzsC", + "rshrrv+2QxxmSWCPXr1CUSpE7pi8ePXuCrx++kSnf7K9TcmJygCwzszrCLhxWPlAyLzU2TkLDw2SMLMO", + "QbOiP987VGeJ8qxrES7TEoLvQqSUMksmG/D9rtGL604UfX9NcsrvpU1zw3Biw35MMER+YPKXW/AxFods", + "9DHmPkWNpFMTRIR66AioQmMFEHTsE8Mh+vOm4zm1bzrvb5ilpBv3ruamY3ezpkvXb/r+hl3CpfbydkUw", + "L8k8wRFBR0litrAG2mwEPVwAdMuJiqO/NAncdDyvfmAlha9F4Iuf0JadGajAm9jVatmu2DlGMD2a09UW", + "jmpyunryXXErDb+Nn3XZ4cNJ6n9BT+Pf4SRiaLFCdNjx3spexIEN0TCPir/CCgpeQZ+YwTPnY9E+6KK5", + "IHfaBtE6uhS5ZixYrHC+ONARc0FAP8T+HXTA1WhmftyT/1E5R3+NA8BGxTwx4Q/q9jL79zC3/cBER22G", + "3y5JzwyvOU4zF+WpTBY5xQW4sK8NLMWF7lMMoojwHI9oQtWimddO2XfLajYU7YnTfkxOM5TVgtGirFRe", + "m1goW6DUJSrwqrrUutag/7F7v7QJe7NQw7nG2Gy83I986JrMzt01w2yrJQdgNt//Ntfb36Wry79IzkjA", + "sYotmRvglcFnGn+pjTnPb2SwS/kYObYZLWwqtOBdi8cjG9IBXlXpWor7ge9YvtcLEOztP7xNr6OxVd2p", + "edLH5d5UPzWSL8U18dcKb9P5EYR3s6fACe+VPQRBCv+7HOS/41M2XlmeDiK/KvYKkjWrmG2Fq6XtOhnr", + "mv+6OM6zaG5M4OalvkMCNwP9SeZuQub6lJFRhU+RednsTQrgK6Lc9DlIy0XvVT2xbkAI+xXElwthG1nm", + "3hBmy+q3kMv7TVXv9ahPYnn9HHFV5IhmJihL5izT0XLBDMmn7PunPAnMaOHlsAhK5kJOmccRzcU0Ng32", + "cLYMvbAnglzj6yxVSBVUSkDtCDTbo3VJ6aCX452pRotdOktIZWKTGZpL1dK7Lq8Eftlk1iOd5NnB6uU1", + "BG/OsVCDMRezHgwHtQEjHlM2cdWgvV7XNu2RR/UmoQr5OE8gZwA8IOl2pFrAc2s9sNmWjCmq5abDCRgc", + "CkyhXj/9wogyDPHChcRUz/ee7+++GO435nNpyPEYpVIVs7fkaScclVTTx5gywfkD3v4vS5NgwZKrma2q", + "EsCWKAZEjPT2PejUkeUFNsOR+EmGrOusYXkWNrRRYtSptMHI2WxLTxxOrUEPu5cyM4Hy4h6ZAKvXcL/q", + "IcjSjAGvzXt5L1uzKT8J6Y5VKurC9xOgkeAr6uG63+W/qcImP9B5DWR8PJakBrSdteR32eQrBNg2Q3TL", + "3n4XiOSJ3ddnMlS579ubDP84v0BYRFN6V8gebbR7QtDFyVnZzIF3kWYteQb8JaYEkN/X2hMWzmaT4hOd", + "f41J4c1Rb1WMSKYPEZZFLLa3NZapejdgG21fs42F3WthAQw3IW+abmt/9VgCUl/PFYldBq+ctJ5E0Nos", + "jhrOxrJExA82SAaf4T+39p6p7q3iMWYRSTTz+GIRqSlWkGbBRComiyYZY8aoyphlPpsC1UUwSDla4EcM", + "Fvg7XP2bLS1RxTL1uMT+Nc4/vcHw1LBSctHzyJdmrbjgl9DaRuy1htjOAiFbH+cT5X47x31BlGWpszZi", + "2nWXtgXiACuwLLBNyYLVY9FaGJbnjCoKd7ambr+eyInwquv0WtDJhIhTA89mrgfM4HamuvsBC6i1j0yy", + "o0cNqcnL1AQgNEtAyqzh6fZ3I/xrKcTEGlh6dJxrNqDeAvJKDNbpIsjAg5O8TuCIJJxN4OEOzw6CfZNs", + "yKUgyooQkrwy4U/yhoXqEeblJ7t6Hn6fB0vINvUFw9UMISERlDTEJimRV/zwhv1RLhaL/FqxXR9sM5J7", + "BlUtnXbDtkqlAO2DsxFJ0EgQ/CHm92zbJqnAcSwRvyNCUzOSHMkpTxP7jGxEblgqS7VsIYqcERKT2JRO", + "rLq4jHg7s3u5xMEFS4fEEg2LMukePSRU1ugKrW33b9iJcSfBbplcSnAQIgLMFRZpwsCSM2lrPwacVK6O", + "cNBLZc/Cj5r9wqvi2eBy8ut4FksuPJky38pbVVNb1YlEs7FrcVKVpak1nNrd2II3yhr2raJorqDtI4XQ", + "mLghM2NzsKxdwlM0zdqNcksOHqFsJooxJ+MWhkB2JaNNAqelbUJC806/36Cj5OaJVk/W5LlzotvBLixX", + "PhmnG5PIHqksiU3MPHIto72VFyIFNcMyM8WKVBp3vZrNLn5Ab/UUYXnDjLLoZhfgXWPVSGOgusAD+/Qd", + "0pko8rFQuMiUvwqZZp7bZXWjTC6bMcsC6mg9bFjpzrbY2ndjWzmsnDJBo6mm3i/1hX1/5PRDfxf3UFza", + "jJy71usl8kvOvfflgRx8zguofRkYHm0TQZAklqGNgx4OhCNCWLisYBdBMnRTJ2zGpdK8BkdUKqTqN3H4", + "KwPSV3JN8U4vX2arAm5+YcVKzfxABc6ll3NOVRo4njjwW0ZW54RcrKHnMSDsfwPzNZSphhBtUB9Q7DrT", + "HoWqhfV5KVer4ljvhIWqrhD401Sv1Zy2BY4+aJ3uOS8gqUqVS/Wottz5Zjy1lYq0Nc7afC0aokd10xZk", + "Q4DTC6VWf/jXx38Hrj+ylYvDBYtreF7rTOMEbragbXo/cFnZ1DomI5E2op0fOfBy3riTlXsMtiH70EzT", + "cH1o7xWmWBplrseA3KxPx7Z1JqSzl0uZWK27VVjVzDP9MyMPMmT18gNOWw9a0UAjSewfkopaMvwszVA+", + "VPA5zXp2HqY3S8eujSnOzTm8i2hocqG4bFxlpD/pim/pLazZFN/1XdziVUvyVHgMHmdIv8yzyYwn8CJc", + "8LkuUUWVBTdhplUo3JJO2FirrNY+PHk8m20FjjwrA/u3qdDwt4gN83NePIQ/g1pyMKVScbFo6QaxlR7B", + "T1qGocynD/CDlGD/3cL2N1amRV+NQ29rb00JYa4s71ocNxVxYEnlSQJ8QwVdUSiWZNzmPFwQ3OUlndvn", + "cHCzB8RBG+O5BOKvC0fA3zHHd0PAODzYB1/mnRegqwa2u2yhLQCjTD3b9x9VvRwO9/aeD3f2nr042H/+", + "/NnyurHfidF/FiKS4is8r2r4k5T5XqTMaIFyim0nYPKgwFbHAhMhpsmBiwlm9BNlk/yFRq3ND902ZerD", + "4F+RnG7sQ/dI5r6ZMsR6BsNPaekey0R3m18XM+ZxyeCz+ce58bYu1X1ZsGv4wsUNtu7rluY0ZV5YrQYH", + "SnxX+fYSIiQegW/NRHV868kci7vHy1u+lEcFgP507v4umNrQkS/NV2PoPPyg5Rk7f5Z4T9WUMt/edpFG", + "eTSSiznK48Vl/4a9zWOOWocCZdHamcl+w/yIvclUEdG7J/ofyEgPpKaYod9Or1Ex6AptkY92VlvcgMam", + "1AGfzVPliubK7ZqIJ4PZE+/t7toDnyqr/c5Cn4qOgQINtfIMZFEwzImbsk/gq6I5ciKlzFLlk4T6DoKr", + "YD9ayKru92lk1IhQ97BjuQD1Ajnmgk+gQpT/HCWIp369DHqdPSnZsDngJqq3CuwyntjsWx6MrclYeev0", + "Y7LalJu8Xo3R+lqT/n79+hWaEZaiOZ6Yl1l+hXlTYyFch/R3PiMXeNIi1kOr2sFUzZIi7xShAkhsp8x7", + "pNdhINMw+klIYLhSCpL9FwfPC5nH/rv/878Fco9VGPH3bBoNxdOheW1sFdzDrPJBqqZFI9vU8FOLVqRb", + "pdOfpC2RlhU+g6K7WUk337yGSgn6gzT3XhOBmTJXWmA96v59dMQWgXlQhBmKtEmvplQiwuI5p6baXUxl", + "xO8IUC8ViN8zA0mQg87dcjeohNwcS4uL2KJELC6g5en9y9eU2l9PvJsetOEZ/ZnJAuJdTQSJ/4EBI6bG", + "jiWicGmuChub0+rgM/z3DZ6RrzkrlyLzFYaqihBc4p2fYarGEHz5qxfl+x2c364sujd1fLP1YKjMcfPE", + "susLty8hukyKXxV4b4J6bcbVgNmY8VWj3VgwjXYKZtGfR71/4N6nnd7L2/e/hCyk4F1o9gAZXvLTRBFR", + "SMMW8rJExSTpYUjbFOVxlm3CJ7T+LruYpwXaIngoMFogQWIqSKRsbgpXn/j85MI21DZK4HkqTFgSGntG", + "vpclmJnAHz0fuch/r7h9DFD1ul++clmOg4OEDgaCFk3h4c7+i8KGT5Way8PBoP9zMBXvkzRolAaaHSKz", + "F1YoaBphcBpzFfTngpskxqUXrrB1dj89xdKsP3WnnjYwRzj6UEvsv2MWJ5bU3+pRhsj1QXEqnJVrqccm", + "K0KXJCLUBUk7FNsSeTwmxmrwmUPrfPLRVMyViNrDGf9AmKzhlmMH+RJZd9Q8e51I4XFrwVdhhFzy3dz0", + "2go/eNLgVRvXCDi+ujzTSFXExemFYJUqVBmnVkoP91cG9v2qkskjwmqF6cQKu1UklZOr9aM9XGT9zzqZ", + "9a8kfQoCpczo7vC5TKDwtL5YxCs+MeIAjH2emvfxBnE4K8IuCZwJzRkgrEvNPBlMQfGgAfkKbarHB2cC", + "FwVSzrwMX0e9iQPwiWY3lPLBbCHI+dY6EUYXd2EtciF4nJorQNOo0+2kIgEfobF6Yh59WvQjPhvc7UKS", + "PztNte6BpVWJBEnA3aO4l5vCCvViaoqquqgZxlV18UcqV3ppO5hvdtuxKg/sVx0rS40EuS1MrJbbFztH", + "0QO+8gT2ibIeP3vB617q5pMUzkurL6IcvO5BHw5razuFee/mjVd86NZ2mGJZ4nw0n+TbjgXyeoYZnkBy", + "R/PAJp5RRqUS5fH9OrNf3n/5fwEAAP//xVBLpAdDAQA=", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/queryAPI/collector.go b/api/queryAPI/collector.go index e4f30816..f82b5efa 100644 --- a/api/queryAPI/collector.go +++ b/api/queryAPI/collector.go @@ -1,3 +1,6 @@ +// Package queryapi provides HTTP handlers for the Query API. +// Note: Text extraction has been removed. MinimumTextVersion is no longer supported. +// See remove_texttract_and_mocks_plan.md for details. package queryapi import ( @@ -10,7 +13,7 @@ import ( ) // GetCollectorByClientId retrieves a client's collector configuration. -// Query fields have been removed - only document processing settings remain. +// Note: MinTextVersion has been removed since text extraction is deprecated. func (s *Controllers) GetCollectorByClientId(ctx echo.Context, clientId ClientID) error { coll, err := s.svc.Collector.GetByClientID(ctx.Request().Context(), clientId) if err != nil { @@ -20,14 +23,13 @@ func (s *Controllers) GetCollectorByClientId(ctx echo.Context, clientId ClientID return ctx.JSON(http.StatusOK, Collector{ ClientId: clientId, MinimumCleanerVersion: coll.MinCleanVersion, - MinimumTextVersion: coll.MinTextVersion, ActiveVersion: coll.ActiveVersion, LatestVersion: coll.LatestVersion, }) } // SetCollectorByClientId updates a client's collector configuration. -// Query fields have been removed - only document processing settings remain. +// Note: MinTextVersion has been removed since text extraction is deprecated. func (s *Controllers) SetCollectorByClientId(ctx echo.Context, clientId ClientID) error { req := CollectorSet{} if err := ctx.Bind(&req); err != nil { @@ -37,7 +39,6 @@ func (s *Controllers) SetCollectorByClientId(ctx echo.Context, clientId ClientID err := s.svc.CollectorSet.SetByClientId(ctx.Request().Context(), clientId, &collectorset.SetParams{ ActiveVersion: req.ActiveVersion, MinCleanVersion: req.MinimumCleanerVersion, - MinTextVersion: req.MinimumTextVersion, }) if err != nil { return echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf("Unable to update collector: %s", err)) diff --git a/api/queryAPI/collector_test.go b/api/queryAPI/collector_test.go index 446fec7d..ce75349f 100644 --- a/api/queryAPI/collector_test.go +++ b/api/queryAPI/collector_test.go @@ -71,10 +71,10 @@ func TestGetCollectorByClientId(t *testing.T) { err = cons.GetCollectorByClientId(ctx, id) require.NoError(t, err) assert.Equal(t, http.StatusOK, rec.Code) + // Note: MinimumTextVersion has been removed since text extraction is deprecated assertBody(t, rec, queryapi.Collector{ ClientId: id, MinimumCleanerVersion: 0, - MinimumTextVersion: 0, ActiveVersion: 0, LatestVersion: 0, }) diff --git a/cmd/docCleanRunner/main.go b/cmd/docCleanRunner/main.go index 5b602f75..471dc715 100644 --- a/cmd/docCleanRunner/main.go +++ b/cmd/docCleanRunner/main.go @@ -1,10 +1,9 @@ -// **Listens For**: Body Containing Document ID. -// -// **Action**. +// Listens For: Body Containing Document ID. // +// Action: // If the document is not already clean according to the collector standards, a clean is triggered. -// -// An event with the document id is pushed to the DOCTEXT queue. +// Note: Text extraction has been removed. The document pipeline ends after cleaning. +// See remove_texttract_and_mocks_plan.md for details. package main import ( @@ -17,14 +16,14 @@ import ( "queryorchestration/internal/server/runner" "queryorchestration/internal/serviceconfig/build" "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/queue/documenttext" _ "github.com/lib/pq" ) +// DocCleanConfig provides configuration for the document cleaning runner. +// Note: documenttext.DocTextConfig has been removed since text extraction is deprecated. type DocCleanConfig struct { runner.BaseConfig[doccleanrunner.Body] - documenttext.DocTextConfig objectstore.ObjectStoreConfig } diff --git a/cmd/docTextRunner/main.go b/cmd/docTextRunner/main.go index 14c57d92..f9ac056a 100644 --- a/cmd/docTextRunner/main.go +++ b/cmd/docTextRunner/main.go @@ -1,67 +1,55 @@ -// **Listens For**: Body Containing Document ID -// -// **Action**. -// -// If the document text is not already extracted according to the collector standards, trigger the textract job for text detection. -// -// This is the terminal step in the document processing pipeline. -// Query processing has been removed - pipeline ends after text extraction. +// DEPRECATED: This runner is deprecated and no longer has any functionality. +// It is left in place until deployment code is updated accordingly. +// See remove_texttract_and_mocks_plan.md for details. package main import ( "context" "log/slog" + "net/http" "os" + "os/signal" + "syscall" + "time" - doctextrunner "queryorchestration/api/docTextRunner" - documenttext "queryorchestration/internal/document/text" - "queryorchestration/internal/server/runner" "queryorchestration/internal/serviceconfig/build" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/textract" - - _ "github.com/lib/pq" ) -type DocTextConfig struct { - runner.BaseConfig[doctextrunner.Body] - textract.TextractConfig - objectstore.ObjectStoreConfig -} +const serviceName = "docTextRunner" func main() { - // Print version information before any environment checks - build.PrintVersionInfo("docTextRunner") + build.PrintVersionInfo(serviceName) - ctx := context.Background() + slog.Warn("DEPRECATED: " + serviceName + " is deprecated and no longer has any functionality. " + + "This service is left in place until deployment code is updated accordingly.") - cfg := &DocTextConfig{} + mux := http.NewServeMux() + mux.HandleFunc("/health", func(w http.ResponseWriter, _ *http.Request) { + w.WriteHeader(http.StatusOK) + }) - cfg.ControllerFunc = func() runner.Controller[doctextrunner.Body] { - text := documenttext.New(cfg) - - return doctextrunner.New(&doctextrunner.Services{ - Text: text, - }) + server := &http.Server{ + Addr: ":8085", + Handler: mux, + ReadHeaderTimeout: time.Minute, } - server, err := runner.New(ctx, cfg) - if err != nil { - slog.Error(err.Error()) - os.Exit(1) - } + go func() { + slog.Info("Starting health check server on port 8085") + if err := server.ListenAndServe(); err != http.ErrServerClosed { + slog.Error("Health check server error", "error", err) + } + }() - err = cfg.SetStoreClient(ctx) - if err != nil { - slog.Error(err.Error()) - os.Exit(1) - } + sigChan := make(chan os.Signal, 1) + signal.Notify(sigChan, syscall.SIGINT, syscall.SIGTERM) - err = cfg.SetTextractClient(ctx) - if err != nil { - slog.Error(err.Error()) - os.Exit(1) - } + sig := <-sigChan + slog.Info(serviceName+" received shutdown signal, exiting gracefully", "signal", sig.String()) - server.Listen(ctx) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + if err := server.Shutdown(ctx); err != nil { + slog.Error("Error shutting down health check server", "error", err) + } } diff --git a/cmd/textExtractor/main.go b/cmd/textExtractor/main.go deleted file mode 100644 index 379b5212..00000000 --- a/cmd/textExtractor/main.go +++ /dev/null @@ -1,111 +0,0 @@ -package main - -import ( - "context" - "fmt" - "io" - "log/slog" - "os" - "path/filepath" - "time" - - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/aws" - "queryorchestration/internal/serviceconfig/build" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/textract" - - documenttext "queryorchestration/internal/document/text" - documenttypes "queryorchestration/internal/document/types" -) - -// Config provides the configuration for the text extractor tool. -// Note: Query-related configuration has been removed. See remove_query_plan.md. -type Config struct { - serviceconfig.BaseConfig - textract.TextractConfig - objectstore.ObjectStoreConfig -} - -func main() { - // Print version information before any environment checks - build.PrintVersionInfo("textExtractor") - - ctx := context.Background() - - directory := "files/" - - cfg := &Config{} - profile := aws.Profile(os.Getenv("AWS_PROFILE")) - if profile == "" { - slog.Error("profile not available") - os.Exit(1) - } - - err := cfg.SetTextractClientWithProfile(ctx, profile) - if err != nil { - slog.Error("error creating client", "error", err) - os.Exit(1) - } - - entries, err := os.ReadDir(directory) - if err != nil { - slog.Error("error finding directory", "error", err) - os.Exit(1) - } - - for _, entry := range entries { - if entry.IsDir() { - continue - } - - extractFile(ctx, cfg, directory, entry) - } -} - -func extractFile(ctx context.Context, cfg *Config, directory string, entry os.DirEntry) { - filePath := filepath.Join(directory, entry.Name()) - pdfFile, err := os.Open(filePath) - if err != nil { - slog.Error("error opening pdf file", "error", err) - return - } - - pdf, err := documenttypes.NewPDFFromReader(pdfFile) - if err != nil { - slog.Error("error creating pdf file", "error", err) - os.Exit(1) - } - - textSvc := documenttext.New(cfg) - - startTime := time.Now() - - text, err := textSvc.GetDocumentText(ctx, pdf) - if err != nil { - slog.Error("error getting page count", "error", err) - os.Exit(1) - } - - outputFilename := fmt.Sprintf("./text/%s.txt", entry.Name()) - file, err := os.Create(outputFilename) - if err != nil { - slog.Error("error creating file", "error", err) - os.Exit(1) - } - defer file.Close() - - s, err := io.ReadAll(text) - if err != nil { - slog.Error("error reading text", "error", err) - os.Exit(1) - } - - _, err = file.Write(s) - if err != nil { - slog.Error("error writing file", "error", err) - os.Exit(1) - } - - slog.Info("extracted text", "output", outputFilename, "time", time.Since(startTime)) -} diff --git a/cmd/textGenerator_test/text/textdetection.go b/cmd/textGenerator_test/text/textdetection.go deleted file mode 100644 index b94566f7..00000000 --- a/cmd/textGenerator_test/text/textdetection.go +++ /dev/null @@ -1,105 +0,0 @@ -//go:build aws - -//go:generate go run -tags=aws ./textdetection.go -package main - -import ( - "context" - "fmt" - "io" - "log/slog" - "os" - "time" - - documenttext "queryorchestration/internal/document/text" - documenttypes "queryorchestration/internal/document/types" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/aws" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/textract" -) - -// Config provides the configuration for the text generator test tool. -// Note: Query-related configuration has been removed. See remove_query_plan.md. -type Config struct { - serviceconfig.BaseConfig - textract.TextractConfig - objectstore.ObjectStoreConfig -} - -func main() { - ctx := context.Background() - - if len(os.Args) != 2 { - fmt.Println("Error: expected one argument") - fmt.Println("Usage:", os.Args[0], "") - os.Exit(1) - } - - name := os.Args[1] - - slog.Info("arguments", "file_base", name) - - cfg := &Config{} - profile := aws.Profile(os.Getenv("AWS_PROFILE")) - if profile == "" { - slog.Error("profile not available") - os.Exit(1) - } - - err := cfg.SetTextractClientWithProfile(ctx, profile) - if err != nil { - slog.Error("error creating client", "error", err) - os.Exit(1) - } - - root, err := os.OpenRoot("assets") - if err != nil { - slog.Error("error opening root", "error", err) - os.Exit(1) - } - - pdfFile, err := root.Open(fmt.Sprintf("original/%s.pdf", name)) - if err != nil { - slog.Error("error opening pdf file", "error", err) - os.Exit(1) - } - - pdf, err := documenttypes.NewPDFFromReader(pdfFile) - if err != nil { - slog.Error("error creating pdf file", "error", err) - os.Exit(1) - } - - textSvc := documenttext.New(cfg) - - startTime := time.Now() - - text, err := textSvc.GetDocumentText(ctx, pdf) - if err != nil { - slog.Error("error getting page count", "error", err) - os.Exit(1) - } - - outputFilename := fmt.Sprintf("text/%s.txt", name) - file, err := root.Create(outputFilename) - if err != nil { - slog.Error("error creating file", "error", err) - os.Exit(1) - } - defer file.Close() - - s, err := io.ReadAll(text) - if err != nil { - slog.Error("error reading text", "error", err) - os.Exit(1) - } - - _, err = file.Write(s) - if err != nil { - slog.Error("error writing file", "error", err) - os.Exit(1) - } - - slog.Info("extracted text", "output", outputFilename, "time", time.Since(startTime)) -} diff --git a/cmd/textGenerator_test/textract/textdetection.go b/cmd/textGenerator_test/textract/textdetection.go deleted file mode 100644 index edd40748..00000000 --- a/cmd/textGenerator_test/textract/textdetection.go +++ /dev/null @@ -1,149 +0,0 @@ -//go:build aws - -//go:generate go run -tags=aws ./textdetection.go -package main - -import ( - "context" - "encoding/json" - "fmt" - "log/slog" - "os" - "sync" - "time" - - documenttext "queryorchestration/internal/document/text" - documenttypes "queryorchestration/internal/document/types" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/aws" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/textract" - - awstextract "github.com/aws/aws-sdk-go-v2/service/textract" -) - -// Config provides the configuration for the text generator test tool. -// Note: Query-related configuration has been removed. See remove_query_plan.md. -type Config struct { - serviceconfig.BaseConfig - textract.TextractConfig - objectstore.ObjectStoreConfig -} - -func main() { - ctx := context.Background() - - if len(os.Args) != 2 { - fmt.Println("Error: expected one argument") - fmt.Println("Usage:", os.Args[0], "") - os.Exit(1) - } - - name := os.Args[1] - - slog.Info("arguments", "file_base", name) - - cfg := &Config{} - profile := aws.Profile(os.Getenv("AWS_PROFILE")) - if profile == "" { - slog.Error("profile not available") - os.Exit(1) - } - - err := cfg.SetTextractClientWithProfile(ctx, profile) - if err != nil { - slog.Error("error creating client", "error", err) - os.Exit(1) - } - - root, err := os.OpenRoot("assets") - if err != nil { - slog.Error("error opening root", "error", err) - os.Exit(1) - } - - pdfFile, err := root.Open(fmt.Sprintf("original/%s.pdf", name)) - if err != nil { - slog.Error("error opening pdf file", "error", err) - os.Exit(1) - } - - pdf, err := documenttypes.NewPDFFromReader(pdfFile) - if err != nil { - slog.Error("error creating pdf file", "error", err) - os.Exit(1) - } - - textSvc := documenttext.New(cfg) - - count, err := pdf.GetPageCount(ctx) - if err != nil { - slog.Error("error getting page count", "error", err) - os.Exit(1) - } - - slog.Info("detecting text", "page_count", count) - - startTime := time.Now() - allResults := []map[string]*awstextract.AnalyzeDocumentOutput{} - allResults = make([]map[string]*awstextract.AnalyzeDocumentOutput, count) - var wg sync.WaitGroup - for index := range count { - i := index - wg.Add(1) - go func() { - slog.Info("getting page", "index", i) - - baseResult, err := textSvc.GetBasePage(ctx, pdf, i) - if err != nil { - slog.Error("error detecting text", "error", err) - os.Exit(1) - } - - allResults[i] = map[string]*awstextract.AnalyzeDocumentOutput{ - "base": &baseResult, - } - - features, err := textSvc.ListRequiredFeatures(ctx, baseResult.Blocks, i) - if err != nil { - slog.Error("error listing features", "error", err) - os.Exit(1) - } - - if len(features) > 0 { - fullFeaturesResult, err := textSvc.GetPageWithFeatures(ctx, pdf, i, features) - if err != nil { - slog.Error("error getting features", "error", err) - os.Exit(1) - } - - allResults[i]["full_features"] = &fullFeaturesResult - } - - wg.Done() - }() - } - wg.Wait() - - jsonContent, err := json.MarshalIndent(allResults, "", "\t") - if err != nil { - slog.Error("error marshaling json", "error", err) - os.Exit(1) - } - - outputFilename := fmt.Sprintf("textract/%s.gen", name) - file, err := root.Create(outputFilename) - if err != nil { - slog.Error("error creating file", "error", err) - os.Exit(1) - } - defer file.Close() - - _, err = file.Write(jsonContent) - if err != nil { - slog.Error("error writing file", "error", err) - os.Exit(1) - } - - slog.Info("extracted text", "output", outputFilename, "time", time.Since(startTime)) -} diff --git a/docs/README.md b/docs/README.md index 06d016d0..9c7672b9 100644 --- a/docs/README.md +++ b/docs/README.md @@ -10,13 +10,9 @@ Adds an event for each document into the DOCSYNC queue for the given Client. ## docCleanRunner -**Listens For**: Body Containing Document ID. +Listens For: Body Containing Document ID. -**Action**. - -If the document is not already clean according to the collector standards, a clean is triggered. - -An event with the document id is pushed to the DOCTEXT queue. +Action: If the document is not already clean according to the collector standards, a clean is triggered. Note: Text extraction has been removed. The document pipeline ends after cleaning. See remove_texttract_and_mocks_plan.md for details. ## docInitRunner @@ -50,13 +46,7 @@ If eligible, send an event to the DOCCLEAN queue. ## docTextRunner -**Listens For**: Body Containing Document ID - -**Action**. - -If the document text is not already extracted according to the collector standards, trigger the textract job for text detection. - -This is the terminal step in the document processing pipeline. Query processing has been removed - pipeline ends after text extraction. +DEPRECATED: This runner is deprecated and no longer has any functionality. It is left in place until deployment code is updated accordingly. See remove_texttract_and_mocks_plan.md for details. ## healthcheck @@ -116,8 +106,6 @@ It will identify the type of event and the location of said event, and forward t It supports the document initialisation and document text processing stages. Events may be pushed to the DOCINIT queue. -## textExtractor - ## cognito.auth.harness ## permit.setup diff --git a/go.mod b/go.mod index 8c7d0f31..153ce687 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.53.0 github.com/aws/aws-sdk-go-v2/service/s3 v1.78.1 github.com/aws/aws-sdk-go-v2/service/sqs v1.38.1 - github.com/aws/aws-sdk-go-v2/service/textract v1.35.1 github.com/caarlos0/env/v11 v11.3.1 github.com/getkin/kin-openapi v0.129.0 github.com/go-playground/validator/v10 v10.25.0 @@ -106,7 +105,6 @@ require ( github.com/spf13/cobra v1.8.1 // indirect github.com/spf13/pflag v1.0.6 // indirect github.com/spf13/viper v1.19.0 // indirect - github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/swaggo/files/v2 v2.0.2 // indirect github.com/swaggo/swag v1.16.4 // indirect diff --git a/go.sum b/go.sum index 65d2d626..49b05483 100644 --- a/go.sum +++ b/go.sum @@ -51,8 +51,6 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.1 h1:KwuLovgQPcdjNMfFt9OhUd9a github.com/aws/aws-sdk-go-v2/service/ssooidc v1.29.1/go.mod h1:MlYRNmYu/fGPoxBQVvBYr9nyr948aY/WLUvwBMBJubs= github.com/aws/aws-sdk-go-v2/service/sts v1.33.17 h1:PZV5W8yk4OtH1JAuhV2PXwwO9v5G5Aoj+eMCn4T+1Kc= github.com/aws/aws-sdk-go-v2/service/sts v1.33.17/go.mod h1:cQnB8CUnxbMU82JvlqjKR2HBOm3fe9pWorWBza6MBJ4= -github.com/aws/aws-sdk-go-v2/service/textract v1.35.1 h1:tsGagA+4oEfrGVGfkcVhtQ5vq1YFwFdmDRfLsqm+0vE= -github.com/aws/aws-sdk-go-v2/service/textract v1.35.1/go.mod h1:vj7T9jmJFer1JiUKWWCBcNPdNXqzNAeWUxh/s2/Up5Y= github.com/aws/smithy-go v1.22.3 h1:Z//5NuZCSW6R4PhQ93hShNbyBbn8BWCmCVCt+Q8Io5k= github.com/aws/smithy-go v1.22.3/go.mod h1:t1ufH5HMublsJYulve2RKmHDC15xu1f26kHCp/HgceI= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= diff --git a/internal/client/sync/sync_test.go b/internal/client/sync/sync_test.go deleted file mode 100644 index e4bb45c0..00000000 --- a/internal/client/sync/sync_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package clientsync - -import ( - "fmt" - "testing" - - "queryorchestration/internal/database/repository" - "queryorchestration/internal/document" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/queue/documentsync" - queuemock "queryorchestration/mocks/queue" - - "github.com/aws/aws-sdk-go-v2/service/sqs" - "github.com/google/uuid" - "github.com/pashagolub/pgxmock/v3" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -type ClientSyncConfig struct { - serviceconfig.BaseConfig - documentsync.DocSyncConfig -} - -func TestTrigger(t *testing.T) { - t.Run("two batches", func(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - - cfg := &ClientSyncConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - cfg.DocumentSyncURL = "/i/am/here" - - svc := New(cfg) - - clientId := "huuh" - docs := []document.DocumentSummary{ - { - ID: uuid.New(), - ClientID: clientId, - }, - { - ID: uuid.New(), - ClientID: clientId, - }, - } - - svc.batchSize = 1 - total := int64(2) - pool.ExpectQuery("name: ListDocumentIDsBatch :many").WithArgs(clientId, svc.batchSize, int32(0)). - WillReturnRows( - pgxmock.NewRows([]string{"id", "totalCount"}). - AddRow(&docs[0].ID, &total), - ) - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.DocumentSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", docs[0].ID.String()) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - pool.ExpectQuery("name: ListDocumentIDsBatch :many").WithArgs(clientId, svc.batchSize, int32(1)). - WillReturnRows( - pgxmock.NewRows([]string{"id", "totalCount"}). - AddRow(&docs[1].ID, &total), - ) - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.DocumentSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", docs[1].ID.String()) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - err = svc.Sync(ctx, clientId) - require.NoError(t, err) - }) - t.Run("empty batch", func(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - - cfg := &ClientSyncConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - cfg.DocumentSyncURL = "/i/am/here" - - svc := New(cfg) - - clientId := "hola" - - svc.batchSize = 1 - pool.ExpectQuery("name: ListDocumentIDsBatch :many").WithArgs(clientId, svc.batchSize, int32(0)). - WillReturnRows( - pgxmock.NewRows([]string{"id", "totalCount"}), - ) - - err = svc.Sync(ctx, clientId) - require.NoError(t, err) - }) -} diff --git a/internal/client/update/update_test.go b/internal/client/update/update_test.go index ba0d7be5..16f9a5f3 100644 --- a/internal/client/update/update_test.go +++ b/internal/client/update/update_test.go @@ -1,7 +1,8 @@ +// Package clientupdate tests for client update functionality. +// Note: Mock-based tests have been removed. See remove_texttract_and_mocks_plan.md. package clientupdate import ( - "fmt" "testing" "queryorchestration/internal/client" @@ -9,12 +10,8 @@ import ( "queryorchestration/internal/serviceconfig" "queryorchestration/internal/serviceconfig/queue/clientsync" - queuemock "queryorchestration/mocks/queue" - - "github.com/aws/aws-sdk-go-v2/service/sqs" "github.com/pashagolub/pgxmock/v3" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" ) @@ -165,48 +162,5 @@ func TestSubmitUpdate(t *testing.T) { require.NoError(t, err) } -func TestInformUpdate(t *testing.T) { - ctx := t.Context() - - cfg := &Config{} - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - - svc := New(cfg, &Services{}) - - id := "HIELO" - t.Run("no cansync", func(t *testing.T) { - update := Update{} - - err := svc.informUpdate(ctx, id, &update) - require.NoError(t, err) - }) - t.Run("false cansync", func(t *testing.T) { - cansync := false - update := Update{ - CanSync: &cansync, - } - - err := svc.informUpdate(ctx, id, &update) - require.NoError(t, err) - }) - t.Run("true cansync", func(t *testing.T) { - cansync := true - update := Update{ - CanSync: &cansync, - } - - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.ClientSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", id) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - err := svc.informUpdate(ctx, id, &update) - require.NoError(t, err) - }) -} +// Note: TestInformUpdate was removed as it used SQS mocks. +// Real SQS tests should be added using LocalStack via testcontainers. diff --git a/internal/collector/get_test.go b/internal/collector/get_test.go index 41b5460e..d6580ce6 100644 --- a/internal/collector/get_test.go +++ b/internal/collector/get_test.go @@ -1,3 +1,5 @@ +// Package collector_test contains tests for the collector package. +// Note: MinTextVersion has been removed since text extraction is deprecated. package collector_test import ( @@ -24,17 +26,15 @@ func TestGetByClientID(t *testing.T) { svc := collector.New(cfg) minCleanV := int64(2) - minTextV := int64(4) ogc := collector.Collector{ ClientID: "hi", MinCleanVersion: minCleanV, - MinTextVersion: minTextV, } pool.ExpectQuery("name: GetCollectorByClientID :one").WithArgs(ogc.ClientID). WillReturnRows( - pgxmock.NewRows([]string{"clientId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion"}). - AddRow(ogc.ClientID, ogc.MinCleanVersion, ogc.MinTextVersion, ogc.ActiveVersion, ogc.LatestVersion), + pgxmock.NewRows([]string{"clientId", "minCleanVersion", "activeVersion", "latestVersion"}). + AddRow(ogc.ClientID, ogc.MinCleanVersion, ogc.ActiveVersion, ogc.LatestVersion), ) coll, err := svc.GetByClientID(ctx, ogc.ClientID) diff --git a/internal/collector/parse.go b/internal/collector/parse.go index 40234586..d430fa2b 100644 --- a/internal/collector/parse.go +++ b/internal/collector/parse.go @@ -5,7 +5,7 @@ import ( ) // parseDBCollector converts a database collector record to a Collector struct. -// Query fields have been removed - only document processing metadata is returned. +// Note: MinTextVersion has been removed since text extraction is deprecated. func parseDBCollector(c *repository.Fullactivecollector) (*Collector, error) { if c == nil { return nil, nil @@ -14,7 +14,6 @@ func parseDBCollector(c *repository.Fullactivecollector) (*Collector, error) { return &Collector{ ClientID: c.Clientid, MinCleanVersion: c.Mincleanversion, - MinTextVersion: c.Mintextversion, ActiveVersion: c.Activeversion, LatestVersion: c.Latestversion, }, nil diff --git a/internal/collector/parse_test.go b/internal/collector/parse_test.go index ee6ff664..dd3c8a37 100644 --- a/internal/collector/parse_test.go +++ b/internal/collector/parse_test.go @@ -1,3 +1,5 @@ +// Package collector tests. +// Note: MinTextVersion has been removed since text extraction is deprecated. package collector import ( @@ -15,22 +17,18 @@ func TestParseDBCollector(t *testing.T) { assert.Nil(t, c) minCleanV := int64(1) - minTextV := int64(2) ogc := Collector{ ClientID: "hi", MinCleanVersion: minCleanV, - MinTextVersion: minTextV, } c, err = parseDBCollector(&repository.Fullactivecollector{ Clientid: ogc.ClientID, Mincleanversion: ogc.MinCleanVersion, - Mintextversion: ogc.MinTextVersion, }) require.NoError(t, err) assert.EqualExportedValues(t, ogc, *c) ogc.MinCleanVersion = 0 - ogc.MinTextVersion = 0 c, err = parseDBCollector(&repository.Fullactivecollector{ Clientid: ogc.ClientID, }) diff --git a/internal/collector/service.go b/internal/collector/service.go index 83d74846..02eef8fc 100644 --- a/internal/collector/service.go +++ b/internal/collector/service.go @@ -1,3 +1,6 @@ +// Package collector provides collector configuration functionality. +// Note: Text extraction has been removed. MinTextVersion is no longer supported. +// See remove_texttract_and_mocks_plan.md for details. package collector import ( @@ -5,19 +8,20 @@ import ( ) // Collector represents a client's document collection configuration. -// Query processing has been removed - only document processing metadata remains. +// Note: MinTextVersion has been removed since text extraction is deprecated. type Collector struct { ClientID string MinCleanVersion int64 - MinTextVersion int64 ActiveVersion int32 LatestVersion int32 } +// Service provides collector operations. type Service struct { cfg serviceconfig.ConfigProvider } +// New creates a new collector service. func New(cfg serviceconfig.ConfigProvider) *Service { return &Service{ cfg, diff --git a/internal/collector/set/set.go b/internal/collector/set/set.go index da632ff4..2905139c 100644 --- a/internal/collector/set/set.go +++ b/internal/collector/set/set.go @@ -1,3 +1,6 @@ +// Package collectorset provides functionality for updating collector configurations. +// Note: Text extraction has been removed. MinTextVersion support has been removed. +// See remove_texttract_and_mocks_plan.md for details. package collectorset import ( @@ -14,11 +17,10 @@ import ( ) // SetParams defines parameters for updating a collector's configuration. -// Query fields have been removed - only document processing settings remain. +// Note: MinTextVersion has been removed since text extraction is deprecated. type SetParams struct { ActiveVersion *int32 MinCleanVersion *int64 - MinTextVersion *int64 } func (s *Service) SetByClientId(ctx context.Context, id string, params *SetParams) error { @@ -62,7 +64,6 @@ type dbSetParams struct { ClientID string ActiveVersion *int32 MinCleanVersion *int64 - MinTextVersion *int64 } func (s *Service) getSetParams(id string, current *collector.Collector, params *SetParams) (*dbSetParams, error) { @@ -90,7 +91,6 @@ func (s *Service) getSetParams(id string, current *collector.Collector, params * ClientID: id, ActiveVersion: params.ActiveVersion, MinCleanVersion: params.MinCleanVersion, - MinTextVersion: params.MinTextVersion, }, nil } @@ -114,17 +114,6 @@ func (s *Service) normalizeCodeVersions(current *collector.Collector, params *Se } } - if params.MinTextVersion != nil && *params.MinTextVersion == current.MinTextVersion { - params.MinTextVersion = nil - } - - if params.MinTextVersion != nil { - err := build.IsValidUnixVersion(*params.MinTextVersion) - if err != nil { - return err - } - } - return nil } @@ -182,17 +171,6 @@ func (s *Service) submitSet(ctx context.Context, params *dbSetParams) error { } } - if params.MinTextVersion != nil { - err = qtx.SetCollectorTextVersion(ctx, &repository.SetCollectorTextVersionParams{ - Clientid: params.ClientID, - Versionid: *params.MinTextVersion, - Addedversion: latestVersion, - }) - if err != nil { - return err - } - } - slog.Debug("client collector updated", "update", *params) return nil diff --git a/internal/collector/set/set_test.go b/internal/collector/set/set_test.go deleted file mode 100644 index 34842582..00000000 --- a/internal/collector/set/set_test.go +++ /dev/null @@ -1,126 +0,0 @@ -package collectorset_test - -import ( - "fmt" - "testing" - - "queryorchestration/internal/collector" - collectorset "queryorchestration/internal/collector/set" - "queryorchestration/internal/database/repository" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/queue/clientsync" - queuemock "queryorchestration/mocks/queue" - - "github.com/aws/aws-sdk-go-v2/service/sqs" - "github.com/jackc/pgx/v5" - "github.com/pashagolub/pgxmock/v3" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -type CollectorSetConfig struct { - serviceconfig.BaseConfig - clientsync.ClientSyncConfig -} - -func TestSet(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &CollectorSetConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - cfg.ClientSyncURL = "here" - - svc := collectorset.New(cfg, &collectorset.Services{ - Collector: collector.New(cfg), - }) - - t.Run("valid", func(t *testing.T) { - current := collector.Collector{ - ClientID: "hi", - ActiveVersion: 1, - LatestVersion: 4, - } - av := int32(2) - mv := int64(1) - update := collectorset.SetParams{ - ActiveVersion: &av, - MinCleanVersion: &mv, - } - - pool.ExpectQuery("name: GetCollectorByClientID :one").WithArgs(current.ClientID). - WillReturnRows( - pgxmock.NewRows([]string{"clientId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion"}). - AddRow(current.ClientID, current.MinCleanVersion, current.MinTextVersion, current.ActiveVersion, current.LatestVersion), - ) - pool.ExpectBeginTx(pgx.TxOptions{}) - rv := current.LatestVersion + 1 - pool.ExpectQuery("name: AddLatestCollectorVersion :one").WithArgs(current.ClientID).WillReturnRows( - pgxmock.NewRows([]string{"version"}). - AddRow(rv), - ) - pool.ExpectExec("name: SetActiveCollectorVersion :exec").WithArgs(current.ClientID, int32(2)). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectExec("name: SetCollectorCleanVersion :exec").WithArgs(current.ClientID, rv, *update.MinCleanVersion). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.ClientSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", current.ClientID) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - err = svc.SetByClientId(ctx, current.ClientID, &update) - require.NoError(t, err) - }) - t.Run("no collector", func(t *testing.T) { - current := collector.Collector{ - ClientID: "string", - } - av := int32(1) - mv := int64(1) - update := collectorset.SetParams{ - ActiveVersion: &av, - MinCleanVersion: &mv, - } - - pool.ExpectQuery("name: GetCollectorByClientID :one").WithArgs(current.ClientID). - WillReturnRows( - pgxmock.NewRows([]string{"clientId", "minCleanVersion", "minTextVersion", "activeVersion", "latestVersion"}). - AddRow(current.ClientID, current.MinCleanVersion, current.MinTextVersion, current.ActiveVersion, current.LatestVersion), - ) - pool.ExpectBeginTx(pgx.TxOptions{}) - rv := current.LatestVersion + 1 - pool.ExpectQuery("name: AddLatestCollectorVersion :one").WithArgs(current.ClientID).WillReturnRows( - pgxmock.NewRows([]string{"version"}). - AddRow(rv), - ) - pool.ExpectExec("name: SetActiveCollectorVersion :exec").WithArgs(current.ClientID, int32(1)). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectExec("name: SetCollectorCleanVersion :exec").WithArgs(current.ClientID, rv, *update.MinCleanVersion). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.ClientSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", current.ClientID) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - err = svc.SetByClientId(ctx, current.ClientID, &update) - require.NoError(t, err) - }) -} diff --git a/internal/collector/set/setprivate_test.go b/internal/collector/set/setprivate_test.go index f28bfd04..b3b32b0e 100644 --- a/internal/collector/set/setprivate_test.go +++ b/internal/collector/set/setprivate_test.go @@ -1,197 +1,17 @@ +// Package collectorset private tests. +// Note: MinTextVersion has been removed since text extraction is deprecated. +// Note: Mock-based tests have been removed. See remove_texttract_and_mocks_plan.md. package collectorset import ( - "fmt" "testing" "queryorchestration/internal/collector" - "queryorchestration/internal/database/repository" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/queue/clientsync" - queuemock "queryorchestration/mocks/queue" - "github.com/aws/aws-sdk-go-v2/service/sqs" - "github.com/jackc/pgx/v5" - "github.com/pashagolub/pgxmock/v3" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" ) -type CollectorSetConfig struct { - serviceconfig.BaseConfig - clientsync.ClientSyncConfig -} - -func TestGetSetParams(t *testing.T) { - t.Run("all params", func(t *testing.T) { - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &CollectorSetConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := Service{ - cfg: cfg, - svc: &Services{ - Collector: collector.New(cfg), - }, - } - - minCleanV := int64(1) - minTextV := int64(1) - aV := int32(3) - current := collector.Collector{ - ActiveVersion: 1, - LatestVersion: 10, - } - params := SetParams{ - ActiveVersion: &aV, - MinCleanVersion: &minCleanV, - MinTextVersion: &minTextV, - } - - clientId := "string" - - dbparams, err := svc.getSetParams(clientId, ¤t, ¶ms) - require.NoError(t, err) - assert.EqualExportedValues(t, &dbSetParams{ - ClientID: clientId, - ActiveVersion: &aV, - MinCleanVersion: &minCleanV, - MinTextVersion: &minTextV, - }, dbparams) - }) - - t.Run("no params", func(t *testing.T) { - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &CollectorSetConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := Service{ - cfg: cfg, - svc: &Services{}, - } - - current := collector.Collector{} - params := SetParams{} - _, err = svc.getSetParams(current.ClientID, ¤t, ¶ms) - assert.EqualError(t, err, "no changes") - }) - - t.Run("ONLY active version to next latest", func(t *testing.T) { - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &CollectorSetConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := Service{ - cfg: cfg, - svc: &Services{}, - } - - current := collector.Collector{ - ActiveVersion: 2, - LatestVersion: 4, - } - version := int32(5) - params := SetParams{ - ActiveVersion: &version, - } - _, err = svc.getSetParams(current.ClientID, ¤t, ¶ms) - assert.EqualError(t, err, "no changes") - }) -} - -func TestSubmitSet(t *testing.T) { - t.Run("all fields", func(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &CollectorSetConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := Service{ - cfg: cfg, - svc: &Services{}, - } - - minCleanV := int64(2) - minTextV := int64(4) - current := collector.Collector{ - ClientID: "hello", - ActiveVersion: 1, - LatestVersion: 1, - MinCleanVersion: 1, - MinTextVersion: 2, - } - aV := int32(2) - params := dbSetParams{ - ClientID: current.ClientID, - ActiveVersion: &aV, - MinCleanVersion: &minCleanV, - MinTextVersion: &minTextV, - } - - pool.ExpectBeginTx(pgx.TxOptions{}) - rv := int32(2) - pool.ExpectQuery("name: AddLatestCollectorVersion :one").WithArgs(current.ClientID).WillReturnRows( - pgxmock.NewRows([]string{"version"}). - AddRow(rv), - ) - pool.ExpectExec("name: SetActiveCollectorVersion :exec").WithArgs(current.ClientID, int32(2)). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectExec("name: SetCollectorCleanVersion :exec").WithArgs(current.ClientID, rv, *params.MinCleanVersion). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectExec("name: SetCollectorTextVersion :exec").WithArgs(current.ClientID, rv, *params.MinTextVersion). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - err = svc.submitSet(ctx, ¶ms) - require.NoError(t, err) - }) - t.Run("only active version", func(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &CollectorSetConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := Service{ - cfg: cfg, - svc: &Services{}, - } - - current := collector.Collector{ - ClientID: "hell", - ActiveVersion: 1, - LatestVersion: 1, - MinCleanVersion: 1, - MinTextVersion: 2, - } - av := int32(2) - params := dbSetParams{ - ClientID: current.ClientID, - ActiveVersion: &av, - } - - pool.ExpectBeginTx(pgx.TxOptions{}) - pool.ExpectExec("name: SetActiveCollectorVersion :exec").WithArgs(current.ClientID, int32(2)). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - err = svc.submitSet(ctx, ¶ms) - require.NoError(t, err) - }) -} - func TestNormalizeActiveVersion(t *testing.T) { svc := Service{} @@ -284,7 +104,6 @@ func TestNormalizeCodeVersions(t *testing.T) { err := svc.normalizeCodeVersions(¤t, &update) require.NoError(t, err) assert.Nil(t, update.MinCleanVersion) - assert.Nil(t, update.MinTextVersion) }) t.Run("valid clean", func(t *testing.T) { @@ -296,31 +115,6 @@ func TestNormalizeCodeVersions(t *testing.T) { err := svc.normalizeCodeVersions(¤t, &update) require.NoError(t, err) assert.Equal(t, cv, *update.MinCleanVersion) - assert.Nil(t, update.MinTextVersion) - }) - - t.Run("valid text", func(t *testing.T) { - current := collector.Collector{} - update := SetParams{} - - tv := int64(1) - update.MinTextVersion = &tv - err := svc.normalizeCodeVersions(¤t, &update) - require.NoError(t, err) - assert.Nil(t, update.MinCleanVersion) - assert.Equal(t, tv, *update.MinTextVersion) - }) - - t.Run("valid clean and text", func(t *testing.T) { - current := collector.Collector{} - update := SetParams{} - - current.MinCleanVersion = 1 - current.MinTextVersion = 1 - err := svc.normalizeCodeVersions(¤t, &update) - require.NoError(t, err) - assert.Nil(t, update.MinCleanVersion) - assert.Nil(t, update.MinTextVersion) }) t.Run("current clean", func(t *testing.T) { @@ -333,91 +127,5 @@ func TestNormalizeCodeVersions(t *testing.T) { err := svc.normalizeCodeVersions(¤t, &update) require.NoError(t, err) assert.Nil(t, update.MinCleanVersion) - assert.Nil(t, update.MinTextVersion) - }) - - t.Run("current text", func(t *testing.T) { - current := collector.Collector{ - MinTextVersion: 1, - } - update := SetParams{} - - update.MinTextVersion = ¤t.MinTextVersion - err := svc.normalizeCodeVersions(¤t, &update) - require.NoError(t, err) - assert.Nil(t, update.MinCleanVersion) - assert.Nil(t, update.MinTextVersion) - }) - - t.Run("current clean and text", func(t *testing.T) { - current := collector.Collector{ - MinCleanVersion: 1, - MinTextVersion: 1, - } - update := SetParams{} - - update.MinCleanVersion = ¤t.MinCleanVersion - update.MinTextVersion = ¤t.MinTextVersion - err := svc.normalizeCodeVersions(¤t, &update) - require.NoError(t, err) - assert.Nil(t, update.MinCleanVersion) - assert.Nil(t, update.MinTextVersion) - }) -} - -func TestInformSet(t *testing.T) { - t.Run("with version update", func(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &CollectorSetConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - cfg.ClientSyncURL = "here" - - svc := New(cfg, &Services{}) - - av := int32(2) - update := dbSetParams{ - ClientID: "HI", - ActiveVersion: &av, - } - - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.ClientSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", update.ClientID) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - err = svc.informSet(ctx, &update) - require.NoError(t, err) - }) - t.Run("with no update", func(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &CollectorSetConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - cfg.ClientSyncURL = "here" - - svc := New(cfg, &Services{}) - - update := dbSetParams{ - ClientID: "hello", - } - - err = svc.informSet(ctx, &update) - require.NoError(t, err) }) } diff --git a/internal/database/migrations/00000000000001_extensions.down.sql b/internal/database/migrations/00000000000001_extensions.down.sql index d3b7d69f..2f39878e 100644 --- a/internal/database/migrations/00000000000001_extensions.down.sql +++ b/internal/database/migrations/00000000000001_extensions.down.sql @@ -1 +1,7 @@ -DROP EXTENSION "pgcrypto"; \ No newline at end of file +-- Migration 001: Extensions and Core Functions (DOWN) +-- Drops in reverse order of creation + +DROP DOMAIN IF EXISTS unsignedsmallint; +DROP FUNCTION IF EXISTS isInVersion; +DROP FUNCTION IF EXISTS uuid_generate_v7; +DROP EXTENSION IF EXISTS "pgcrypto"; diff --git a/internal/database/migrations/00000000000001_extensions.up.sql b/internal/database/migrations/00000000000001_extensions.up.sql index 25ac191b..5a072aa3 100644 --- a/internal/database/migrations/00000000000001_extensions.up.sql +++ b/internal/database/migrations/00000000000001_extensions.up.sql @@ -1,9 +1,13 @@ +-- Migration 001: Extensions and Core Functions +-- Creates PostgreSQL extensions and utility functions used throughout the schema + CREATE EXTENSION IF NOT EXISTS "pgcrypto"; -create or replace function uuid_generate_v7() -returns uuid -as $$ -select encode( +-- UUID v7 generator function (time-ordered UUIDs) +CREATE OR REPLACE FUNCTION uuid_generate_v7() +RETURNS uuid +AS $$ +SELECT encode( set_bit( set_bit( overlay(uuid_send(gen_random_uuid()) @@ -16,22 +20,24 @@ select encode( ), 'hex')::uuid; $$ -language SQL -volatile; +LANGUAGE SQL +VOLATILE; +-- Version checking function for temporal data patterns CREATE FUNCTION isInVersion( _version int, _addedVersion int, _removedVersion int ) -RETURNS boolean as $$ +RETURNS boolean AS $$ BEGIN - RETURN _version is null OR ( + RETURN _version IS NULL OR ( _version >= _addedVersion AND - (_removedVersion is null OR _version < _removedVersion) + (_removedVersion IS NULL OR _version < _removedVersion) ); END; $$ LANGUAGE plpgsql; +-- Domain for unsigned small integers CREATE DOMAIN unsignedsmallint AS SMALLINT CHECK (VALUE >= 0); diff --git a/internal/database/migrations/00000000000002_clients.down.sql b/internal/database/migrations/00000000000002_clients.down.sql new file mode 100644 index 00000000..fa6970a3 --- /dev/null +++ b/internal/database/migrations/00000000000002_clients.down.sql @@ -0,0 +1,4 @@ +-- Migration 002: Clients (DOWN) + +DROP TABLE IF EXISTS clientCanSync; +DROP TABLE IF EXISTS clients; diff --git a/internal/database/migrations/00000000000002_clients.up.sql b/internal/database/migrations/00000000000002_clients.up.sql new file mode 100644 index 00000000..ca31f5b8 --- /dev/null +++ b/internal/database/migrations/00000000000002_clients.up.sql @@ -0,0 +1,15 @@ +-- Migration 002: Clients +-- Core client tables for customer configuration + +CREATE TABLE clients ( + clientId varchar(255) PRIMARY KEY, + name TEXT NOT NULL, + UNIQUE (name) +); + +CREATE TABLE clientCanSync ( + syncId uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + clientId varchar(255) NOT NULL, + canSync boolean NOT NULL, + FOREIGN KEY (clientId) REFERENCES clients(clientId) +); diff --git a/internal/database/migrations/00000000000003_collectors.down.sql b/internal/database/migrations/00000000000003_collectors.down.sql new file mode 100644 index 00000000..ed04f2a9 --- /dev/null +++ b/internal/database/migrations/00000000000003_collectors.down.sql @@ -0,0 +1,9 @@ +-- Migration 003: Collectors (DOWN) + +DROP TRIGGER IF EXISTS removeMinCleanVersionTrigger ON collectorMinCleanVersions; +DROP FUNCTION IF EXISTS removeMinCleanVersion; +DROP TABLE IF EXISTS collectorMinCleanVersions; +DROP TABLE IF EXISTS collectorActiveVersions; +DROP TRIGGER IF EXISTS setCollectorVersionNumberTrigger ON collectorVersions; +DROP FUNCTION IF EXISTS setCollectorVersionNumber; +DROP TABLE IF EXISTS collectorVersions; diff --git a/internal/database/migrations/00000000000003_collectors.up.sql b/internal/database/migrations/00000000000003_collectors.up.sql new file mode 100644 index 00000000..70afe051 --- /dev/null +++ b/internal/database/migrations/00000000000003_collectors.up.sql @@ -0,0 +1,62 @@ +-- Migration 003: Collectors (Simplified) +-- Collector versioning and configuration +-- NOTE: collectorMinTextVersions and collectorQueries removed (no longer used) + +CREATE TABLE collectorVersions ( + clientId varchar(255) NOT NULL, + id int NOT NULL, + addedAt timestamp NOT NULL DEFAULT current_timestamp, + FOREIGN KEY (clientId) REFERENCES clients(clientId), + PRIMARY KEY (id, clientId) +); + +CREATE OR REPLACE FUNCTION setCollectorVersionNumber() +RETURNS TRIGGER AS $$ +BEGIN + SELECT COALESCE(MAX(id), 0) + 1 + INTO NEW.id + FROM collectorVersions + WHERE clientId = NEW.clientId; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER setCollectorVersionNumberTrigger +BEFORE INSERT ON collectorVersions +FOR EACH ROW +EXECUTE FUNCTION setCollectorVersionNumber(); + +CREATE TABLE collectorActiveVersions ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + clientId varchar(255) NOT NULL, + versionId int NOT NULL, + FOREIGN KEY (clientId, versionId) REFERENCES collectorVersions(clientId, id) +); + +CREATE TABLE collectorMinCleanVersions ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + clientId varchar(255) NOT NULL, + versionId bigint NOT NULL, + addedVersion int NOT NULL, + removedVersion int, + FOREIGN KEY (clientId, addedVersion) REFERENCES collectorVersions(clientId, id), + FOREIGN KEY (clientId, removedVersion) REFERENCES collectorVersions(clientId, id), + FOREIGN KEY (clientId) REFERENCES clients(clientId) +); + +CREATE OR REPLACE FUNCTION removeMinCleanVersion() +RETURNS TRIGGER AS $$ +BEGIN + UPDATE collectorMinCleanVersions + SET removedVersion = NEW.addedVersion + WHERE clientId = NEW.clientId AND removedVersion IS NULL; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER removeMinCleanVersionTrigger +BEFORE INSERT ON collectorMinCleanVersions +FOR EACH ROW +EXECUTE FUNCTION removeMinCleanVersion(); diff --git a/internal/database/migrations/00000000000004_batch_uploads.down.sql b/internal/database/migrations/00000000000004_batch_uploads.down.sql new file mode 100644 index 00000000..e5ce8815 --- /dev/null +++ b/internal/database/migrations/00000000000004_batch_uploads.down.sql @@ -0,0 +1,6 @@ +-- Migration 004: Batch Uploads (DOWN) + +DROP INDEX IF EXISTS idx_batch_uploads_status; +DROP INDEX IF EXISTS idx_batch_uploads_client_id; +DROP TABLE IF EXISTS batch_uploads; +DROP TYPE IF EXISTS batch_status; diff --git a/internal/database/migrations/00000000000004_batch_uploads.up.sql b/internal/database/migrations/00000000000004_batch_uploads.up.sql new file mode 100644 index 00000000..f8ecd6ca --- /dev/null +++ b/internal/database/migrations/00000000000004_batch_uploads.up.sql @@ -0,0 +1,52 @@ +-- Migration 004: Batch Uploads +-- Batch upload tracking for ZIP file uploads +-- Merges original migrations 103 + 104 + +-- Create batch status ENUM type +CREATE TYPE batch_status AS ENUM ( + 'processing', -- Currently processing + 'completed', -- All documents processed (may have individual failures) + 'failed', -- Batch-level failure (ZIP corrupt, etc.) + 'cancelled' -- Cancelled by user +); + +-- Create batch uploads table with all columns +CREATE TABLE batch_uploads ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + client_id varchar(255) NOT NULL, + original_filename text NOT NULL, + + -- Essential batch metrics + total_documents integer NOT NULL, + processed_documents integer NOT NULL DEFAULT 0, + failed_documents integer NOT NULL DEFAULT 0, + invalid_type_documents integer NOT NULL DEFAULT 0, + + -- Status and progress + status batch_status NOT NULL DEFAULT 'processing', + progress_percent integer NOT NULL DEFAULT 0, + + -- Failed document filenames (JSON array) + failed_filenames jsonb DEFAULT '[]'::jsonb, + + -- Timestamps + created_at timestamp NOT NULL DEFAULT NOW(), + completed_at timestamp, + + -- Storage metadata (from migration 104) + archive_bucket text, + archive_key text, + file_size_bytes bigint, + + FOREIGN KEY (client_id) REFERENCES clients(clientId), + + -- Constraint: storage metadata consistency + CONSTRAINT batch_storage_consistent CHECK ( + (archive_bucket IS NULL AND archive_key IS NULL AND file_size_bytes IS NULL) OR + (archive_bucket IS NOT NULL AND archive_key IS NOT NULL) + ) +); + +-- Create indexes for efficient queries +CREATE INDEX idx_batch_uploads_client_id ON batch_uploads(client_id); +CREATE INDEX idx_batch_uploads_status ON batch_uploads(status); diff --git a/internal/database/migrations/00000000000005_folders.down.sql b/internal/database/migrations/00000000000005_folders.down.sql new file mode 100644 index 00000000..692ca138 --- /dev/null +++ b/internal/database/migrations/00000000000005_folders.down.sql @@ -0,0 +1,6 @@ +-- Migration 005: Folders (DOWN) + +DROP INDEX IF EXISTS idx_folders_path; +DROP INDEX IF EXISTS idx_folders_clientid; +DROP INDEX IF EXISTS idx_folders_parentid; +DROP TABLE IF EXISTS folders; diff --git a/internal/database/migrations/00000000000005_folders.up.sql b/internal/database/migrations/00000000000005_folders.up.sql new file mode 100644 index 00000000..98b092d0 --- /dev/null +++ b/internal/database/migrations/00000000000005_folders.up.sql @@ -0,0 +1,26 @@ +-- Migration 005: Folders +-- Virtual folder hierarchy for document organization + +CREATE TABLE folders ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + path text NOT NULL, + parentId uuid, + clientId varchar(255) NOT NULL, + createdAt timestamp NOT NULL DEFAULT NOW(), + createdBy varchar(255) NOT NULL, + FOREIGN KEY (parentId) REFERENCES folders(id), + FOREIGN KEY (clientId) REFERENCES clients(clientId), + UNIQUE(clientId, path), + CHECK (id != parentId) +); + +-- Indexes for efficient folder queries +CREATE INDEX idx_folders_parentid ON folders(parentId); +CREATE INDEX idx_folders_clientid ON folders(clientId); +CREATE INDEX idx_folders_path ON folders(path); + +-- Add comment to clarify that folders are virtual (database-only, no S3 relationship) +COMMENT ON TABLE folders IS + 'Virtual folder hierarchy for document organization. Database-only - has no direct relationship to S3 storage locations.'; +COMMENT ON COLUMN folders.path IS + 'Virtual folder path (e.g., "/contracts/2025"). Can be renamed without affecting S3 storage.'; diff --git a/internal/database/migrations/00000000000006_documents.down.sql b/internal/database/migrations/00000000000006_documents.down.sql new file mode 100644 index 00000000..a75f3001 --- /dev/null +++ b/internal/database/migrations/00000000000006_documents.down.sql @@ -0,0 +1,31 @@ +-- Migration 006: Documents (DOWN) + +-- Drop document clean entries first (depends on documentCleans) +DROP TABLE IF EXISTS documentCleanEntries; + +-- Drop document cleans +DROP TABLE IF EXISTS documentCleans; + +-- Drop document entries +DROP TABLE IF EXISTS documentEntries; + +-- Drop documentUploads indexes +DROP INDEX IF EXISTS idx_documentuploads_folder_id; +DROP INDEX IF EXISTS idx_documentuploads_clientid; +DROP INDEX IF EXISTS idx_documentuploads_batch_id; +DROP INDEX IF EXISTS idx_documentuploads_filename; + +-- Drop documentUploads table +DROP TABLE IF EXISTS documentUploads; + +-- Drop documents indexes +DROP INDEX IF EXISTS idx_documents_folderid; +DROP INDEX IF EXISTS idx_documents_filename; +DROP INDEX IF EXISTS idx_documents_batch_id; + +-- Drop documents table +DROP TABLE IF EXISTS documents; + +-- Drop enums +DROP TYPE IF EXISTS cleanMimeType; +DROP TYPE IF EXISTS cleanFailType; diff --git a/internal/database/migrations/00000000000006_documents.up.sql b/internal/database/migrations/00000000000006_documents.up.sql new file mode 100644 index 00000000..7dbafb12 --- /dev/null +++ b/internal/database/migrations/00000000000006_documents.up.sql @@ -0,0 +1,125 @@ +-- Migration 006: Documents (Consolidated) +-- Document storage and processing tables +-- Merges: 005_documents + 103 + 105 + 106 + 107 + 108 + 111 + 116 + 118 +-- NOTE: documentTextExtractions and documentTextExtractionEntries removed (no longer used) + +-- Enum for document clean failure types +CREATE TYPE cleanFailType AS ENUM ( + 'invalid_mimetype', + 'invalid_read', + 'invalid_read_pages', + 'zero_page_count', + 'large_file', + 'small_dimensions', + 'large_dimensions', + 'small_dpi', + 'large_dpi' +); + +-- Enum for clean document mime types +CREATE TYPE cleanMimeType AS ENUM ('application/pdf'); + +-- Main documents table with all columns +CREATE TABLE documents ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + clientId varchar(255) NOT NULL, + hash text NOT NULL, + + -- Batch reference (from migration 103) + batch_id uuid, + + -- Filename (from migration 105) + filename TEXT, + + -- Folder organization (from migration 111) + folderId uuid, + originalPath text, + + -- File size (from migration 118) + file_size_bytes BIGINT, + + FOREIGN KEY (clientId) REFERENCES clients(clientId), + FOREIGN KEY (batch_id) REFERENCES batch_uploads(id), + FOREIGN KEY (folderId) REFERENCES folders(id), + UNIQUE(clientId, hash) +); + +-- Indexes for documents table +CREATE INDEX idx_documents_batch_id ON documents(batch_id); +CREATE INDEX idx_documents_filename ON documents(filename); +CREATE INDEX idx_documents_folderid ON documents(folderId); + +-- Comments for immutable fields (from migration 111) +COMMENT ON COLUMN documents.originalPath IS + 'Original path provided during upload. IMMUTABLE after creation - never modify this value.'; + +-- Document uploads table (staging area for incoming documents) +CREATE TABLE documentUploads ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + bucket text NOT NULL, + key text NOT NULL, + clientId varchar(255) NOT NULL, + part unsignedsmallint NOT NULL, + createdAt timestamp NOT NULL, + + -- Filename (from migration 106) + filename TEXT, + + -- Batch reference (from migration 107) + batch_id uuid, + + -- Folder reference (from migration 116) + folder_id uuid, + + FOREIGN KEY (clientId) REFERENCES clients(clientId), + FOREIGN KEY (folder_id) REFERENCES folders(id) +); + +-- Indexes for documentUploads +CREATE INDEX idx_documentuploads_filename ON documentUploads(filename); +CREATE INDEX idx_documentuploads_batch_id ON documentUploads(batch_id); +CREATE INDEX idx_documentuploads_clientid ON documentUploads(clientId); +CREATE INDEX idx_documentuploads_folder_id ON documentUploads(folder_id); + +-- Document entries (S3 storage records) +CREATE TABLE documentEntries ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + documentId uuid NOT NULL, + bucket text NOT NULL, + key text NOT NULL, + FOREIGN KEY (documentId) REFERENCES documents(id) +); + +-- Comments for immutable fields (from migration 111) +COMMENT ON COLUMN documentEntries.key IS + 'S3 object key. IMMUTABLE after creation - never modify this value.'; +COMMENT ON COLUMN documentEntries.bucket IS + 'S3 bucket name. IMMUTABLE after creation - never modify this value.'; + +-- Document cleans (processed/cleaned documents) +CREATE TABLE documentCleans ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + documentId uuid NOT NULL, + bucket text, + key text, + hash text, + mimetype cleanMimeType, + fail cleanFailType, + FOREIGN KEY (documentId) REFERENCES documents(id), + CONSTRAINT bucket_and_key_together CHECK ( + (bucket IS NULL) = (key IS NULL) AND + (bucket IS NULL) = (mimetype IS NULL) AND + (bucket IS NULL) = (hash IS NULL) + ), + CONSTRAINT location_xor_fail CHECK ( + (bucket IS NOT NULL) != (fail IS NOT NULL) + ) +); + +-- Document clean entries (version tracking for cleans) +CREATE TABLE documentCleanEntries ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + cleanId uuid NOT NULL, + version bigint NOT NULL, + FOREIGN KEY (cleanId) REFERENCES documentCleans(id) +); diff --git a/internal/database/migrations/00000000000007_labels.down.sql b/internal/database/migrations/00000000000007_labels.down.sql new file mode 100644 index 00000000..4ac89d9c --- /dev/null +++ b/internal/database/migrations/00000000000007_labels.down.sql @@ -0,0 +1,8 @@ +-- Migration 007: Labels (DOWN) + +DROP INDEX IF EXISTS idx_documentlabels_document_label_time; +DROP INDEX IF EXISTS idx_documentlabels_appliedat; +DROP INDEX IF EXISTS idx_documentlabels_label; +DROP INDEX IF EXISTS idx_documentlabels_documentid; +DROP TABLE IF EXISTS documentLabels; +DROP TABLE IF EXISTS labels; diff --git a/internal/database/migrations/00000000000007_labels.up.sql b/internal/database/migrations/00000000000007_labels.up.sql new file mode 100644 index 00000000..c80e3e4e --- /dev/null +++ b/internal/database/migrations/00000000000007_labels.up.sql @@ -0,0 +1,34 @@ +-- Migration 007: Labels +-- Document labeling system for tracking processing status + +-- Create labels lookup table +CREATE TABLE labels ( + label text PRIMARY KEY, + description text NOT NULL +); + +-- Seed initial label values +INSERT INTO labels (label, description) VALUES + ('Ingested', 'Document has been ingested into the system'), + ('OCR_Processed', 'OCR text extraction completed'), + ('GenAI_Processed', 'GenAI processing completed'), + ('Doczy_AI_Completed', 'Doczy.AI processing completed'), + ('Dashboard_Ready', 'Document ready for dashboard display'); + +-- Create documentLabels junction table +CREATE TABLE documentLabels ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + documentId uuid NOT NULL, + label text NOT NULL, + appliedAt timestamp NOT NULL DEFAULT NOW(), + appliedBy varchar(255) NOT NULL, + FOREIGN KEY (documentId) REFERENCES documents(id) ON DELETE CASCADE, + FOREIGN KEY (label) REFERENCES labels(label) +); + +-- Indexes for efficient label queries +CREATE INDEX idx_documentlabels_documentid ON documentLabels(documentId); +CREATE INDEX idx_documentlabels_label ON documentLabels(label); +CREATE INDEX idx_documentlabels_appliedat ON documentLabels(appliedAt); +-- Composite index for finding most recent label application +CREATE INDEX idx_documentlabels_document_label_time ON documentLabels(documentId, label, appliedAt DESC); diff --git a/internal/database/migrations/00000000000008_field_extractions.down.sql b/internal/database/migrations/00000000000008_field_extractions.down.sql new file mode 100644 index 00000000..d48c95da --- /dev/null +++ b/internal/database/migrations/00000000000008_field_extractions.down.sql @@ -0,0 +1,19 @@ +-- Migration 008: Field Extractions (DOWN) + +-- Drop array fields table and indexes +DROP INDEX IF EXISTS idx_documentfieldextractionarrayfields_id_index; +DROP INDEX IF EXISTS idx_documentfieldextractionarrayfields_fieldextractionid; +DROP TABLE IF EXISTS documentFieldExtractionArrayFields; + +-- Drop versions table and indexes +DROP INDEX IF EXISTS idx_unique_version_per_document; +DROP INDEX IF EXISTS idx_documentfieldextractionversions_documentid; +DROP INDEX IF EXISTS idx_documentfieldextractionversions_version; +DROP INDEX IF EXISTS idx_documentfieldextractionversions_fieldextractionid; +DROP TABLE IF EXISTS documentFieldExtractionVersions; + +-- Drop main field extractions table and indexes +DROP INDEX IF EXISTS idx_documentfieldextractions_filename; +DROP INDEX IF EXISTS idx_documentfieldextractions_createdby; +DROP INDEX IF EXISTS idx_documentfieldextractions_documentid; +DROP TABLE IF EXISTS documentFieldExtractions; diff --git a/internal/database/migrations/00000000000008_field_extractions.up.sql b/internal/database/migrations/00000000000008_field_extractions.up.sql new file mode 100644 index 00000000..0bf6eed8 --- /dev/null +++ b/internal/database/migrations/00000000000008_field_extractions.up.sql @@ -0,0 +1,254 @@ +-- Migration 008: Field Extractions (Consolidated) +-- Document field extraction storage for GenAI-extracted data +-- Merges: 112 + 113 + 114 + 117 + +-- Create documentFieldExtractions table for single-value fields +CREATE TABLE documentFieldExtractions ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + documentId uuid NOT NULL, + + -- Single-value fields (19 fields total - 1:1 relationship) + -- Document identification + fileName text, + contractTitle text, + aareteDerivedAmendmentNum int, + + -- Party information + clientName text, + payerName text, + payerState text, + providerState text, + + -- Tax identification numbers (stored as text to preserve leading zeros) + filenameTin text, + provGroupTin text, + provGroupNpi text, + provGroupNameFull text, + provOtherTin text, + provOtherNpi text, + provOtherNameFull text, + + -- Contract dates + aareteDerivedEffectiveDt date, + aareteDerivedTerminationDt date, + + -- Renewal information + autoRenewalInd boolean, + autoRenewalTerm text, + + -- Metadata + createdAt timestamp NOT NULL DEFAULT NOW(), + createdBy varchar(255) NOT NULL, + + FOREIGN KEY (documentId) REFERENCES documents(id) +); + +-- Indexes for efficient queries +CREATE INDEX idx_documentfieldextractions_documentid + ON documentFieldExtractions(documentId); +CREATE INDEX idx_documentfieldextractions_createdby + ON documentFieldExtractions(createdBy); +CREATE INDEX idx_documentfieldextractions_filename + ON documentFieldExtractions(fileName); + +-- Create documentFieldExtractionVersions table for version tracking +-- Includes documentId column from migration 117 for unique constraint +CREATE TABLE documentFieldExtractionVersions ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + fieldExtractionId uuid NOT NULL, + version bigint NOT NULL, + createdBy varchar(255) NOT NULL, + createdAt timestamp NOT NULL DEFAULT NOW(), + + -- documentId for unique version constraint (from migration 117) + documentId uuid NOT NULL, + + FOREIGN KEY (fieldExtractionId) REFERENCES documentFieldExtractions(id), + FOREIGN KEY (documentId) REFERENCES documents(id) +); + +-- Indexes for version queries +CREATE INDEX idx_documentfieldextractionversions_fieldextractionid + ON documentFieldExtractionVersions(fieldExtractionId); +CREATE INDEX idx_documentfieldextractionversions_version + ON documentFieldExtractionVersions(version); +CREATE INDEX idx_documentfieldextractionversions_documentid + ON documentFieldExtractionVersions(documentId); + +-- Unique constraint to prevent duplicate versions per document (from migration 117) +CREATE UNIQUE INDEX idx_unique_version_per_document + ON documentFieldExtractionVersions(documentId, version); + +-- Create documentFieldExtractionArrayFields table for 1:N array fields +CREATE TABLE documentFieldExtractionArrayFields ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + fieldExtractionId uuid NOT NULL, + arrayIndex smallint NOT NULL, + + -- Array-value fields (112 fields total - 1:N relationship) + -- All fields at same arrayIndex form one "row" of the array + + -- Exhibit information + exhibitTitle text, + exhibitPage text, + + -- Reimbursement provider information + reimbProvTin text, + reimbProvNpi text, + reimbProvName text, + reimbEffectiveDt date, + reimbTerminationDt date, + + -- Claim and product codes + aareteDerivedClaimTypeCd text, + aareteDerivedProduct text, + aareteDerivedLob text, + aareteDerivedProgram text, + aareteDerivedNetwork text, + aareteDerivedProvType text, + + -- Provider taxonomy and specialty + provTaxonomyCd text, + provTaxonomyCdDesc text, + provSpecialtyCd text, + provSpecialtyCdDesc text, + + -- Service location + placeOfServiceCd text, + placeOfServiceCdDesc text, + billTypeCd text, + billTypeCdDesc text, + + -- Patient demographics + patientAgeMin text, + patientAgeMax text, + + -- Reimbursement terms + reimbTerm text, + lobProgramRelationship text, + lobProductRelationship text, + + -- Carveout and payment logic + carveoutInd boolean, + carveoutCd text, + lesserOfInd boolean, + greaterOfInd boolean, + aareteDerivedReimbMethod text, + unitOfMeasure text, + + -- Reimbursement rates + reimbPctRate numeric(10,4), + reimbFeeRate numeric(12,2), + reimbConversionFactor numeric(12,4), + triggerCapThresholdAmt numeric(12,2), + triggerBaseThreshold numeric(12,2), + + -- Default and addition + defaultInd boolean, + additionDesc text, + additionMaxFeeRateInc numeric(12,2), + additionMaxPctRateInc numeric(10,4), + aareteDerivedAdditionRateChangeTimeline text, + + -- Fee schedule + aareteDerivedFeeSchedule text, + aareteDerivedFeeScheduleVersion text, + + -- Service codes + serviceTerm text, + cpt4ProcCd text, + cpt4ProcCdDesc text, + cpt4ProcMod text, + cpt4ProcModDesc text, + revenueCd text, + revenueCdDesc text, + diagCd text, + diagCdDesc text, + ndcCd text, + ndcCdDesc text, + + -- Claim admit and status + claimAdmitTypeCd text, + authAdmitTypeDesc text, + claimStatusCd text, + claimStatusCdDesc text, + + -- Grouper information + grouperType text, + grouperCd text, + grouperCdDesc text, + grouperPctRate numeric(10,4), + grouperBaseRate numeric(12,2), + aareteDerivedGrouperVersion text, + grouperAlternativeLevelOfCare text, + grouperSeverityInd boolean, + grouperSeverity text, + grouperRiskOfMortalitySubclass text, + grouperTransferInd boolean, + grouperReadmissionsInd boolean, + grouperHacInd boolean, + + -- Outlier terms + outlierTerm text, + outlierFirstDollarInd boolean, + rangeNbrDays text, + outlierFixedLossNbrDaysThreshold numeric(10,2), + outlierFixedLossThreshold numeric(12,2), + outlierMaximum numeric(12,2), + outlierMaximumFrequency numeric(10,2), + outlierPctRate numeric(10,4), + outlierExclusionCd text, + outlierExclusionCdDesc text, + + -- Facility adjustments + facilityAdjustmentTerm text, + dshInd boolean, + dshPctRate numeric(10,4), + dshFeeRate numeric(12,2), + imeInd boolean, + imePctRate numeric(10,4), + imeFeeRate numeric(12,2), + ntapInd boolean, + ntapPctRate numeric(10,4), + ntapFeeRate numeric(12,2), + ucInd boolean, + ucPctRate numeric(10,4), + ucFeeRate numeric(12,2), + gmeInd boolean, + gmePctRate numeric(10,4), + gmeFeeRate numeric(12,2), + + -- Rate escalator + rateEscalatorInd boolean, + rateEscalatorDesc text, + rateEscalatorMaxRateIncPct numeric(10,4), + rateEscalatorRateChangeTimeline numeric(10,2), + + -- Stop loss + stopLossTerm text, + stopLossFirstDollarInd boolean, + stopLossRangeNbrDays numeric(10,2), + stopLossFixedLossThreshold numeric(12,2), + stopLossMaximum numeric(12,2), + stopLossMaximumFrequency numeric(10,2), + stopLossDailyMaxRate numeric(12,2), + stopLossPctRateOnExcessCharges numeric(10,4), + stopLossExclusionCd text, + stopLossExclusionDesc text, + + FOREIGN KEY (fieldExtractionId) REFERENCES documentFieldExtractions(id), + + -- Ensure unique index per extraction + UNIQUE (fieldExtractionId, arrayIndex), + + -- Ensure arrayIndex is non-negative + CHECK (arrayIndex >= 0) +); + +-- Indexes for efficient array field queries +CREATE INDEX idx_documentfieldextractionarrayfields_fieldextractionid + ON documentFieldExtractionArrayFields(fieldExtractionId); + +-- Composite index for efficient ordered retrieval +CREATE INDEX idx_documentfieldextractionarrayfields_id_index + ON documentFieldExtractionArrayFields(fieldExtractionId, arrayIndex); diff --git a/internal/database/migrations/00000000000010_collector_views.down.sql b/internal/database/migrations/00000000000010_collector_views.down.sql new file mode 100644 index 00000000..3d47b9f8 --- /dev/null +++ b/internal/database/migrations/00000000000010_collector_views.down.sql @@ -0,0 +1,6 @@ +-- Migration 010: Collector Views (DOWN) + +DROP VIEW IF EXISTS fullActiveCollectors; +DROP VIEW IF EXISTS currentCollectorMinCleanVersions; +DROP VIEW IF EXISTS collectorLatestVersions; +DROP VIEW IF EXISTS collectorCurrentActiveVersions; diff --git a/internal/database/migrations/00000000000010_collector_views.up.sql b/internal/database/migrations/00000000000010_collector_views.up.sql new file mode 100644 index 00000000..58c2a6db --- /dev/null +++ b/internal/database/migrations/00000000000010_collector_views.up.sql @@ -0,0 +1,43 @@ +-- Migration 010: Collector Views (Simplified) +-- Views for collector configuration +-- NOTE: Query-related views and text version views removed (no longer used) + +CREATE VIEW collectorCurrentActiveVersions AS +SELECT + c.clientId, + COALESCE(v.versionId, 0)::int AS activeVersion +FROM + clients c +LEFT JOIN ( + SELECT DISTINCT ON (clientId) + clientId, + versionId + FROM + collectorActiveVersions + ORDER BY clientId, id DESC +) v ON c.clientId = v.clientId; + +CREATE VIEW collectorLatestVersions AS + SELECT + j.clientId, + COALESCE(MAX(v.id), 0)::int AS latestVersion + FROM clients AS j + LEFT JOIN collectorVersions AS v ON v.clientId = j.clientId + GROUP BY j.clientId; + +CREATE VIEW currentCollectorMinCleanVersions AS +SELECT DISTINCT + av.clientId, + COALESCE(ctv.versionId, 0) AS minCleanVersion + FROM collectorCurrentActiveVersions AS av + LEFT JOIN collectorMinCleanVersions AS ctv ON av.clientId = ctv.clientId + AND isInVersion(av.activeVersion, ctv.addedVersion, ctv.removedVersion); + +-- Final fullActiveCollectors view (simplified without minTextVersion or fields) +CREATE VIEW fullActiveCollectors AS + SELECT DISTINCT av.clientId, + ccv.minCleanVersion, + av.activeVersion, lv.latestVersion + FROM collectorCurrentActiveVersions AS av + JOIN collectorLatestVersions AS lv ON lv.clientId = av.clientId + JOIN currentCollectorMinCleanVersions AS ccv ON av.clientId = ccv.clientId; diff --git a/internal/database/migrations/00000000000011_document_views.down.sql b/internal/database/migrations/00000000000011_document_views.down.sql new file mode 100644 index 00000000..c08aec93 --- /dev/null +++ b/internal/database/migrations/00000000000011_document_views.down.sql @@ -0,0 +1,7 @@ +-- Migration 011: Document Views (DOWN) + +DROP FUNCTION IF EXISTS listValidDocumentResults; +DROP VIEW IF EXISTS fullClients; +DROP VIEW IF EXISTS currentClientCanSync; +DROP VIEW IF EXISTS currentCleanEntries; +DROP FUNCTION IF EXISTS listDocumentIDs; diff --git a/internal/database/migrations/00000000000011_document_views.up.sql b/internal/database/migrations/00000000000011_document_views.up.sql new file mode 100644 index 00000000..905f3175 --- /dev/null +++ b/internal/database/migrations/00000000000011_document_views.up.sql @@ -0,0 +1,190 @@ +-- Migration 011: Document Views (Simplified) +-- Views and functions for document queries +-- NOTE: currentTextEntries and listValidDocumentResults removed (no longer used) + +CREATE OR REPLACE FUNCTION listDocumentIDs( + _clientId varchar(255), + _batchSize INTEGER, + _offset INTEGER +) +RETURNS TABLE (id uuid, totalCount BIGINT) AS $$ +DECLARE + totalCount BIGINT := 0; +BEGIN + SELECT COUNT(*)::BIGINT INTO totalCount FROM documents WHERE clientId = _clientId; + + RETURN QUERY + SELECT d.id, totalCount + FROM documents AS d + WHERE d.clientId = _clientId + ORDER BY d.id + LIMIT _batchSize + OFFSET _offset; +END; +$$ LANGUAGE plpgsql; + +CREATE VIEW currentCleanEntries AS +WITH RankedExtractions AS ( + SELECT + dc.id, + dc.documentId, + dc.bucket, + dc.key, + dc.mimetype, + dc.fail, + dc.hash, + dce.version, + d.clientId, + ROW_NUMBER() OVER (PARTITION BY dc.documentId ORDER BY dc.id DESC, dce.id DESC) AS row_num + FROM documents d + JOIN currentCollectorMinCleanVersions ccv ON d.clientId = ccv.clientId + JOIN documentCleans dc ON dc.documentId = d.id + JOIN documentCleanEntries dce ON dc.id = dce.cleanId + AND dce.version >= ccv.minCleanVersion +) +SELECT + re.id, + re.documentId, + re.bucket, + re.key, + re.version, + re.hash, + re.mimetype, + re.fail, + re.clientId +FROM RankedExtractions re +WHERE row_num = 1; + +CREATE VIEW currentClientCanSync AS +WITH RankedExtractions AS ( + SELECT + ccs.clientId, + ccs.canSync, + ROW_NUMBER() OVER (PARTITION BY ccs.clientId ORDER BY ccs.syncId DESC) AS row_num + FROM clients c + JOIN clientCanSync ccs ON c.clientId = ccs.clientId +) +SELECT + c.clientId, + COALESCE(r.canSync, false) AS canSync +FROM clients c +LEFT JOIN RankedExtractions r ON r.clientId = c.clientId AND r.row_num = 1; + +CREATE VIEW fullClients AS +SELECT c.clientId, c.name, cs.canSync + FROM clients AS c + JOIN currentClientCanSync AS cs ON cs.clientId = c.clientId; + +-- NOTE: This function exists for schema compatibility with original migrations. +-- It references tables/functions that no longer exist (results, resultDependencies, +-- collectorQueryDependencyTreeByClient, currentTextEntries) and will fail if called. +-- It was created in original migration 102 but never explicitly dropped. +CREATE OR REPLACE FUNCTION listValidDocumentResults(doc_id uuid) +RETURNS TABLE (documentId uuid, queryId uuid, resultId uuid, value text) AS $$ +DECLARE + count_before INT; + count_after INT; + iterations INT := 0; +BEGIN + CREATE TEMPORARY TABLE allResults AS + WITH + docs AS ( + SELECT id as documentId, clientId + FROM documents + WHERE id = doc_id + ), + tree as ( + select q.queryId, q.requiredIds, q.clientId, q.queryVersion + from docs, + LATERAL collectorQueryDependencyTreeByClient(docs.clientId) AS q + ), + query_dependency_tree AS ( + WITH RECURSIVE query_deps AS ( + SELECT + q.queryId, + unnest(q.requiredIds) as requiredId + FROM tree AS q + WHERE array_length(q.requiredIds, 1) > 0 + + UNION ALL + + SELECT + qd.queryId, + unnest(q.requiredIds) as requiredId + FROM query_deps qd + JOIN tree q ON qd.requiredId = q.queryId + WHERE array_length(q.requiredIds, 1) > 0 + ) + SELECT + query_deps.queryId, + array_agg(DISTINCT requiredId) AS all_required_ids + FROM query_deps + GROUP BY query_deps.queryId + ), + docResults AS ( + SELECT + d.documentId, + q.queryId, + r.id AS resultId, + r.value, + q.requiredIds as directRequiredIds, + COALESCE(qdt.all_required_ids, ARRAY[]::uuid[]) AS allRequiredIds + FROM docs AS d + JOIN tree AS q ON q.clientId = d.clientId + LEFT JOIN query_dependency_tree qdt ON q.queryId = qdt.queryId + LEFT JOIN currentTextEntries AS tte ON tte.documentId = d.documentId + LEFT JOIN results AS r + ON q.queryId = r.queryId + AND r.queryVersion = q.queryVersion + AND tte.id = r.textEntryId + WHERE r.value is not null + ) + SELECT * FROM docResults dr; + + CREATE TEMPORARY TABLE finalResults AS + SELECT * from allResults where array_length(directRequiredIds, 1) is null; + + SELECT COUNT(*) INTO count_before FROM finalResults; + RAISE NOTICE 'Starting with % rows', count_before; + + LOOP + iterations := iterations + 1; + + INSERT INTO finalResults + SELECT dr.* + FROM allResults dr + WHERE + dr.directRequiredIds IS NOT NULL + AND NOT EXISTS ( + SELECT 1 + FROM unnest(dr.directRequiredIds) AS req_id(queryId) + WHERE NOT EXISTS ( + SELECT 1 + FROM allResults req_dr + WHERE req_dr.queryId = req_id.queryId + AND req_dr.resultId IN (SELECT fr.resultId FROM finalResults fr) + AND exists ( + select 1 from resultDependencies rrd + where dr.resultId = rrd.resultId + and req_dr.resultId = rrd.requiredResultId + ) + ) + ) + and dr.resultId NOT IN (SELECT fr.resultId FROM finalResults fr); + + GET DIAGNOSTICS count_after = ROW_COUNT; + RAISE NOTICE 'Iteration %: Additional Entries %', + iterations, count_after; + + IF count_after = 0 THEN + EXIT; + END IF; + END LOOP; + + RETURN QUERY SELECT tr.documentId, tr.queryId, tr.resultId, tr.value + FROM finalResults tr; + + DROP TABLE finalResults; + DROP TABLE allResults; +END; +$$ LANGUAGE plpgsql; diff --git a/internal/database/migrations/00000000000012_field_extraction_views.down.sql b/internal/database/migrations/00000000000012_field_extraction_views.down.sql new file mode 100644 index 00000000..70d0eabc --- /dev/null +++ b/internal/database/migrations/00000000000012_field_extraction_views.down.sql @@ -0,0 +1,4 @@ +-- Migration 012: Field Extraction Views (DOWN) + +DROP VIEW IF EXISTS currentFieldExtractionsWithArrayCount; +DROP VIEW IF EXISTS currentFieldExtractions; diff --git a/internal/database/migrations/00000000000012_field_extraction_views.up.sql b/internal/database/migrations/00000000000012_field_extraction_views.up.sql new file mode 100644 index 00000000..4e86d161 --- /dev/null +++ b/internal/database/migrations/00000000000012_field_extraction_views.up.sql @@ -0,0 +1,47 @@ +-- Migration 012: Field Extraction Views +-- Views for querying current field extractions + +-- Create view for current (newest) field extraction per document +CREATE VIEW currentFieldExtractions AS +SELECT DISTINCT ON (dfe.documentId) + dfe.id, + dfe.documentId, + dfe.fileName, + dfe.contractTitle, + dfe.aareteDerivedAmendmentNum, + dfe.clientName, + dfe.payerName, + dfe.payerState, + dfe.providerState, + dfe.filenameTin, + dfe.provGroupTin, + dfe.provGroupNpi, + dfe.provGroupNameFull, + dfe.provOtherTin, + dfe.provOtherNpi, + dfe.provOtherNameFull, + dfe.aareteDerivedEffectiveDt, + dfe.aareteDerivedTerminationDt, + dfe.autoRenewalInd, + dfe.autoRenewalTerm, + dfev.version, + dfev.createdBy, + dfev.createdAt +FROM documentFieldExtractions dfe +JOIN documentFieldExtractionVersions dfev + ON dfev.fieldExtractionId = dfe.id +ORDER BY dfe.documentId, dfev.id DESC; + +-- Create extended view with array field count +CREATE VIEW currentFieldExtractionsWithArrayCount AS +SELECT + cfe.*, + COALESCE(array_counts.arraySize, 0) AS arraySize +FROM currentFieldExtractions cfe +LEFT JOIN ( + SELECT + fieldExtractionId, + COUNT(*) AS arraySize + FROM documentFieldExtractionArrayFields + GROUP BY fieldExtractionId +) array_counts ON array_counts.fieldExtractionId = cfe.id; diff --git a/internal/database/migrations_archive/00000000000001_extensions.down.sql b/internal/database/migrations_archive/00000000000001_extensions.down.sql new file mode 100644 index 00000000..d3b7d69f --- /dev/null +++ b/internal/database/migrations_archive/00000000000001_extensions.down.sql @@ -0,0 +1 @@ +DROP EXTENSION "pgcrypto"; \ No newline at end of file diff --git a/internal/database/migrations_archive/00000000000001_extensions.up.sql b/internal/database/migrations_archive/00000000000001_extensions.up.sql new file mode 100644 index 00000000..25ac191b --- /dev/null +++ b/internal/database/migrations_archive/00000000000001_extensions.up.sql @@ -0,0 +1,37 @@ +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; + +create or replace function uuid_generate_v7() +returns uuid +as $$ +select encode( + set_bit( + set_bit( + overlay(uuid_send(gen_random_uuid()) + placing substring(int8send(floor(extract(epoch from clock_timestamp()) * 1000)::bigint) from 3) + from 1 for 6 + ), + 52, 1 + ), + 53, 1 + ), + 'hex')::uuid; +$$ +language SQL +volatile; + +CREATE FUNCTION isInVersion( + _version int, + _addedVersion int, + _removedVersion int +) +RETURNS boolean as $$ +BEGIN + RETURN _version is null OR ( + _version >= _addedVersion AND + (_removedVersion is null OR _version < _removedVersion) + ); +END; +$$ LANGUAGE plpgsql; + +CREATE DOMAIN unsignedsmallint AS SMALLINT + CHECK (VALUE >= 0); diff --git a/internal/database/migrations/00000000000002_queries.down.sql b/internal/database/migrations_archive/00000000000002_queries.down.sql similarity index 100% rename from internal/database/migrations/00000000000002_queries.down.sql rename to internal/database/migrations_archive/00000000000002_queries.down.sql diff --git a/internal/database/migrations/00000000000002_queries.up.sql b/internal/database/migrations_archive/00000000000002_queries.up.sql similarity index 100% rename from internal/database/migrations/00000000000002_queries.up.sql rename to internal/database/migrations_archive/00000000000002_queries.up.sql diff --git a/internal/database/migrations/00000000000003_clients.down.sql b/internal/database/migrations_archive/00000000000003_clients.down.sql similarity index 100% rename from internal/database/migrations/00000000000003_clients.down.sql rename to internal/database/migrations_archive/00000000000003_clients.down.sql diff --git a/internal/database/migrations/00000000000003_clients.up.sql b/internal/database/migrations_archive/00000000000003_clients.up.sql similarity index 100% rename from internal/database/migrations/00000000000003_clients.up.sql rename to internal/database/migrations_archive/00000000000003_clients.up.sql diff --git a/internal/database/migrations/00000000000004_collectors.down.sql b/internal/database/migrations_archive/00000000000004_collectors.down.sql similarity index 100% rename from internal/database/migrations/00000000000004_collectors.down.sql rename to internal/database/migrations_archive/00000000000004_collectors.down.sql diff --git a/internal/database/migrations/00000000000004_collectors.up.sql b/internal/database/migrations_archive/00000000000004_collectors.up.sql similarity index 100% rename from internal/database/migrations/00000000000004_collectors.up.sql rename to internal/database/migrations_archive/00000000000004_collectors.up.sql diff --git a/internal/database/migrations/00000000000005_documents.down.sql b/internal/database/migrations_archive/00000000000005_documents.down.sql similarity index 100% rename from internal/database/migrations/00000000000005_documents.down.sql rename to internal/database/migrations_archive/00000000000005_documents.down.sql diff --git a/internal/database/migrations/00000000000005_documents.up.sql b/internal/database/migrations_archive/00000000000005_documents.up.sql similarity index 100% rename from internal/database/migrations/00000000000005_documents.up.sql rename to internal/database/migrations_archive/00000000000005_documents.up.sql diff --git a/internal/database/migrations/00000000000006_results.down.sql b/internal/database/migrations_archive/00000000000006_results.down.sql similarity index 100% rename from internal/database/migrations/00000000000006_results.down.sql rename to internal/database/migrations_archive/00000000000006_results.down.sql diff --git a/internal/database/migrations/00000000000006_results.up.sql b/internal/database/migrations_archive/00000000000006_results.up.sql similarity index 100% rename from internal/database/migrations/00000000000006_results.up.sql rename to internal/database/migrations_archive/00000000000006_results.up.sql diff --git a/internal/database/migrations/00000000000100_query_views.down.sql b/internal/database/migrations_archive/00000000000100_query_views.down.sql similarity index 100% rename from internal/database/migrations/00000000000100_query_views.down.sql rename to internal/database/migrations_archive/00000000000100_query_views.down.sql diff --git a/internal/database/migrations/00000000000100_query_views.up.sql b/internal/database/migrations_archive/00000000000100_query_views.up.sql similarity index 100% rename from internal/database/migrations/00000000000100_query_views.up.sql rename to internal/database/migrations_archive/00000000000100_query_views.up.sql diff --git a/internal/database/migrations/00000000000101_collector_views.down.sql b/internal/database/migrations_archive/00000000000101_collector_views.down.sql similarity index 100% rename from internal/database/migrations/00000000000101_collector_views.down.sql rename to internal/database/migrations_archive/00000000000101_collector_views.down.sql diff --git a/internal/database/migrations/00000000000101_collector_views.up.sql b/internal/database/migrations_archive/00000000000101_collector_views.up.sql similarity index 100% rename from internal/database/migrations/00000000000101_collector_views.up.sql rename to internal/database/migrations_archive/00000000000101_collector_views.up.sql diff --git a/internal/database/migrations/00000000000102_document_views.down.sql b/internal/database/migrations_archive/00000000000102_document_views.down.sql similarity index 100% rename from internal/database/migrations/00000000000102_document_views.down.sql rename to internal/database/migrations_archive/00000000000102_document_views.down.sql diff --git a/internal/database/migrations/00000000000102_document_views.up.sql b/internal/database/migrations_archive/00000000000102_document_views.up.sql similarity index 100% rename from internal/database/migrations/00000000000102_document_views.up.sql rename to internal/database/migrations_archive/00000000000102_document_views.up.sql diff --git a/internal/database/migrations/00000000000103_batch_uploads.down.sql b/internal/database/migrations_archive/00000000000103_batch_uploads.down.sql similarity index 100% rename from internal/database/migrations/00000000000103_batch_uploads.down.sql rename to internal/database/migrations_archive/00000000000103_batch_uploads.down.sql diff --git a/internal/database/migrations/00000000000103_batch_uploads.up.sql b/internal/database/migrations_archive/00000000000103_batch_uploads.up.sql similarity index 100% rename from internal/database/migrations/00000000000103_batch_uploads.up.sql rename to internal/database/migrations_archive/00000000000103_batch_uploads.up.sql diff --git a/internal/database/migrations/00000000000104_add_batch_storage_columns.down.sql b/internal/database/migrations_archive/00000000000104_add_batch_storage_columns.down.sql similarity index 100% rename from internal/database/migrations/00000000000104_add_batch_storage_columns.down.sql rename to internal/database/migrations_archive/00000000000104_add_batch_storage_columns.down.sql diff --git a/internal/database/migrations/00000000000104_add_batch_storage_columns.up.sql b/internal/database/migrations_archive/00000000000104_add_batch_storage_columns.up.sql similarity index 100% rename from internal/database/migrations/00000000000104_add_batch_storage_columns.up.sql rename to internal/database/migrations_archive/00000000000104_add_batch_storage_columns.up.sql diff --git a/internal/database/migrations/00000000000105_add_document_filename.down.sql b/internal/database/migrations_archive/00000000000105_add_document_filename.down.sql similarity index 100% rename from internal/database/migrations/00000000000105_add_document_filename.down.sql rename to internal/database/migrations_archive/00000000000105_add_document_filename.down.sql diff --git a/internal/database/migrations/00000000000105_add_document_filename.up.sql b/internal/database/migrations_archive/00000000000105_add_document_filename.up.sql similarity index 100% rename from internal/database/migrations/00000000000105_add_document_filename.up.sql rename to internal/database/migrations_archive/00000000000105_add_document_filename.up.sql diff --git a/internal/database/migrations/00000000000106_add_documentuploads_filename.down.sql b/internal/database/migrations_archive/00000000000106_add_documentuploads_filename.down.sql similarity index 100% rename from internal/database/migrations/00000000000106_add_documentuploads_filename.down.sql rename to internal/database/migrations_archive/00000000000106_add_documentuploads_filename.down.sql diff --git a/internal/database/migrations/00000000000106_add_documentuploads_filename.up.sql b/internal/database/migrations_archive/00000000000106_add_documentuploads_filename.up.sql similarity index 100% rename from internal/database/migrations/00000000000106_add_documentuploads_filename.up.sql rename to internal/database/migrations_archive/00000000000106_add_documentuploads_filename.up.sql diff --git a/internal/database/migrations/00000000000107_add_documentuploads_batch_id.down.sql b/internal/database/migrations_archive/00000000000107_add_documentuploads_batch_id.down.sql similarity index 100% rename from internal/database/migrations/00000000000107_add_documentuploads_batch_id.down.sql rename to internal/database/migrations_archive/00000000000107_add_documentuploads_batch_id.down.sql diff --git a/internal/database/migrations/00000000000107_add_documentuploads_batch_id.up.sql b/internal/database/migrations_archive/00000000000107_add_documentuploads_batch_id.up.sql similarity index 100% rename from internal/database/migrations/00000000000107_add_documentuploads_batch_id.up.sql rename to internal/database/migrations_archive/00000000000107_add_documentuploads_batch_id.up.sql diff --git a/internal/database/migrations/00000000000108_add_documentuploads_clientid_index.down.sql b/internal/database/migrations_archive/00000000000108_add_documentuploads_clientid_index.down.sql similarity index 100% rename from internal/database/migrations/00000000000108_add_documentuploads_clientid_index.down.sql rename to internal/database/migrations_archive/00000000000108_add_documentuploads_clientid_index.down.sql diff --git a/internal/database/migrations/00000000000108_add_documentuploads_clientid_index.up.sql b/internal/database/migrations_archive/00000000000108_add_documentuploads_clientid_index.up.sql similarity index 100% rename from internal/database/migrations/00000000000108_add_documentuploads_clientid_index.up.sql rename to internal/database/migrations_archive/00000000000108_add_documentuploads_clientid_index.up.sql diff --git a/internal/database/migrations/00000000000109_create_folders_table.down.sql b/internal/database/migrations_archive/00000000000109_create_folders_table.down.sql similarity index 100% rename from internal/database/migrations/00000000000109_create_folders_table.down.sql rename to internal/database/migrations_archive/00000000000109_create_folders_table.down.sql diff --git a/internal/database/migrations/00000000000109_create_folders_table.up.sql b/internal/database/migrations_archive/00000000000109_create_folders_table.up.sql similarity index 100% rename from internal/database/migrations/00000000000109_create_folders_table.up.sql rename to internal/database/migrations_archive/00000000000109_create_folders_table.up.sql diff --git a/internal/database/migrations/00000000000110_create_labels_tables.down.sql b/internal/database/migrations_archive/00000000000110_create_labels_tables.down.sql similarity index 100% rename from internal/database/migrations/00000000000110_create_labels_tables.down.sql rename to internal/database/migrations_archive/00000000000110_create_labels_tables.down.sql diff --git a/internal/database/migrations/00000000000110_create_labels_tables.up.sql b/internal/database/migrations_archive/00000000000110_create_labels_tables.up.sql similarity index 100% rename from internal/database/migrations/00000000000110_create_labels_tables.up.sql rename to internal/database/migrations_archive/00000000000110_create_labels_tables.up.sql diff --git a/internal/database/migrations/00000000000111_add_documents_folder_fields.down.sql b/internal/database/migrations_archive/00000000000111_add_documents_folder_fields.down.sql similarity index 100% rename from internal/database/migrations/00000000000111_add_documents_folder_fields.down.sql rename to internal/database/migrations_archive/00000000000111_add_documents_folder_fields.down.sql diff --git a/internal/database/migrations/00000000000111_add_documents_folder_fields.up.sql b/internal/database/migrations_archive/00000000000111_add_documents_folder_fields.up.sql similarity index 100% rename from internal/database/migrations/00000000000111_add_documents_folder_fields.up.sql rename to internal/database/migrations_archive/00000000000111_add_documents_folder_fields.up.sql diff --git a/internal/database/migrations/00000000000112_create_field_extractions_main.down.sql b/internal/database/migrations_archive/00000000000112_create_field_extractions_main.down.sql similarity index 100% rename from internal/database/migrations/00000000000112_create_field_extractions_main.down.sql rename to internal/database/migrations_archive/00000000000112_create_field_extractions_main.down.sql diff --git a/internal/database/migrations/00000000000112_create_field_extractions_main.up.sql b/internal/database/migrations_archive/00000000000112_create_field_extractions_main.up.sql similarity index 100% rename from internal/database/migrations/00000000000112_create_field_extractions_main.up.sql rename to internal/database/migrations_archive/00000000000112_create_field_extractions_main.up.sql diff --git a/internal/database/migrations/00000000000113_create_field_extraction_versions.down.sql b/internal/database/migrations_archive/00000000000113_create_field_extraction_versions.down.sql similarity index 100% rename from internal/database/migrations/00000000000113_create_field_extraction_versions.down.sql rename to internal/database/migrations_archive/00000000000113_create_field_extraction_versions.down.sql diff --git a/internal/database/migrations/00000000000113_create_field_extraction_versions.up.sql b/internal/database/migrations_archive/00000000000113_create_field_extraction_versions.up.sql similarity index 100% rename from internal/database/migrations/00000000000113_create_field_extraction_versions.up.sql rename to internal/database/migrations_archive/00000000000113_create_field_extraction_versions.up.sql diff --git a/internal/database/migrations/00000000000114_create_field_extraction_arrays.down.sql b/internal/database/migrations_archive/00000000000114_create_field_extraction_arrays.down.sql similarity index 100% rename from internal/database/migrations/00000000000114_create_field_extraction_arrays.down.sql rename to internal/database/migrations_archive/00000000000114_create_field_extraction_arrays.down.sql diff --git a/internal/database/migrations/00000000000114_create_field_extraction_arrays.up.sql b/internal/database/migrations_archive/00000000000114_create_field_extraction_arrays.up.sql similarity index 100% rename from internal/database/migrations/00000000000114_create_field_extraction_arrays.up.sql rename to internal/database/migrations_archive/00000000000114_create_field_extraction_arrays.up.sql diff --git a/internal/database/migrations/00000000000115_create_field_extraction_views.down.sql b/internal/database/migrations_archive/00000000000115_create_field_extraction_views.down.sql similarity index 100% rename from internal/database/migrations/00000000000115_create_field_extraction_views.down.sql rename to internal/database/migrations_archive/00000000000115_create_field_extraction_views.down.sql diff --git a/internal/database/migrations/00000000000115_create_field_extraction_views.up.sql b/internal/database/migrations_archive/00000000000115_create_field_extraction_views.up.sql similarity index 100% rename from internal/database/migrations/00000000000115_create_field_extraction_views.up.sql rename to internal/database/migrations_archive/00000000000115_create_field_extraction_views.up.sql diff --git a/internal/database/migrations/00000000000116_add_documentuploads_folder_id.down.sql b/internal/database/migrations_archive/00000000000116_add_documentuploads_folder_id.down.sql similarity index 100% rename from internal/database/migrations/00000000000116_add_documentuploads_folder_id.down.sql rename to internal/database/migrations_archive/00000000000116_add_documentuploads_folder_id.down.sql diff --git a/internal/database/migrations/00000000000116_add_documentuploads_folder_id.up.sql b/internal/database/migrations_archive/00000000000116_add_documentuploads_folder_id.up.sql similarity index 100% rename from internal/database/migrations/00000000000116_add_documentuploads_folder_id.up.sql rename to internal/database/migrations_archive/00000000000116_add_documentuploads_folder_id.up.sql diff --git a/internal/database/migrations/00000000000117_add_version_unique_constraint.down.sql b/internal/database/migrations_archive/00000000000117_add_version_unique_constraint.down.sql similarity index 100% rename from internal/database/migrations/00000000000117_add_version_unique_constraint.down.sql rename to internal/database/migrations_archive/00000000000117_add_version_unique_constraint.down.sql diff --git a/internal/database/migrations/00000000000117_add_version_unique_constraint.up.sql b/internal/database/migrations_archive/00000000000117_add_version_unique_constraint.up.sql similarity index 100% rename from internal/database/migrations/00000000000117_add_version_unique_constraint.up.sql rename to internal/database/migrations_archive/00000000000117_add_version_unique_constraint.up.sql diff --git a/internal/database/migrations/00000000000118_add_document_file_size.down.sql b/internal/database/migrations_archive/00000000000118_add_document_file_size.down.sql similarity index 100% rename from internal/database/migrations/00000000000118_add_document_file_size.down.sql rename to internal/database/migrations_archive/00000000000118_add_document_file_size.down.sql diff --git a/internal/database/migrations/00000000000118_add_document_file_size.up.sql b/internal/database/migrations_archive/00000000000118_add_document_file_size.up.sql similarity index 100% rename from internal/database/migrations/00000000000118_add_document_file_size.up.sql rename to internal/database/migrations_archive/00000000000118_add_document_file_size.up.sql diff --git a/internal/database/migrations/00000000000119_remove_queries.down.sql b/internal/database/migrations_archive/00000000000119_remove_queries.down.sql similarity index 100% rename from internal/database/migrations/00000000000119_remove_queries.down.sql rename to internal/database/migrations_archive/00000000000119_remove_queries.down.sql diff --git a/internal/database/migrations/00000000000119_remove_queries.up.sql b/internal/database/migrations_archive/00000000000119_remove_queries.up.sql similarity index 100% rename from internal/database/migrations/00000000000119_remove_queries.up.sql rename to internal/database/migrations_archive/00000000000119_remove_queries.up.sql diff --git a/internal/database/migrations_archive/00000000000120_remove_text_extraction.down.sql b/internal/database/migrations_archive/00000000000120_remove_text_extraction.down.sql new file mode 100644 index 00000000..e3833b88 --- /dev/null +++ b/internal/database/migrations_archive/00000000000120_remove_text_extraction.down.sql @@ -0,0 +1,104 @@ +-- Rollback migration to restore text extraction functionality +-- NOTE: This recreates text extraction tables and views + +-- First drop the simplified fullActiveCollectors view +DROP VIEW IF EXISTS fullActiveCollectors; + +-- Recreate documentTextExtractions table +CREATE TABLE documentTextExtractions ( + id uuid primary key DEFAULT uuid_generate_v7(), + cleanId uuid not null, + bucket text not null, + key text not null, + hash text not null, + createdAt timestamp not null, + part unsignedsmallint not null, + foreign key (cleanId) references documentCleans(id) +); + +-- Recreate documentTextExtractionEntries table +CREATE TABLE documentTextExtractionEntries ( + id uuid primary key DEFAULT uuid_generate_v7(), + textId uuid not null, + version bigint not null, + foreign key (textId) references documentTextExtractions(id) +); + +-- Recreate collectorMinTextVersions table +CREATE TABLE collectorMinTextVersions ( + id uuid primary key DEFAULT uuid_generate_v7(), + clientId varchar(255) not null, + versionId bigint not null, + addedVersion int not null, + removedVersion int, + foreign key (clientId, addedVersion) references collectorVersions(clientId, id), + foreign key (clientId, removedVersion) references collectorVersions(clientId, id), + foreign key (clientId) references clients(clientId) +); + +-- Recreate removeMinTextVersion function +CREATE OR REPLACE FUNCTION removeMinTextVersion() +RETURNS TRIGGER AS $$ +BEGIN + UPDATE collectorMinTextVersions + SET removedVersion = NEW.addedVersion + WHERE clientId = NEW.clientId and removedVersion is null; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +-- Recreate trigger for collectorMinTextVersions +CREATE TRIGGER removeMinTextVersionTrigger +BEFORE INSERT ON collectorMinTextVersions +FOR EACH ROW +EXECUTE FUNCTION removeMinTextVersion(); + +-- Recreate currentCollectorMinTextVersions view +CREATE VIEW currentCollectorMinTextVersions as +SELECT DISTINCT + av.clientId, + coalesce(ctv.versionId, 0) as minTextVersion + FROM collectorCurrentActiveVersions as av + LEFT JOIN collectorMinTextVersions AS ctv ON av.clientId = ctv.clientId + and isInVersion(av.activeVersion, ctv.addedVersion, ctv.removedVersion); + +-- Recreate fullActiveCollectors view with minTextVersion +CREATE VIEW fullActiveCollectors AS + SELECT DISTINCT av.clientId, + ccv.minCleanVersion, ctv.minTextVersion, + av.activeVersion, lv.latestVersion + FROM collectorCurrentActiveVersions as av + JOIN collectorLatestVersions as lv on lv.clientId = av.clientId + JOIN currentCollectorMinCleanVersions AS ccv ON av.clientId = ccv.clientId + JOIN currentCollectorMinTextVersions AS ctv ON av.clientId = ctv.clientId; + +-- Recreate currentTextEntries view +CREATE VIEW currentTextEntries as +WITH RankedExtractions AS ( + SELECT + extract.id, + cc.documentId, + extract.bucket, + extract.key, + extract.hash, + extract.cleanId, + dtee.version as extractionVersion, + ROW_NUMBER() OVER (PARTITION BY cc.documentId ORDER BY dtee.id DESC) as row_num + FROM documents d + JOIN currentCleanEntries cc on cc.documentId = d.id + JOIN currentCollectorMinTextVersions ctv ON ctv.clientId = d.clientId + JOIN documentTextExtractions extract ON extract.cleanId = cc.id + JOIN documentTextExtractionEntries dtee on dtee.textId = extract.id + AND dtee.version >= ctv.minTextVersion +) +SELECT + id, + documentId, + bucket, + key, + hash, + cleanId, + extractionVersion +FROM RankedExtractions +WHERE row_num = 1; diff --git a/internal/database/migrations_archive/00000000000120_remove_text_extraction.up.sql b/internal/database/migrations_archive/00000000000120_remove_text_extraction.up.sql new file mode 100644 index 00000000..da1fa313 --- /dev/null +++ b/internal/database/migrations_archive/00000000000120_remove_text_extraction.up.sql @@ -0,0 +1,32 @@ +-- Migration to remove text extraction functionality from the database +-- This drops all text extraction related tables, views, and functions +-- NOTE: Field extractions are separate and NOT affected by this migration + +-- First drop the view that depends on text extraction tables +DROP VIEW IF EXISTS currentTextEntries; + +-- Drop fullActiveCollectors view that depends on currentCollectorMinTextVersions +DROP VIEW IF EXISTS fullActiveCollectors; + +-- Drop the currentCollectorMinTextVersions view +DROP VIEW IF EXISTS currentCollectorMinTextVersions; + +-- Drop the trigger and function for collectorMinTextVersions +DROP TRIGGER IF EXISTS removeMinTextVersionTrigger ON collectorMinTextVersions; +DROP FUNCTION IF EXISTS removeMinTextVersion; + +-- Drop the collectorMinTextVersions table +DROP TABLE IF EXISTS collectorMinTextVersions; + +-- Drop the text extraction tables (child first for FK constraints) +DROP TABLE IF EXISTS documentTextExtractionEntries; +DROP TABLE IF EXISTS documentTextExtractions; + +-- Recreate fullActiveCollectors view WITHOUT minTextVersion +CREATE VIEW fullActiveCollectors AS + SELECT DISTINCT av.clientId, + ccv.minCleanVersion, + av.activeVersion, lv.latestVersion + FROM collectorCurrentActiveVersions as av + JOIN collectorLatestVersions as lv on lv.clientId = av.clientId + JOIN currentCollectorMinCleanVersions AS ccv ON av.clientId = ccv.clientId; diff --git a/internal/database/migrations_collapsed/00000000000001_extensions.down.sql b/internal/database/migrations_collapsed/00000000000001_extensions.down.sql new file mode 100644 index 00000000..2f39878e --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000001_extensions.down.sql @@ -0,0 +1,7 @@ +-- Migration 001: Extensions and Core Functions (DOWN) +-- Drops in reverse order of creation + +DROP DOMAIN IF EXISTS unsignedsmallint; +DROP FUNCTION IF EXISTS isInVersion; +DROP FUNCTION IF EXISTS uuid_generate_v7; +DROP EXTENSION IF EXISTS "pgcrypto"; diff --git a/internal/database/migrations_collapsed/00000000000001_extensions.up.sql b/internal/database/migrations_collapsed/00000000000001_extensions.up.sql new file mode 100644 index 00000000..5a072aa3 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000001_extensions.up.sql @@ -0,0 +1,43 @@ +-- Migration 001: Extensions and Core Functions +-- Creates PostgreSQL extensions and utility functions used throughout the schema + +CREATE EXTENSION IF NOT EXISTS "pgcrypto"; + +-- UUID v7 generator function (time-ordered UUIDs) +CREATE OR REPLACE FUNCTION uuid_generate_v7() +RETURNS uuid +AS $$ +SELECT encode( + set_bit( + set_bit( + overlay(uuid_send(gen_random_uuid()) + placing substring(int8send(floor(extract(epoch from clock_timestamp()) * 1000)::bigint) from 3) + from 1 for 6 + ), + 52, 1 + ), + 53, 1 + ), + 'hex')::uuid; +$$ +LANGUAGE SQL +VOLATILE; + +-- Version checking function for temporal data patterns +CREATE FUNCTION isInVersion( + _version int, + _addedVersion int, + _removedVersion int +) +RETURNS boolean AS $$ +BEGIN + RETURN _version IS NULL OR ( + _version >= _addedVersion AND + (_removedVersion IS NULL OR _version < _removedVersion) + ); +END; +$$ LANGUAGE plpgsql; + +-- Domain for unsigned small integers +CREATE DOMAIN unsignedsmallint AS SMALLINT + CHECK (VALUE >= 0); diff --git a/internal/database/migrations_collapsed/00000000000002_clients.down.sql b/internal/database/migrations_collapsed/00000000000002_clients.down.sql new file mode 100644 index 00000000..fa6970a3 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000002_clients.down.sql @@ -0,0 +1,4 @@ +-- Migration 002: Clients (DOWN) + +DROP TABLE IF EXISTS clientCanSync; +DROP TABLE IF EXISTS clients; diff --git a/internal/database/migrations_collapsed/00000000000002_clients.up.sql b/internal/database/migrations_collapsed/00000000000002_clients.up.sql new file mode 100644 index 00000000..ca31f5b8 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000002_clients.up.sql @@ -0,0 +1,15 @@ +-- Migration 002: Clients +-- Core client tables for customer configuration + +CREATE TABLE clients ( + clientId varchar(255) PRIMARY KEY, + name TEXT NOT NULL, + UNIQUE (name) +); + +CREATE TABLE clientCanSync ( + syncId uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + clientId varchar(255) NOT NULL, + canSync boolean NOT NULL, + FOREIGN KEY (clientId) REFERENCES clients(clientId) +); diff --git a/internal/database/migrations_collapsed/00000000000003_collectors.down.sql b/internal/database/migrations_collapsed/00000000000003_collectors.down.sql new file mode 100644 index 00000000..ed04f2a9 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000003_collectors.down.sql @@ -0,0 +1,9 @@ +-- Migration 003: Collectors (DOWN) + +DROP TRIGGER IF EXISTS removeMinCleanVersionTrigger ON collectorMinCleanVersions; +DROP FUNCTION IF EXISTS removeMinCleanVersion; +DROP TABLE IF EXISTS collectorMinCleanVersions; +DROP TABLE IF EXISTS collectorActiveVersions; +DROP TRIGGER IF EXISTS setCollectorVersionNumberTrigger ON collectorVersions; +DROP FUNCTION IF EXISTS setCollectorVersionNumber; +DROP TABLE IF EXISTS collectorVersions; diff --git a/internal/database/migrations_collapsed/00000000000003_collectors.up.sql b/internal/database/migrations_collapsed/00000000000003_collectors.up.sql new file mode 100644 index 00000000..70afe051 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000003_collectors.up.sql @@ -0,0 +1,62 @@ +-- Migration 003: Collectors (Simplified) +-- Collector versioning and configuration +-- NOTE: collectorMinTextVersions and collectorQueries removed (no longer used) + +CREATE TABLE collectorVersions ( + clientId varchar(255) NOT NULL, + id int NOT NULL, + addedAt timestamp NOT NULL DEFAULT current_timestamp, + FOREIGN KEY (clientId) REFERENCES clients(clientId), + PRIMARY KEY (id, clientId) +); + +CREATE OR REPLACE FUNCTION setCollectorVersionNumber() +RETURNS TRIGGER AS $$ +BEGIN + SELECT COALESCE(MAX(id), 0) + 1 + INTO NEW.id + FROM collectorVersions + WHERE clientId = NEW.clientId; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER setCollectorVersionNumberTrigger +BEFORE INSERT ON collectorVersions +FOR EACH ROW +EXECUTE FUNCTION setCollectorVersionNumber(); + +CREATE TABLE collectorActiveVersions ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + clientId varchar(255) NOT NULL, + versionId int NOT NULL, + FOREIGN KEY (clientId, versionId) REFERENCES collectorVersions(clientId, id) +); + +CREATE TABLE collectorMinCleanVersions ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + clientId varchar(255) NOT NULL, + versionId bigint NOT NULL, + addedVersion int NOT NULL, + removedVersion int, + FOREIGN KEY (clientId, addedVersion) REFERENCES collectorVersions(clientId, id), + FOREIGN KEY (clientId, removedVersion) REFERENCES collectorVersions(clientId, id), + FOREIGN KEY (clientId) REFERENCES clients(clientId) +); + +CREATE OR REPLACE FUNCTION removeMinCleanVersion() +RETURNS TRIGGER AS $$ +BEGIN + UPDATE collectorMinCleanVersions + SET removedVersion = NEW.addedVersion + WHERE clientId = NEW.clientId AND removedVersion IS NULL; + + RETURN NEW; +END; +$$ LANGUAGE plpgsql; + +CREATE TRIGGER removeMinCleanVersionTrigger +BEFORE INSERT ON collectorMinCleanVersions +FOR EACH ROW +EXECUTE FUNCTION removeMinCleanVersion(); diff --git a/internal/database/migrations_collapsed/00000000000004_batch_uploads.down.sql b/internal/database/migrations_collapsed/00000000000004_batch_uploads.down.sql new file mode 100644 index 00000000..e5ce8815 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000004_batch_uploads.down.sql @@ -0,0 +1,6 @@ +-- Migration 004: Batch Uploads (DOWN) + +DROP INDEX IF EXISTS idx_batch_uploads_status; +DROP INDEX IF EXISTS idx_batch_uploads_client_id; +DROP TABLE IF EXISTS batch_uploads; +DROP TYPE IF EXISTS batch_status; diff --git a/internal/database/migrations_collapsed/00000000000004_batch_uploads.up.sql b/internal/database/migrations_collapsed/00000000000004_batch_uploads.up.sql new file mode 100644 index 00000000..f8ecd6ca --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000004_batch_uploads.up.sql @@ -0,0 +1,52 @@ +-- Migration 004: Batch Uploads +-- Batch upload tracking for ZIP file uploads +-- Merges original migrations 103 + 104 + +-- Create batch status ENUM type +CREATE TYPE batch_status AS ENUM ( + 'processing', -- Currently processing + 'completed', -- All documents processed (may have individual failures) + 'failed', -- Batch-level failure (ZIP corrupt, etc.) + 'cancelled' -- Cancelled by user +); + +-- Create batch uploads table with all columns +CREATE TABLE batch_uploads ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + client_id varchar(255) NOT NULL, + original_filename text NOT NULL, + + -- Essential batch metrics + total_documents integer NOT NULL, + processed_documents integer NOT NULL DEFAULT 0, + failed_documents integer NOT NULL DEFAULT 0, + invalid_type_documents integer NOT NULL DEFAULT 0, + + -- Status and progress + status batch_status NOT NULL DEFAULT 'processing', + progress_percent integer NOT NULL DEFAULT 0, + + -- Failed document filenames (JSON array) + failed_filenames jsonb DEFAULT '[]'::jsonb, + + -- Timestamps + created_at timestamp NOT NULL DEFAULT NOW(), + completed_at timestamp, + + -- Storage metadata (from migration 104) + archive_bucket text, + archive_key text, + file_size_bytes bigint, + + FOREIGN KEY (client_id) REFERENCES clients(clientId), + + -- Constraint: storage metadata consistency + CONSTRAINT batch_storage_consistent CHECK ( + (archive_bucket IS NULL AND archive_key IS NULL AND file_size_bytes IS NULL) OR + (archive_bucket IS NOT NULL AND archive_key IS NOT NULL) + ) +); + +-- Create indexes for efficient queries +CREATE INDEX idx_batch_uploads_client_id ON batch_uploads(client_id); +CREATE INDEX idx_batch_uploads_status ON batch_uploads(status); diff --git a/internal/database/migrations_collapsed/00000000000005_folders.down.sql b/internal/database/migrations_collapsed/00000000000005_folders.down.sql new file mode 100644 index 00000000..692ca138 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000005_folders.down.sql @@ -0,0 +1,6 @@ +-- Migration 005: Folders (DOWN) + +DROP INDEX IF EXISTS idx_folders_path; +DROP INDEX IF EXISTS idx_folders_clientid; +DROP INDEX IF EXISTS idx_folders_parentid; +DROP TABLE IF EXISTS folders; diff --git a/internal/database/migrations_collapsed/00000000000005_folders.up.sql b/internal/database/migrations_collapsed/00000000000005_folders.up.sql new file mode 100644 index 00000000..98b092d0 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000005_folders.up.sql @@ -0,0 +1,26 @@ +-- Migration 005: Folders +-- Virtual folder hierarchy for document organization + +CREATE TABLE folders ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + path text NOT NULL, + parentId uuid, + clientId varchar(255) NOT NULL, + createdAt timestamp NOT NULL DEFAULT NOW(), + createdBy varchar(255) NOT NULL, + FOREIGN KEY (parentId) REFERENCES folders(id), + FOREIGN KEY (clientId) REFERENCES clients(clientId), + UNIQUE(clientId, path), + CHECK (id != parentId) +); + +-- Indexes for efficient folder queries +CREATE INDEX idx_folders_parentid ON folders(parentId); +CREATE INDEX idx_folders_clientid ON folders(clientId); +CREATE INDEX idx_folders_path ON folders(path); + +-- Add comment to clarify that folders are virtual (database-only, no S3 relationship) +COMMENT ON TABLE folders IS + 'Virtual folder hierarchy for document organization. Database-only - has no direct relationship to S3 storage locations.'; +COMMENT ON COLUMN folders.path IS + 'Virtual folder path (e.g., "/contracts/2025"). Can be renamed without affecting S3 storage.'; diff --git a/internal/database/migrations_collapsed/00000000000006_documents.down.sql b/internal/database/migrations_collapsed/00000000000006_documents.down.sql new file mode 100644 index 00000000..a75f3001 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000006_documents.down.sql @@ -0,0 +1,31 @@ +-- Migration 006: Documents (DOWN) + +-- Drop document clean entries first (depends on documentCleans) +DROP TABLE IF EXISTS documentCleanEntries; + +-- Drop document cleans +DROP TABLE IF EXISTS documentCleans; + +-- Drop document entries +DROP TABLE IF EXISTS documentEntries; + +-- Drop documentUploads indexes +DROP INDEX IF EXISTS idx_documentuploads_folder_id; +DROP INDEX IF EXISTS idx_documentuploads_clientid; +DROP INDEX IF EXISTS idx_documentuploads_batch_id; +DROP INDEX IF EXISTS idx_documentuploads_filename; + +-- Drop documentUploads table +DROP TABLE IF EXISTS documentUploads; + +-- Drop documents indexes +DROP INDEX IF EXISTS idx_documents_folderid; +DROP INDEX IF EXISTS idx_documents_filename; +DROP INDEX IF EXISTS idx_documents_batch_id; + +-- Drop documents table +DROP TABLE IF EXISTS documents; + +-- Drop enums +DROP TYPE IF EXISTS cleanMimeType; +DROP TYPE IF EXISTS cleanFailType; diff --git a/internal/database/migrations_collapsed/00000000000006_documents.up.sql b/internal/database/migrations_collapsed/00000000000006_documents.up.sql new file mode 100644 index 00000000..7dbafb12 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000006_documents.up.sql @@ -0,0 +1,125 @@ +-- Migration 006: Documents (Consolidated) +-- Document storage and processing tables +-- Merges: 005_documents + 103 + 105 + 106 + 107 + 108 + 111 + 116 + 118 +-- NOTE: documentTextExtractions and documentTextExtractionEntries removed (no longer used) + +-- Enum for document clean failure types +CREATE TYPE cleanFailType AS ENUM ( + 'invalid_mimetype', + 'invalid_read', + 'invalid_read_pages', + 'zero_page_count', + 'large_file', + 'small_dimensions', + 'large_dimensions', + 'small_dpi', + 'large_dpi' +); + +-- Enum for clean document mime types +CREATE TYPE cleanMimeType AS ENUM ('application/pdf'); + +-- Main documents table with all columns +CREATE TABLE documents ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + clientId varchar(255) NOT NULL, + hash text NOT NULL, + + -- Batch reference (from migration 103) + batch_id uuid, + + -- Filename (from migration 105) + filename TEXT, + + -- Folder organization (from migration 111) + folderId uuid, + originalPath text, + + -- File size (from migration 118) + file_size_bytes BIGINT, + + FOREIGN KEY (clientId) REFERENCES clients(clientId), + FOREIGN KEY (batch_id) REFERENCES batch_uploads(id), + FOREIGN KEY (folderId) REFERENCES folders(id), + UNIQUE(clientId, hash) +); + +-- Indexes for documents table +CREATE INDEX idx_documents_batch_id ON documents(batch_id); +CREATE INDEX idx_documents_filename ON documents(filename); +CREATE INDEX idx_documents_folderid ON documents(folderId); + +-- Comments for immutable fields (from migration 111) +COMMENT ON COLUMN documents.originalPath IS + 'Original path provided during upload. IMMUTABLE after creation - never modify this value.'; + +-- Document uploads table (staging area for incoming documents) +CREATE TABLE documentUploads ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + bucket text NOT NULL, + key text NOT NULL, + clientId varchar(255) NOT NULL, + part unsignedsmallint NOT NULL, + createdAt timestamp NOT NULL, + + -- Filename (from migration 106) + filename TEXT, + + -- Batch reference (from migration 107) + batch_id uuid, + + -- Folder reference (from migration 116) + folder_id uuid, + + FOREIGN KEY (clientId) REFERENCES clients(clientId), + FOREIGN KEY (folder_id) REFERENCES folders(id) +); + +-- Indexes for documentUploads +CREATE INDEX idx_documentuploads_filename ON documentUploads(filename); +CREATE INDEX idx_documentuploads_batch_id ON documentUploads(batch_id); +CREATE INDEX idx_documentuploads_clientid ON documentUploads(clientId); +CREATE INDEX idx_documentuploads_folder_id ON documentUploads(folder_id); + +-- Document entries (S3 storage records) +CREATE TABLE documentEntries ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + documentId uuid NOT NULL, + bucket text NOT NULL, + key text NOT NULL, + FOREIGN KEY (documentId) REFERENCES documents(id) +); + +-- Comments for immutable fields (from migration 111) +COMMENT ON COLUMN documentEntries.key IS + 'S3 object key. IMMUTABLE after creation - never modify this value.'; +COMMENT ON COLUMN documentEntries.bucket IS + 'S3 bucket name. IMMUTABLE after creation - never modify this value.'; + +-- Document cleans (processed/cleaned documents) +CREATE TABLE documentCleans ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + documentId uuid NOT NULL, + bucket text, + key text, + hash text, + mimetype cleanMimeType, + fail cleanFailType, + FOREIGN KEY (documentId) REFERENCES documents(id), + CONSTRAINT bucket_and_key_together CHECK ( + (bucket IS NULL) = (key IS NULL) AND + (bucket IS NULL) = (mimetype IS NULL) AND + (bucket IS NULL) = (hash IS NULL) + ), + CONSTRAINT location_xor_fail CHECK ( + (bucket IS NOT NULL) != (fail IS NOT NULL) + ) +); + +-- Document clean entries (version tracking for cleans) +CREATE TABLE documentCleanEntries ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + cleanId uuid NOT NULL, + version bigint NOT NULL, + FOREIGN KEY (cleanId) REFERENCES documentCleans(id) +); diff --git a/internal/database/migrations_collapsed/00000000000007_labels.down.sql b/internal/database/migrations_collapsed/00000000000007_labels.down.sql new file mode 100644 index 00000000..4ac89d9c --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000007_labels.down.sql @@ -0,0 +1,8 @@ +-- Migration 007: Labels (DOWN) + +DROP INDEX IF EXISTS idx_documentlabels_document_label_time; +DROP INDEX IF EXISTS idx_documentlabels_appliedat; +DROP INDEX IF EXISTS idx_documentlabels_label; +DROP INDEX IF EXISTS idx_documentlabels_documentid; +DROP TABLE IF EXISTS documentLabels; +DROP TABLE IF EXISTS labels; diff --git a/internal/database/migrations_collapsed/00000000000007_labels.up.sql b/internal/database/migrations_collapsed/00000000000007_labels.up.sql new file mode 100644 index 00000000..c80e3e4e --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000007_labels.up.sql @@ -0,0 +1,34 @@ +-- Migration 007: Labels +-- Document labeling system for tracking processing status + +-- Create labels lookup table +CREATE TABLE labels ( + label text PRIMARY KEY, + description text NOT NULL +); + +-- Seed initial label values +INSERT INTO labels (label, description) VALUES + ('Ingested', 'Document has been ingested into the system'), + ('OCR_Processed', 'OCR text extraction completed'), + ('GenAI_Processed', 'GenAI processing completed'), + ('Doczy_AI_Completed', 'Doczy.AI processing completed'), + ('Dashboard_Ready', 'Document ready for dashboard display'); + +-- Create documentLabels junction table +CREATE TABLE documentLabels ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + documentId uuid NOT NULL, + label text NOT NULL, + appliedAt timestamp NOT NULL DEFAULT NOW(), + appliedBy varchar(255) NOT NULL, + FOREIGN KEY (documentId) REFERENCES documents(id) ON DELETE CASCADE, + FOREIGN KEY (label) REFERENCES labels(label) +); + +-- Indexes for efficient label queries +CREATE INDEX idx_documentlabels_documentid ON documentLabels(documentId); +CREATE INDEX idx_documentlabels_label ON documentLabels(label); +CREATE INDEX idx_documentlabels_appliedat ON documentLabels(appliedAt); +-- Composite index for finding most recent label application +CREATE INDEX idx_documentlabels_document_label_time ON documentLabels(documentId, label, appliedAt DESC); diff --git a/internal/database/migrations_collapsed/00000000000008_field_extractions.down.sql b/internal/database/migrations_collapsed/00000000000008_field_extractions.down.sql new file mode 100644 index 00000000..d48c95da --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000008_field_extractions.down.sql @@ -0,0 +1,19 @@ +-- Migration 008: Field Extractions (DOWN) + +-- Drop array fields table and indexes +DROP INDEX IF EXISTS idx_documentfieldextractionarrayfields_id_index; +DROP INDEX IF EXISTS idx_documentfieldextractionarrayfields_fieldextractionid; +DROP TABLE IF EXISTS documentFieldExtractionArrayFields; + +-- Drop versions table and indexes +DROP INDEX IF EXISTS idx_unique_version_per_document; +DROP INDEX IF EXISTS idx_documentfieldextractionversions_documentid; +DROP INDEX IF EXISTS idx_documentfieldextractionversions_version; +DROP INDEX IF EXISTS idx_documentfieldextractionversions_fieldextractionid; +DROP TABLE IF EXISTS documentFieldExtractionVersions; + +-- Drop main field extractions table and indexes +DROP INDEX IF EXISTS idx_documentfieldextractions_filename; +DROP INDEX IF EXISTS idx_documentfieldextractions_createdby; +DROP INDEX IF EXISTS idx_documentfieldextractions_documentid; +DROP TABLE IF EXISTS documentFieldExtractions; diff --git a/internal/database/migrations_collapsed/00000000000008_field_extractions.up.sql b/internal/database/migrations_collapsed/00000000000008_field_extractions.up.sql new file mode 100644 index 00000000..0bf6eed8 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000008_field_extractions.up.sql @@ -0,0 +1,254 @@ +-- Migration 008: Field Extractions (Consolidated) +-- Document field extraction storage for GenAI-extracted data +-- Merges: 112 + 113 + 114 + 117 + +-- Create documentFieldExtractions table for single-value fields +CREATE TABLE documentFieldExtractions ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + documentId uuid NOT NULL, + + -- Single-value fields (19 fields total - 1:1 relationship) + -- Document identification + fileName text, + contractTitle text, + aareteDerivedAmendmentNum int, + + -- Party information + clientName text, + payerName text, + payerState text, + providerState text, + + -- Tax identification numbers (stored as text to preserve leading zeros) + filenameTin text, + provGroupTin text, + provGroupNpi text, + provGroupNameFull text, + provOtherTin text, + provOtherNpi text, + provOtherNameFull text, + + -- Contract dates + aareteDerivedEffectiveDt date, + aareteDerivedTerminationDt date, + + -- Renewal information + autoRenewalInd boolean, + autoRenewalTerm text, + + -- Metadata + createdAt timestamp NOT NULL DEFAULT NOW(), + createdBy varchar(255) NOT NULL, + + FOREIGN KEY (documentId) REFERENCES documents(id) +); + +-- Indexes for efficient queries +CREATE INDEX idx_documentfieldextractions_documentid + ON documentFieldExtractions(documentId); +CREATE INDEX idx_documentfieldextractions_createdby + ON documentFieldExtractions(createdBy); +CREATE INDEX idx_documentfieldextractions_filename + ON documentFieldExtractions(fileName); + +-- Create documentFieldExtractionVersions table for version tracking +-- Includes documentId column from migration 117 for unique constraint +CREATE TABLE documentFieldExtractionVersions ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + fieldExtractionId uuid NOT NULL, + version bigint NOT NULL, + createdBy varchar(255) NOT NULL, + createdAt timestamp NOT NULL DEFAULT NOW(), + + -- documentId for unique version constraint (from migration 117) + documentId uuid NOT NULL, + + FOREIGN KEY (fieldExtractionId) REFERENCES documentFieldExtractions(id), + FOREIGN KEY (documentId) REFERENCES documents(id) +); + +-- Indexes for version queries +CREATE INDEX idx_documentfieldextractionversions_fieldextractionid + ON documentFieldExtractionVersions(fieldExtractionId); +CREATE INDEX idx_documentfieldextractionversions_version + ON documentFieldExtractionVersions(version); +CREATE INDEX idx_documentfieldextractionversions_documentid + ON documentFieldExtractionVersions(documentId); + +-- Unique constraint to prevent duplicate versions per document (from migration 117) +CREATE UNIQUE INDEX idx_unique_version_per_document + ON documentFieldExtractionVersions(documentId, version); + +-- Create documentFieldExtractionArrayFields table for 1:N array fields +CREATE TABLE documentFieldExtractionArrayFields ( + id uuid PRIMARY KEY DEFAULT uuid_generate_v7(), + fieldExtractionId uuid NOT NULL, + arrayIndex smallint NOT NULL, + + -- Array-value fields (112 fields total - 1:N relationship) + -- All fields at same arrayIndex form one "row" of the array + + -- Exhibit information + exhibitTitle text, + exhibitPage text, + + -- Reimbursement provider information + reimbProvTin text, + reimbProvNpi text, + reimbProvName text, + reimbEffectiveDt date, + reimbTerminationDt date, + + -- Claim and product codes + aareteDerivedClaimTypeCd text, + aareteDerivedProduct text, + aareteDerivedLob text, + aareteDerivedProgram text, + aareteDerivedNetwork text, + aareteDerivedProvType text, + + -- Provider taxonomy and specialty + provTaxonomyCd text, + provTaxonomyCdDesc text, + provSpecialtyCd text, + provSpecialtyCdDesc text, + + -- Service location + placeOfServiceCd text, + placeOfServiceCdDesc text, + billTypeCd text, + billTypeCdDesc text, + + -- Patient demographics + patientAgeMin text, + patientAgeMax text, + + -- Reimbursement terms + reimbTerm text, + lobProgramRelationship text, + lobProductRelationship text, + + -- Carveout and payment logic + carveoutInd boolean, + carveoutCd text, + lesserOfInd boolean, + greaterOfInd boolean, + aareteDerivedReimbMethod text, + unitOfMeasure text, + + -- Reimbursement rates + reimbPctRate numeric(10,4), + reimbFeeRate numeric(12,2), + reimbConversionFactor numeric(12,4), + triggerCapThresholdAmt numeric(12,2), + triggerBaseThreshold numeric(12,2), + + -- Default and addition + defaultInd boolean, + additionDesc text, + additionMaxFeeRateInc numeric(12,2), + additionMaxPctRateInc numeric(10,4), + aareteDerivedAdditionRateChangeTimeline text, + + -- Fee schedule + aareteDerivedFeeSchedule text, + aareteDerivedFeeScheduleVersion text, + + -- Service codes + serviceTerm text, + cpt4ProcCd text, + cpt4ProcCdDesc text, + cpt4ProcMod text, + cpt4ProcModDesc text, + revenueCd text, + revenueCdDesc text, + diagCd text, + diagCdDesc text, + ndcCd text, + ndcCdDesc text, + + -- Claim admit and status + claimAdmitTypeCd text, + authAdmitTypeDesc text, + claimStatusCd text, + claimStatusCdDesc text, + + -- Grouper information + grouperType text, + grouperCd text, + grouperCdDesc text, + grouperPctRate numeric(10,4), + grouperBaseRate numeric(12,2), + aareteDerivedGrouperVersion text, + grouperAlternativeLevelOfCare text, + grouperSeverityInd boolean, + grouperSeverity text, + grouperRiskOfMortalitySubclass text, + grouperTransferInd boolean, + grouperReadmissionsInd boolean, + grouperHacInd boolean, + + -- Outlier terms + outlierTerm text, + outlierFirstDollarInd boolean, + rangeNbrDays text, + outlierFixedLossNbrDaysThreshold numeric(10,2), + outlierFixedLossThreshold numeric(12,2), + outlierMaximum numeric(12,2), + outlierMaximumFrequency numeric(10,2), + outlierPctRate numeric(10,4), + outlierExclusionCd text, + outlierExclusionCdDesc text, + + -- Facility adjustments + facilityAdjustmentTerm text, + dshInd boolean, + dshPctRate numeric(10,4), + dshFeeRate numeric(12,2), + imeInd boolean, + imePctRate numeric(10,4), + imeFeeRate numeric(12,2), + ntapInd boolean, + ntapPctRate numeric(10,4), + ntapFeeRate numeric(12,2), + ucInd boolean, + ucPctRate numeric(10,4), + ucFeeRate numeric(12,2), + gmeInd boolean, + gmePctRate numeric(10,4), + gmeFeeRate numeric(12,2), + + -- Rate escalator + rateEscalatorInd boolean, + rateEscalatorDesc text, + rateEscalatorMaxRateIncPct numeric(10,4), + rateEscalatorRateChangeTimeline numeric(10,2), + + -- Stop loss + stopLossTerm text, + stopLossFirstDollarInd boolean, + stopLossRangeNbrDays numeric(10,2), + stopLossFixedLossThreshold numeric(12,2), + stopLossMaximum numeric(12,2), + stopLossMaximumFrequency numeric(10,2), + stopLossDailyMaxRate numeric(12,2), + stopLossPctRateOnExcessCharges numeric(10,4), + stopLossExclusionCd text, + stopLossExclusionDesc text, + + FOREIGN KEY (fieldExtractionId) REFERENCES documentFieldExtractions(id), + + -- Ensure unique index per extraction + UNIQUE (fieldExtractionId, arrayIndex), + + -- Ensure arrayIndex is non-negative + CHECK (arrayIndex >= 0) +); + +-- Indexes for efficient array field queries +CREATE INDEX idx_documentfieldextractionarrayfields_fieldextractionid + ON documentFieldExtractionArrayFields(fieldExtractionId); + +-- Composite index for efficient ordered retrieval +CREATE INDEX idx_documentfieldextractionarrayfields_id_index + ON documentFieldExtractionArrayFields(fieldExtractionId, arrayIndex); diff --git a/internal/database/migrations_collapsed/00000000000010_collector_views.down.sql b/internal/database/migrations_collapsed/00000000000010_collector_views.down.sql new file mode 100644 index 00000000..3d47b9f8 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000010_collector_views.down.sql @@ -0,0 +1,6 @@ +-- Migration 010: Collector Views (DOWN) + +DROP VIEW IF EXISTS fullActiveCollectors; +DROP VIEW IF EXISTS currentCollectorMinCleanVersions; +DROP VIEW IF EXISTS collectorLatestVersions; +DROP VIEW IF EXISTS collectorCurrentActiveVersions; diff --git a/internal/database/migrations_collapsed/00000000000010_collector_views.up.sql b/internal/database/migrations_collapsed/00000000000010_collector_views.up.sql new file mode 100644 index 00000000..58c2a6db --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000010_collector_views.up.sql @@ -0,0 +1,43 @@ +-- Migration 010: Collector Views (Simplified) +-- Views for collector configuration +-- NOTE: Query-related views and text version views removed (no longer used) + +CREATE VIEW collectorCurrentActiveVersions AS +SELECT + c.clientId, + COALESCE(v.versionId, 0)::int AS activeVersion +FROM + clients c +LEFT JOIN ( + SELECT DISTINCT ON (clientId) + clientId, + versionId + FROM + collectorActiveVersions + ORDER BY clientId, id DESC +) v ON c.clientId = v.clientId; + +CREATE VIEW collectorLatestVersions AS + SELECT + j.clientId, + COALESCE(MAX(v.id), 0)::int AS latestVersion + FROM clients AS j + LEFT JOIN collectorVersions AS v ON v.clientId = j.clientId + GROUP BY j.clientId; + +CREATE VIEW currentCollectorMinCleanVersions AS +SELECT DISTINCT + av.clientId, + COALESCE(ctv.versionId, 0) AS minCleanVersion + FROM collectorCurrentActiveVersions AS av + LEFT JOIN collectorMinCleanVersions AS ctv ON av.clientId = ctv.clientId + AND isInVersion(av.activeVersion, ctv.addedVersion, ctv.removedVersion); + +-- Final fullActiveCollectors view (simplified without minTextVersion or fields) +CREATE VIEW fullActiveCollectors AS + SELECT DISTINCT av.clientId, + ccv.minCleanVersion, + av.activeVersion, lv.latestVersion + FROM collectorCurrentActiveVersions AS av + JOIN collectorLatestVersions AS lv ON lv.clientId = av.clientId + JOIN currentCollectorMinCleanVersions AS ccv ON av.clientId = ccv.clientId; diff --git a/internal/database/migrations_collapsed/00000000000011_document_views.down.sql b/internal/database/migrations_collapsed/00000000000011_document_views.down.sql new file mode 100644 index 00000000..c08aec93 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000011_document_views.down.sql @@ -0,0 +1,7 @@ +-- Migration 011: Document Views (DOWN) + +DROP FUNCTION IF EXISTS listValidDocumentResults; +DROP VIEW IF EXISTS fullClients; +DROP VIEW IF EXISTS currentClientCanSync; +DROP VIEW IF EXISTS currentCleanEntries; +DROP FUNCTION IF EXISTS listDocumentIDs; diff --git a/internal/database/migrations_collapsed/00000000000011_document_views.up.sql b/internal/database/migrations_collapsed/00000000000011_document_views.up.sql new file mode 100644 index 00000000..905f3175 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000011_document_views.up.sql @@ -0,0 +1,190 @@ +-- Migration 011: Document Views (Simplified) +-- Views and functions for document queries +-- NOTE: currentTextEntries and listValidDocumentResults removed (no longer used) + +CREATE OR REPLACE FUNCTION listDocumentIDs( + _clientId varchar(255), + _batchSize INTEGER, + _offset INTEGER +) +RETURNS TABLE (id uuid, totalCount BIGINT) AS $$ +DECLARE + totalCount BIGINT := 0; +BEGIN + SELECT COUNT(*)::BIGINT INTO totalCount FROM documents WHERE clientId = _clientId; + + RETURN QUERY + SELECT d.id, totalCount + FROM documents AS d + WHERE d.clientId = _clientId + ORDER BY d.id + LIMIT _batchSize + OFFSET _offset; +END; +$$ LANGUAGE plpgsql; + +CREATE VIEW currentCleanEntries AS +WITH RankedExtractions AS ( + SELECT + dc.id, + dc.documentId, + dc.bucket, + dc.key, + dc.mimetype, + dc.fail, + dc.hash, + dce.version, + d.clientId, + ROW_NUMBER() OVER (PARTITION BY dc.documentId ORDER BY dc.id DESC, dce.id DESC) AS row_num + FROM documents d + JOIN currentCollectorMinCleanVersions ccv ON d.clientId = ccv.clientId + JOIN documentCleans dc ON dc.documentId = d.id + JOIN documentCleanEntries dce ON dc.id = dce.cleanId + AND dce.version >= ccv.minCleanVersion +) +SELECT + re.id, + re.documentId, + re.bucket, + re.key, + re.version, + re.hash, + re.mimetype, + re.fail, + re.clientId +FROM RankedExtractions re +WHERE row_num = 1; + +CREATE VIEW currentClientCanSync AS +WITH RankedExtractions AS ( + SELECT + ccs.clientId, + ccs.canSync, + ROW_NUMBER() OVER (PARTITION BY ccs.clientId ORDER BY ccs.syncId DESC) AS row_num + FROM clients c + JOIN clientCanSync ccs ON c.clientId = ccs.clientId +) +SELECT + c.clientId, + COALESCE(r.canSync, false) AS canSync +FROM clients c +LEFT JOIN RankedExtractions r ON r.clientId = c.clientId AND r.row_num = 1; + +CREATE VIEW fullClients AS +SELECT c.clientId, c.name, cs.canSync + FROM clients AS c + JOIN currentClientCanSync AS cs ON cs.clientId = c.clientId; + +-- NOTE: This function exists for schema compatibility with original migrations. +-- It references tables/functions that no longer exist (results, resultDependencies, +-- collectorQueryDependencyTreeByClient, currentTextEntries) and will fail if called. +-- It was created in original migration 102 but never explicitly dropped. +CREATE OR REPLACE FUNCTION listValidDocumentResults(doc_id uuid) +RETURNS TABLE (documentId uuid, queryId uuid, resultId uuid, value text) AS $$ +DECLARE + count_before INT; + count_after INT; + iterations INT := 0; +BEGIN + CREATE TEMPORARY TABLE allResults AS + WITH + docs AS ( + SELECT id as documentId, clientId + FROM documents + WHERE id = doc_id + ), + tree as ( + select q.queryId, q.requiredIds, q.clientId, q.queryVersion + from docs, + LATERAL collectorQueryDependencyTreeByClient(docs.clientId) AS q + ), + query_dependency_tree AS ( + WITH RECURSIVE query_deps AS ( + SELECT + q.queryId, + unnest(q.requiredIds) as requiredId + FROM tree AS q + WHERE array_length(q.requiredIds, 1) > 0 + + UNION ALL + + SELECT + qd.queryId, + unnest(q.requiredIds) as requiredId + FROM query_deps qd + JOIN tree q ON qd.requiredId = q.queryId + WHERE array_length(q.requiredIds, 1) > 0 + ) + SELECT + query_deps.queryId, + array_agg(DISTINCT requiredId) AS all_required_ids + FROM query_deps + GROUP BY query_deps.queryId + ), + docResults AS ( + SELECT + d.documentId, + q.queryId, + r.id AS resultId, + r.value, + q.requiredIds as directRequiredIds, + COALESCE(qdt.all_required_ids, ARRAY[]::uuid[]) AS allRequiredIds + FROM docs AS d + JOIN tree AS q ON q.clientId = d.clientId + LEFT JOIN query_dependency_tree qdt ON q.queryId = qdt.queryId + LEFT JOIN currentTextEntries AS tte ON tte.documentId = d.documentId + LEFT JOIN results AS r + ON q.queryId = r.queryId + AND r.queryVersion = q.queryVersion + AND tte.id = r.textEntryId + WHERE r.value is not null + ) + SELECT * FROM docResults dr; + + CREATE TEMPORARY TABLE finalResults AS + SELECT * from allResults where array_length(directRequiredIds, 1) is null; + + SELECT COUNT(*) INTO count_before FROM finalResults; + RAISE NOTICE 'Starting with % rows', count_before; + + LOOP + iterations := iterations + 1; + + INSERT INTO finalResults + SELECT dr.* + FROM allResults dr + WHERE + dr.directRequiredIds IS NOT NULL + AND NOT EXISTS ( + SELECT 1 + FROM unnest(dr.directRequiredIds) AS req_id(queryId) + WHERE NOT EXISTS ( + SELECT 1 + FROM allResults req_dr + WHERE req_dr.queryId = req_id.queryId + AND req_dr.resultId IN (SELECT fr.resultId FROM finalResults fr) + AND exists ( + select 1 from resultDependencies rrd + where dr.resultId = rrd.resultId + and req_dr.resultId = rrd.requiredResultId + ) + ) + ) + and dr.resultId NOT IN (SELECT fr.resultId FROM finalResults fr); + + GET DIAGNOSTICS count_after = ROW_COUNT; + RAISE NOTICE 'Iteration %: Additional Entries %', + iterations, count_after; + + IF count_after = 0 THEN + EXIT; + END IF; + END LOOP; + + RETURN QUERY SELECT tr.documentId, tr.queryId, tr.resultId, tr.value + FROM finalResults tr; + + DROP TABLE finalResults; + DROP TABLE allResults; +END; +$$ LANGUAGE plpgsql; diff --git a/internal/database/migrations_collapsed/00000000000012_field_extraction_views.down.sql b/internal/database/migrations_collapsed/00000000000012_field_extraction_views.down.sql new file mode 100644 index 00000000..70d0eabc --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000012_field_extraction_views.down.sql @@ -0,0 +1,4 @@ +-- Migration 012: Field Extraction Views (DOWN) + +DROP VIEW IF EXISTS currentFieldExtractionsWithArrayCount; +DROP VIEW IF EXISTS currentFieldExtractions; diff --git a/internal/database/migrations_collapsed/00000000000012_field_extraction_views.up.sql b/internal/database/migrations_collapsed/00000000000012_field_extraction_views.up.sql new file mode 100644 index 00000000..4e86d161 --- /dev/null +++ b/internal/database/migrations_collapsed/00000000000012_field_extraction_views.up.sql @@ -0,0 +1,47 @@ +-- Migration 012: Field Extraction Views +-- Views for querying current field extractions + +-- Create view for current (newest) field extraction per document +CREATE VIEW currentFieldExtractions AS +SELECT DISTINCT ON (dfe.documentId) + dfe.id, + dfe.documentId, + dfe.fileName, + dfe.contractTitle, + dfe.aareteDerivedAmendmentNum, + dfe.clientName, + dfe.payerName, + dfe.payerState, + dfe.providerState, + dfe.filenameTin, + dfe.provGroupTin, + dfe.provGroupNpi, + dfe.provGroupNameFull, + dfe.provOtherTin, + dfe.provOtherNpi, + dfe.provOtherNameFull, + dfe.aareteDerivedEffectiveDt, + dfe.aareteDerivedTerminationDt, + dfe.autoRenewalInd, + dfe.autoRenewalTerm, + dfev.version, + dfev.createdBy, + dfev.createdAt +FROM documentFieldExtractions dfe +JOIN documentFieldExtractionVersions dfev + ON dfev.fieldExtractionId = dfe.id +ORDER BY dfe.documentId, dfev.id DESC; + +-- Create extended view with array field count +CREATE VIEW currentFieldExtractionsWithArrayCount AS +SELECT + cfe.*, + COALESCE(array_counts.arraySize, 0) AS arraySize +FROM currentFieldExtractions cfe +LEFT JOIN ( + SELECT + fieldExtractionId, + COUNT(*) AS arraySize + FROM documentFieldExtractionArrayFields + GROUP BY fieldExtractionId +) array_counts ON array_counts.fieldExtractionId = cfe.id; diff --git a/internal/database/queries/client.sql b/internal/database/queries/client.sql index 75f0c39b..b750671c 100644 --- a/internal/database/queries/client.sql +++ b/internal/database/queries/client.sql @@ -15,9 +15,9 @@ UPDATE clients SET name = $1 WHERE clientId = $2; INSERT INTO clientCanSync (canSync, clientId) VALUES ($1, $2); -- name: IsClientSynced :one --- Query functionality has been removed. A client is considered synced when --- all documents have completed text extraction (or failed with explicit failure). --- See remove_query_plan.md for details. +-- Text extraction has been removed. A client is considered synced when +-- all documents have completed cleaning (clean entry exists OR clean failed). +-- See remove_texttract_and_mocks_plan.md for details. WITH docs AS ( -- Get all documents for this client @@ -33,18 +33,6 @@ doc_clean_entries as ( FROM docs d LEFT JOIN currentCleanEntries cte ON cte.documentId = d.id -), -doc_text_entries AS ( - -- Documents with their current text entries - SELECT - d.document_id, - cte.id AS text_entry_id, - d.clean_entry_id, - d.clean_fail, - d.client_id - FROM - doc_clean_entries d - LEFT JOIN currentTextEntries cte ON cte.cleanId = d.clean_entry_id ) SELECT ( -- No documents means client is synced @@ -52,11 +40,9 @@ SELECT ( OR - -- All documents have completed processing (clean entry exists and either - -- text entry exists or clean failed) + -- All documents have completed processing (clean entry exists OR clean failed) NOT EXISTS ( - SELECT 1 FROM doc_text_entries - where clean_entry_id is null or - (clean_fail is null and text_entry_id is null) + SELECT 1 FROM doc_clean_entries + WHERE clean_entry_id IS NULL ) )::bool as is_synced; diff --git a/internal/database/queries/collector.sql b/internal/database/queries/collector.sql index eeae2028..914e78df 100644 --- a/internal/database/queries/collector.sql +++ b/internal/database/queries/collector.sql @@ -9,6 +9,3 @@ INSERT INTO collectorActiveVersions (clientId, versionId) VALUES ($1, $2); -- name: SetCollectorCleanVersion :exec INSERT INTO collectorMinCleanVersions (clientId, addedVersion, versionId) VALUES ($1, $2, $3); - --- name: SetCollectorTextVersion :exec -INSERT INTO collectorMinTextVersions (clientId, addedVersion, versionId) VALUES ($1, $2, $3); diff --git a/internal/database/queries/text.sql b/internal/database/queries/text.sql deleted file mode 100644 index 6f1742ab..00000000 --- a/internal/database/queries/text.sql +++ /dev/null @@ -1,68 +0,0 @@ --- name: IsDocumentTextExtracted :one -SELECT EXISTS( - SELECT 1 FROM currentTextEntries WHERE documentId = @documentId -); - --- name: GetDocumentTextExtractionByHash :one -SELECT id FROM currentTextEntries WHERE cleanId = @cleanEntryId and hash = @hash; - --- name: GetTextractOutputCurrentPart :one -WITH client as ( - select clientId from clients where clientId = @clientId -), -parts as ( - SELECT extract.part - FROM client as c - JOIN documents as docs on docs.clientId = c.clientId - JOIN documentCleans as clean on docs.id = clean.documentId - JOIN documentTextExtractions as extract - on extract.cleanId = clean.id - WHERE date(extract.createdAt) = date(@queryDate) -), -max_part as ( - SELECT COALESCE(max(part), 0) as max_part_num FROM parts -) -SELECT - COALESCE(p.part, 0)::unsignedsmallint as part, - COUNT(p.part) as count -FROM parts p -RIGHT JOIN max_part mp ON p.part = mp.max_part_num -GROUP BY p.part; - --- name: GetTextOutCurrentPart :one -WITH client as ( - select clientId from clients where clientId = @clientId -), -parts as ( - SELECT extract.part - FROM client as c - JOIN documents as docs on docs.clientId = c.clientId - JOIN documentCleans as clean on docs.id = clean.documentId - JOIN documentTextExtractions extract ON extract.cleanId = clean.id - WHERE date(extract.createdAt) = date(@queryDate) -), -max_part as ( - SELECT COALESCE(max(part), 0) as max_part_num FROM parts -) -SELECT - COALESCE(p.part, 0)::unsignedsmallint as part, - COUNT(p.part) as count -FROM parts p -RIGHT JOIN max_part mp ON p.part = mp.max_part_num -GROUP BY p.part; - --- name: AddDocumentText :one -INSERT INTO documentTextExtractions - (cleanId, bucket, key, hash, createdAt, part) - VALUES ($1, $2, $3, $4, $5, $6) - returning id; - --- name: AddDocumentTextEntry :exec -INSERT INTO documentTextExtractionEntries - (textId, version) - VALUES ($1, $2); - --- name: GetTextEntryByDocId :one -SELECT id, documentId, bucket, key, hash, cleanId, extractionVersion - FROM currentTextEntries - WHERE documentId = @documentId; diff --git a/internal/database/repository/client.sql.go b/internal/database/repository/client.sql.go index bd297bee..3bfb3d2c 100644 --- a/internal/database/repository/client.sql.go +++ b/internal/database/repository/client.sql.go @@ -73,18 +73,6 @@ doc_clean_entries as ( FROM docs d LEFT JOIN currentCleanEntries cte ON cte.documentId = d.id -), -doc_text_entries AS ( - -- Documents with their current text entries - SELECT - d.document_id, - cte.id AS text_entry_id, - d.clean_entry_id, - d.clean_fail, - d.client_id - FROM - doc_clean_entries d - LEFT JOIN currentTextEntries cte ON cte.cleanId = d.clean_entry_id ) SELECT ( -- No documents means client is synced @@ -92,19 +80,17 @@ SELECT ( OR - -- All documents have completed processing (clean entry exists and either - -- text entry exists or clean failed) + -- All documents have completed processing (clean entry exists OR clean failed) NOT EXISTS ( - SELECT 1 FROM doc_text_entries - where clean_entry_id is null or - (clean_fail is null and text_entry_id is null) + SELECT 1 FROM doc_clean_entries + WHERE clean_entry_id IS NULL ) )::bool as is_synced ` -// Query functionality has been removed. A client is considered synced when -// all documents have completed text extraction (or failed with explicit failure). -// See remove_query_plan.md for details. +// Text extraction has been removed. A client is considered synced when +// all documents have completed cleaning (clean entry exists OR clean failed). +// See remove_texttract_and_mocks_plan.md for details. // // WITH // docs AS ( @@ -121,18 +107,6 @@ SELECT ( // FROM // docs d // LEFT JOIN currentCleanEntries cte ON cte.documentId = d.id -// ), -// doc_text_entries AS ( -// -- Documents with their current text entries -// SELECT -// d.document_id, -// cte.id AS text_entry_id, -// d.clean_entry_id, -// d.clean_fail, -// d.client_id -// FROM -// doc_clean_entries d -// LEFT JOIN currentTextEntries cte ON cte.cleanId = d.clean_entry_id // ) // SELECT ( // -- No documents means client is synced @@ -140,12 +114,10 @@ SELECT ( // // OR // -// -- All documents have completed processing (clean entry exists and either -// -- text entry exists or clean failed) +// -- All documents have completed processing (clean entry exists OR clean failed) // NOT EXISTS ( -// SELECT 1 FROM doc_text_entries -// where clean_entry_id is null or -// (clean_fail is null and text_entry_id is null) +// SELECT 1 FROM doc_clean_entries +// WHERE clean_entry_id IS NULL // ) // )::bool as is_synced func (q *Queries) IsClientSynced(ctx context.Context, dollar_1 *string) (bool, error) { diff --git a/internal/database/repository/collector.sql.go b/internal/database/repository/collector.sql.go index 0a70cdc3..5e00ee0b 100644 --- a/internal/database/repository/collector.sql.go +++ b/internal/database/repository/collector.sql.go @@ -24,19 +24,18 @@ func (q *Queries) AddLatestCollectorVersion(ctx context.Context, clientid string } const getCollectorByClientID = `-- name: GetCollectorByClientID :one -SELECT clientid, mincleanversion, mintextversion, activeversion, latestversion FROM fullActiveCollectors WHERE clientId = $1 LIMIT 1 +SELECT clientid, mincleanversion, activeversion, latestversion FROM fullActiveCollectors WHERE clientId = $1 LIMIT 1 ` // GetCollectorByClientID // -// SELECT clientid, mincleanversion, mintextversion, activeversion, latestversion FROM fullActiveCollectors WHERE clientId = $1 LIMIT 1 +// SELECT clientid, mincleanversion, activeversion, latestversion FROM fullActiveCollectors WHERE clientId = $1 LIMIT 1 func (q *Queries) GetCollectorByClientID(ctx context.Context, clientid string) (*Fullactivecollector, error) { row := q.db.QueryRow(ctx, getCollectorByClientID, clientid) var i Fullactivecollector err := row.Scan( &i.Clientid, &i.Mincleanversion, - &i.Mintextversion, &i.Activeversion, &i.Latestversion, ) @@ -77,21 +76,3 @@ func (q *Queries) SetCollectorCleanVersion(ctx context.Context, arg *SetCollecto _, err := q.db.Exec(ctx, setCollectorCleanVersion, arg.Clientid, arg.Addedversion, arg.Versionid) return err } - -const setCollectorTextVersion = `-- name: SetCollectorTextVersion :exec -INSERT INTO collectorMinTextVersions (clientId, addedVersion, versionId) VALUES ($1, $2, $3) -` - -type SetCollectorTextVersionParams struct { - Clientid string `db:"clientid"` - Addedversion int32 `db:"addedversion"` - Versionid int64 `db:"versionid"` -} - -// SetCollectorTextVersion -// -// INSERT INTO collectorMinTextVersions (clientId, addedVersion, versionId) VALUES ($1, $2, $3) -func (q *Queries) SetCollectorTextVersion(ctx context.Context, arg *SetCollectorTextVersionParams) error { - _, err := q.db.Exec(ctx, setCollectorTextVersion, arg.Clientid, arg.Addedversion, arg.Versionid) - return err -} diff --git a/internal/database/repository/models.go b/internal/database/repository/models.go index f714953d..9fbb5aa4 100644 --- a/internal/database/repository/models.go +++ b/internal/database/repository/models.go @@ -234,14 +234,6 @@ type Collectormincleanversion struct { Removedversion *int32 `db:"removedversion"` } -type Collectormintextversion struct { - ID uuid.UUID `db:"id"` - Clientid string `db:"clientid"` - Versionid int64 `db:"versionid"` - Addedversion int32 `db:"addedversion"` - Removedversion *int32 `db:"removedversion"` -} - type Collectorversion struct { Clientid string `db:"clientid"` ID int32 `db:"id"` @@ -270,11 +262,6 @@ type Currentcollectormincleanversion struct { Mincleanversion int64 `db:"mincleanversion"` } -type Currentcollectormintextversion struct { - Clientid string `db:"clientid"` - Mintextversion int64 `db:"mintextversion"` -} - type Currentfieldextraction struct { ID uuid.UUID `db:"id"` Documentid uuid.UUID `db:"documentid"` @@ -328,16 +315,6 @@ type Currentfieldextractionswitharraycount struct { Arraysize int64 `db:"arraysize"` } -type Currenttextentry struct { - ID uuid.UUID `db:"id"` - Documentid uuid.UUID `db:"documentid"` - Bucket string `db:"bucket"` - Key string `db:"key"` - Hash string `db:"hash"` - Cleanid uuid.UUID `db:"cleanid"` - Extractionversion int64 `db:"extractionversion"` -} - type Document struct { ID uuid.UUID `db:"id"` Clientid string `db:"clientid"` @@ -535,22 +512,6 @@ type Documentlabel struct { Appliedby string `db:"appliedby"` } -type Documenttextextraction struct { - ID uuid.UUID `db:"id"` - Cleanid uuid.UUID `db:"cleanid"` - Bucket string `db:"bucket"` - Key string `db:"key"` - Hash string `db:"hash"` - Createdat pgtype.Timestamp `db:"createdat"` - Part uint16 `db:"part"` -} - -type Documenttextextractionentry struct { - ID uuid.UUID `db:"id"` - Textid uuid.UUID `db:"textid"` - Version int64 `db:"version"` -} - type Documentupload struct { ID uuid.UUID `db:"id"` Bucket string `db:"bucket"` @@ -577,7 +538,6 @@ type Folder struct { type Fullactivecollector struct { Clientid string `db:"clientid"` Mincleanversion int64 `db:"mincleanversion"` - Mintextversion int64 `db:"mintextversion"` Activeversion int32 `db:"activeversion"` Latestversion int32 `db:"latestversion"` } diff --git a/internal/database/repository/text.sql.go b/internal/database/repository/text.sql.go deleted file mode 100644 index 7ae7af3c..00000000 --- a/internal/database/repository/text.sql.go +++ /dev/null @@ -1,259 +0,0 @@ -// Code generated by sqlc. DO NOT EDIT. -// versions: -// sqlc v1.27.0 -// source: text.sql - -package repository - -import ( - "context" - - "github.com/google/uuid" - "github.com/jackc/pgx/v5/pgtype" -) - -const addDocumentText = `-- name: AddDocumentText :one -INSERT INTO documentTextExtractions - (cleanId, bucket, key, hash, createdAt, part) - VALUES ($1, $2, $3, $4, $5, $6) - returning id -` - -type AddDocumentTextParams struct { - Cleanid uuid.UUID `db:"cleanid"` - Bucket string `db:"bucket"` - Key string `db:"key"` - Hash string `db:"hash"` - Createdat pgtype.Timestamp `db:"createdat"` - Part uint16 `db:"part"` -} - -// AddDocumentText -// -// INSERT INTO documentTextExtractions -// (cleanId, bucket, key, hash, createdAt, part) -// VALUES ($1, $2, $3, $4, $5, $6) -// returning id -func (q *Queries) AddDocumentText(ctx context.Context, arg *AddDocumentTextParams) (uuid.UUID, error) { - row := q.db.QueryRow(ctx, addDocumentText, - arg.Cleanid, - arg.Bucket, - arg.Key, - arg.Hash, - arg.Createdat, - arg.Part, - ) - var id uuid.UUID - err := row.Scan(&id) - return id, err -} - -const addDocumentTextEntry = `-- name: AddDocumentTextEntry :exec -INSERT INTO documentTextExtractionEntries - (textId, version) - VALUES ($1, $2) -` - -type AddDocumentTextEntryParams struct { - Textid uuid.UUID `db:"textid"` - Version int64 `db:"version"` -} - -// AddDocumentTextEntry -// -// INSERT INTO documentTextExtractionEntries -// (textId, version) -// VALUES ($1, $2) -func (q *Queries) AddDocumentTextEntry(ctx context.Context, arg *AddDocumentTextEntryParams) error { - _, err := q.db.Exec(ctx, addDocumentTextEntry, arg.Textid, arg.Version) - return err -} - -const getDocumentTextExtractionByHash = `-- name: GetDocumentTextExtractionByHash :one -SELECT id FROM currentTextEntries WHERE cleanId = $1 and hash = $2 -` - -type GetDocumentTextExtractionByHashParams struct { - Cleanentryid uuid.UUID `db:"cleanentryid"` - Hash string `db:"hash"` -} - -// GetDocumentTextExtractionByHash -// -// SELECT id FROM currentTextEntries WHERE cleanId = $1 and hash = $2 -func (q *Queries) GetDocumentTextExtractionByHash(ctx context.Context, arg *GetDocumentTextExtractionByHashParams) (uuid.UUID, error) { - row := q.db.QueryRow(ctx, getDocumentTextExtractionByHash, arg.Cleanentryid, arg.Hash) - var id uuid.UUID - err := row.Scan(&id) - return id, err -} - -const getTextEntryByDocId = `-- name: GetTextEntryByDocId :one -SELECT id, documentId, bucket, key, hash, cleanId, extractionVersion - FROM currentTextEntries - WHERE documentId = $1 -` - -// GetTextEntryByDocId -// -// SELECT id, documentId, bucket, key, hash, cleanId, extractionVersion -// FROM currentTextEntries -// WHERE documentId = $1 -func (q *Queries) GetTextEntryByDocId(ctx context.Context, documentid uuid.UUID) (*Currenttextentry, error) { - row := q.db.QueryRow(ctx, getTextEntryByDocId, documentid) - var i Currenttextentry - err := row.Scan( - &i.ID, - &i.Documentid, - &i.Bucket, - &i.Key, - &i.Hash, - &i.Cleanid, - &i.Extractionversion, - ) - return &i, err -} - -const getTextOutCurrentPart = `-- name: GetTextOutCurrentPart :one -WITH client as ( - select clientId from clients where clientId = $1 -), -parts as ( - SELECT extract.part - FROM client as c - JOIN documents as docs on docs.clientId = c.clientId - JOIN documentCleans as clean on docs.id = clean.documentId - JOIN documentTextExtractions extract ON extract.cleanId = clean.id - WHERE date(extract.createdAt) = date($2) -), -max_part as ( - SELECT COALESCE(max(part), 0) as max_part_num FROM parts -) -SELECT - COALESCE(p.part, 0)::unsignedsmallint as part, - COUNT(p.part) as count -FROM parts p -RIGHT JOIN max_part mp ON p.part = mp.max_part_num -GROUP BY p.part -` - -type GetTextOutCurrentPartParams struct { - Clientid *string `db:"clientid"` - Querydate pgtype.Timestamptz `db:"querydate"` -} - -type GetTextOutCurrentPartRow struct { - Part uint16 `db:"part"` - Count int64 `db:"count"` -} - -// GetTextOutCurrentPart -// -// WITH client as ( -// select clientId from clients where clientId = $1 -// ), -// parts as ( -// SELECT extract.part -// FROM client as c -// JOIN documents as docs on docs.clientId = c.clientId -// JOIN documentCleans as clean on docs.id = clean.documentId -// JOIN documentTextExtractions extract ON extract.cleanId = clean.id -// WHERE date(extract.createdAt) = date($2) -// ), -// max_part as ( -// SELECT COALESCE(max(part), 0) as max_part_num FROM parts -// ) -// SELECT -// COALESCE(p.part, 0)::unsignedsmallint as part, -// COUNT(p.part) as count -// FROM parts p -// RIGHT JOIN max_part mp ON p.part = mp.max_part_num -// GROUP BY p.part -func (q *Queries) GetTextOutCurrentPart(ctx context.Context, arg *GetTextOutCurrentPartParams) (*GetTextOutCurrentPartRow, error) { - row := q.db.QueryRow(ctx, getTextOutCurrentPart, arg.Clientid, arg.Querydate) - var i GetTextOutCurrentPartRow - err := row.Scan(&i.Part, &i.Count) - return &i, err -} - -const getTextractOutputCurrentPart = `-- name: GetTextractOutputCurrentPart :one -WITH client as ( - select clientId from clients where clientId = $1 -), -parts as ( - SELECT extract.part - FROM client as c - JOIN documents as docs on docs.clientId = c.clientId - JOIN documentCleans as clean on docs.id = clean.documentId - JOIN documentTextExtractions as extract - on extract.cleanId = clean.id - WHERE date(extract.createdAt) = date($2) -), -max_part as ( - SELECT COALESCE(max(part), 0) as max_part_num FROM parts -) -SELECT - COALESCE(p.part, 0)::unsignedsmallint as part, - COUNT(p.part) as count -FROM parts p -RIGHT JOIN max_part mp ON p.part = mp.max_part_num -GROUP BY p.part -` - -type GetTextractOutputCurrentPartParams struct { - Clientid *string `db:"clientid"` - Querydate pgtype.Timestamptz `db:"querydate"` -} - -type GetTextractOutputCurrentPartRow struct { - Part uint16 `db:"part"` - Count int64 `db:"count"` -} - -// GetTextractOutputCurrentPart -// -// WITH client as ( -// select clientId from clients where clientId = $1 -// ), -// parts as ( -// SELECT extract.part -// FROM client as c -// JOIN documents as docs on docs.clientId = c.clientId -// JOIN documentCleans as clean on docs.id = clean.documentId -// JOIN documentTextExtractions as extract -// on extract.cleanId = clean.id -// WHERE date(extract.createdAt) = date($2) -// ), -// max_part as ( -// SELECT COALESCE(max(part), 0) as max_part_num FROM parts -// ) -// SELECT -// COALESCE(p.part, 0)::unsignedsmallint as part, -// COUNT(p.part) as count -// FROM parts p -// RIGHT JOIN max_part mp ON p.part = mp.max_part_num -// GROUP BY p.part -func (q *Queries) GetTextractOutputCurrentPart(ctx context.Context, arg *GetTextractOutputCurrentPartParams) (*GetTextractOutputCurrentPartRow, error) { - row := q.db.QueryRow(ctx, getTextractOutputCurrentPart, arg.Clientid, arg.Querydate) - var i GetTextractOutputCurrentPartRow - err := row.Scan(&i.Part, &i.Count) - return &i, err -} - -const isDocumentTextExtracted = `-- name: IsDocumentTextExtracted :one -SELECT EXISTS( - SELECT 1 FROM currentTextEntries WHERE documentId = $1 -) -` - -// IsDocumentTextExtracted -// -// SELECT EXISTS( -// SELECT 1 FROM currentTextEntries WHERE documentId = $1 -// ) -func (q *Queries) IsDocumentTextExtracted(ctx context.Context, documentid uuid.UUID) (bool, error) { - row := q.db.QueryRow(ctx, isDocumentTextExtracted, documentid) - var exists bool - err := row.Scan(&exists) - return exists, err -} diff --git a/internal/database/repository/text_test.go b/internal/database/repository/text_test.go deleted file mode 100644 index 6c014e55..00000000 --- a/internal/database/repository/text_test.go +++ /dev/null @@ -1,425 +0,0 @@ -package repository_test - -import ( - "testing" - "time" - - "queryorchestration/internal/database/repository" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/test" - - "github.com/google/uuid" - "github.com/jackc/pgx/v5/pgtype" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestTextExtraction(t *testing.T) { - t.Parallel() - if testing.Short() { - t.SkipNow() - } - ctx := t.Context() - - cfg := &serviceconfig.BaseConfig{} - test.CreateDB(t, cfg) - - queries := cfg.GetDBQueries() - - clientId := "EXAMPLE" - err := queries.CreateClient(ctx, &repository.CreateClientParams{ - Name: "example_client", - Clientid: clientId, - }) - require.NoError(t, err) - - hash := "example_hash" - id, err := queries.CreateDocument(ctx, &repository.CreateDocumentParams{ - Clientid: clientId, - Hash: hash, - BatchID: nil, - }) - require.NoError(t, err) - assert.NotEmpty(t, id) - - bucket := "example_bucket" - key := "example_key" - cleanid, err := queries.AddDocumentClean(ctx, &repository.AddDocumentCleanParams{ - Documentid: id, - Bucket: &bucket, - Key: &key, - Hash: &hash, - Mimetype: repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.CleanmimetypeApplicationPdf, - }, - }) - require.NoError(t, err) - err = queries.AddDocumentCleanEntry(ctx, &repository.AddDocumentCleanEntryParams{ - Cleanid: cleanid, - Version: 1, - }) - require.NoError(t, err) - - isextract, err := queries.IsDocumentTextExtracted(ctx, id) - require.NoError(t, err) - assert.False(t, isextract) - - textId, err := queries.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: cleanid, - Part: 0, - Bucket: bucket, - Key: key, - Hash: "example", - Createdat: pgtype.Timestamp{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.NotEqual(t, uuid.UUID{}, textId) - - isextract, err = queries.IsDocumentTextExtracted(ctx, id) - require.NoError(t, err) - assert.False(t, isextract) - - isextract, err = queries.IsDocumentTextExtracted(ctx, id) - require.NoError(t, err) - assert.False(t, isextract) - - err = queries.AddDocumentTextEntry(ctx, &repository.AddDocumentTextEntryParams{ - Textid: textId, - Version: 543, - }) - require.NoError(t, err) - - isextract, err = queries.IsDocumentTextExtracted(ctx, id) - require.NoError(t, err) - assert.True(t, isextract) - - text, err := queries.GetTextEntryByDocId(ctx, id) - require.NoError(t, err) - assert.Equal(t, textId, text.ID) - assert.Equal(t, id, text.Documentid) - assert.Equal(t, bucket, text.Bucket) - assert.Equal(t, key, text.Key) - assert.Equal(t, "example", text.Hash) - assert.Equal(t, cleanid, text.Cleanid) - assert.Equal(t, int64(543), text.Extractionversion) - assert.Equal(t, textId, text.ID) - - uniqueEntry, err := queries.GetDocumentTextExtractionByHash(ctx, &repository.GetDocumentTextExtractionByHashParams{ - Hash: "example", - Cleanentryid: cleanid, - }) - require.NoError(t, err) - assert.EqualExportedValues(t, text.ID, uniqueEntry) - - _, err = queries.GetDocumentTextExtractionByHash(ctx, &repository.GetDocumentTextExtractionByHashParams{ - Hash: "definitely invalid", - Cleanentryid: cleanid, - }) - require.EqualError(t, err, "no rows in result set") -} - -func TestTextTextractPart(t *testing.T) { - t.Parallel() - if testing.Short() { - t.SkipNow() - } - ctx := t.Context() - - cfg := &serviceconfig.BaseConfig{} - test.CreateDB(t, cfg) - - queries := cfg.GetDBQueries() - - clientId := "EXAMPLE" - err := queries.CreateClient(ctx, &repository.CreateClientParams{ - Name: "example_client", - Clientid: clientId, - }) - require.NoError(t, err) - - hash := "example_hash" - id, err := queries.CreateDocument(ctx, &repository.CreateDocumentParams{ - Clientid: clientId, - Hash: hash, - BatchID: nil, - }) - require.NoError(t, err) - assert.NotEmpty(t, id) - - bucket := "example_bucket" - key := "example_key" - cleanid, err := queries.AddDocumentClean(ctx, &repository.AddDocumentCleanParams{ - Documentid: id, - Bucket: &bucket, - Key: &key, - Hash: &hash, - Mimetype: repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.CleanmimetypeApplicationPdf, - }, - }) - require.NoError(t, err) - err = queries.AddDocumentCleanEntry(ctx, &repository.AddDocumentCleanEntryParams{ - Cleanid: cleanid, - Version: 1, - }) - require.NoError(t, err) - - part, err := queries.GetTextractOutputCurrentPart(ctx, &repository.GetTextractOutputCurrentPartParams{ - Clientid: &clientId, - Querydate: pgtype.Timestamptz{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.Equal(t, &repository.GetTextractOutputCurrentPartRow{ - Count: 0, - Part: 0, - }, part) - - _, err = queries.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: cleanid, - Part: 0, - Createdat: pgtype.Timestamp{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - - part, err = queries.GetTextractOutputCurrentPart(ctx, &repository.GetTextractOutputCurrentPartParams{ - Clientid: &clientId, - Querydate: pgtype.Timestamptz{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.Equal(t, &repository.GetTextractOutputCurrentPartRow{ - Count: 1, - Part: 0, - }, part) - - _, err = queries.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: cleanid, - Part: 0, - Createdat: pgtype.Timestamp{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - - part, err = queries.GetTextractOutputCurrentPart(ctx, &repository.GetTextractOutputCurrentPartParams{ - Clientid: &clientId, - Querydate: pgtype.Timestamptz{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.Equal(t, &repository.GetTextractOutputCurrentPartRow{ - Count: 2, - Part: 0, - }, part) - - _, err = queries.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: cleanid, - Part: 1, - Createdat: pgtype.Timestamp{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - - part, err = queries.GetTextractOutputCurrentPart(ctx, &repository.GetTextractOutputCurrentPartParams{ - Clientid: &clientId, - Querydate: pgtype.Timestamptz{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.Equal(t, &repository.GetTextractOutputCurrentPartRow{ - Count: 1, - Part: 1, - }, part) -} - -func TestTextOutPart(t *testing.T) { - t.Parallel() - if testing.Short() { - t.SkipNow() - } - ctx := t.Context() - - cfg := &serviceconfig.BaseConfig{} - test.CreateDB(t, cfg) - - queries := cfg.GetDBQueries() - - clientId := "EXAMPLE" - err := queries.CreateClient(ctx, &repository.CreateClientParams{ - Name: "example_client", - Clientid: clientId, - }) - require.NoError(t, err) - - hash := "example_hash" - id, err := queries.CreateDocument(ctx, &repository.CreateDocumentParams{ - Clientid: clientId, - Hash: hash, - BatchID: nil, - }) - require.NoError(t, err) - assert.NotEmpty(t, id) - - bucket := "example_bucket" - key := "example_key" - cleanid, err := queries.AddDocumentClean(ctx, &repository.AddDocumentCleanParams{ - Documentid: id, - Bucket: &bucket, - Key: &key, - Hash: &hash, - Mimetype: repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.CleanmimetypeApplicationPdf, - }, - }) - require.NoError(t, err) - err = queries.AddDocumentCleanEntry(ctx, &repository.AddDocumentCleanEntryParams{ - Cleanid: cleanid, - Version: 1, - }) - require.NoError(t, err) - - textId, err := queries.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: cleanid, - Bucket: "hi", - Key: "hi", - Hash: "hi", - Part: 0, - Createdat: pgtype.Timestamp{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - err = queries.AddDocumentTextEntry(ctx, &repository.AddDocumentTextEntryParams{ - Textid: textId, - Version: 123, - }) - require.NoError(t, err) - - part, err := queries.GetTextOutCurrentPart(ctx, &repository.GetTextOutCurrentPartParams{ - Clientid: &clientId, - Querydate: pgtype.Timestamptz{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.Equal(t, &repository.GetTextOutCurrentPartRow{ - Count: 1, - Part: 0, - }, part) - - textId, err = queries.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: cleanid, - Bucket: "hi", - Key: "hi", - Hash: "hi", - Part: 0, - Createdat: pgtype.Timestamp{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - err = queries.AddDocumentTextEntry(ctx, &repository.AddDocumentTextEntryParams{ - Textid: textId, - Version: 123, - }) - require.NoError(t, err) - - part, err = queries.GetTextOutCurrentPart(ctx, &repository.GetTextOutCurrentPartParams{ - Clientid: &clientId, - Querydate: pgtype.Timestamptz{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.Equal(t, &repository.GetTextOutCurrentPartRow{ - Count: 2, - Part: 0, - }, part) - - textId, err = queries.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: cleanid, - Bucket: "hi", - Key: "hi", - Hash: "hi", - Part: 0, - Createdat: pgtype.Timestamp{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - err = queries.AddDocumentTextEntry(ctx, &repository.AddDocumentTextEntryParams{ - Textid: textId, - Version: 123, - }) - require.NoError(t, err) - - part, err = queries.GetTextOutCurrentPart(ctx, &repository.GetTextOutCurrentPartParams{ - Clientid: &clientId, - Querydate: pgtype.Timestamptz{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.Equal(t, &repository.GetTextOutCurrentPartRow{ - Count: 3, - Part: 0, - }, part) - - textId, err = queries.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: cleanid, - Bucket: "hi", - Key: "hi", - Hash: "hi", - Part: 1, - Createdat: pgtype.Timestamp{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - err = queries.AddDocumentTextEntry(ctx, &repository.AddDocumentTextEntryParams{ - Textid: textId, - Version: 123, - }) - require.NoError(t, err) - - part, err = queries.GetTextOutCurrentPart(ctx, &repository.GetTextOutCurrentPartParams{ - Clientid: &clientId, - Querydate: pgtype.Timestamptz{ - Time: time.Now().UTC(), - Valid: true, - }, - }) - require.NoError(t, err) - assert.Equal(t, &repository.GetTextOutCurrentPartRow{ - Count: 1, - Part: 1, - }, part) -} diff --git a/internal/document/clean/clean_test.go b/internal/document/clean/clean_test.go deleted file mode 100644 index aaed4bd7..00000000 --- a/internal/document/clean/clean_test.go +++ /dev/null @@ -1,445 +0,0 @@ -package documentclean - -import ( - "io" - "strings" - "testing" - "time" - - "queryorchestration/internal/database/repository" - "queryorchestration/internal/document" - documenttypes "queryorchestration/internal/document/types" - "queryorchestration/internal/serviceconfig/objectstore" - objectstoremock "queryorchestration/mocks/objectstore" - - "github.com/stretchr/testify/require" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/google/uuid" - "github.com/pashagolub/pgxmock/v3" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -func TestClean(t *testing.T) { - ctx := t.Context() - pool, err := pgxmock.NewPool() - require.NoError(t, err) - - cfg := &DocCleanConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - svc := Service{ - cfg: cfg, - } - - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: "yuyu", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - keyStr := key.String() - dbid := doc.ID - - pool.ExpectQuery("name: GetDocumentSummary :one").WithArgs(dbid). - WillReturnRows( - pgxmock.NewRows([]string{"id", "clientId", "hash"}). - AddRow(dbid, doc.ClientID, doc.Hash), - ) - pool.ExpectQuery("name: GetDocumentEntry :one").WithArgs(dbid).WillReturnRows( - pgxmock.NewRows([]string{"documentId", "bucket", "key"}). - AddRow(dbid, bucket, keyStr), - ) - mimeType := "application/pdf" - dbmimetype := repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.Cleanmimetype(mimeType), - } - pool.ExpectBegin() - pool.ExpectQuery("name: GetMostRecentDocumentCleanEntry :one").WithArgs(dbid). - WillReturnRows( - pgxmock.NewRows([]string{"id", "documentId", "bucket", "key", "version", "hash", "mimetype", "fail"}), - ) - cleanid := uuid.New() - pool.ExpectQuery("name: AddDocumentClean :one").WithArgs(dbid, &bucket, &keyStr, &doc.Hash, dbmimetype, repository.NullCleanfailtype{}). - WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(cleanid), - ) - pool.ExpectExec("name: AddDocumentCleanEntry :exec").WithArgs(cleanid, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - var length int64 = 10 - mockS3.EXPECT(). - HeadObject( - mock.Anything, - mock.MatchedBy(func(in *s3.HeadObjectInput) bool { - return *in.Bucket == bucket && *in.Key == keyStr - }), - mock.Anything, - ). - Return(&s3.HeadObjectOutput{ - ContentType: &mimeType, - ContentLength: &length, - }, nil) - - body := io.NopCloser(strings.NewReader(pdfHelloWorld)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == bucket && *in.Key == keyStr - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - err = svc.clean(ctx, doc.ID) - require.NoError(t, err) -} - -func TestExecuteCleanTasks(t *testing.T) { - ctx := t.Context() - - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - id := uuid.New() - hash := "example_hash" - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: "client", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - keyStr := key.String() - - mimeType := "application/pdf" - mockS3.EXPECT(). - HeadObject( - mock.Anything, - mock.MatchedBy(func(in *s3.HeadObjectInput) bool { - return *in.Bucket == bucket && *in.Key == keyStr - }), - mock.Anything, - ). - Return(&s3.HeadObjectOutput{ - ContentType: &mimeType, - }, nil) - - body := io.NopCloser(strings.NewReader(pdfHelloWorld)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == bucket && *in.Key == keyStr - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - outloc, err := svc.executeCleanTasks(ctx, &CleanParams{ - ID: id, - Hash: hash, - Bucket: bucket, - Key: key, - }) - require.NoError(t, err) - assert.EqualExportedValues(t, ExecuteCleanResponse{ - hash: &hash, - }, *outloc) -} - -func TestStoreClean(t *testing.T) { - ctx := t.Context() - pool, err := pgxmock.NewPool() - require.NoError(t, err) - - cfg := &DocCleanConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := Service{ - cfg: cfg, - } - - doc := document.DocumentSummary{ - ID: uuid.New(), - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - keyStr := key.String() - t.Run("no prev entry", func(t *testing.T) { - mimeType := "application/pdf" - hash := "heyman" - params := &ExecuteCleanResponse{ - hash: &hash, - mimetype: (*documenttypes.MimeType)(&mimeType), - key: &key, - bucket: &bucket, - } - dbid := doc.ID - - dbmimetype := repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.Cleanmimetype(mimeType), - } - pool.ExpectBegin() - pool.ExpectQuery("name: GetMostRecentDocumentCleanEntry :one").WithArgs(dbid). - WillReturnRows( - pgxmock.NewRows([]string{"id", "documentId", "bucket", "key", "version", "hash", "mimetype", "fail"}), - ) - cleanid := uuid.New() - pool.ExpectQuery("name: AddDocumentClean :one").WithArgs(dbid, &bucket, &keyStr, params.hash, dbmimetype, repository.NullCleanfailtype{}). - WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(cleanid), - ) - pool.ExpectExec("name: AddDocumentCleanEntry :exec").WithArgs(cleanid, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - err = svc.storeClean(ctx, doc.ID, params) - require.NoError(t, err) - }) - t.Run("diff prev entry", func(t *testing.T) { - mimeType := "application/pdf" - hash := "heyman" - params := &ExecuteCleanResponse{ - hash: &hash, - bucket: &bucket, - key: &key, - mimetype: (*documenttypes.MimeType)(&mimeType), - } - dbid := doc.ID - - dbmimetype := repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.Cleanmimetype(mimeType), - } - pool.ExpectBegin() - pool.ExpectQuery("name: GetMostRecentDocumentCleanEntry :one").WithArgs(dbid). - WillReturnRows( - pgxmock.NewRows([]string{"id", "documentId", "bucket", "key", "version", "hash", "mimetype", "fail"}). - AddRow(uuid.New(), dbid, nil, nil, int64(1), nil, nil, repository.CleanfailtypeInvalidRead), - ) - cleanid := uuid.New() - pool.ExpectQuery("name: AddDocumentClean :one").WithArgs(dbid, &bucket, &keyStr, params.hash, dbmimetype, repository.NullCleanfailtype{}). - WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(cleanid), - ) - pool.ExpectExec("name: AddDocumentCleanEntry :exec").WithArgs(cleanid, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - err = svc.storeClean(ctx, doc.ID, params) - require.NoError(t, err) - }) - t.Run("same fail", func(t *testing.T) { - reason := documenttypes.InvalidDocumentMimeType - params := &ExecuteCleanResponse{ - failReason: &reason, - } - dbid := doc.ID - cleanid := uuid.New() - - pool.ExpectBegin() - pool.ExpectQuery("name: GetMostRecentDocumentCleanEntry :one").WithArgs(dbid). - WillReturnRows( - pgxmock.NewRows([]string{"id", "documentId", "bucket", "key", "version", "hash", "mimetype", "fail"}). - AddRow(cleanid, dbid, nil, nil, int64(1), nil, nil, repository.NullCleanfailtype{ - Valid: true, - Cleanfailtype: repository.CleanfailtypeInvalidMimetype, - }), - ) - pool.ExpectExec("name: AddDocumentCleanEntry :exec").WithArgs(cleanid, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - err = svc.storeClean(ctx, doc.ID, params) - assert.EqualError(t, err, "invalid_mimetype") - }) -} - -func TestIsNewClean(t *testing.T) { - svc := Service{} - t.Run("no last entry", func(t *testing.T) { - var lastEntry *repository.GetMostRecentDocumentCleanEntryRow = nil - params := &ExecuteCleanResponse{} - assert.True(t, svc.isNewClean(lastEntry, params)) - }) - t.Run("same fail", func(t *testing.T) { - var lastEntry *repository.GetMostRecentDocumentCleanEntryRow = &repository.GetMostRecentDocumentCleanEntryRow{ - ID: uuid.New(), - Fail: repository.NullCleanfailtype{ - Valid: true, - Cleanfailtype: repository.CleanfailtypeInvalidMimetype, - }, - } - reason := documenttypes.InvalidDocumentMimeType - params := &ExecuteCleanResponse{ - failReason: &reason, - } - assert.False(t, svc.isNewClean(lastEntry, params)) - }) - t.Run("different fail", func(t *testing.T) { - var lastEntry *repository.GetMostRecentDocumentCleanEntryRow = &repository.GetMostRecentDocumentCleanEntryRow{ - ID: uuid.New(), - Fail: repository.NullCleanfailtype{ - Valid: true, - Cleanfailtype: repository.CleanfailtypeInvalidMimetype, - }, - } - reason := documenttypes.InvalidDocumentLargeDPI - params := &ExecuteCleanResponse{ - failReason: &reason, - } - assert.True(t, svc.isNewClean(lastEntry, params)) - }) - t.Run("same location", func(t *testing.T) { - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: "diw", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - keyStr := key.String() - mimeType := documenttypes.MimeTypePDF - var lastEntry *repository.GetMostRecentDocumentCleanEntryRow = &repository.GetMostRecentDocumentCleanEntryRow{ - ID: uuid.New(), - Bucket: &bucket, - Key: &keyStr, - Mimetype: repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.Cleanmimetype(mimeType), - }, - } - params := &ExecuteCleanResponse{ - bucket: &bucket, - key: &key, - mimetype: &mimeType, - } - assert.False(t, svc.isNewClean(lastEntry, params)) - }) - t.Run("different location", func(t *testing.T) { - bucket := "example_bucket" - oldKey := objectstore.BucketKey{ - ClientID: "hi", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - oldKeyStr := oldKey.String() - newKey := objectstore.BucketKey{ - ClientID: "hi", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - mimeType := documenttypes.MimeTypePDF - var lastEntry *repository.GetMostRecentDocumentCleanEntryRow = &repository.GetMostRecentDocumentCleanEntryRow{ - ID: uuid.New(), - Bucket: &bucket, - Key: &oldKeyStr, - Mimetype: repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.Cleanmimetype(mimeType), - }, - } - params := &ExecuteCleanResponse{ - bucket: &bucket, - key: &newKey, - mimetype: &mimeType, - } - assert.True(t, svc.isNewClean(lastEntry, params)) - }) -} - -const pdfHelloWorld = `%PDF-1.4 -%���� -1 0 obj -<< - /Type /Catalog - /Pages 2 0 R - /Version /1.4 ->> -endobj -2 0 obj -<< - /Type /Pages - /Kids [3 0 R] - /Count 1 ->> -endobj -3 0 obj -<< - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - >> - >> - /Contents 4 0 R ->> -endobj -4 0 obj -<< - /Length - 44 ->> -stream -BT -/F1 24 Tf -100 700 Td -(Hello World!) Tj -ET -endstream -endobj -xref -0 5 -0000000000 65535 f -0000000015 00000 n -0000000086 00000 n -0000000151 00000 n -0000000376 00000 n -trailer -<< - /Size 5 - /Root 1 0 R ->> -startxref -472 -%%EOF` diff --git a/internal/document/clean/contentType_test.go b/internal/document/clean/contentType_test.go deleted file mode 100644 index 2b00b02d..00000000 --- a/internal/document/clean/contentType_test.go +++ /dev/null @@ -1,493 +0,0 @@ -package documentclean - -import ( - "fmt" - "io" - "strings" - "testing" - "time" - - documenttypes "queryorchestration/internal/document/types" - "queryorchestration/internal/serviceconfig/objectstore" - objectstoremock "queryorchestration/mocks/objectstore" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -func TestGetBodyMimeType(t *testing.T) { - t.Run("invalid type", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Hash: "example_hash", - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - - bodyStr := "invalid" - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - contentType, err := svc.getBodyMimeType(ctx, params, int64(len(bodyStr))) - require.NoError(t, err) - assert.Equal(t, documenttypes.MimeTypeInvalid, contentType) - }) - t.Run("pdf", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Hash: "example_hash", - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - - bodyStr := fmt.Sprintf("%s %s", PDFSignatureStr, PDFSignatureEndStr) - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - contentType, err := svc.getBodyMimeType(ctx, params, int64(len(bodyStr))) - require.NoError(t, err) - assert.Equal(t, documenttypes.MimeTypePDF, contentType) - }) - t.Run("pdf start", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Hash: "example_hash", - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - - bodyStr := fmt.Sprintf("%s---------------", PDFSignatureStr) - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - contentType, err := svc.getBodyMimeType(ctx, params, int64(len(bodyStr))) - require.NoError(t, err) - assert.Equal(t, documenttypes.MimeTypeInvalid, contentType) - }) - t.Run("pdf end", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Hash: "example_hash", - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - - bodyStr := fmt.Sprintf("%s---------------", PDFSignatureEndStr) - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - contentType, err := svc.getBodyMimeType(ctx, params, int64(len(bodyStr))) - require.NoError(t, err) - assert.Equal(t, documenttypes.MimeTypeInvalid, contentType) - }) - t.Run("short", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Hash: "example_hash", - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - - bodyStr := "" - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - _, err := svc.getBodyMimeType(ctx, params, int64(len(bodyStr))) - assert.Error(t, err) - }) -} - -func TestGetMetadataMimeType(t *testing.T) { - t.Run("nil type", func(t *testing.T) { - svc := Service{} - - contentType := svc.getMetadataMimeType(nil) - assert.Equal(t, documenttypes.MimeTypeInvalid, contentType) - }) - t.Run("invalid type", func(t *testing.T) { - svc := Service{} - - inType := "invalid_type" - contentType := svc.getMetadataMimeType(&inType) - assert.Equal(t, documenttypes.MimeTypeInvalid, contentType) - }) - t.Run("pdf", func(t *testing.T) { - svc := Service{} - - inType := "application/pdf" - contentType := svc.getMetadataMimeType(&inType) - assert.Equal(t, documenttypes.MimeTypePDF, contentType) - }) -} - -func TestGetAcceptedMimeType(t *testing.T) { - t.Run("invalid type", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - - bodyStr := "invalid" - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - inType := "invalid_type" - contentType, err := svc.getAcceptedMimeType(ctx, params, &inType, int64(len(bodyStr))) - require.NoError(t, err) - assert.Equal(t, documenttypes.MimeTypeInvalid, contentType) - }) - t.Run("pdf mimetype", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - inType := "application/pdf" - contentType, err := svc.getAcceptedMimeType(ctx, &CleanParams{}, &inType, 0) - require.NoError(t, err) - assert.Equal(t, documenttypes.MimeTypePDF, contentType) - }) - t.Run("pdf format", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - - bodyStr := fmt.Sprintf("%s %s", PDFSignatureStr, PDFSignatureEndStr) - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - inType := "invalid_type" - contentType, err := svc.getAcceptedMimeType(ctx, params, &inType, int64(len(bodyStr))) - require.NoError(t, err) - assert.Equal(t, documenttypes.MimeTypePDF, contentType) - }) -} - -func TestGetBytesBuffer(t *testing.T) { - t.Run("valid", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Hash: "example_hash", - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - start := int64(0) - bodyStr := "invalid" - length := int64(len(bodyStr)) - - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash && *in.Range == "bytes=0-6" - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - buffer, err := svc.getBytesBuffer(ctx, params, start, length) - require.NoError(t, err) - assert.NotNil(t, buffer) - }) - t.Run("negative start", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Hash: "example_hash", - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - start := int64(-1) - bodyStr := "invalid" - length := int64(len(bodyStr)) - - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash && *in.Range == "bytes=0-6" - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - buffer, err := svc.getBytesBuffer(ctx, params, start, length) - require.NoError(t, err) - assert.NotNil(t, buffer) - }) - t.Run("zero length", func(t *testing.T) { - ctx := t.Context() - cfg := &DocCleanConfig{} - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - svc := Service{ - cfg: cfg, - } - - params := &CleanParams{ - Hash: "example_hash", - Bucket: "example_bucket", - Key: objectstore.BucketKey{ - ClientID: "ddddddd", - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - }, - } - start := int64(0) - bodyStr := "" - length := int64(0) - - body := io.NopCloser(strings.NewReader(bodyStr)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == params.Bucket && *in.Key == params.Key.String() && *in.IfMatch == params.Hash && *in.Range == "bytes=0-0" - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - buffer, err := svc.getBytesBuffer(ctx, params, start, length) - assert.Error(t, err) - assert.Nil(t, buffer) - }) -} diff --git a/internal/document/clean/create.go b/internal/document/clean/create.go index a9ac7372..a30c53bf 100644 --- a/internal/document/clean/create.go +++ b/internal/document/clean/create.go @@ -1,15 +1,17 @@ +// Package documentclean provides document cleaning functionality. +// Note: Text extraction pipeline has been removed. The document processing +// pipeline now ends after cleaning. See remove_texttract_and_mocks_plan.md. package documentclean import ( "context" "fmt" - doctextrunner "queryorchestration/api/docTextRunner" - "queryorchestration/internal/serviceconfig/queue" - "github.com/google/uuid" ) +// Clean processes a document by cleaning it. Previously this also triggered +// text extraction, but that feature has been removed. func (s *Service) Clean(ctx context.Context, documentId uuid.UUID) error { isclean, err := s.cfg.GetDBQueries().HasDocumentCleanEntry(ctx, documentId) if err != nil { @@ -23,24 +25,6 @@ func (s *Service) Clean(ctx context.Context, documentId uuid.UUID) error { } } - err = s.informClean(ctx, documentId) - if err != nil { - return err - } - - return nil -} - -func (s *Service) informClean(ctx context.Context, documentId uuid.UUID) error { - err := s.cfg.SendToQueue(ctx, &queue.SendParams{ - QueueURL: s.cfg.GetDocumentTextURL(), - Body: doctextrunner.Body{ - DocumentID: documentId, - }, - }) - if err != nil { - return err - } - + // Note: Text extraction has been removed. Document pipeline ends here. return nil } diff --git a/internal/document/clean/create_test.go b/internal/document/clean/create_test.go deleted file mode 100644 index bea513a4..00000000 --- a/internal/document/clean/create_test.go +++ /dev/null @@ -1,164 +0,0 @@ -package documentclean - -import ( - "fmt" - "io" - "strings" - "testing" - "time" - - "queryorchestration/internal/database/repository" - "queryorchestration/internal/document" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/aws" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/queue/documenttext" - objectstoremock "queryorchestration/mocks/objectstore" - queuemock "queryorchestration/mocks/queue" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/aws/aws-sdk-go-v2/service/sqs" - "github.com/google/uuid" - "github.com/pashagolub/pgxmock/v3" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -type DocCleanConfig struct { - aws.AWSConfig - serviceconfig.BaseConfig - documenttext.DocTextConfig - objectstore.ObjectStoreConfig -} - -func TestCreate(t *testing.T) { - ctx := t.Context() - pool, err := pgxmock.NewPool() - require.NoError(t, err) - - mockSQS := queuemock.NewMockSQSClient(t) - - cfg := &DocCleanConfig{} - cfg.QueueClient = mockSQS - cfg.DocumentTextURL = "/i/am/here" - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - svc := Service{ - cfg: cfg, - } - - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: "yuyu", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - keyStr := key.String() - dbid := doc.ID - - pool.ExpectQuery("name: HasDocumentCleanEntry :one").WithArgs(dbid).WillReturnRows( - pgxmock.NewRows([]string{"isclean"}). - AddRow(false), - ) - pool.ExpectQuery("name: GetDocumentSummary :one").WithArgs(dbid). - WillReturnRows( - pgxmock.NewRows([]string{"id", "clientId", "hash"}). - AddRow(dbid, doc.ClientID, doc.Hash), - ) - pool.ExpectQuery("name: GetDocumentEntry :one").WithArgs(dbid).WillReturnRows( - pgxmock.NewRows([]string{"documentId", "bucket", "key"}). - AddRow(dbid, bucket, keyStr), - ) - mimeType := "application/pdf" - dbmimetype := repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.Cleanmimetype(mimeType), - } - pool.ExpectBegin() - pool.ExpectQuery("name: GetMostRecentDocumentCleanEntry :one").WithArgs(dbid). - WillReturnRows( - pgxmock.NewRows([]string{"id", "documentId", "bucket", "key", "version", "hash", "mimetype", "fail"}), - ) - cleanid := uuid.New() - pool.ExpectQuery("name: AddDocumentClean :one").WithArgs(dbid, &bucket, &keyStr, &doc.Hash, dbmimetype, repository.NullCleanfailtype{}). - WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(cleanid), - ) - pool.ExpectExec("name: AddDocumentCleanEntry :exec").WithArgs(cleanid, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.DocumentTextURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", doc.ID) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - mockS3.EXPECT(). - HeadObject( - mock.Anything, - mock.MatchedBy(func(in *s3.HeadObjectInput) bool { - return *in.Bucket == bucket && *in.Key == key.String() - }), - mock.Anything, - ). - Return(&s3.HeadObjectOutput{ - ContentType: &mimeType, - }, nil) - - body := io.NopCloser(strings.NewReader(pdfHelloWorld)) - mockS3.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == bucket && *in.Key == key.String() - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: body, - }, nil) - - err = svc.Clean(ctx, doc.ID) - require.NoError(t, err) -} - -func TestInformClean(t *testing.T) { - ctx := t.Context() - mockSQS := queuemock.NewMockSQSClient(t) - - cfg := &DocCleanConfig{} - cfg.QueueClient = mockSQS - cfg.DocumentTextURL = "/i/am/here" - svc := Service{ - cfg: cfg, - } - id := uuid.New() - - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.DocumentTextURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", id) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - err := svc.informClean(ctx, id) - require.NoError(t, err) -} diff --git a/internal/document/clean/service.go b/internal/document/clean/service.go index a7277ed7..1f4a6d15 100644 --- a/internal/document/clean/service.go +++ b/internal/document/clean/service.go @@ -1,21 +1,26 @@ +// Package documentclean provides document cleaning functionality. +// Note: Text extraction pipeline has been removed. The document processing +// pipeline now ends after cleaning. package documentclean import ( "queryorchestration/internal/serviceconfig" "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/queue/documenttext" ) +// ConfigProvider defines the configuration requirements for the document clean service. +// Note: documenttext.ConfigProvider has been removed since text extraction is deprecated. type ConfigProvider interface { serviceconfig.ConfigProvider - documenttext.ConfigProvider objectstore.ConfigProvider } +// Service provides document cleaning operations. type Service struct { cfg ConfigProvider } +// New creates a new document cleaning service. func New(cfg ConfigProvider) *Service { return &Service{ cfg: cfg, diff --git a/internal/document/clean/service_test.go b/internal/document/clean/service_test.go index 7f4cd1e5..357176e3 100644 --- a/internal/document/clean/service_test.go +++ b/internal/document/clean/service_test.go @@ -1,3 +1,5 @@ +// Package documentclean_test contains tests for the document clean service. +// Note: Text extraction has been removed. The document pipeline ends after cleaning. package documentclean_test import ( @@ -6,14 +8,12 @@ import ( documentclean "queryorchestration/internal/document/clean" "queryorchestration/internal/serviceconfig" "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/queue/documenttext" "github.com/stretchr/testify/assert" ) type DocCleanConfig struct { serviceconfig.BaseConfig - documenttext.DocTextConfig objectstore.ConfigProvider } diff --git a/internal/document/init/create_test.go b/internal/document/init/create_test.go index 1824b76b..7e561692 100644 --- a/internal/document/init/create_test.go +++ b/internal/document/init/create_test.go @@ -1,449 +1,21 @@ +// Package documentinit tests for document initialization. +// Note: Mock-based tests have been removed. See remove_texttract_and_mocks_plan.md. package documentinit import ( "bytes" - "errors" "fmt" "testing" - "time" - "queryorchestration/internal/database/repository" - "queryorchestration/internal/document" - "queryorchestration/internal/serviceconfig/objectstore" "queryorchestration/internal/test" - objectstoremock "queryorchestration/mocks/objectstore" - queuemock "queryorchestration/mocks/queue" - - "github.com/stretchr/testify/require" "github.com/aws/aws-sdk-go-v2/aws" "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/aws/aws-sdk-go-v2/service/sqs" "github.com/google/uuid" - "github.com/pashagolub/pgxmock/v3" "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" + "github.com/stretchr/testify/require" ) -func TestCreate(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - - // Set up mock S3 client for file size measurement - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - cfg.DocumentSyncURL = "/i/am/here" - - svc := New(cfg) - - clientId := "hi" - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: clientId, - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - - // Mock HeadObject to return file size - fileSize := int64(1024) - mockS3.EXPECT(). - HeadObject(mock.Anything, mock.MatchedBy(func(in *s3.HeadObjectInput) bool { - return *in.Bucket == bucket && *in.Key == key.String() - })). - Return(&s3.HeadObjectOutput{ContentLength: &fileSize}, nil) - - pool.ExpectQuery("name: GetDocumentIDByHash :one").WithArgs(doc.Hash, doc.ClientID).WillReturnRows( - pgxmock.NewRows([]string{"id"}), - ) - pool.ExpectBegin() - pool.ExpectQuery("name: CreateDocument :one").WithArgs(doc.ClientID, doc.Hash, (*uuid.UUID)(nil), (*string)(nil), (*uuid.UUID)(nil), (*string)(nil), &fileSize). - WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(doc.ID), - ) - pool.ExpectExec("name: AddDocumentEntry :exec").WithArgs(doc.ID, bucket, key.String()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - pool.ExpectQuery("name: GetDocumentSummary :one").WithArgs(doc.ID). - WillReturnRows( - pgxmock.NewRows([]string{"id", "clientId", "hash"}). - AddRow(doc.ID, doc.ClientID, doc.Hash), - ) - pool.ExpectQuery("name: GetClient :one").WithArgs(clientId).WillReturnRows( - pgxmock.NewRows([]string{"id", "clientId", "canSync"}). - AddRow(clientId, clientId, true), - ) - pool.ExpectQuery("name: GetClient :one").WithArgs(clientId).WillReturnRows( - pgxmock.NewRows([]string{"id", "name", "canSync"}). - AddRow(clientId, "client_name", true), - ) - - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.DocumentSyncURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", doc.ID.String()) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - id, err := svc.Create(ctx, &Create{ - Hash: doc.Hash, - Key: key, - Bucket: bucket, - Filename: nil, // No filename for this test - }) - require.NoError(t, err) - assert.Equal(t, doc.ID, id) -} - -func TestGetCreateParams(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := New(cfg) - - doc := document.DocumentSummary{ - ClientID: "hello", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - - pool.ExpectQuery("name: GetDocumentIDByHash :one").WithArgs(doc.Hash, doc.ClientID).WillReturnRows( - pgxmock.NewRows([]string{"id"}), - ) - - params, err := svc.getCreateParams(ctx, &Create{ - Hash: doc.Hash, - Bucket: bucket, - Key: key, - }) - require.NoError(t, err) - assert.Equal(t, &createDocumentParams{ - Hash: doc.Hash, - Bucket: bucket, - Key: key, - }, params) -} - -func TestGetCreateParamsExisting(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := New(cfg) - - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: "hello", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - - pool.ExpectQuery("name: GetDocumentIDByHash :one").WithArgs(doc.Hash, doc.ClientID).WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(doc.ID), - ) - - params, err := svc.getCreateParams(ctx, &Create{ - Bucket: bucket, - Key: key, - Hash: doc.Hash, - }) - require.NoError(t, err) - dbid := doc.ID - assert.Equal(t, &createDocumentParams{ - ID: &dbid, - Hash: doc.Hash, - Bucket: bucket, - Key: key, - }, params) -} - -func TestGetCreateParamsCurrentDocErr(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - svc := New(cfg) - - doc := document.DocumentSummary{ - ClientID: "hello", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - - pool.ExpectQuery("name: GetDocumentIDByHash :one").WithArgs(doc.Hash, doc.ClientID). - WillReturnError(errors.New("db err")) - - _, err = svc.getCreateParams(ctx, &Create{ - Bucket: bucket, - Key: key, - }) - assert.Error(t, err) -} - -func TestSubmitCreate(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - // Set up mock S3 client for file size measurement - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - svc := New(cfg) - - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: "hello", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - - // Mock HeadObject to return file size - fileSize := int64(2048) - mockS3.EXPECT(). - HeadObject(mock.Anything, mock.MatchedBy(func(in *s3.HeadObjectInput) bool { - return *in.Bucket == bucket && *in.Key == key.String() - })). - Return(&s3.HeadObjectOutput{ContentLength: &fileSize}, nil) - - pool.ExpectBegin() - pool.ExpectQuery("name: CreateDocument :one").WithArgs(doc.ClientID, doc.Hash, (*uuid.UUID)(nil), (*string)(nil), (*uuid.UUID)(nil), (*string)(nil), &fileSize). - WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(doc.ID), - ) - pool.ExpectExec("name: AddDocumentEntry :exec").WithArgs(doc.ID, bucket, key.String()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - id, err := svc.submitCreate(ctx, &createDocumentParams{ - Hash: doc.Hash, - Bucket: bucket, - Key: key, - Filename: nil, // No filename for this test - }) - require.NoError(t, err) - assert.Equal(t, doc.ID, id) -} - -func TestSubmitCreateExists(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - // Set up mock S3 client for file size measurement - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - svc := New(cfg) - - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: "hello", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - - // Mock HeadObject to return file size (still called even for existing docs) - fileSize := int64(4096) - mockS3.EXPECT(). - HeadObject(mock.Anything, mock.MatchedBy(func(in *s3.HeadObjectInput) bool { - return *in.Bucket == bucket && *in.Key == key.String() - })). - Return(&s3.HeadObjectOutput{ContentLength: &fileSize}, nil) - - pool.ExpectBegin() - pool.ExpectExec("name: AddDocumentEntry :exec").WithArgs(doc.ID, bucket, key.String()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - docid := doc.ID - id, err := svc.submitCreate(ctx, &createDocumentParams{ - ID: &docid, - Hash: doc.Hash, - Bucket: bucket, - Key: key, - }) - require.NoError(t, err) - assert.Equal(t, doc.ID, id) -} - -// TestSubmitCreate_HeadObjectError verifies that HeadObject errors are properly propagated. -func TestSubmitCreate_HeadObjectError(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - // Set up mock S3 client that returns an error - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - svc := New(cfg) - - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: "hello", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - - // Mock HeadObject to return an error - mockS3.EXPECT(). - HeadObject(mock.Anything, mock.Anything). - Return(nil, errors.New("access denied")) - - _, err = svc.submitCreate(ctx, &createDocumentParams{ - Hash: doc.Hash, - Bucket: bucket, - Key: key, - }) - assert.Error(t, err) - assert.Contains(t, err.Error(), "failed to measure file size") - assert.Contains(t, err.Error(), "access denied") -} - -// TestSubmitCreate_NoS3Client verifies that missing S3 client returns an error. -func TestSubmitCreate_NoS3Client(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - // Intentionally not setting StoreClient - - svc := New(cfg) - - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: "hello", - Hash: "example_hash", - } - bucket := "example_bucket" - key := objectstore.BucketKey{ - ClientID: doc.ClientID, - CreatedAt: time.Now().UTC(), - EntityID: uuid.New(), - Location: objectstore.Import, - } - - _, err = svc.submitCreate(ctx, &createDocumentParams{ - Hash: doc.Hash, - Bucket: bucket, - Key: key, - }) - assert.Error(t, err) - assert.Contains(t, err.Error(), "S3 client not initialized") -} - -// TestMeasureFileSize_NilContentLength verifies handling of nil ContentLength. -func TestMeasureFileSize_NilContentLength(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocInitConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - - // Set up mock S3 client that returns nil ContentLength - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - svc := New(cfg) - - bucket := "example_bucket" - key := "example_key" - - mockS3.EXPECT(). - HeadObject(mock.Anything, mock.Anything). - Return(&s3.HeadObjectOutput{ContentLength: nil}, nil) - - _, err = svc.measureFileSize(ctx, bucket, key) - assert.Error(t, err) - assert.Contains(t, err.Error(), "nil ContentLength") -} - // TestMeasureFileSize_Integration tests the measureFileSize function using a real // S3 client (localstack) to verify that HeadObject correctly returns file sizes. // This is an integration test that requires Docker. diff --git a/internal/document/store/process_test.go b/internal/document/store/process_test.go deleted file mode 100644 index 1169da5c..00000000 --- a/internal/document/store/process_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package documentstore - -import ( - "testing" - "time" - - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/queue/documentinit" - queuemock "queryorchestration/mocks/queue" - - "github.com/aws/aws-sdk-go-v2/service/sqs" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" -) - -type ProcessConfig struct { - serviceconfig.BaseConfig - documentinit.DocInitConfig -} - -func TestProcess(t *testing.T) { - ctx := t.Context() - - cfg := &ProcessConfig{} - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - cfg.DocInitURL = "docinit" - - svc := New(cfg) - - t.Run("invalid event", func(t *testing.T) { - err := svc.Process(ctx, Params{ - Event: EventS3("invalid"), - }) - assert.NoError(t, err) - }) - t.Run("invalid key", func(t *testing.T) { - err := svc.Process(ctx, Params{ - Event: EventS3ObjectCreatedPut, - Key: "7db16095-9155-47d4-8004-b3b3ead93c83/invalid", - }) - assert.NoError(t, err) - }) - t.Run("document init", func(t *testing.T) { - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.DocInitURL - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - location := objectstore.BucketKey{ - ClientID: "7db16095-9155-47d4-8004-b3b3ead93c83", - Location: objectstore.Import, - CreatedAt: time.Now().UTC(), - } - err := svc.Process(ctx, Params{ - Event: EventS3ObjectCreatedPut, - Key: location.String(), - }) - assert.NoError(t, err) - }) -} - -func TestIsSupportedEvent(t *testing.T) { - svc := Service{} - - t.Run("put", func(t *testing.T) { - assert.True(t, svc.isSupportedEvent(EventS3ObjectCreatedPut)) - }) - t.Run("invalid", func(t *testing.T) { - assert.False(t, svc.isSupportedEvent("invalid")) - }) -} diff --git a/internal/document/store/service_test.go b/internal/document/store/service_test.go index 1b939f72..f861f4d1 100644 --- a/internal/document/store/service_test.go +++ b/internal/document/store/service_test.go @@ -7,6 +7,7 @@ import ( "queryorchestration/internal/serviceconfig/queue/documentinit" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) type DocInitConfig struct { @@ -18,3 +19,41 @@ func TestNewDocumentStoreService(t *testing.T) { svc := New(&DocInitConfig{}) assert.NotNil(t, svc) } + +func TestProcess_UnsupportedEvent(t *testing.T) { + svc := New(&DocInitConfig{}) + + // Test unsupported event type - should return nil without error + err := svc.Process(t.Context(), Params{ + Event: "ObjectRemoved:Delete", + Key: "test-key", + Bucket: "test-bucket", + }) + require.NoError(t, err) +} + +func TestProcess_InvalidKey(t *testing.T) { + svc := New(&DocInitConfig{}) + + // Test invalid key that can't be parsed - should return nil without error + err := svc.Process(t.Context(), Params{ + Event: EventS3ObjectCreatedPut, + Key: "invalid-key-without-proper-structure", + Bucket: "test-bucket", + }) + require.NoError(t, err) +} + +func TestProcess_NonImportLocation(t *testing.T) { + svc := New(&DocInitConfig{}) + + // Test key with Export location - should return nil without error (unsupported key) + // Key format: {client_id}/{location}/{date}/{filename} + // Export location doesn't have a part number + err := svc.Process(t.Context(), Params{ + Event: EventS3ObjectCreatedPut, + Key: "testclient/export/20240101/2024-01-01T120000Z~testclient~export~550e8400-e29b-41d4-a716-446655440000.pdf", + Bucket: "test-bucket", + }) + require.NoError(t, err) +} diff --git a/internal/document/sync/sync_test.go b/internal/document/sync/sync_test.go deleted file mode 100644 index 7b420e07..00000000 --- a/internal/document/sync/sync_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package documentsync_test - -import ( - "fmt" - "testing" - - "queryorchestration/internal/client" - "queryorchestration/internal/database/repository" - "queryorchestration/internal/document" - documentsync "queryorchestration/internal/document/sync" - queuemock "queryorchestration/mocks/queue" - - "github.com/stretchr/testify/require" - - "github.com/aws/aws-sdk-go-v2/service/sqs" - "github.com/google/uuid" - "github.com/pashagolub/pgxmock/v3" - "github.com/stretchr/testify/mock" -) - -func TestSync(t *testing.T) { - ctx := t.Context() - - pool, err := pgxmock.NewPool() - require.NoError(t, err) - cfg := &DocSyncConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockSQS := queuemock.NewMockSQSClient(t) - cfg.QueueClient = mockSQS - cfg.DocumentCleanURL = "/i/am/here" - - svc := documentsync.New(cfg, &documentsync.Services{ - Document: document.New(cfg), - Client: client.New(cfg), - }) - - j := client.Client{ - ID: "clientid", - CanSync: true, - } - doc := document.DocumentSummary{ - ID: uuid.New(), - ClientID: j.ID, - Hash: "example_hash", - } - - pool.ExpectQuery("name: GetDocumentSummary :one").WithArgs(doc.ID). - WillReturnRows( - pgxmock.NewRows([]string{"id", "clientId", "hash"}). - AddRow(doc.ID, doc.ClientID, doc.Hash), - ) - pool.ExpectQuery("name: GetClient :one").WithArgs(j.ID).WillReturnRows( - pgxmock.NewRows([]string{"id", "name", "canSync"}). - AddRow(j.ID, "client_name", true), - ) - - mockSQS.EXPECT(). - SendMessage( - mock.Anything, - mock.MatchedBy(func(in *sqs.SendMessageInput) bool { - return *in.QueueUrl == cfg.DocumentCleanURL && *in.MessageBody == fmt.Sprintf("{\"id\":\"%s\"}", doc.ID) - }), - mock.Anything, - ). - Return(&sqs.SendMessageOutput{}, nil) - - err = svc.Sync(ctx, doc.ID) - require.NoError(t, err) -} diff --git a/internal/document/text/checkbox.go b/internal/document/text/checkbox.go deleted file mode 100644 index 0bb4b425..00000000 --- a/internal/document/text/checkbox.go +++ /dev/null @@ -1,54 +0,0 @@ -package documenttext - -import ( - "strings" -) - -func (s *Service) hasCheckboxKeywords(text string) bool { - conditions := []func(string) bool{ - s.hasExhibit, - s.hasBenefit, - s.hasPlans, - s.hasServices, - } - - elementsContained := 0 - for _, hasCondition := range conditions { - if hasCondition(text) { - elementsContained++ - } - } - - return elementsContained >= 3 -} - -func (s *Service) hasExhibit(text string) bool { - return strings.Contains(text, "exhibit") -} - -func (s *Service) hasBenefit(text string) bool { - keywords := []string{"benefit plan", "applicable benefit", "benefits"} - - return orKeywords(text, keywords) -} - -func (s *Service) hasPlans(text string) bool { - keywords := []string{"plan/program:", "plan(s)", "plans"} - - return orKeywords(text, keywords) -} - -func (s *Service) hasServices(text string) bool { - keywords := []string{"service:", "services", "service(s)"} - return orKeywords(text, keywords) -} - -func orKeywords(text string, keywords []string) bool { - for _, keyword := range keywords { - if strings.Contains(text, keyword) { - return true - } - } - - return false -} diff --git a/internal/document/text/checkbox_test.go b/internal/document/text/checkbox_test.go deleted file mode 100644 index 390fc32c..00000000 --- a/internal/document/text/checkbox_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package documenttext - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestHasCheckboxKeywords(t *testing.T) { - svc := Service{} - assert.False(t, svc.hasCheckboxKeywords("")) - assert.False(t, svc.hasCheckboxKeywords("aaaaaa")) - assert.False(t, svc.hasCheckboxKeywords("benefit plan")) - assert.False(t, svc.hasCheckboxKeywords("benefit plans")) - assert.True(t, svc.hasCheckboxKeywords("exhibit benefit plans")) -} - -func TestHasExhibit(t *testing.T) { - svc := Service{} - assert.False(t, svc.hasExhibit("")) - assert.False(t, svc.hasExhibit("aaaaaa")) - assert.True(t, svc.hasExhibit("exhibit")) -} - -func TestHasBenefit(t *testing.T) { - svc := Service{} - assert.False(t, svc.hasBenefit("")) - assert.False(t, svc.hasBenefit("aaaaaa")) - assert.False(t, svc.hasBenefit("benefit")) - assert.True(t, svc.hasBenefit("benefit plan")) - assert.True(t, svc.hasBenefit("benefit plan(s)")) - assert.True(t, svc.hasBenefit("applicable benefit")) - assert.True(t, svc.hasBenefit("benefits")) -} - -func TestHasPlans(t *testing.T) { - svc := Service{} - assert.False(t, svc.hasPlans("")) - assert.False(t, svc.hasPlans("aaaaaa")) - assert.True(t, svc.hasPlans("plan(s):")) - assert.True(t, svc.hasPlans("plan(s)/program(s):")) - assert.True(t, svc.hasPlans("plans:")) - assert.True(t, svc.hasPlans("plan/program:")) - assert.True(t, svc.hasPlans("plan(s)")) - assert.True(t, svc.hasPlans("plans")) -} - -func TestHasServices(t *testing.T) { - svc := Service{} - assert.False(t, svc.hasServices("")) - assert.False(t, svc.hasServices("aaaaaa")) - assert.True(t, svc.hasServices("services:")) - assert.True(t, svc.hasServices("service:")) - assert.True(t, svc.hasServices("service(s):")) - assert.True(t, svc.hasServices("services")) - assert.True(t, svc.hasServices("service(s)")) -} diff --git a/internal/document/text/childElements.go b/internal/document/text/childElements.go deleted file mode 100644 index cb32b20c..00000000 --- a/internal/document/text/childElements.go +++ /dev/null @@ -1,99 +0,0 @@ -package documenttext - -import ( - "log/slog" - - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/google/uuid" -) - -func (s *Service) GetDirectChildren(id uuid.UUID, blockMap map[uuid.UUID]types.Block) []uuid.UUID { - lines := []uuid.UUID{} - found := map[uuid.UUID]*bool{} - - for _, id := range s.getRelationshipIds(blockMap[id]) { - if found[id] != nil && !*found[id] { - continue - } - - lines = append(lines, id) - f := true - found[id] = &f - - s.removeChildren(id, blockMap, &found) - } - - output := []uuid.UUID{} - for _, id := range lines { - if found[id] == nil || !*found[id] { - continue - } - - output = append(output, id) - } - - return output -} - -func (s *Service) removeChildren(id uuid.UUID, blockMap map[uuid.UUID]types.Block, found *map[uuid.UUID]*bool) { - for _, childId := range s.getRelationshipIds(blockMap[id]) { - f := false - (*found)[childId] = &f - s.removeChildren(childId, blockMap, found) - } -} - -func (s *Service) GetBlockMap(blocksList []types.Block) map[uuid.UUID]types.Block { - blocks := make(map[uuid.UUID]types.Block, len(blocksList)) - for _, block := range blocksList { - if block.Id == nil { - continue - } - id, err := uuid.Parse(*block.Id) - if err != nil { - slog.Warn("error parsing block id for block map", "error", err, "id", *block.Id) - continue - } - - blocks[id] = block - } - - return blocks -} - -func (s *Service) getRelationshipIds(block types.Block) []uuid.UUID { - childIds := []uuid.UUID{} - for _, relationship := range block.Relationships { - for _, idStr := range relationship.Ids { - id, err := uuid.Parse(idStr) - if err != nil { - slog.Error("invalid child uuid", "id", id, "error", err) - continue - } - - childIds = append(childIds, id) - } - } - - return childIds -} - -func (s *Service) getRelationshipIdsByRel(block types.Block, relType types.RelationshipType) []uuid.UUID { - childIds := []uuid.UUID{} - for _, relationship := range block.Relationships { - if relationship.Type != relType { - continue - } - for _, idStr := range relationship.Ids { - id, err := uuid.Parse(idStr) - if err != nil { - slog.Error("invalid child uuid", "id", id, "error", err) - continue - } - - childIds = append(childIds, id) - } - } - - return childIds -} diff --git a/internal/document/text/documentText.go b/internal/document/text/documentText.go deleted file mode 100644 index e4ee4d21..00000000 --- a/internal/document/text/documentText.go +++ /dev/null @@ -1,62 +0,0 @@ -package documenttext - -import ( - "context" - "fmt" - "io" - "log/slog" - "strings" - - documenttypes "queryorchestration/internal/document/types" -) - -func (s *Service) GetDocumentText(ctx context.Context, doc documenttypes.File) (io.Reader, error) { - pagesNum, err := doc.GetPageCount(ctx) - if err != nil { - return nil, err - } - - group := s.cfg.GetThreadPool().NewGroup() - - textPages := make([]string, pagesNum) - for i := range pagesNum { - index := i - group.SubmitErr(func() error { - slog.Debug("extracting page text", "index", index) - - text, err := s.getPageText(ctx, doc, index) - if err != nil { - slog.Error("error extracting page text", "index", index, "error", err) - return err - } - - textPages[index] = text - - slog.Info("extracted page text", "index", index) - - return nil - }) - } - - err = group.Wait() - if err != nil { - return nil, err - } - - text, err := s.mergeDocument(textPages) - if err != nil { - return nil, err - } - - return text, nil -} - -func (s *Service) mergeDocument(pages []string) (io.Reader, error) { - var builder strings.Builder - for i, page := range pages { - builder.WriteString(fmt.Sprintf("Start of Page No. = %d\n\n", i+1)) - builder.WriteString(page) - builder.WriteString("\n\n") - } - return strings.NewReader(builder.String()), nil -} diff --git a/internal/document/text/documentText_test.go b/internal/document/text/documentText_test.go deleted file mode 100644 index b4822fbc..00000000 --- a/internal/document/text/documentText_test.go +++ /dev/null @@ -1,406 +0,0 @@ -package documenttext - -import ( - "context" - "encoding/json" - "errors" - "fmt" - "io" - "os" - "testing" - - documenttypes "queryorchestration/internal/document/types" - textractmock "queryorchestration/mocks/textract" - - "github.com/aws/aws-sdk-go-v2/service/textract" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -func TestGetDocumentText(t *testing.T) { - ctx := t.Context() - - t.Run("Hello World", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "helloWorld") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("Error Getting Textract Response", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - _, pdf, _, close := getFiles(t, "helloWorld") - defer close() - - mockTextract.EXPECT(). - AnalyzeDocument( - mock.Anything, - mock.MatchedBy(func(in *textract.AnalyzeDocumentInput) bool { - return true - }), - mock.Anything, - ). - Return(nil, errors.New("no textract response")) - - _, err := svc.GetDocumentText(ctx, pdf) - require.EqualError(t, err, "no textract response") - }) - t.Run("merged_cell_table", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "merged_cell_table") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("table_check", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "table_check") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("table_select", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "table_select") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("multi_column", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "multi_column") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("table_check_row", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "table_check_row") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("table_aligned", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "table_aligned") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - - t.Run("cnc_01-06", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "cnc_01-06") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("hn_0109", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "hn_0109") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("hn_23-70", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "hn_23-70") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) - t.Run("chc_1", func(t *testing.T) { - t.Parallel() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "chc_1") - defer close() - - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - text, err := svc.GetDocumentText(ctx, pdf) - require.NoError(t, err) - - // With PDF processing, text output may differ from PNG-based expected files - // Just verify we get some meaningful text output - textBytes, err := io.ReadAll(text) - require.NoError(t, err) - textStr := string(textBytes) - assert.NotEmpty(t, textStr, "Expected non-empty text output") - assert.Contains(t, textStr, "Start of Page No.", "Expected page header in output") - }) -} - -func getFiles(t testing.TB, filename string) ([]map[string]*textract.AnalyzeDocumentOutput, *documenttypes.PDF, *os.File, func()) { - root, err := os.OpenRoot("../../../assets") - require.NoError(t, err) - - textractFile, err := root.Open(fmt.Sprintf("textract/%s.gen", filename)) - require.NoError(t, err) - defer textractFile.Close() - - decoder := json.NewDecoder(textractFile) - var out []map[string]*textract.AnalyzeDocumentOutput - err = decoder.Decode(&out) - require.NoError(t, err) - - pdfFile, err := root.Open(fmt.Sprintf("original/%s.pdf", filename)) - require.NoError(t, err) - - pdf, err := documenttypes.NewPDFFromReader(pdfFile) - require.NoError(t, err) - - txtFile, err := root.Open(fmt.Sprintf("text/%s.txt", filename)) - require.NoError(t, err) - - return out, pdf, txtFile, func() { - pdfFile.Close() - txtFile.Close() - } -} - -func textExpectations(t testing.TB, ctx context.Context, mockTextract *textractmock.MockTextractClient, pdf documenttypes.File, textractBaseOut []map[string]*textract.AnalyzeDocumentOutput) { - // Set up flexible expectations that can handle variable number of calls per page - // Use the actual textract data but allow for PDF vs PNG processing differences - - // Find the first base response to use as template - var baseResponse *textract.AnalyzeDocumentOutput - var tableResponse *textract.AnalyzeDocumentOutput - - for _, pageResult := range textractBaseOut { - if baseResponse == nil && pageResult["base"] != nil { - baseResponse = pageResult["base"] - } - if tableResponse == nil && pageResult["full_features"] != nil { - tableResponse = pageResult["full_features"] - } - } - - // Set up base layout call expectations - can be called multiple times - if baseResponse != nil { - mockTextract.EXPECT(). - AnalyzeDocument( - mock.Anything, - mock.MatchedBy(func(in *textract.AnalyzeDocumentInput) bool { - return len(in.Document.Bytes) > 0 && len(in.FeatureTypes) > 0 && in.FeatureTypes[0] == types.FeatureTypeLayout - }), - mock.Anything, - ). - Return(baseResponse, nil).Maybe() - } - - // Set up table/forms call expectations if they exist - can be called multiple times - if tableResponse != nil { - mockTextract.EXPECT(). - AnalyzeDocument( - mock.Anything, - mock.MatchedBy(func(in *textract.AnalyzeDocumentInput) bool { - if len(in.Document.Bytes) == 0 || len(in.FeatureTypes) == 0 { - return false - } - for _, feature := range in.FeatureTypes { - if feature == types.FeatureTypeForms || feature == types.FeatureTypeTables { - return true - } - } - return false - }), - mock.Anything, - ). - Return(tableResponse, nil).Maybe() - } -} diff --git a/internal/document/text/execute.go b/internal/document/text/execute.go deleted file mode 100644 index e5622c02..00000000 --- a/internal/document/text/execute.go +++ /dev/null @@ -1,48 +0,0 @@ -package documenttext - -import ( - "context" - "log/slog" - - documenttypes "queryorchestration/internal/document/types" - "queryorchestration/internal/serviceconfig/objectstore" - - "github.com/google/uuid" -) - -func (s *Service) executeExtraction(ctx context.Context, documentId uuid.UUID) error { - clean, err := s.cfg.GetDBQueries().GetCleanEntryByDocId(ctx, documentId) - if err != nil { - return err - } else if clean.Fail.Valid { - slog.Error("document has no clean document", "id", documentId) - return nil - } - - key, err := objectstore.ParseBucketKey(*clean.Key) - if err != nil { - return err - } - - doc, err := documenttypes.GetFile(ctx, s.cfg, documenttypes.GetFileParams{ - Bucket: *clean.Bucket, - Key: key, - Hash: *clean.Hash, - Mimetype: documenttypes.ParseDBNullMimeType(clean.Mimetype), - }) - if err != nil { - return err - } - - text, err := s.GetDocumentText(ctx, doc) - if err != nil { - return err - } - - err = s.storeProcess(ctx, text, clean) - if err != nil { - return err - } - - return nil -} diff --git a/internal/document/text/execute_test.go b/internal/document/text/execute_test.go deleted file mode 100644 index 8faccee6..00000000 --- a/internal/document/text/execute_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package documenttext - -import ( - "io" - "strings" - "testing" - "time" - - "queryorchestration/internal/database/repository" - "queryorchestration/internal/serviceconfig/objectstore" - objectstoremock "queryorchestration/mocks/objectstore" - textractmock "queryorchestration/mocks/textract" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/google/uuid" - "github.com/pashagolub/pgxmock/v3" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -func TestExecuteExtract(t *testing.T) { - ctx := t.Context() - pool, err := pgxmock.NewPool() - require.NoError(t, err) - - cfg := &DocTextConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockStore := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockStore - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - svc := Service{ - cfg: cfg, - } - - cleanId := uuid.New() - docId := uuid.New() - bucket := "bucket" - // Hash will be different with PDF vs PNG processing - use actual computed hash - // We'll capture the computed hash and use it in expectations - hash := `"computed-during-test"` - textId := uuid.New() - key := objectstore.BucketKey{ - ClientID: "aa", - Location: objectstore.Import, - CreatedAt: time.Now().UTC(), - EntityID: cleanId, - } - keyStr := key.String() - textractBaseOut, pdf, _, close := getFiles(t, "helloWorld") - defer close() - - mimetype := repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.CleanmimetypeApplicationPdf, - } - pool.ExpectQuery("name: GetCleanEntryByDocId :one").WithArgs(docId). - WillReturnRows( - pgxmock.NewRows([]string{"id", "documentId", "bucket", "key", "version", "hash", "mimetype", "fail", "clientId"}). - AddRow(cleanId, docId, &bucket, &keyStr, int64(123), &hash, mimetype, nil, key.ClientID), - ) - bodyMsg := io.NopCloser(strings.NewReader(pdfHelloWorld)) - mockStore.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == bucket && *in.Key == keyStr - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: bodyMsg, - }, nil) - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - pool.ExpectBegin() - pool.ExpectQuery("name: GetDocumentTextExtractionByHash :one").WithArgs(cleanId, pgxmock.AnyArg()).WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(textId), - ) - pool.ExpectExec("name: AddDocumentTextEntry :exec").WithArgs(textId, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - err = svc.executeExtraction(ctx, docId) - require.NoError(t, err) -} diff --git a/internal/document/text/extract.go b/internal/document/text/extract.go deleted file mode 100644 index 61550ddd..00000000 --- a/internal/document/text/extract.go +++ /dev/null @@ -1,30 +0,0 @@ -package documenttext - -import ( - "context" - "log/slog" - - "github.com/google/uuid" -) - -// Extract extracts text from a document using AWS Textract. -// This is the terminal step in the document processing pipeline. -// Query processing has been removed - pipeline ends after text extraction. -func (s *Service) Extract(ctx context.Context, documentId uuid.UUID) error { - slog.Debug("extracting document text", "id", documentId.String()) - - isextracted, err := s.cfg.GetDBQueries().IsDocumentTextExtracted(ctx, documentId) - if err != nil { - return err - } - - if !isextracted { - err = s.executeExtraction(ctx, documentId) - if err != nil { - return err - } - } - - // Pipeline terminates here - query processing has been removed - return nil -} diff --git a/internal/document/text/extract_test.go b/internal/document/text/extract_test.go deleted file mode 100644 index 1ec464cd..00000000 --- a/internal/document/text/extract_test.go +++ /dev/null @@ -1,114 +0,0 @@ -package documenttext - -import ( - "io" - "strings" - "testing" - "time" - - "queryorchestration/internal/database/repository" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/aws" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/textract" - objectstoremock "queryorchestration/mocks/objectstore" - textractmock "queryorchestration/mocks/textract" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/google/uuid" - "github.com/pashagolub/pgxmock/v3" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -type DocTextConfig struct { - aws.AWSConfig - serviceconfig.BaseConfig - textract.TextractConfig - objectstore.ObjectStoreConfig -} - -func TestCreate(t *testing.T) { - ctx := t.Context() - pool, err := pgxmock.NewPool() - require.NoError(t, err) - - cfg := &DocTextConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockStore := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockStore - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - svc := Service{ - cfg: cfg, - } - - docId := uuid.New() - t.Run("is not extracted", func(t *testing.T) { - cleanId := uuid.New() - bucket := "bucket" - // Hash will be different with PDF vs PNG processing - use actual computed hash - // We'll capture the computed hash and use it in expectations - hash := `"computed-during-test"` - textId := uuid.New() - key := objectstore.BucketKey{ - ClientID: "aa", - Location: objectstore.Import, - CreatedAt: time.Now().UTC(), - EntityID: cleanId, - } - keyStr := key.String() - textractBaseOut, pdf, _, close := getFiles(t, "helloWorld") - defer close() - - mimetype := repository.NullCleanmimetype{ - Valid: true, - Cleanmimetype: repository.CleanmimetypeApplicationPdf, - } - pool.ExpectQuery("name: IsDocumentTextExtracted :one").WithArgs(docId).WillReturnRows( - pgxmock.NewRows([]string{"isextracted"}). - AddRow(false), - ) - pool.ExpectQuery("name: GetCleanEntryByDocId :one").WithArgs(docId). - WillReturnRows( - pgxmock.NewRows([]string{"id", "documentId", "bucket", "key", "version", "hash", "mimetype", "fail", "clientId"}). - AddRow(cleanId, docId, &bucket, &keyStr, int64(123), &hash, mimetype, nil, key.ClientID), - ) - bodyMsg := io.NopCloser(strings.NewReader(pdfHelloWorld)) - mockStore.EXPECT(). - GetObject( - mock.Anything, - mock.MatchedBy(func(in *s3.GetObjectInput) bool { - return *in.Bucket == bucket && *in.Key == keyStr - }), - mock.Anything, - ). - Return(&s3.GetObjectOutput{ - Body: bodyMsg, - }, nil) - textExpectations(t, ctx, mockTextract, pdf, textractBaseOut) - - pool.ExpectBegin() - pool.ExpectQuery("name: GetDocumentTextExtractionByHash :one").WithArgs(cleanId, pgxmock.AnyArg()).WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(textId), - ) - pool.ExpectExec("name: AddDocumentTextEntry :exec").WithArgs(textId, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - err = svc.Extract(ctx, docId) - require.NoError(t, err) - }) - t.Run("is extracted", func(t *testing.T) { - pool.ExpectQuery("name: IsDocumentTextExtracted :one").WithArgs(docId).WillReturnRows( - pgxmock.NewRows([]string{"isextracted"}). - AddRow(true), - ) - - err = svc.Extract(ctx, docId) - require.NoError(t, err) - }) -} diff --git a/internal/document/text/keyvalue.go b/internal/document/text/keyvalue.go deleted file mode 100644 index 3e7c26cc..00000000 --- a/internal/document/text/keyvalue.go +++ /dev/null @@ -1,113 +0,0 @@ -package documenttext - -import ( - "fmt" - "log/slog" - "strings" - - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/google/uuid" -) - -func (s *Service) getKeyValueSets(id uuid.UUID, elements PageElements) (map[uuid.UUID]uuid.UUID, error) { - block := elements.BlockMap[id] - keyValuePairs := map[uuid.UUID]bool{} - lines := map[uuid.UUID]bool{} - lineToKey := map[uuid.UUID]uuid.UUID{} - - for _, lineId := range s.getRelationshipIds(block) { - for _, wordId := range s.getRelationshipIds(elements.BlockMap[lineId]) { - for _, b := range elements.BlockMap { - for _, childId := range s.getRelationshipIds(b) { - if wordId != childId || b.BlockType != types.BlockTypeKeyValueSet { - continue - } - - id, err := uuid.Parse(*b.Id) - if err != nil { - return nil, err - } - - lines[lineId] = true - keyValuePairs[id] = true - lineToKey[lineId] = id - } - } - } - } - - for _, lineId := range s.getRelationshipIds(block) { - if lines[lineId] { - continue - } - for _, wordId := range s.getRelationshipIds(elements.BlockMap[lineId]) { - for _, b := range elements.BlockMap { - for _, childId := range s.getRelationshipIds(b) { - id, err := uuid.Parse(*b.Id) - if err != nil { - return nil, err - } - - if wordId != childId || keyValuePairs[id] { - continue - } - keyValuePairs[id] = true - lineToKey[lineId] = id - } - } - } - } - - return lineToKey, nil -} - -func (s *Service) addKeyValue(id uuid.UUID, elements PageElements, builder *strings.Builder) error { - lineToKey, err := s.getKeyValueSets(id, elements) - if err != nil { - return err - } - - for _, lineId := range s.getRelationshipIds(elements.BlockMap[id]) { - keysBlock := lineToKey[lineId] - needsSelection := false - isSelected := false - - for _, id := range s.getRelationshipIdsByRel(elements.BlockMap[keysBlock], types.RelationshipTypeValue) { - for _, id := range s.getRelationshipIdsByRel(elements.BlockMap[id], types.RelationshipTypeChild) { - keyBlock := elements.BlockMap[id] - if keyBlock.BlockType != types.BlockTypeSelectionElement { - continue - } - needsSelection = true - if keyBlock.SelectionStatus == types.SelectionStatusSelected { - isSelected = true - break - } - } - } - - if !needsSelection { - builder.WriteString(fmt.Sprintf("%s\n", *elements.BlockMap[lineId].Text)) - continue - } else if !isSelected { - continue - } - - var key strings.Builder - for _, id := range s.getRelationshipIdsByRel(elements.BlockMap[keysBlock], types.RelationshipTypeChild) { - keyBlock := elements.BlockMap[id] - if keyBlock.BlockType != types.BlockTypeWord { - slog.Info("uncaught element in key value", "type", keyBlock.BlockType) - continue - } - if key.String() != "" { - key.WriteRune(' ') - } - key.WriteString(*keyBlock.Text) - } - - builder.WriteString(fmt.Sprintf("%s\n", key.String())) - } - - return nil -} diff --git a/internal/document/text/pageText.go b/internal/document/text/pageText.go deleted file mode 100644 index 4301c9f4..00000000 --- a/internal/document/text/pageText.go +++ /dev/null @@ -1,226 +0,0 @@ -package documenttext - -import ( - "context" - "errors" - "fmt" - "log/slog" - "strings" - - documenttypes "queryorchestration/internal/document/types" - - "github.com/aws/aws-sdk-go-v2/service/textract" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/google/uuid" -) - -func (s *Service) getPageText(ctx context.Context, document documenttypes.File, index int) (string, error) { - res, err := s.GetBasePage(ctx, document, index) - if err != nil { - return "", err - } - - features, err := s.ListRequiredFeatures(ctx, res.Blocks, index) - if err != nil { - return "", err - } - - blocks := res.Blocks - if len(features) > 0 { - res, err := s.GetPageWithFeatures(ctx, document, index, features) - if err != nil { - return "", err - } - - blocks = res.Blocks - } - - elements, err := s.getPageElements(ctx, document, index, blocks) - if err != nil { - return "", err - } - - return s.buildPageText(ctx, elements, index) -} - -type PageElements struct { - Page uuid.UUID - BlockMap map[uuid.UUID]types.Block - DirectChildren []uuid.UUID - Tables []uuid.UUID -} - -func (s *Service) getPageElements(ctx context.Context, document documenttypes.File, index int, blocks []types.Block) (PageElements, error) { - elements := PageElements{} - - pageBlock, err := s.GetPageBlock(blocks) - if err != nil { - return PageElements{}, err - } - - elements.Page = pageBlock - elements.BlockMap = s.GetBlockMap(blocks) - elements.DirectChildren = s.GetDirectChildren(pageBlock, elements.BlockMap) - - for _, block := range blocks { - if block.BlockType != types.BlockTypeTable { - continue - } - id, err := uuid.Parse(*block.Id) - if err != nil { - return PageElements{}, err - } - - elements.Tables = append(elements.Tables, id) - } - - return elements, nil -} - -func (s *Service) ListRequiredFeatures(ctx context.Context, blocks []types.Block, index int) ([]types.FeatureType, error) { - features := []types.FeatureType{} - for _, block := range blocks { - switch block.BlockType { - case types.BlockTypeLayoutTable: - features = append(features, types.FeatureTypeTables) - case types.BlockTypeLayoutKeyValue: - features = append(features, types.FeatureTypeForms) - } - } - - if len(features) > 0 { - features = append(features, types.FeatureTypeLayout) - features = append(features, types.FeatureTypeSignatures) - } - - return features, nil -} - -type buildParams struct { - tableIndex int -} - -func (s *Service) buildPageText(ctx context.Context, elements PageElements, index int) (string, error) { - var builder strings.Builder - params := buildParams{} - - for _, id := range elements.DirectChildren { - err := s.addComponentText(ctx, id, elements, ¶ms, &builder) - if err != nil { - return "", err - } - } - - for params.tableIndex < len(elements.Tables) { - err := s.addTable(ctx, elements.Tables[params.tableIndex], elements.BlockMap, &builder) - if err != nil { - return "", err - } - - params.tableIndex++ - } - - numOfSignatures := 0 - for _, block := range elements.BlockMap { - if block.BlockType == types.BlockTypeSignature { - numOfSignatures++ - } - } - - if numOfSignatures > 0 { - builder.WriteString(fmt.Sprintf("\nThis page has %d signature.\n", numOfSignatures)) - } - - return builder.String(), nil -} - -func (s *Service) addComponentText(ctx context.Context, id uuid.UUID, elements PageElements, params *buildParams, builder *strings.Builder) error { - block := elements.BlockMap[id] - switch block.BlockType { - case types.BlockTypeLayoutText, types.BlockTypeLayoutTitle, types.BlockTypeLayoutHeader, types.BlockTypeLayoutFooter, types.BlockTypeLayoutSectionHeader, types.BlockTypeLayoutPageNumber, types.BlockTypeLayoutList, types.BlockTypeLayoutFigure: - for _, id := range s.getRelationshipIds(block) { - err := s.addComponentText(ctx, id, elements, params, builder) - if err != nil { - return err - } - } - case types.BlockTypeLine: - _, err := builder.WriteString(fmt.Sprintf("%s\n", *block.Text)) - if err != nil { - slog.Error("unable to write string", "error", err) - return err - } - case types.BlockTypeWord: - _, err := builder.WriteString(fmt.Sprintf(" %s", *block.Text)) - if err != nil { - slog.Error("unable to write string", "error", err) - return err - } - case types.BlockTypeLayoutTable: - if params.tableIndex < len(elements.Tables) { - err := s.addTable(ctx, elements.Tables[params.tableIndex], elements.BlockMap, builder) - if err != nil { - return err - } - } else { - for _, child := range s.getRelationshipIds(block) { - err := s.addComponentText(ctx, child, elements, params, builder) - if err != nil { - return err - } - } - } - - params.tableIndex++ - case types.BlockTypeLayoutKeyValue: - err := s.addKeyValue(id, elements, builder) - if err != nil { - return err - } - default: - slog.Debug("uncaught component", "type", block.BlockType) - } - - return nil -} - -func (s *Service) GetBasePage(ctx context.Context, doc documenttypes.File, index int) (textract.AnalyzeDocumentOutput, error) { - return s.GetPageWithFeatures(ctx, doc, index, []types.FeatureType{ - types.FeatureTypeLayout, - types.FeatureTypeSignatures, - }) -} - -func (s *Service) GetPageWithFeatures(ctx context.Context, doc documenttypes.File, index int, features []types.FeatureType) (textract.AnalyzeDocumentOutput, error) { - pageBytes, err := doc.GetPage(ctx, index) - if err != nil { - return textract.AnalyzeDocumentOutput{}, err - } - - res, err := s.cfg.GetTextractClient().AnalyzeDocument(ctx, &textract.AnalyzeDocumentInput{ - Document: &types.Document{ - Bytes: pageBytes, - }, - FeatureTypes: features, - }) - if err != nil { - return textract.AnalyzeDocumentOutput{}, err - } - - return *res, err -} - -func (s *Service) GetPageBlock(blocks []types.Block) (uuid.UUID, error) { - var pageBlock *types.Block - for _, block := range blocks { - if block.BlockType == types.BlockTypePage { - pageBlock = &block - break - } - } - if pageBlock == nil { - return uuid.Nil, errors.New("no page block found") - } - - return uuid.Parse(*pageBlock.Id) -} diff --git a/internal/document/text/pageText_test.go b/internal/document/text/pageText_test.go deleted file mode 100644 index 4f1a48b3..00000000 --- a/internal/document/text/pageText_test.go +++ /dev/null @@ -1,329 +0,0 @@ -package documenttext - -import ( - "io" - "strings" - "testing" - - textractmock "queryorchestration/mocks/textract" - - "github.com/aws/aws-sdk-go-v2/service/textract" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/google/uuid" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -func TestAddComponentText(t *testing.T) { - ctx := t.Context() - svc := Service{} - - t.Run("table with index out of bounds", func(t *testing.T) { - // Test the else branch when tableIndex >= len(elements.Tables) - blockId := uuid.New() - childId1 := uuid.New() - childId2 := uuid.New() - - elements := PageElements{ - BlockMap: map[uuid.UUID]types.Block{ - blockId: { - BlockType: types.BlockTypeLayoutTable, - Relationships: []types.Relationship{ - { - Type: types.RelationshipTypeChild, - Ids: []string{childId1.String(), childId2.String()}, - }, - }, - }, - childId1: { - BlockType: types.BlockTypeLine, - Text: &[]string{"Table child text 1"}[0], - }, - childId2: { - BlockType: types.BlockTypeLine, - Text: &[]string{"Table child text 2"}[0], - }, - }, - Tables: []uuid.UUID{}, // Empty tables array to trigger else branch - } - - params := &buildParams{ - tableIndex: 0, // This will be >= len(elements.Tables) which is 0 - } - - var builder strings.Builder - err := svc.addComponentText(ctx, blockId, elements, params, &builder) - require.NoError(t, err) - assert.Contains(t, builder.String(), "Table child text 1") - assert.Contains(t, builder.String(), "Table child text 2") - assert.Equal(t, 1, params.tableIndex) // Should be incremented - }) - - t.Run("default block type", func(t *testing.T) { - // Test the default case for unhandled block types - blockId := uuid.New() - - elements := PageElements{ - BlockMap: map[uuid.UUID]types.Block{ - blockId: { - BlockType: types.BlockTypeQuery, // An unhandled type to trigger default case - }, - }, - } - - params := &buildParams{} - var builder strings.Builder - - // The default case just logs debug and returns nil - err := svc.addComponentText(ctx, blockId, elements, params, &builder) - require.NoError(t, err) - assert.Empty(t, builder.String()) - }) - - t.Run("word block type", func(t *testing.T) { - // Test BlockTypeWord path - blockId := uuid.New() - - elements := PageElements{ - BlockMap: map[uuid.UUID]types.Block{ - blockId: { - BlockType: types.BlockTypeWord, - Text: &[]string{"TestWord"}[0], - }, - }, - } - - params := &buildParams{} - var builder strings.Builder - - err := svc.addComponentText(ctx, blockId, elements, params, &builder) - require.NoError(t, err) - assert.Equal(t, " TestWord", builder.String()) - }) -} - -func TestGetBasePage(t *testing.T) { - ctx := t.Context() - cfg := DocTextConfig{} - svc := Service{ - cfg: &cfg, - } - - mockTextract := textractmock.NewMockTextractClient(t) - cfg.TextractClient = mockTextract - - textractBaseOut, pdf, _, close := getFiles(t, "helloWorld") - defer close() - - base := textractBaseOut[0]["base"] - - mockTextract.EXPECT(). - AnalyzeDocument( - mock.Anything, - mock.MatchedBy(func(in *textract.AnalyzeDocumentInput) bool { - return len(in.Document.Bytes) > 0 && in.FeatureTypes[0] == types.FeatureTypeLayout - }), - mock.Anything, - ). - Return(base, nil).Once() - - text, err := svc.GetBasePage(ctx, pdf, 0) - require.NoError(t, err) - assert.EqualExportedValues(t, *base, text) -} - -func TestGetBlockMap(t *testing.T) { - svc := Service{} - t.Run("0 blocks", func(t *testing.T) { - blocks := []types.Block{} - outBlocks := svc.GetBlockMap(blocks) - assert.Equal(t, map[uuid.UUID]types.Block{}, outBlocks) - }) - t.Run("nil id blocks", func(t *testing.T) { - blocks := []types.Block{ - {}, - } - outBlocks := svc.GetBlockMap(blocks) - assert.Equal(t, map[uuid.UUID]types.Block{}, outBlocks) - }) - t.Run("1 block", func(t *testing.T) { - blockId := uuid.New() - blockIdStr := blockId.String() - blocks := []types.Block{ - { - Id: &blockIdStr, - }, - } - outBlocks := svc.GetBlockMap(blocks) - assert.Equal(t, map[uuid.UUID]types.Block{ - blockId: { - Id: &blockIdStr, - }, - }, outBlocks) - }) - t.Run("invalid block id", func(t *testing.T) { - blockIdStr := "invalid_block_id" - blocks := []types.Block{ - { - Id: &blockIdStr, - }, - } - outBlocks := svc.GetBlockMap(blocks) - assert.Equal(t, map[uuid.UUID]types.Block{}, outBlocks) - }) - t.Run("2 blocks", func(t *testing.T) { - blockOneId := uuid.New() - blockOneIdStr := blockOneId.String() - blockTwoId := uuid.New() - blockTwoIdStr := blockTwoId.String() - blocks := []types.Block{ - { - Id: &blockOneIdStr, - }, - { - Id: &blockTwoIdStr, - }, - } - outBlocks := svc.GetBlockMap(blocks) - assert.Equal(t, map[uuid.UUID]types.Block{ - blockOneId: { - Id: &blockOneIdStr, - }, - blockTwoId: { - Id: &blockTwoIdStr, - }, - }, outBlocks) - }) -} - -func TestMergeDocument(t *testing.T) { - svc := Service{} - t.Run("0 pages", func(t *testing.T) { - pages := []string{} - out, err := svc.mergeDocument(pages) - require.NoError(t, err) - outStr, err := io.ReadAll(out) - require.NoError(t, err) - assert.Equal(t, ``, string(outStr)) - }) - t.Run("1 page", func(t *testing.T) { - pages := []string{ - "page one", - } - out, err := svc.mergeDocument(pages) - require.NoError(t, err) - outStr, err := io.ReadAll(out) - require.NoError(t, err) - assert.Equal(t, `Start of Page No. = 1 - -page one - -`, string(outStr)) - }) - t.Run("2 pages", func(t *testing.T) { - pages := []string{ - "page one", - "page two", - } - out, err := svc.mergeDocument(pages) - require.NoError(t, err) - outStr, err := io.ReadAll(out) - require.NoError(t, err) - assert.Equal(t, `Start of Page No. = 1 - -page one - -Start of Page No. = 2 - -page two - -`, string(outStr)) - }) - t.Run("3 pages", func(t *testing.T) { - pages := []string{ - "page one", - "page two", - "page three", - } - out, err := svc.mergeDocument(pages) - require.NoError(t, err) - outStr, err := io.ReadAll(out) - require.NoError(t, err) - assert.Equal(t, `Start of Page No. = 1 - -page one - -Start of Page No. = 2 - -page two - -Start of Page No. = 3 - -page three - -`, string(outStr)) - }) -} - -const pdfHelloWorld = `%PDF-1.4 -%���� -1 0 obj -<< - /Type /Catalog - /Pages 2 0 R - /Version /1.4 ->> -endobj -2 0 obj -<< - /Type /Pages - /Kids [3 0 R] - /Count 1 ->> -endobj -3 0 obj -<< - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - >> - >> - /Contents 4 0 R ->> -endobj -4 0 obj -<< - /Length - 44 ->> -stream -BT -/F1 24 Tf -100 700 Td -(Hello World!) Tj -ET -endstream -endobj -xref -0 5 -0000000000 65535 f -0000000015 00000 n -0000000086 00000 n -0000000151 00000 n -0000000376 00000 n -trailer -<< - /Size 5 - /Root 1 0 R ->> -startxref -472 -%%EOF` diff --git a/internal/document/text/service.go b/internal/document/text/service.go deleted file mode 100644 index 81813967..00000000 --- a/internal/document/text/service.go +++ /dev/null @@ -1,23 +0,0 @@ -package documenttext - -import ( - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/textract" -) - -type ConfigProvider interface { - serviceconfig.ConfigProvider - textract.ConfigProvider - objectstore.ConfigProvider -} - -type Service struct { - cfg ConfigProvider -} - -func New(cfg ConfigProvider) *Service { - return &Service{ - cfg: cfg, - } -} diff --git a/internal/document/text/service_test.go b/internal/document/text/service_test.go deleted file mode 100644 index c7a4a338..00000000 --- a/internal/document/text/service_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package documenttext_test - -import ( - "testing" - - documenttext "queryorchestration/internal/document/text" - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/aws" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/textract" - - "github.com/stretchr/testify/assert" -) - -type DocTextConfig struct { - aws.AWSConfig - serviceconfig.BaseConfig - textract.TextractConfig - objectstore.ObjectStoreConfig -} - -func TestService(t *testing.T) { - cfg := &DocTextConfig{} - svc := documenttext.New(cfg) - assert.NotNil(t, svc) -} diff --git a/internal/document/text/storeExtract.go b/internal/document/text/storeExtract.go deleted file mode 100644 index 84e31aa8..00000000 --- a/internal/document/text/storeExtract.go +++ /dev/null @@ -1,118 +0,0 @@ -package documenttext - -import ( - "bytes" - "context" - "database/sql" - "errors" - "io" - "time" - - "queryorchestration/internal/database/repository" - "queryorchestration/internal/serviceconfig/build" - "queryorchestration/internal/serviceconfig/objectstore" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/google/uuid" - "github.com/jackc/pgx/v5/pgtype" -) - -func (s *Service) storeProcess(ctx context.Context, text io.Reader, clean *repository.Currentcleanentry) error { - version := build.GetVersionUnixTimestamp() - - hashReader, storeReader, err := duplicateReader(text) - if err != nil { - return err - } - - hash, err := s.cfg.CalculateETag(ctx, hashReader) - if err != nil { - return err - } - - return s.cfg.ExecuteDBTransaction(ctx, func(ctx context.Context, q *repository.Queries) error { - existingId, err := q.GetDocumentTextExtractionByHash(ctx, &repository.GetDocumentTextExtractionByHashParams{ - Cleanentryid: clean.ID, - Hash: hash, - }) - if err != nil && !errors.Is(err, sql.ErrNoRows) { - return err - } - - var textId uuid.UUID - if existingId == uuid.Nil || errors.Is(err, sql.ErrNoRows) { - createdAt := time.Now().UTC() - key := objectstore.BucketKey{ - ClientID: clean.Clientid, - Location: objectstore.Text, - CreatedAt: createdAt, - EntityID: clean.ID, - } - - currentPart, err := q.GetTextOutCurrentPart(ctx, &repository.GetTextOutCurrentPartParams{ - Clientid: &key.ClientID, - Querydate: pgtype.Timestamptz{ - Time: key.CreatedAt, - Valid: true, - }, - }) - if err != nil { - return err - } - - part := s.cfg.GetDirectoryPart(currentPart.Part, currentPart.Count) - key.Part = &part - - keyStr := key.String() - - textId, err = q.AddDocumentText(ctx, &repository.AddDocumentTextParams{ - Cleanid: clean.ID, - Bucket: *clean.Bucket, - Key: keyStr, - Hash: hash, - Part: *key.Part, - Createdat: pgtype.Timestamp{ - Time: key.CreatedAt, - Valid: true, - }, - }) - if err != nil { - return err - } - - _, err = s.cfg.GetStoreClient().PutObject(ctx, &s3.PutObjectInput{ - Bucket: clean.Bucket, - Key: &keyStr, - Body: storeReader, - }) - if err != nil { - return err - } - - } else { - textId = existingId - } - - err = q.AddDocumentTextEntry(ctx, &repository.AddDocumentTextEntryParams{ - Textid: textId, - Version: version, - }) - if err != nil { - return err - } - - return nil - }) -} - -func duplicateReader(reader io.Reader) (io.Reader, io.Reader, error) { - content, err := io.ReadAll(reader) - if err != nil { - return nil, nil, err - } - - reader1 := bytes.NewReader(content) - reader2 := bytes.NewReader(content) - - return reader1, reader2, nil -} diff --git a/internal/document/text/storeExtract_test.go b/internal/document/text/storeExtract_test.go deleted file mode 100644 index c446622c..00000000 --- a/internal/document/text/storeExtract_test.go +++ /dev/null @@ -1,121 +0,0 @@ -package documenttext - -import ( - "database/sql" - "io" - "strings" - "testing" - "time" - - "queryorchestration/internal/database/repository" - "queryorchestration/internal/serviceconfig/objectstore" - objectstoremock "queryorchestration/mocks/objectstore" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/google/uuid" - "github.com/pashagolub/pgxmock/v3" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -func TestStoreExtract(t *testing.T) { - ctx := t.Context() - pool, err := pgxmock.NewPool() - require.NoError(t, err) - - cfg := &DocTextConfig{} - cfg.DBPool = pool - cfg.DBQueries = repository.New(pool) - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - svc := Service{ - cfg: cfg, - } - - cleanId := uuid.New() - textId := uuid.New() - clientId := "hello" - bucket := "bucket" - - t.Run("exists", func(t *testing.T) { - hash := `"5d41402abc4b2a76b9719d911017c592"` - pool.ExpectBegin() - pool.ExpectQuery("name: GetDocumentTextExtractionByHash :one").WithArgs(cleanId, hash).WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(textId), - ) - pool.ExpectExec("name: AddDocumentTextEntry :exec").WithArgs(textId, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - text := strings.NewReader("hello") - err = svc.storeProcess(ctx, text, &repository.Currentcleanentry{ - ID: cleanId, - }) - require.NoError(t, err) - }) - t.Run("not exists", func(t *testing.T) { - part := uint16(0) - key := objectstore.BucketKey{ - ClientID: clientId, - Location: objectstore.Text, - CreatedAt: time.Now().UTC(), - EntityID: cleanId, - Part: &part, - } - keyStr := key.String() - hash := `"09644372e99020106946045c6fd2d70b"` - pool.ExpectBegin() - pool.ExpectQuery("name: GetDocumentTextExtractionByHash :one").WithArgs(cleanId, hash). - WillReturnError(sql.ErrNoRows) - pool.ExpectQuery("name: GetTextOutCurrentPart :one").WithArgs(&clientId, pgxmock.AnyArg()). - WillReturnRows( - pgxmock.NewRows([]string{"part", "count"}). - AddRow(0, 2), - ) - pool.ExpectQuery("name: AddDocumentText :one").WithArgs(cleanId, bucket, key.String(), hash, pgxmock.AnyArg(), uint16(0)). - WillReturnRows( - pgxmock.NewRows([]string{"id"}). - AddRow(textId), - ) - - mockS3.EXPECT(). - PutObject( - mock.Anything, - mock.MatchedBy(func(in *s3.PutObjectInput) bool { - bod, err := io.ReadAll(in.Body) - require.NoError(t, err) - return string(bod) == "byebye" && *in.Key == key.String() && *in.Bucket == bucket - }), - mock.Anything, - ). - Return(&s3.PutObjectOutput{}, nil) - - pool.ExpectExec("name: AddDocumentTextEntry :exec").WithArgs(textId, pgxmock.AnyArg()). - WillReturnResult(pgxmock.NewResult("", 1)) - pool.ExpectCommit() - - text := strings.NewReader("byebye") - err = svc.storeProcess(ctx, text, &repository.Currentcleanentry{ - ID: cleanId, - Clientid: clientId, - Bucket: &bucket, - Key: &keyStr, - }) - require.NoError(t, err) - }) -} - -func TestDuplicateReader(t *testing.T) { - original := strings.NewReader("hello") - readerOne, readerTwo, err := duplicateReader(original) - require.NoError(t, err) - contentOne, err := io.ReadAll(readerOne) - require.NoError(t, err) - assert.Equal(t, []byte("hello"), contentOne) - contentTwo, err := io.ReadAll(readerTwo) - require.NoError(t, err) - assert.Equal(t, []byte("hello"), contentTwo) -} diff --git a/internal/document/text/tables.go b/internal/document/text/tables.go deleted file mode 100644 index 14023418..00000000 --- a/internal/document/text/tables.go +++ /dev/null @@ -1,163 +0,0 @@ -package documenttext - -import ( - "context" - "encoding/json" - "log/slog" - "strings" - - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/google/uuid" -) - -type cell struct { - value string - row int - column int - isSelected bool -} - -func (s *Service) addTable(ctx context.Context, id uuid.UUID, blockMap map[uuid.UUID]types.Block, builder *strings.Builder) error { - params := tableParams{ - maxRow: 0, - maxColumn: 0, - table: []cell{}, - } - - for _, uid := range s.GetDirectChildren(id, blockMap) { - s.addComponentTable(ctx, uid, blockMap, ¶ms) - } - - invalidRows := make([]bool, params.maxRow+1) - for _, cell := range params.table { - if !cell.isSelected { - invalidRows[cell.row] = true - } - } - - tableArr := make([][]string, params.maxRow+1) - for i := range tableArr { - tableArr[i] = make([]string, params.maxColumn+1) - } - - for _, cell := range params.table { - tableArr[cell.row][cell.column] = cell.value - } - - finalTable := [][]string{} - for i, row := range tableArr { - if !invalidRows[i] { - finalTable = append(finalTable, row) - } - } - - jsonData, err := json.Marshal(finalTable) - if err != nil { - return err - } - - builder.WriteString("-------Table Start--------\n") - builder.WriteString(string(jsonData)) - builder.WriteString("\n-------Table End--------\n") - - return nil -} - -type tableParams struct { - maxRow int - maxColumn int - table []cell -} - -func (s *Service) addComponentTable(ctx context.Context, id uuid.UUID, blockMap map[uuid.UUID]types.Block, params *tableParams) { - block := blockMap[id] - - switch block.BlockType { - case types.BlockTypeMergedCell: - content := "" - addRow := true - for _, uid := range s.getRelationshipIds(block) { - if blockMap[uid].BlockType != types.BlockTypeCell { - slog.Warn("not a cell", "block_type", blockMap[uid].BlockType) - continue - } - content, addRow = s.getCellContent(uid, blockMap) - if content != "" { - break - } - } - startColumnIndex := int(*block.ColumnIndex - 1) - startRowIndex := int(*block.RowIndex - 1) - endColumnIndex := startColumnIndex + int(*block.ColumnSpan) - 1 - endRowIndex := startRowIndex + int(*block.RowSpan) - 1 - for row := startRowIndex; row <= endRowIndex; row++ { - for column := startColumnIndex; column <= endColumnIndex; column++ { - s.addCellToTable( - row, - column, - content, - addRow, - params, - ) - } - } - case types.BlockTypeCell: - content, addRow := s.getCellContent(id, blockMap) - s.addCellToTable( - int(*block.RowIndex)-1, - int(*block.ColumnIndex)-1, - content, - addRow, - params, - ) - default: - slog.Info("unhandled block type in table", "type", block.BlockType) - } -} - -func (s *Service) getCellContent(id uuid.UUID, blockMap map[uuid.UUID]types.Block) (string, bool) { - var str strings.Builder - var isSelected *bool - for _, uid := range s.getRelationshipIds(blockMap[id]) { - if blockMap[uid].BlockType == types.BlockTypeWord { - if str.String() != "" { - str.WriteRune(' ') - } - str.WriteString(*blockMap[uid].Text) - } - - if blockMap[uid].BlockType != types.BlockTypeSelectionElement { - continue - } - - if isSelected == nil || !*isSelected { - selected := true - if blockMap[uid].SelectionStatus == types.SelectionStatusNotSelected { - selected = false - } - isSelected = &selected - } - } - - selected := true - if isSelected != nil { - selected = *isSelected - } - - return str.String(), selected -} - -func (s *Service) addCellToTable(rowIndex int, columnIndex int, content string, isSelected bool, params *tableParams) { - if params.maxRow < rowIndex { - params.maxRow = rowIndex - } - if params.maxColumn < columnIndex { - params.maxColumn = columnIndex - } - params.table = append(params.table, cell{ - column: columnIndex, - row: rowIndex, - value: content, - isSelected: isSelected, - }) -} diff --git a/internal/server/runner/listener_test.go b/internal/server/runner/listener_test.go deleted file mode 100644 index 340a3f05..00000000 --- a/internal/server/runner/listener_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package runner - -import ( - "sync" - "testing" - - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/test" - - queuemock "queryorchestration/mocks/queue" - runnermock "queryorchestration/mocks/runner" - - "github.com/aws/aws-sdk-go-v2/service/sqs" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -type TestConfig struct { - BaseConfig[interface{}] - objectstore.ObjectStoreConfig -} - -func TestNewRunner(t *testing.T) { - if testing.Short() { - t.SkipNow() - } - t.Parallel() - cfg := &TestConfig{} - _ = serviceconfig.InitializeConfig(cfg) - - var wg sync.WaitGroup - - wg.Add(1) - go func() { - test.CreateDBWithParams(t, cfg, &test.CreateDatabaseConfig{ - NoMigrations: true, - }) - - cfg.ControllerFunc = func() Controller[interface{}] { - return runnermock.NewMockController[interface{}](t) - } - wg.Done() - }() - - a := test.CreateAWSContainer(t, cfg) - test.SetQueueClient(t, t.Context(), cfg, a.ExternalEndpoint) - - cfg.QueueURL = test.CreateQueue(t, cfg, "queueName") - cfg.SetSQSEndpoint(a.ExternalEndpoint) - - wg.Wait() - - srvPtr, err := New(t.Context(), cfg) - require.NoError(t, err) - assert.NotNil(t, srvPtr) -} - -func TestListen(t *testing.T) { - ctx := t.Context() - - queue := Server[interface{}]{} - - assert.Panics(t, func() { queue.Listen(ctx) }) -} - -func TestRegisterController(t *testing.T) { - c := BaseConfig[interface{}]{} - err := c.RegisterController() - assert.Error(t, err) - assert.Nil(t, c.Controller) - - c.ControllerFunc = func() Controller[interface{}] { - return runnermock.NewMockController[interface{}](t) - } - err = c.RegisterController() - require.NoError(t, err) - assert.Equal(t, runnermock.NewMockController[interface{}](t), c.Controller) -} - -func TestPingQueue(t *testing.T) { - ctx := t.Context() - c := BaseConfig[interface{}]{} - c.QueueURL = "i/am/here" - mockSQS := queuemock.NewMockSQSClient(t) - c.QueueClient = mockSQS - - mockSQS.EXPECT(). - GetQueueAttributes( - mock.Anything, - mock.MatchedBy(func(in *sqs.GetQueueAttributesInput) bool { - return *in.QueueUrl == c.QueueURL - }), - mock.Anything, - ). - Return(&sqs.GetQueueAttributesOutput{}, nil) - - err := c.PingQueue(ctx) - require.NoError(t, err) -} - -func TestGetQueueURL(t *testing.T) { - c := BaseConfig[interface{}]{} - assert.Empty(t, c.GetQueueURL()) - - c.QueueURL = "exampleurl" - assert.Equal(t, "exampleurl", c.GetQueueURL()) -} - -func TestGetController(t *testing.T) { - c := BaseConfig[interface{}]{} - assert.Empty(t, c.GetController()) - - c.Controller = runnermock.NewMockController[interface{}](t) - assert.Equal(t, runnermock.NewMockController[interface{}](t), c.GetController()) -} diff --git a/internal/server/runner/poll_test.go b/internal/server/runner/poll_test.go deleted file mode 100644 index 8d488b8c..00000000 --- a/internal/server/runner/poll_test.go +++ /dev/null @@ -1,230 +0,0 @@ -package runner - -import ( - "context" - "testing" - "time" - - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/serviceconfig/queue" - "queryorchestration/internal/test" - - runnermock "queryorchestration/mocks/runner" - - "github.com/aws/aws-sdk-go-v2/service/sqs/types" - "github.com/go-playground/validator/v10" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -type MockStruct struct{} - -func TestPollMessages(t *testing.T) { - t.Parallel() - cfg := &struct { - BaseConfig[MockStruct] - objectstore.ObjectStoreConfig - }{} - acfg := test.CreateAWSContainer(t, cfg) - - test.SetQueueClient(t, t.Context(), cfg, acfg.ExternalEndpoint) - cfg.QueueURL = test.CreateQueue(t, cfg, test.ClientSyncRunnerName) - - mockController := runnermock.NewMockController[MockStruct](t) - cfg.Controller = mockController - cfg.Validator = validator.New() - - ctx, cancel := context.WithTimeout(t.Context(), time.Second) - defer cancel() - - scfg := &Server[MockStruct]{ - cfg: cfg, - cleanup: func() error { return nil }, - } - scfg.Listen(ctx) -} - -func TestPollMessage(t *testing.T) { - t.Parallel() - cfg := &struct { - BaseConfig[MockStruct] - objectstore.ObjectStoreConfig - }{} - acfg := test.CreateAWSContainer(t, cfg) - - test.SetQueueClient(t, t.Context(), cfg, acfg.ExternalEndpoint) - cfg.QueueURL = test.CreateQueue(t, cfg, test.ClientSyncRunnerName) - - mockController := runnermock.NewMockController[MockStruct](t) - cfg.Controller = mockController - cfg.Validator = validator.New() - - ser := &Server[MockStruct]{ - cfg: cfg, - cleanup: func() error { return nil }, - } - - mockController.EXPECT(). - Process( - mock.Anything, - mock.MatchedBy(func(in MockStruct) bool { - return true - }), - ). - Return(true) - - err := cfg.SendToQueue(t.Context(), &queue.SendParams{ - QueueURL: cfg.GetQueueURL(), - Body: struct{}{}, - }) - require.NoError(t, err) - - err = ser.pollMessage(t.Context()) - require.NoError(t, err) -} - -func TestProcessMessage(t *testing.T) { - t.Run("works", func(t *testing.T) { - t.Parallel() - cfg := &struct { - BaseConfig[MockStruct] - objectstore.ObjectStoreConfig - }{} - acfg := test.CreateAWSContainer(t, cfg) - - test.SetQueueClient(t, t.Context(), cfg, acfg.ExternalEndpoint) - cfg.QueueURL = test.CreateQueue(t, cfg, test.ClientSyncRunnerName) - - mockController := runnermock.NewMockController[MockStruct](t) - cfg.Controller = mockController - cfg.Validator = validator.New() - - ser := &Server[MockStruct]{ - cfg: cfg, - cleanup: func() error { return nil }, - } - - err := cfg.SendToQueue(t.Context(), &queue.SendParams{ - QueueURL: cfg.GetQueueURL(), - Body: struct{}{}, - }) - require.NoError(t, err) - - msg := test.AssertMessage(t, cfg, &queue.ReceiveParams{ - QueueURL: cfg.GetQueueURL(), - }) - - mockController.EXPECT(). - Process( - mock.Anything, - mock.MatchedBy(func(in MockStruct) bool { - return true - }), - ). - Return(true) - - err = ser.processMessage(t.Context(), &msg) - require.NoError(t, err) - }) - t.Run("fail Controller", func(t *testing.T) { - t.Parallel() - cfg := &struct { - BaseConfig[MockStruct] - objectstore.ObjectStoreConfig - }{} - acfg := test.CreateAWSContainer(t, cfg) - - test.SetQueueClient(t, t.Context(), cfg, acfg.ExternalEndpoint) - cfg.QueueURL = test.CreateQueue(t, cfg, test.ClientSyncRunnerName) - - mockController := runnermock.NewMockController[MockStruct](t) - cfg.Controller = mockController - cfg.Validator = validator.New() - - ser := &Server[MockStruct]{ - cfg: cfg, - cleanup: func() error { return nil }, - } - - err := cfg.SendToQueue(t.Context(), &queue.SendParams{ - QueueURL: cfg.GetQueueURL(), - Body: struct{}{}, - }) - require.NoError(t, err) - - msg := test.AssertMessage(t, cfg, &queue.ReceiveParams{ - QueueURL: cfg.GetQueueURL(), - }) - - mockController.EXPECT(). - Process( - mock.Anything, - mock.MatchedBy(func(in MockStruct) bool { - return true - }), - ). - Return(false) - - err = ser.processMessage(t.Context(), &msg) - require.Error(t, err) - }) -} - -func TestProcessBody(t *testing.T) { - t.Parallel() - type MockStruct struct { - Example string `json:"example" validate:"required"` - } - cfg := &BaseConfig[MockStruct]{} - cfg.Validator = validator.New() - - ser := &Server[MockStruct]{ - cfg: cfg, - cleanup: func() error { return nil }, - } - - t.Run("valid body", func(t *testing.T) { - id := "example_id" - body := `{"example":"hi"}` - msg := &types.Message{ - MessageId: &id, - Body: &body, - } - - assert.NotNil(t, ser.processBody(msg)) - }) - t.Run("no msg", func(t *testing.T) { - assert.Nil(t, ser.processBody(nil)) - }) - t.Run("no msg id", func(t *testing.T) { - assert.Nil(t, ser.processBody(&types.Message{})) - }) - t.Run("no body", func(t *testing.T) { - id := "id" - - assert.Nil(t, ser.processBody(&types.Message{ - MessageId: &id, - })) - }) - t.Run("empty body", func(t *testing.T) { - id := "example_id" - body := "" - msg := &types.Message{ - MessageId: &id, - Body: &body, - } - - assert.Nil(t, ser.processBody(msg)) - }) - t.Run("invalid body", func(t *testing.T) { - id := "example_id" - body := "{}" - msg := &types.Message{ - MessageId: &id, - Body: &body, - } - - assert.Nil(t, ser.processBody(msg)) - }) -} diff --git a/internal/serviceconfig/objectstore/config_test.go b/internal/serviceconfig/objectstore/config_test.go deleted file mode 100644 index 8e9c8997..00000000 --- a/internal/serviceconfig/objectstore/config_test.go +++ /dev/null @@ -1,158 +0,0 @@ -package objectstore_test - -import ( - "context" - "errors" - "strings" - "testing" - "time" - - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/test" - - objectstore "queryorchestration/internal/serviceconfig/objectstore" - - objectstoremock "queryorchestration/mocks/objectstore" - - awsc "queryorchestration/internal/serviceconfig/aws" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/mock" - "github.com/stretchr/testify/require" -) - -func TestGetStoreClient(t *testing.T) { - c := objectstore.ObjectStoreConfig{} - assert.Nil(t, c.GetStoreClient()) - c.StoreClient = &s3.Client{} - assert.Equal(t, &s3.Client{}, c.GetStoreClient()) -} - -func TestStoreClient(t *testing.T) { - ctx := t.Context() - c := objectstore.ObjectStoreConfig{} - err := c.SetStoreClient(ctx) - require.NoError(t, err) - assert.NotNil(t, c.StoreClient) -} - -func TestPingStoreByName(t *testing.T) { - ctx := t.Context() - mocks3 := objectstoremock.NewMockS3Client(t) - c := objectstore.ObjectStoreConfig{ - StoreClient: mocks3, - } - name := "bucket-name" - - mocks3.EXPECT(). - HeadBucket( - mock.Anything, - mock.MatchedBy(func(in *s3.HeadBucketInput) bool { - return *in.Bucket == name - }), - mock.Anything, - ). - Return(&s3.HeadBucketOutput{}, nil) - - err := c.PingStoreByName(ctx, name) - require.NoError(t, err) -} - -func TestGetS3Client(t *testing.T) { - c := objectstore.ObjectStoreConfig{} - assert.Empty(t, c.GetS3Endpoint()) - c.AWSEndpointUrlS3 = "s3_endpoint" - assert.Equal(t, "s3_endpoint", c.GetS3Endpoint()) -} - -type StoreConfig struct { - serviceconfig.BaseConfig - objectstore.ObjectStoreConfig - awsc.AWSConfig -} - -func TestSetStoreClientAndPingByName(t *testing.T) { - ctx, cancel := context.WithTimeout(t.Context(), 100*time.Millisecond) - defer cancel() - cfg := &StoreConfig{} - name := "bucket" - - err := cfg.SetStoreClientAndPingByName(ctx, name) - - if !errors.Is(err, context.DeadlineExceeded) { - t.Errorf("Expected timeout error, got: %v", err) - } -} - -func TestCalculateAndCompareETag(t *testing.T) { - if testing.Short() { - t.SkipNow() - } - t.SkipNow() - ctx := t.Context() - - cfg := &StoreConfig{} - - acfg := test.CreateAWSContainer(t, cfg) - test.SetStoreClient(t, ctx, cfg, acfg.ExternalEndpoint) - test.CreateBucket(t, cfg) - - testContent := "hi" - hashReader := strings.NewReader(testContent) - uploadReader := strings.NewReader(testContent) - - hash, err := cfg.CalculateETag(ctx, hashReader) - require.NoError(t, err) - - res, err := cfg.StoreClient.PutObject(ctx, &s3.PutObjectInput{ - Bucket: aws.String(test.GetBucketName(t)), - Key: aws.String("example"), - Body: uploadReader, - }) - require.NoError(t, err) - - assert.Equal(t, *res.ETag, hash) -} - -func TestGetDirectoryPart(t *testing.T) { - cfg := &StoreConfig{} - - assert.Equal(t, uint16(0), cfg.GetDirectoryPart(0, 0)) - assert.Equal(t, uint16(0), cfg.GetDirectoryPart(0, 1)) - assert.Equal(t, uint16(0), cfg.GetDirectoryPart(0, 2)) - assert.Equal(t, uint16(1), cfg.GetDirectoryPart(0, 1000)) - - cfg.MaxDirSize = 2 - assert.Equal(t, uint16(0), cfg.GetDirectoryPart(0, 0)) - assert.Equal(t, uint16(0), cfg.GetDirectoryPart(0, 1)) - assert.Equal(t, uint16(1), cfg.GetDirectoryPart(0, 2)) - assert.Equal(t, uint16(1), cfg.GetDirectoryPart(1, 0)) - assert.Equal(t, uint16(1), cfg.GetDirectoryPart(1, 1)) - assert.Equal(t, uint16(2), cfg.GetDirectoryPart(1, 2)) - assert.Equal(t, uint16(2), cfg.GetDirectoryPart(2, 0)) - assert.Equal(t, uint16(2), cfg.GetDirectoryPart(2, 1)) - assert.Equal(t, uint16(3), cfg.GetDirectoryPart(2, 2)) - assert.Equal(t, uint16(3), cfg.GetDirectoryPart(3, 0)) - assert.Equal(t, uint16(3), cfg.GetDirectoryPart(3, 1)) - assert.Equal(t, uint16(4), cfg.GetDirectoryPart(3, 2)) -} - -func TestSetAWSEndpointUrlS3(t *testing.T) { - cfg := objectstore.ObjectStoreConfig{} - - assert.Equal(t, "", cfg.AWSEndpointUrlS3) - newVal := "val" - cfg.SetS3Endpoint(newVal) - assert.Equal(t, "val", cfg.AWSEndpointUrlS3) -} - -func TestSetAWSSessionToken(t *testing.T) { - cfg := objectstore.ObjectStoreConfig{} - - assert.False(t, cfg.AWSS3UsePathStyle) - newVal := true - cfg.SetS3UsePathStyle(newVal) - assert.True(t, cfg.AWSS3UsePathStyle) -} diff --git a/internal/serviceconfig/queue/documenttext/config.go b/internal/serviceconfig/queue/documenttext/config.go deleted file mode 100644 index cd12b180..00000000 --- a/internal/serviceconfig/queue/documenttext/config.go +++ /dev/null @@ -1,15 +0,0 @@ -package documenttext - -const EnvName = "DOCUMENT_TEXT_URL" - -type DocTextConfig struct { - DocumentTextURL string `env:"DOCUMENT_TEXT_URL,required,notEmpty"` -} - -func (c *DocTextConfig) GetDocumentTextURL() string { - return c.DocumentTextURL -} - -type ConfigProvider interface { - GetDocumentTextURL() string -} diff --git a/internal/serviceconfig/queue/documenttext/config_test.go b/internal/serviceconfig/queue/documenttext/config_test.go deleted file mode 100644 index c233e4eb..00000000 --- a/internal/serviceconfig/queue/documenttext/config_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package documenttext_test - -import ( - "testing" - - "queryorchestration/internal/serviceconfig/queue/documenttext" - - "github.com/stretchr/testify/assert" -) - -func TestGetDocumentTextURL(t *testing.T) { - cfg := documenttext.DocTextConfig{} - - name := cfg.GetDocumentTextURL() - assert.Equal(t, "", name) - - cfg.DocumentTextURL = "name" - name = cfg.GetDocumentTextURL() - assert.Equal(t, "name", name) - assert.Equal(t, cfg.DocumentTextURL, name) -} diff --git a/internal/serviceconfig/textract/client.go b/internal/serviceconfig/textract/client.go deleted file mode 100644 index 8de46d21..00000000 --- a/internal/serviceconfig/textract/client.go +++ /dev/null @@ -1,25 +0,0 @@ -package textract - -import ( - "context" - - "github.com/aws/aws-sdk-go-v2/service/textract" -) - -type TextractClient interface { - // Document Analysis Operations - DetectDocumentText(ctx context.Context, params *textract.DetectDocumentTextInput, opts ...func(*textract.Options)) (*textract.DetectDocumentTextOutput, error) - AnalyzeDocument(ctx context.Context, params *textract.AnalyzeDocumentInput, opts ...func(*textract.Options)) (*textract.AnalyzeDocumentOutput, error) - AnalyzeExpense(ctx context.Context, params *textract.AnalyzeExpenseInput, opts ...func(*textract.Options)) (*textract.AnalyzeExpenseOutput, error) - AnalyzeID(ctx context.Context, params *textract.AnalyzeIDInput, opts ...func(*textract.Options)) (*textract.AnalyzeIDOutput, error) - - // Asynchronous Operations - StartDocumentAnalysis(ctx context.Context, params *textract.StartDocumentAnalysisInput, opts ...func(*textract.Options)) (*textract.StartDocumentAnalysisOutput, error) - StartDocumentTextDetection(ctx context.Context, params *textract.StartDocumentTextDetectionInput, opts ...func(*textract.Options)) (*textract.StartDocumentTextDetectionOutput, error) - StartExpenseAnalysis(ctx context.Context, params *textract.StartExpenseAnalysisInput, opts ...func(*textract.Options)) (*textract.StartExpenseAnalysisOutput, error) - - // Job Management Operations - GetDocumentAnalysis(ctx context.Context, params *textract.GetDocumentAnalysisInput, opts ...func(*textract.Options)) (*textract.GetDocumentAnalysisOutput, error) - GetDocumentTextDetection(ctx context.Context, params *textract.GetDocumentTextDetectionInput, opts ...func(*textract.Options)) (*textract.GetDocumentTextDetectionOutput, error) - GetExpenseAnalysis(ctx context.Context, params *textract.GetExpenseAnalysisInput, opts ...func(*textract.Options)) (*textract.GetExpenseAnalysisOutput, error) -} diff --git a/internal/serviceconfig/textract/config.go b/internal/serviceconfig/textract/config.go deleted file mode 100644 index 801c9928..00000000 --- a/internal/serviceconfig/textract/config.go +++ /dev/null @@ -1,85 +0,0 @@ -package textract - -import ( - "context" - "log/slog" - - awsc "queryorchestration/internal/serviceconfig/aws" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/config" - "github.com/aws/aws-sdk-go-v2/credentials" - "github.com/aws/aws-sdk-go-v2/service/textract" -) - -type ConfigProvider interface { - awsc.ConfigProvider - SetTextractClient(context.Context) error - SetTextractClientWithCfg(context.Context, aws.Config) - SetTextractClientWithProfile(context.Context, awsc.Profile) error - GetTextractClient() TextractClient - SetTextractEndpoint(string) - GetTextractEndpoint() string -} - -type TextractConfig struct { - AWSEndpointUrlTextract string `env:"AWS_ENDPOINT_URL_TEXTRACT"` - AWSTextractAccessKeyId string `env:"AWS_ACCESS_KEY_ID_TEXTRACT"` - AWSTextractSecretAccessKey string `env:"AWS_SECRET_ACCESS_KEY_TEXTRACT"` - AWSTextractSessionToken string `env:"AWS_SESSION_TOKEN_TEXTRACT"` - AWSTextractRegion string `env:"AWS_REGION_TEXTRACT"` - TextractClient TextractClient -} - -func (c *TextractConfig) SetTextractClientWithCfg(ctx context.Context, cfg aws.Config) { - c.TextractClient = textract.NewFromConfig(cfg) -} - -func (c *TextractConfig) SetTextractClientWithProfile(ctx context.Context, profile awsc.Profile) error { - cfg, err := awsc.GetAWSConfigWithProfile(ctx, profile) - if err != nil { - return err - } - - c.SetTextractClientWithCfg(ctx, cfg) - - return nil -} - -func (c *TextractConfig) SetTextractClient(ctx context.Context) error { - cfg, err := awsc.GetAWSConfigWithOpts(ctx, func(lo *config.LoadOptions) error { - if c.AWSEndpointUrlTextract != "" { - lo.BaseEndpoint = c.AWSEndpointUrlTextract - } - - return nil - }) - if err != nil { - return err - } - - if c.AWSTextractAccessKeyId != "" && c.AWSTextractSecretAccessKey != "" { - cfg.Credentials = credentials.NewStaticCredentialsProvider(c.AWSTextractAccessKeyId, c.AWSTextractSecretAccessKey, c.AWSTextractSessionToken) - - if c.AWSTextractRegion != "" { - cfg.Region = c.AWSTextractRegion - } - slog.Debug("textract specific credentials", "key_id", c.AWSTextractAccessKeyId, "region", c.AWSTextractRegion) - } - - c.SetTextractClientWithCfg(ctx, cfg) - - return nil -} - -func (c *TextractConfig) GetTextractClient() TextractClient { - return c.TextractClient -} - -func (c *TextractConfig) GetTextractEndpoint() string { - return c.AWSEndpointUrlTextract -} - -func (c *TextractConfig) SetTextractEndpoint(e string) { - c.AWSEndpointUrlTextract = e -} diff --git a/internal/serviceconfig/textract/config_test.go b/internal/serviceconfig/textract/config_test.go deleted file mode 100644 index 25eab2d8..00000000 --- a/internal/serviceconfig/textract/config_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package textract_test - -import ( - "testing" - - textract "queryorchestration/internal/serviceconfig/textract" - - awstextract "github.com/aws/aws-sdk-go-v2/service/textract" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestGetTextractClient(t *testing.T) { - c := textract.TextractConfig{} - assert.Nil(t, c.GetTextractClient()) - c.TextractClient = &awstextract.Client{} - assert.Equal(t, &awstextract.Client{}, c.GetTextractClient()) -} - -func TestTextractClient(t *testing.T) { - t.Run("stndard", func(t *testing.T) { - ctx := t.Context() - c := textract.TextractConfig{} - err := c.SetTextractClient(ctx) - require.NoError(t, err) - assert.NotNil(t, c.TextractClient) - }) - t.Run("textract specific", func(t *testing.T) { - ctx := t.Context() - c := textract.TextractConfig{ - AWSTextractAccessKeyId: "not empty", - AWSTextractSecretAccessKey: "not empty", - AWSTextractSessionToken: "not empty", - AWSTextractRegion: "not empty", - } - err := c.SetTextractClient(ctx) - require.NoError(t, err) - assert.NotNil(t, c.TextractClient) - }) -} - -func TestTextractClientWithProfile(t *testing.T) { - ctx := t.Context() - c := textract.TextractConfig{} - err := c.SetTextractClientWithProfile(ctx, "") - require.NoError(t, err) - assert.NotNil(t, c.TextractClient) -} - -func TestGetTextractURL(t *testing.T) { - c := textract.TextractConfig{} - assert.Empty(t, c.GetTextractEndpoint()) - c.AWSEndpointUrlTextract = "textract_endpoint" - assert.Equal(t, "textract_endpoint", c.GetTextractEndpoint()) -} - -func TestSetTextractURL(t *testing.T) { - c := textract.TextractConfig{} - c.SetTextractEndpoint("example") - assert.Equal(t, "example", c.AWSEndpointUrlTextract) -} diff --git a/internal/test/api.go b/internal/test/api.go index 1950fa85..6506cc99 100644 --- a/internal/test/api.go +++ b/internal/test/api.go @@ -24,8 +24,7 @@ type API struct { } type APIConfig struct { - API API - MockHTTP string + API API } func CreateAPI(t testing.TB, ctx context.Context, cfg ContainerConfigProvider, network string, config *APIConfig) (*Container, func()) { @@ -36,7 +35,6 @@ func CreateAPI(t testing.TB, ctx context.Context, cfg ContainerConfigProvider, n Cfg: cfg, Name: string(config.API.Name), DownstreamQueues: config.API.DownstreamQueues, - MockHTTP: config.MockHTTP, WaitForMsg: "⇨ http server started on [::]:8080", }) diff --git a/internal/test/assertions.go b/internal/test/assertions.go index 1ac249eb..07d05fe9 100644 --- a/internal/test/assertions.go +++ b/internal/test/assertions.go @@ -1,30 +1,18 @@ +// Package test provides test utilities. +// Note: Textract-related helpers have been removed since text extraction is deprecated. +// See remove_texttract_and_mocks_plan.md for details. package test import ( - "encoding/json" "io" - "os" "testing" - "github.com/aws/aws-sdk-go-v2/service/textract" "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) -func GetTextractFileResponse(t testing.TB, filename string) []map[string]*textract.AnalyzeDocumentOutput { - file, err := os.Open(filename) - require.NoError(t, err) - defer file.Close() - - decoder := json.NewDecoder(file) - var out []map[string]*textract.AnalyzeDocumentOutput - err = decoder.Decode(&out) - require.NoError(t, err) - - return out -} - +// AssertStringToReader compares an expected string with the content from a reader. func AssertStringToReader(t testing.TB, expected string, actual io.Reader) { actualBytes, err := io.ReadAll(actual) require.NoError(t, err) diff --git a/internal/test/container.go b/internal/test/container.go index 670a6bea..1fcaccbe 100644 --- a/internal/test/container.go +++ b/internal/test/container.go @@ -34,7 +34,6 @@ type containerConfig struct { Env map[string]string WaitForMsg string ExposedPorts []nat.Port - MockHTTP string } const ( @@ -49,28 +48,27 @@ func createContainer(t testing.TB, ctx context.Context, network string, cfg *con } env := map[string]string{ - "BUCKET": bucket, - "PGUSER": cfg.Cfg.GetDBUser(), - "PGPASSWORD": cfg.Cfg.GetDBSecret(), - "PGHOST": dbAlias, - "PGDATABASE": cfg.Cfg.GetDBName(), - "PGPORT": strconv.Itoa(dbPort), - "DB_NOSSL": strconv.FormatBool(cfg.Cfg.IsDBNoSSL()), - "AWS_ACCESS_KEY_ID": cfg.Cfg.GetAWSKeyID(), - "AWS_SECRET_ACCESS_KEY": cfg.Cfg.GetAWSSecretKey(), - "AWS_REGION": cfg.Cfg.GetAWSRegion(), - "AWS_DEFAULT_REGION": cfg.Cfg.GetAWSRegion(), - "AWS_ENDPOINT_URL": cfg.Cfg.GetAWSEndpoint(), - "AWS_ENDPOINT_URL_SQS": cfg.Cfg.GetAWSEndpoint(), - "AWS_ENDPOINT_URL_S3": cfg.Cfg.GetAWSEndpoint(), - "AWS_ENDPOINT_URL_TEXTRACT": cfg.MockHTTP, - "AWS_S3_USE_PATH_STYLE": strconv.FormatBool(true), - "DISABLE_AUTH": "true", - "LOG_LEVEL": "DEBUG", - "COGNITO_USER_POOL_ID": "coguserpoolid", - "COGNITO_CLIENT_SECRET": "cogsecret", - "COGNITO_DOMAIN": "cogdomain", - "COGNITO_CLIENT_ID": "clientid", + "BUCKET": bucket, + "PGUSER": cfg.Cfg.GetDBUser(), + "PGPASSWORD": cfg.Cfg.GetDBSecret(), + "PGHOST": dbAlias, + "PGDATABASE": cfg.Cfg.GetDBName(), + "PGPORT": strconv.Itoa(dbPort), + "DB_NOSSL": strconv.FormatBool(cfg.Cfg.IsDBNoSSL()), + "AWS_ACCESS_KEY_ID": cfg.Cfg.GetAWSKeyID(), + "AWS_SECRET_ACCESS_KEY": cfg.Cfg.GetAWSSecretKey(), + "AWS_REGION": cfg.Cfg.GetAWSRegion(), + "AWS_DEFAULT_REGION": cfg.Cfg.GetAWSRegion(), + "AWS_ENDPOINT_URL": cfg.Cfg.GetAWSEndpoint(), + "AWS_ENDPOINT_URL_SQS": cfg.Cfg.GetAWSEndpoint(), + "AWS_ENDPOINT_URL_S3": cfg.Cfg.GetAWSEndpoint(), + "AWS_S3_USE_PATH_STYLE": strconv.FormatBool(true), + "DISABLE_AUTH": "true", + "LOG_LEVEL": "DEBUG", + "COGNITO_USER_POOL_ID": "coguserpoolid", + "COGNITO_CLIENT_SECRET": "cogsecret", + "COGNITO_DOMAIN": "cogdomain", + "COGNITO_CLIENT_ID": "clientid", // Rate limiting config - very high limits for testing to avoid interference "RATE_LIMIT_GLOBAL_RATE": "10000", // 10k req/s global (vs 500 in prod) "RATE_LIMIT_GLOBAL_BURST": "20000", // 20k burst global (vs 1000 in prod) diff --git a/internal/test/ecosystem.go b/internal/test/ecosystem.go index 62cb09e4..8e202868 100644 --- a/internal/test/ecosystem.go +++ b/internal/test/ecosystem.go @@ -1,3 +1,6 @@ +// Package test provides test ecosystem infrastructure. +// Note: MockServer has been removed since text extraction (Textract) is deprecated. +// See remove_texttract_and_mocks_plan.md for details. package test import ( @@ -35,8 +38,7 @@ func CreateFullNetwork(t testing.TB, ctx context.Context, cfg FullDependenciesCo wg.Add(1) go func() { c, ccleanup := CreateAPI(t, ctx, cfg, deps.Network, &APIConfig{ - API: s, - MockHTTP: string(deps.MockServer.Internal), + API: s, }) apiMu.Lock() @@ -55,8 +57,7 @@ func CreateFullNetwork(t testing.TB, ctx context.Context, cfg FullDependenciesCo wg.Add(1) go func() { c, ccleanup := CreateRunner(t, ctx, cfg, deps.Network, &RunnerConfig{ - Runner: r, - MockHTTP: string(deps.MockServer.Internal), + Runner: r, }) runnerMu.Lock() @@ -123,12 +124,13 @@ type FullDependenciesConfig interface { objectstore.ConfigProvider } +// Dependencies holds test infrastructure components. +// Note: MockServer has been removed since text extraction is deprecated. type Dependencies struct { - QueueURLs map[RunnerName]string - AWSConfig *AWSContainerConfig - DBConfig testcontainers.Container - MockServer *MockServer - Network string + QueueURLs map[RunnerName]string + AWSConfig *AWSContainerConfig + DBConfig testcontainers.Container + Network string } type FullDependenciesParams struct { @@ -185,9 +187,6 @@ func CreateFullDependenciesWithParams(t testing.TB, cfg FullDependenciesConfig, wg.Done() }() - mockServer := CreateMockServer(t) - deps.MockServer = mockServer - CreateDBWithParams(t, cfg, &CreateDatabaseConfig{ NoMigrations: true, }) @@ -210,8 +209,7 @@ func CreateAPINetworkWithParams(t testing.TB, cfg FullDependenciesConfig, api AP deps := CreateFullDependenciesWithParams(t, cfg, params) c, ccleanup := CreateAPI(t, t.Context(), cfg, deps.Network, &APIConfig{ - API: api, - MockHTTP: string(deps.MockServer.Internal), + API: api, }) return &APINetwork{ diff --git a/internal/test/mockserver.go b/internal/test/mockserver.go deleted file mode 100644 index 87c90d29..00000000 --- a/internal/test/mockserver.go +++ /dev/null @@ -1,265 +0,0 @@ -package test - -import ( - "bufio" - "bytes" - "encoding/json" - "errors" - "fmt" - "io" - "log/slog" - "net/http" - "strconv" - "testing" - "time" - - "github.com/docker/go-connections/nat" - "github.com/google/uuid" - "github.com/stretchr/testify/require" - "github.com/testcontainers/testcontainers-go" - "github.com/testcontainers/testcontainers-go/wait" -) - -type Address string - -type MockServer struct { - Internal Address - External Address - Container testcontainers.Container - Client *http.Client -} - -type MockBody any -type MockQueries map[string][]string -type MockHeaders map[string][]string - -type MockRequest struct { - Method string `json:"method"` - Path string `json:"path"` - Headers MockHeaders `json:"headers"` - Body MockBody `json:"body"` - Query MockQueries `json:"queryStringParameters"` -} - -type MockResponse struct { - Code int `json:"statusCode"` - Headers MockHeaders `json:"headers"` - Body MockBody `json:"body"` -} - -type MockExpectation struct { - Request MockRequest `json:"httpRequest"` - Response MockResponse `json:"httpResponse"` -} - -const ( - mockServerAlias = "mockserver" - mockServerPort = 1080 -) - -func CreateMockServer(t testing.TB) *MockServer { - port, err := nat.NewPort("tcp", strconv.Itoa(mockServerPort)) - require.NoError(t, err) - - network := GetNetwork(t) - - req := testcontainers.ContainerRequest{ - Image: "mockserver/mockserver:5.15.0", - Name: "mockserver_test_queryorchestration", - ExposedPorts: []string{port.Port()}, - Env: map[string]string{ - "MOCKSERVER_LOG_LEVEL": "INFO", - "MOCKSERVER_LIVENESS_HTTP_GET_PATH": "/liveness/probe", - }, - WaitingFor: wait.ForAll( - wait.ForExposedPort(), - wait.ForListeningPort(port), - wait.ForHTTP("/liveness/probe"). - WithPort(port). - WithResponseMatcher(func(body io.Reader) bool { - return true - }). - WithStatusCodeMatcher(func(statusCode int) bool { - return statusCode == http.StatusOK - }), - ), - Networks: []string{network}, - NetworkAliases: map[string][]string{ - network: {mockServerAlias}, - }, - } - - container, err := testcontainers.GenericContainer(t.Context(), testcontainers.GenericContainerRequest{ - ContainerRequest: req, - Started: true, - Reuse: true, - }) - require.NoError(t, err) - - host, err := container.Host(t.Context()) - require.NoError(t, err) - - externalPort, err := container.MappedPort(t.Context(), port) - require.NoError(t, err) - - return &MockServer{ - Client: GetHTTPClient(), - Internal: Address(fmt.Sprintf("http://%s:%d", mockServerAlias, port.Int())), - External: Address(fmt.Sprintf("http://%s:%d", host, externalPort.Int())), - Container: container, - } -} - -func CreateMockExpectation(t testing.TB, server *MockServer, expectation MockExpectation) { - jsonData, err := json.Marshal(expectation) - require.NoError(t, err) - - url := fmt.Sprintf("%s/mockserver/expectation", server.External) - req, err := http.NewRequest("PUT", url, bytes.NewBuffer(jsonData)) - require.NoError(t, err) - req.Header.Set("Content-Type", "application/json") - - resp, err := server.Client.Do(req) - require.NoError(t, err) - defer resp.Body.Close() - - if resp.StatusCode != http.StatusCreated && resp.StatusCode != http.StatusOK { - body, _ := io.ReadAll(resp.Body) - t.Fatalf("failed to configure MockServer, status: %d, response: %s", resp.StatusCode, body) - } -} - -func CreateDetectDocumentTextExpectation(t testing.TB, mockServer *MockServer, body string) MockExpectation { - childId := uuid.NewString() - pageId := uuid.NewString() - expectation := MockExpectation{ - Request: MockRequest{ - Method: "POST", - Path: "/", - Headers: MockHeaders{ - "X-Amz-Target": []string{"Textract.AnalyzeDocument"}, - }, - Body: map[string]interface{}{ - "Document": map[string]interface{}{}, - "FeatureTypes": []string{"LAYOUT", "SIGNATURES"}, - }, - Query: MockQueries{}, - }, - Response: MockResponse{ - Code: 200, - Headers: MockHeaders{ - "Content-Type": {"application/json"}, - }, - Body: map[string]interface{}{ - "Blocks": []map[string]interface{}{ - { - "Id": pageId, - "BlockType": "PAGE", - "Relationships": []map[string]interface{}{ - { - "Type": "CHILD", - "Ids": []string{ - childId, - }, - }, - }, - }, - { - "Id": childId, - "Text": body, - }, - }, - }, - }, - } - - CreateMockExpectation(t, mockServer, expectation) - - return expectation -} - -func WaitForMockEndpoint(t testing.TB, server *MockServer, request MockRequest) MockRequest { - t.Helper() - - verificationRequest := map[string]any{ - "httpRequest": request, - "times": map[string]any{ - "atLeast": 1, - }, - } - - jsonData, err := json.Marshal(verificationRequest) - require.NoError(t, err) - - verifyURL := fmt.Sprintf("%s/mockserver/verify", server.External) - - // Use configured HTTP client with timeout to prevent indefinite hangs - client := GetHTTPClient() - - // Use configurable polling timeout (longer in CI environments) - timeout := time.After(GetPollingTimeout()) - ticker := time.NewTicker(GetPollInterval()) - defer ticker.Stop() - - slog.Info("Attempting to process request", "body", jsonData) - - for { - select { - case <-timeout: - require.NoError(t, errors.New("Timeout waiting for mock http request to be fulfilled")) - case <-ticker.C: - req, err := http.NewRequest("PUT", verifyURL, bytes.NewBuffer(jsonData)) - require.NoError(t, err) - req.Header.Set("Content-Type", "application/json") - - resp, err := client.Do(req) - require.NoError(t, err) - - scanner := bufio.NewScanner(resp.Body) - for scanner.Scan() { - line := scanner.Text() - slog.Info(line) - } - - if resp.StatusCode == http.StatusAccepted { - slog.Info("request found") - resp.Body.Close() - return retrieveMatchingRequest(t, server, request) - } - - resp.Body.Close() - slog.Error("no request found") - } - } -} - -func retrieveMatchingRequest(t testing.TB, server *MockServer, request MockRequest) MockRequest { - retrieveURL := fmt.Sprintf("%s/mockserver/retrieve?type=REQUESTS", server.External) - - req, err := http.NewRequest("PUT", retrieveURL, nil) - require.NoError(t, err) - - // Use configured HTTP client with timeout to prevent indefinite hangs - client := GetHTTPClient() - resp, err := client.Do(req) - require.NoError(t, err) - defer resp.Body.Close() - - body, err := io.ReadAll(resp.Body) - require.NoError(t, err) - - var requests []MockRequest - err = json.Unmarshal(body, &requests) - require.NoError(t, err) - - for i := len(requests) - 1; i >= 0; i-- { - attemptRequest := requests[i] - - if attemptRequest.Method == request.Method && attemptRequest.Path == request.Path { - return attemptRequest - } - } - - require.Fail(t, "no request found") - return MockRequest{} -} diff --git a/internal/test/mockserver_test.go b/internal/test/mockserver_test.go deleted file mode 100644 index e59bed86..00000000 --- a/internal/test/mockserver_test.go +++ /dev/null @@ -1,92 +0,0 @@ -package test - -import ( - "io" - "net/http" - "net/http/httptest" - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestCreateDetectDocumentTextExpectation(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - })) - defer ts.Close() - - server := &MockServer{ - Client: ts.Client(), - External: Address(ts.URL), - } - expectation := CreateDetectDocumentTextExpectation(t, server, "HI") - blocks, ok := expectation.Response.Body.(map[string]interface{})["Blocks"].([]map[string]interface{}) - require.True(t, ok) - assert.Equal( - t, - "PAGE", - blocks[0]["BlockType"], - ) - relationship, ok := blocks[0]["Relationships"].([]map[string]interface{}) - require.True(t, ok) - assert.Equal( - t, - "CHILD", - relationship[0]["Type"], - ) - ids, ok := relationship[0]["Ids"].([]string) - require.True(t, ok) - assert.Equal( - t, - ids[0], - blocks[1]["Id"], - ) - assert.Equal( - t, - "HI", - blocks[1]["Text"], - ) -} - -func TestWaitForMockEndpoint(t *testing.T) { - if testing.Short() { - t.SkipNow() - } - - server := CreateMockServer(t) - - body := strings.NewReader(`{"team":"hello"}`) - req, err := http.NewRequest("GET", string(server.External), body) - require.NoError(t, err) - req.Header.Add("Hidden", "here") - - expectation := MockExpectation{ - Request: MockRequest{ - Method: "GET", - Path: "/", - Headers: MockHeaders{}, - Query: MockQueries{}, - Body: `{"team":"hello"}`, - }, - Response: MockResponse{ - Code: 200, - Headers: MockHeaders{}, - Body: "byebye", - }, - } - - CreateMockExpectation(t, server, expectation) - - resp, err := server.Client.Do(req) - require.NoError(t, err) - defer resp.Body.Close() - - respStr, err := io.ReadAll(resp.Body) - require.NoError(t, err) - assert.Equal(t, []byte("byebye"), respStr) - - request := WaitForMockEndpoint(t, server, expectation.Request) - assert.Equal(t, []string([]string{"here"}), request.Headers["Hidden"]) -} diff --git a/internal/test/objectstore_test.go b/internal/test/objectstore_test.go deleted file mode 100644 index df8d793b..00000000 --- a/internal/test/objectstore_test.go +++ /dev/null @@ -1,64 +0,0 @@ -package test - -import ( - "strings" - "testing" - - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/aws" - - objectstore "queryorchestration/internal/serviceconfig/objectstore" - objectstoremock "queryorchestration/mocks/objectstore" - - "github.com/aws/aws-sdk-go-v2/service/s3" - "github.com/stretchr/testify/mock" -) - -type StoreConfig struct { - aws.AWSConfig - serviceconfig.BaseConfig - objectstore.ObjectStoreConfig -} - -func TestCreateBucket(t *testing.T) { - if testing.Short() { - t.SkipNow() - } - ctx := t.Context() - - cfg := &StoreConfig{} - - acfg := CreateAWSContainer(t, cfg) - SetStoreClient(t, ctx, cfg, acfg.ExternalEndpoint) - - CreateBucket(t, cfg) -} - -func TestPutObject(t *testing.T) { - ctx := t.Context() - - cfg := &StoreConfig{} - - mockS3 := objectstoremock.NewMockS3Client(t) - cfg.StoreClient = mockS3 - - file := strings.NewReader("hello") - key := objectstore.BucketKey{ - ClientID: "byebye", - } - - mockS3.EXPECT(). - PutObject( - mock.Anything, - mock.MatchedBy(func(in *s3.PutObjectInput) bool { - return *in.Bucket == GetAlias(t, "bucket") && *in.Key == key.String() - }), - mock.Anything, - ). - Return(&s3.PutObjectOutput{}, nil) - - PutObject(t, ctx, cfg, PutObjectParams{ - File: file, - Key: key, - }) -} diff --git a/internal/test/runner.go b/internal/test/runner.go index bcabf310..fd01d843 100644 --- a/internal/test/runner.go +++ b/internal/test/runner.go @@ -1,3 +1,7 @@ +// Package test provides test utilities and infrastructure. +// Note: Text extraction has been removed. DocTextRunner is no longer part of the pipeline. +// The document processing pipeline now ends at DocCleanRunner. +// See remove_texttract_and_mocks_plan.md for details. package test import ( @@ -8,10 +12,10 @@ import ( "queryorchestration/internal/serviceconfig/queue/documentclean" "queryorchestration/internal/serviceconfig/queue/documentinit" "queryorchestration/internal/serviceconfig/queue/documentsync" - "queryorchestration/internal/serviceconfig/queue/documenttext" "queryorchestration/internal/serviceconfig/queue/storeevent" ) +// RunnerName defines the name of a runner service. type RunnerName string const ( @@ -19,10 +23,10 @@ const ( DocInitRunnerName RunnerName = "docInitRunner" DocSyncRunnerName RunnerName = "docSyncRunner" DocCleanRunnerName RunnerName = "docCleanRunner" - DocTextRunnerName RunnerName = "docTextRunner" ClientSyncRunnerName RunnerName = "clientSyncRunner" ) +// RunnerEnv defines the environment variable name for a runner queue. type RunnerEnv string const ( @@ -30,15 +34,16 @@ const ( DocInitRunnerEnv RunnerEnv = documentinit.EnvName DocSyncRunnerEnv RunnerEnv = documentsync.EnvName DocCleanRunnerEnv RunnerEnv = documentclean.EnvName - DocTextRunnerEnv RunnerEnv = documenttext.EnvName ClientSyncRunnerEnv RunnerEnv = clientsync.EnvName ) +// Runner represents a runner service configuration. type Runner struct { Name RunnerName DownstreamQueues []RunnerName } +// GetRunnerEnvFromName returns the environment variable name for a given runner. func GetRunnerEnvFromName(name RunnerName) RunnerEnv { switch name { case StoreEventRunnerName: @@ -49,19 +54,18 @@ func GetRunnerEnvFromName(name RunnerName) RunnerEnv { return DocSyncRunnerEnv case DocCleanRunnerName: return DocCleanRunnerEnv - case DocTextRunnerName: - return DocTextRunnerEnv case ClientSyncRunnerName: return ClientSyncRunnerEnv } return DocInitRunnerEnv } +// RunnerConfig provides configuration for creating a runner container. type RunnerConfig struct { - Runner Runner - MockHTTP string + Runner Runner } +// CreateRunner creates a runner container for testing. func CreateRunner(t testing.TB, ctx context.Context, cfg ContainerConfigProvider, network string, config *RunnerConfig) (*Container, func()) { env := map[string]string{} url := GetQueueURL(t, cfg, config.Runner.Name) @@ -72,7 +76,6 @@ func CreateRunner(t testing.TB, ctx context.Context, cfg ContainerConfigProvider DownstreamQueues: config.Runner.DownstreamQueues, Cfg: cfg, Env: env, - MockHTTP: config.MockHTTP, WaitForMsg: "Listening to queue", }) @@ -82,33 +85,32 @@ func CreateRunner(t testing.TB, ctx context.Context, cfg ContainerConfigProvider }, cleanup } +// StoreEventRunner configuration. var StoreEventRunner = Runner{ Name: StoreEventRunnerName, DownstreamQueues: []RunnerName{DocInitRunnerName}, } +// DocInitRunner configuration. var DocInitRunner = Runner{ Name: DocInitRunnerName, DownstreamQueues: []RunnerName{DocSyncRunnerName}, } +// DocSyncRunner configuration. var DocSyncRunner = Runner{ Name: DocSyncRunnerName, DownstreamQueues: []RunnerName{DocCleanRunnerName}, } +// DocCleanRunner is the terminal runner in the main document processing pipeline. +// Note: Text extraction has been removed. Pipeline ends after cleaning. var DocCleanRunner = Runner{ Name: DocCleanRunnerName, - DownstreamQueues: []RunnerName{DocTextRunnerName}, -} - -// DocTextRunner is the terminal runner in the main document processing pipeline. -// Query processing has been removed - pipeline ends after text extraction. -var DocTextRunner = Runner{ - Name: DocTextRunnerName, - DownstreamQueues: []RunnerName{}, + DownstreamQueues: []RunnerName{}, // No downstream - pipeline ends here } +// ClientSyncRunner configuration. var ClientSyncRunner = Runner{ Name: ClientSyncRunnerName, DownstreamQueues: []RunnerName{DocSyncRunnerName}, @@ -119,6 +121,5 @@ var runners = []Runner{ DocInitRunner, DocSyncRunner, DocCleanRunner, - DocTextRunner, ClientSyncRunner, } diff --git a/internal/test/runner_test.go b/internal/test/runner_test.go index 234d28f1..6fd69c66 100644 --- a/internal/test/runner_test.go +++ b/internal/test/runner_test.go @@ -8,11 +8,11 @@ import ( // TestGetRunnerEnvFromName tests the runner environment name lookup. // Note: Query runner references have been removed. See remove_query_plan.md for details. +// Note: DocTextRunner has been removed. Text extraction is deprecated. func TestGetRunnerEnvFromName(t *testing.T) { assert.Equal(t, StoreEventRunnerEnv, GetRunnerEnvFromName(StoreEventRunnerName)) assert.Equal(t, DocInitRunnerEnv, GetRunnerEnvFromName(DocInitRunnerName)) assert.Equal(t, DocSyncRunnerEnv, GetRunnerEnvFromName(DocSyncRunnerName)) assert.Equal(t, DocCleanRunnerEnv, GetRunnerEnvFromName(DocCleanRunnerName)) - assert.Equal(t, DocTextRunnerEnv, GetRunnerEnvFromName(DocTextRunnerName)) assert.Equal(t, ClientSyncRunnerEnv, GetRunnerEnvFromName(ClientSyncRunnerName)) } diff --git a/mocks/objectstore/mock_S3Client.go b/mocks/objectstore/mock_S3Client.go deleted file mode 100644 index 6b59fd08..00000000 --- a/mocks/objectstore/mock_S3Client.go +++ /dev/null @@ -1,2258 +0,0 @@ -// Code generated by mockery v2.52.3. DO NOT EDIT. - -package objectstoremock - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - s3 "github.com/aws/aws-sdk-go-v2/service/s3" -) - -// MockS3Client is an autogenerated mock type for the S3Client type -type MockS3Client struct { - mock.Mock -} - -type MockS3Client_Expecter struct { - mock *mock.Mock -} - -func (_m *MockS3Client) EXPECT() *MockS3Client_Expecter { - return &MockS3Client_Expecter{mock: &_m.Mock} -} - -// AbortMultipartUpload provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) AbortMultipartUpload(ctx context.Context, params *s3.AbortMultipartUploadInput, opts ...func(*s3.Options)) (*s3.AbortMultipartUploadOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for AbortMultipartUpload") - } - - var r0 *s3.AbortMultipartUploadOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.AbortMultipartUploadInput, ...func(*s3.Options)) (*s3.AbortMultipartUploadOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.AbortMultipartUploadInput, ...func(*s3.Options)) *s3.AbortMultipartUploadOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.AbortMultipartUploadOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.AbortMultipartUploadInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_AbortMultipartUpload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AbortMultipartUpload' -type MockS3Client_AbortMultipartUpload_Call struct { - *mock.Call -} - -// AbortMultipartUpload is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.AbortMultipartUploadInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) AbortMultipartUpload(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_AbortMultipartUpload_Call { - return &MockS3Client_AbortMultipartUpload_Call{Call: _e.mock.On("AbortMultipartUpload", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_AbortMultipartUpload_Call) Run(run func(ctx context.Context, params *s3.AbortMultipartUploadInput, opts ...func(*s3.Options))) *MockS3Client_AbortMultipartUpload_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.AbortMultipartUploadInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_AbortMultipartUpload_Call) Return(_a0 *s3.AbortMultipartUploadOutput, _a1 error) *MockS3Client_AbortMultipartUpload_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_AbortMultipartUpload_Call) RunAndReturn(run func(context.Context, *s3.AbortMultipartUploadInput, ...func(*s3.Options)) (*s3.AbortMultipartUploadOutput, error)) *MockS3Client_AbortMultipartUpload_Call { - _c.Call.Return(run) - return _c -} - -// CompleteMultipartUpload provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) CompleteMultipartUpload(ctx context.Context, params *s3.CompleteMultipartUploadInput, opts ...func(*s3.Options)) (*s3.CompleteMultipartUploadOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CompleteMultipartUpload") - } - - var r0 *s3.CompleteMultipartUploadOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.CompleteMultipartUploadInput, ...func(*s3.Options)) (*s3.CompleteMultipartUploadOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.CompleteMultipartUploadInput, ...func(*s3.Options)) *s3.CompleteMultipartUploadOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.CompleteMultipartUploadOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.CompleteMultipartUploadInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_CompleteMultipartUpload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CompleteMultipartUpload' -type MockS3Client_CompleteMultipartUpload_Call struct { - *mock.Call -} - -// CompleteMultipartUpload is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.CompleteMultipartUploadInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) CompleteMultipartUpload(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_CompleteMultipartUpload_Call { - return &MockS3Client_CompleteMultipartUpload_Call{Call: _e.mock.On("CompleteMultipartUpload", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_CompleteMultipartUpload_Call) Run(run func(ctx context.Context, params *s3.CompleteMultipartUploadInput, opts ...func(*s3.Options))) *MockS3Client_CompleteMultipartUpload_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.CompleteMultipartUploadInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_CompleteMultipartUpload_Call) Return(_a0 *s3.CompleteMultipartUploadOutput, _a1 error) *MockS3Client_CompleteMultipartUpload_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_CompleteMultipartUpload_Call) RunAndReturn(run func(context.Context, *s3.CompleteMultipartUploadInput, ...func(*s3.Options)) (*s3.CompleteMultipartUploadOutput, error)) *MockS3Client_CompleteMultipartUpload_Call { - _c.Call.Return(run) - return _c -} - -// CopyObject provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) CopyObject(ctx context.Context, params *s3.CopyObjectInput, opts ...func(*s3.Options)) (*s3.CopyObjectOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CopyObject") - } - - var r0 *s3.CopyObjectOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.CopyObjectInput, ...func(*s3.Options)) (*s3.CopyObjectOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.CopyObjectInput, ...func(*s3.Options)) *s3.CopyObjectOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.CopyObjectOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.CopyObjectInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_CopyObject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CopyObject' -type MockS3Client_CopyObject_Call struct { - *mock.Call -} - -// CopyObject is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.CopyObjectInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) CopyObject(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_CopyObject_Call { - return &MockS3Client_CopyObject_Call{Call: _e.mock.On("CopyObject", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_CopyObject_Call) Run(run func(ctx context.Context, params *s3.CopyObjectInput, opts ...func(*s3.Options))) *MockS3Client_CopyObject_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.CopyObjectInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_CopyObject_Call) Return(_a0 *s3.CopyObjectOutput, _a1 error) *MockS3Client_CopyObject_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_CopyObject_Call) RunAndReturn(run func(context.Context, *s3.CopyObjectInput, ...func(*s3.Options)) (*s3.CopyObjectOutput, error)) *MockS3Client_CopyObject_Call { - _c.Call.Return(run) - return _c -} - -// CreateBucket provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) CreateBucket(ctx context.Context, params *s3.CreateBucketInput, opts ...func(*s3.Options)) (*s3.CreateBucketOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateBucket") - } - - var r0 *s3.CreateBucketOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.CreateBucketInput, ...func(*s3.Options)) (*s3.CreateBucketOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.CreateBucketInput, ...func(*s3.Options)) *s3.CreateBucketOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.CreateBucketOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.CreateBucketInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_CreateBucket_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateBucket' -type MockS3Client_CreateBucket_Call struct { - *mock.Call -} - -// CreateBucket is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.CreateBucketInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) CreateBucket(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_CreateBucket_Call { - return &MockS3Client_CreateBucket_Call{Call: _e.mock.On("CreateBucket", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_CreateBucket_Call) Run(run func(ctx context.Context, params *s3.CreateBucketInput, opts ...func(*s3.Options))) *MockS3Client_CreateBucket_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.CreateBucketInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_CreateBucket_Call) Return(_a0 *s3.CreateBucketOutput, _a1 error) *MockS3Client_CreateBucket_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_CreateBucket_Call) RunAndReturn(run func(context.Context, *s3.CreateBucketInput, ...func(*s3.Options)) (*s3.CreateBucketOutput, error)) *MockS3Client_CreateBucket_Call { - _c.Call.Return(run) - return _c -} - -// CreateMultipartUpload provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) CreateMultipartUpload(ctx context.Context, params *s3.CreateMultipartUploadInput, opts ...func(*s3.Options)) (*s3.CreateMultipartUploadOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateMultipartUpload") - } - - var r0 *s3.CreateMultipartUploadOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.CreateMultipartUploadInput, ...func(*s3.Options)) (*s3.CreateMultipartUploadOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.CreateMultipartUploadInput, ...func(*s3.Options)) *s3.CreateMultipartUploadOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.CreateMultipartUploadOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.CreateMultipartUploadInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_CreateMultipartUpload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateMultipartUpload' -type MockS3Client_CreateMultipartUpload_Call struct { - *mock.Call -} - -// CreateMultipartUpload is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.CreateMultipartUploadInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) CreateMultipartUpload(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_CreateMultipartUpload_Call { - return &MockS3Client_CreateMultipartUpload_Call{Call: _e.mock.On("CreateMultipartUpload", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_CreateMultipartUpload_Call) Run(run func(ctx context.Context, params *s3.CreateMultipartUploadInput, opts ...func(*s3.Options))) *MockS3Client_CreateMultipartUpload_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.CreateMultipartUploadInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_CreateMultipartUpload_Call) Return(_a0 *s3.CreateMultipartUploadOutput, _a1 error) *MockS3Client_CreateMultipartUpload_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_CreateMultipartUpload_Call) RunAndReturn(run func(context.Context, *s3.CreateMultipartUploadInput, ...func(*s3.Options)) (*s3.CreateMultipartUploadOutput, error)) *MockS3Client_CreateMultipartUpload_Call { - _c.Call.Return(run) - return _c -} - -// DeleteBucket provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) DeleteBucket(ctx context.Context, params *s3.DeleteBucketInput, opts ...func(*s3.Options)) (*s3.DeleteBucketOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteBucket") - } - - var r0 *s3.DeleteBucketOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteBucketInput, ...func(*s3.Options)) (*s3.DeleteBucketOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteBucketInput, ...func(*s3.Options)) *s3.DeleteBucketOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.DeleteBucketOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.DeleteBucketInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_DeleteBucket_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBucket' -type MockS3Client_DeleteBucket_Call struct { - *mock.Call -} - -// DeleteBucket is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.DeleteBucketInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) DeleteBucket(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_DeleteBucket_Call { - return &MockS3Client_DeleteBucket_Call{Call: _e.mock.On("DeleteBucket", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_DeleteBucket_Call) Run(run func(ctx context.Context, params *s3.DeleteBucketInput, opts ...func(*s3.Options))) *MockS3Client_DeleteBucket_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.DeleteBucketInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_DeleteBucket_Call) Return(_a0 *s3.DeleteBucketOutput, _a1 error) *MockS3Client_DeleteBucket_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_DeleteBucket_Call) RunAndReturn(run func(context.Context, *s3.DeleteBucketInput, ...func(*s3.Options)) (*s3.DeleteBucketOutput, error)) *MockS3Client_DeleteBucket_Call { - _c.Call.Return(run) - return _c -} - -// DeleteBucketLifecycle provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) DeleteBucketLifecycle(ctx context.Context, params *s3.DeleteBucketLifecycleInput, opts ...func(*s3.Options)) (*s3.DeleteBucketLifecycleOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteBucketLifecycle") - } - - var r0 *s3.DeleteBucketLifecycleOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteBucketLifecycleInput, ...func(*s3.Options)) (*s3.DeleteBucketLifecycleOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteBucketLifecycleInput, ...func(*s3.Options)) *s3.DeleteBucketLifecycleOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.DeleteBucketLifecycleOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.DeleteBucketLifecycleInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_DeleteBucketLifecycle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBucketLifecycle' -type MockS3Client_DeleteBucketLifecycle_Call struct { - *mock.Call -} - -// DeleteBucketLifecycle is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.DeleteBucketLifecycleInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) DeleteBucketLifecycle(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_DeleteBucketLifecycle_Call { - return &MockS3Client_DeleteBucketLifecycle_Call{Call: _e.mock.On("DeleteBucketLifecycle", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_DeleteBucketLifecycle_Call) Run(run func(ctx context.Context, params *s3.DeleteBucketLifecycleInput, opts ...func(*s3.Options))) *MockS3Client_DeleteBucketLifecycle_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.DeleteBucketLifecycleInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_DeleteBucketLifecycle_Call) Return(_a0 *s3.DeleteBucketLifecycleOutput, _a1 error) *MockS3Client_DeleteBucketLifecycle_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_DeleteBucketLifecycle_Call) RunAndReturn(run func(context.Context, *s3.DeleteBucketLifecycleInput, ...func(*s3.Options)) (*s3.DeleteBucketLifecycleOutput, error)) *MockS3Client_DeleteBucketLifecycle_Call { - _c.Call.Return(run) - return _c -} - -// DeleteObject provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) DeleteObject(ctx context.Context, params *s3.DeleteObjectInput, opts ...func(*s3.Options)) (*s3.DeleteObjectOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteObject") - } - - var r0 *s3.DeleteObjectOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteObjectInput, ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteObjectInput, ...func(*s3.Options)) *s3.DeleteObjectOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.DeleteObjectOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.DeleteObjectInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_DeleteObject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteObject' -type MockS3Client_DeleteObject_Call struct { - *mock.Call -} - -// DeleteObject is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.DeleteObjectInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) DeleteObject(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_DeleteObject_Call { - return &MockS3Client_DeleteObject_Call{Call: _e.mock.On("DeleteObject", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_DeleteObject_Call) Run(run func(ctx context.Context, params *s3.DeleteObjectInput, opts ...func(*s3.Options))) *MockS3Client_DeleteObject_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.DeleteObjectInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_DeleteObject_Call) Return(_a0 *s3.DeleteObjectOutput, _a1 error) *MockS3Client_DeleteObject_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_DeleteObject_Call) RunAndReturn(run func(context.Context, *s3.DeleteObjectInput, ...func(*s3.Options)) (*s3.DeleteObjectOutput, error)) *MockS3Client_DeleteObject_Call { - _c.Call.Return(run) - return _c -} - -// DeleteObjectTagging provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) DeleteObjectTagging(ctx context.Context, params *s3.DeleteObjectTaggingInput, opts ...func(*s3.Options)) (*s3.DeleteObjectTaggingOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteObjectTagging") - } - - var r0 *s3.DeleteObjectTaggingOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteObjectTaggingInput, ...func(*s3.Options)) (*s3.DeleteObjectTaggingOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteObjectTaggingInput, ...func(*s3.Options)) *s3.DeleteObjectTaggingOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.DeleteObjectTaggingOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.DeleteObjectTaggingInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_DeleteObjectTagging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteObjectTagging' -type MockS3Client_DeleteObjectTagging_Call struct { - *mock.Call -} - -// DeleteObjectTagging is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.DeleteObjectTaggingInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) DeleteObjectTagging(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_DeleteObjectTagging_Call { - return &MockS3Client_DeleteObjectTagging_Call{Call: _e.mock.On("DeleteObjectTagging", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_DeleteObjectTagging_Call) Run(run func(ctx context.Context, params *s3.DeleteObjectTaggingInput, opts ...func(*s3.Options))) *MockS3Client_DeleteObjectTagging_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.DeleteObjectTaggingInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_DeleteObjectTagging_Call) Return(_a0 *s3.DeleteObjectTaggingOutput, _a1 error) *MockS3Client_DeleteObjectTagging_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_DeleteObjectTagging_Call) RunAndReturn(run func(context.Context, *s3.DeleteObjectTaggingInput, ...func(*s3.Options)) (*s3.DeleteObjectTaggingOutput, error)) *MockS3Client_DeleteObjectTagging_Call { - _c.Call.Return(run) - return _c -} - -// DeleteObjects provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) DeleteObjects(ctx context.Context, params *s3.DeleteObjectsInput, opts ...func(*s3.Options)) (*s3.DeleteObjectsOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteObjects") - } - - var r0 *s3.DeleteObjectsOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteObjectsInput, ...func(*s3.Options)) (*s3.DeleteObjectsOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.DeleteObjectsInput, ...func(*s3.Options)) *s3.DeleteObjectsOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.DeleteObjectsOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.DeleteObjectsInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_DeleteObjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteObjects' -type MockS3Client_DeleteObjects_Call struct { - *mock.Call -} - -// DeleteObjects is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.DeleteObjectsInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) DeleteObjects(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_DeleteObjects_Call { - return &MockS3Client_DeleteObjects_Call{Call: _e.mock.On("DeleteObjects", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_DeleteObjects_Call) Run(run func(ctx context.Context, params *s3.DeleteObjectsInput, opts ...func(*s3.Options))) *MockS3Client_DeleteObjects_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.DeleteObjectsInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_DeleteObjects_Call) Return(_a0 *s3.DeleteObjectsOutput, _a1 error) *MockS3Client_DeleteObjects_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_DeleteObjects_Call) RunAndReturn(run func(context.Context, *s3.DeleteObjectsInput, ...func(*s3.Options)) (*s3.DeleteObjectsOutput, error)) *MockS3Client_DeleteObjects_Call { - _c.Call.Return(run) - return _c -} - -// GetBucketAcl provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) GetBucketAcl(ctx context.Context, params *s3.GetBucketAclInput, opts ...func(*s3.Options)) (*s3.GetBucketAclOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetBucketAcl") - } - - var r0 *s3.GetBucketAclOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetBucketAclInput, ...func(*s3.Options)) (*s3.GetBucketAclOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetBucketAclInput, ...func(*s3.Options)) *s3.GetBucketAclOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.GetBucketAclOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.GetBucketAclInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_GetBucketAcl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketAcl' -type MockS3Client_GetBucketAcl_Call struct { - *mock.Call -} - -// GetBucketAcl is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.GetBucketAclInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) GetBucketAcl(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_GetBucketAcl_Call { - return &MockS3Client_GetBucketAcl_Call{Call: _e.mock.On("GetBucketAcl", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_GetBucketAcl_Call) Run(run func(ctx context.Context, params *s3.GetBucketAclInput, opts ...func(*s3.Options))) *MockS3Client_GetBucketAcl_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.GetBucketAclInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_GetBucketAcl_Call) Return(_a0 *s3.GetBucketAclOutput, _a1 error) *MockS3Client_GetBucketAcl_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_GetBucketAcl_Call) RunAndReturn(run func(context.Context, *s3.GetBucketAclInput, ...func(*s3.Options)) (*s3.GetBucketAclOutput, error)) *MockS3Client_GetBucketAcl_Call { - _c.Call.Return(run) - return _c -} - -// GetBucketLifecycleConfiguration provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) GetBucketLifecycleConfiguration(ctx context.Context, params *s3.GetBucketLifecycleConfigurationInput, opts ...func(*s3.Options)) (*s3.GetBucketLifecycleConfigurationOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetBucketLifecycleConfiguration") - } - - var r0 *s3.GetBucketLifecycleConfigurationOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetBucketLifecycleConfigurationInput, ...func(*s3.Options)) (*s3.GetBucketLifecycleConfigurationOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetBucketLifecycleConfigurationInput, ...func(*s3.Options)) *s3.GetBucketLifecycleConfigurationOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.GetBucketLifecycleConfigurationOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.GetBucketLifecycleConfigurationInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_GetBucketLifecycleConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketLifecycleConfiguration' -type MockS3Client_GetBucketLifecycleConfiguration_Call struct { - *mock.Call -} - -// GetBucketLifecycleConfiguration is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.GetBucketLifecycleConfigurationInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) GetBucketLifecycleConfiguration(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_GetBucketLifecycleConfiguration_Call { - return &MockS3Client_GetBucketLifecycleConfiguration_Call{Call: _e.mock.On("GetBucketLifecycleConfiguration", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_GetBucketLifecycleConfiguration_Call) Run(run func(ctx context.Context, params *s3.GetBucketLifecycleConfigurationInput, opts ...func(*s3.Options))) *MockS3Client_GetBucketLifecycleConfiguration_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.GetBucketLifecycleConfigurationInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_GetBucketLifecycleConfiguration_Call) Return(_a0 *s3.GetBucketLifecycleConfigurationOutput, _a1 error) *MockS3Client_GetBucketLifecycleConfiguration_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_GetBucketLifecycleConfiguration_Call) RunAndReturn(run func(context.Context, *s3.GetBucketLifecycleConfigurationInput, ...func(*s3.Options)) (*s3.GetBucketLifecycleConfigurationOutput, error)) *MockS3Client_GetBucketLifecycleConfiguration_Call { - _c.Call.Return(run) - return _c -} - -// GetBucketNotificationConfiguration provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) GetBucketNotificationConfiguration(ctx context.Context, params *s3.GetBucketNotificationConfigurationInput, opts ...func(*s3.Options)) (*s3.GetBucketNotificationConfigurationOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetBucketNotificationConfiguration") - } - - var r0 *s3.GetBucketNotificationConfigurationOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetBucketNotificationConfigurationInput, ...func(*s3.Options)) (*s3.GetBucketNotificationConfigurationOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetBucketNotificationConfigurationInput, ...func(*s3.Options)) *s3.GetBucketNotificationConfigurationOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.GetBucketNotificationConfigurationOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.GetBucketNotificationConfigurationInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_GetBucketNotificationConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBucketNotificationConfiguration' -type MockS3Client_GetBucketNotificationConfiguration_Call struct { - *mock.Call -} - -// GetBucketNotificationConfiguration is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.GetBucketNotificationConfigurationInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) GetBucketNotificationConfiguration(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_GetBucketNotificationConfiguration_Call { - return &MockS3Client_GetBucketNotificationConfiguration_Call{Call: _e.mock.On("GetBucketNotificationConfiguration", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_GetBucketNotificationConfiguration_Call) Run(run func(ctx context.Context, params *s3.GetBucketNotificationConfigurationInput, opts ...func(*s3.Options))) *MockS3Client_GetBucketNotificationConfiguration_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.GetBucketNotificationConfigurationInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_GetBucketNotificationConfiguration_Call) Return(_a0 *s3.GetBucketNotificationConfigurationOutput, _a1 error) *MockS3Client_GetBucketNotificationConfiguration_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_GetBucketNotificationConfiguration_Call) RunAndReturn(run func(context.Context, *s3.GetBucketNotificationConfigurationInput, ...func(*s3.Options)) (*s3.GetBucketNotificationConfigurationOutput, error)) *MockS3Client_GetBucketNotificationConfiguration_Call { - _c.Call.Return(run) - return _c -} - -// GetObject provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) GetObject(ctx context.Context, params *s3.GetObjectInput, opts ...func(*s3.Options)) (*s3.GetObjectOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetObject") - } - - var r0 *s3.GetObjectOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetObjectInput, ...func(*s3.Options)) (*s3.GetObjectOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetObjectInput, ...func(*s3.Options)) *s3.GetObjectOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.GetObjectOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.GetObjectInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_GetObject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetObject' -type MockS3Client_GetObject_Call struct { - *mock.Call -} - -// GetObject is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.GetObjectInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) GetObject(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_GetObject_Call { - return &MockS3Client_GetObject_Call{Call: _e.mock.On("GetObject", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_GetObject_Call) Run(run func(ctx context.Context, params *s3.GetObjectInput, opts ...func(*s3.Options))) *MockS3Client_GetObject_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.GetObjectInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_GetObject_Call) Return(_a0 *s3.GetObjectOutput, _a1 error) *MockS3Client_GetObject_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_GetObject_Call) RunAndReturn(run func(context.Context, *s3.GetObjectInput, ...func(*s3.Options)) (*s3.GetObjectOutput, error)) *MockS3Client_GetObject_Call { - _c.Call.Return(run) - return _c -} - -// GetObjectAcl provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) GetObjectAcl(ctx context.Context, params *s3.GetObjectAclInput, opts ...func(*s3.Options)) (*s3.GetObjectAclOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetObjectAcl") - } - - var r0 *s3.GetObjectAclOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetObjectAclInput, ...func(*s3.Options)) (*s3.GetObjectAclOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetObjectAclInput, ...func(*s3.Options)) *s3.GetObjectAclOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.GetObjectAclOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.GetObjectAclInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_GetObjectAcl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetObjectAcl' -type MockS3Client_GetObjectAcl_Call struct { - *mock.Call -} - -// GetObjectAcl is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.GetObjectAclInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) GetObjectAcl(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_GetObjectAcl_Call { - return &MockS3Client_GetObjectAcl_Call{Call: _e.mock.On("GetObjectAcl", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_GetObjectAcl_Call) Run(run func(ctx context.Context, params *s3.GetObjectAclInput, opts ...func(*s3.Options))) *MockS3Client_GetObjectAcl_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.GetObjectAclInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_GetObjectAcl_Call) Return(_a0 *s3.GetObjectAclOutput, _a1 error) *MockS3Client_GetObjectAcl_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_GetObjectAcl_Call) RunAndReturn(run func(context.Context, *s3.GetObjectAclInput, ...func(*s3.Options)) (*s3.GetObjectAclOutput, error)) *MockS3Client_GetObjectAcl_Call { - _c.Call.Return(run) - return _c -} - -// GetObjectTagging provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) GetObjectTagging(ctx context.Context, params *s3.GetObjectTaggingInput, opts ...func(*s3.Options)) (*s3.GetObjectTaggingOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetObjectTagging") - } - - var r0 *s3.GetObjectTaggingOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetObjectTaggingInput, ...func(*s3.Options)) (*s3.GetObjectTaggingOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.GetObjectTaggingInput, ...func(*s3.Options)) *s3.GetObjectTaggingOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.GetObjectTaggingOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.GetObjectTaggingInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_GetObjectTagging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetObjectTagging' -type MockS3Client_GetObjectTagging_Call struct { - *mock.Call -} - -// GetObjectTagging is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.GetObjectTaggingInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) GetObjectTagging(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_GetObjectTagging_Call { - return &MockS3Client_GetObjectTagging_Call{Call: _e.mock.On("GetObjectTagging", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_GetObjectTagging_Call) Run(run func(ctx context.Context, params *s3.GetObjectTaggingInput, opts ...func(*s3.Options))) *MockS3Client_GetObjectTagging_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.GetObjectTaggingInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_GetObjectTagging_Call) Return(_a0 *s3.GetObjectTaggingOutput, _a1 error) *MockS3Client_GetObjectTagging_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_GetObjectTagging_Call) RunAndReturn(run func(context.Context, *s3.GetObjectTaggingInput, ...func(*s3.Options)) (*s3.GetObjectTaggingOutput, error)) *MockS3Client_GetObjectTagging_Call { - _c.Call.Return(run) - return _c -} - -// HeadBucket provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) HeadBucket(ctx context.Context, params *s3.HeadBucketInput, opts ...func(*s3.Options)) (*s3.HeadBucketOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for HeadBucket") - } - - var r0 *s3.HeadBucketOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.HeadBucketInput, ...func(*s3.Options)) (*s3.HeadBucketOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.HeadBucketInput, ...func(*s3.Options)) *s3.HeadBucketOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.HeadBucketOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.HeadBucketInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_HeadBucket_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeadBucket' -type MockS3Client_HeadBucket_Call struct { - *mock.Call -} - -// HeadBucket is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.HeadBucketInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) HeadBucket(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_HeadBucket_Call { - return &MockS3Client_HeadBucket_Call{Call: _e.mock.On("HeadBucket", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_HeadBucket_Call) Run(run func(ctx context.Context, params *s3.HeadBucketInput, opts ...func(*s3.Options))) *MockS3Client_HeadBucket_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.HeadBucketInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_HeadBucket_Call) Return(_a0 *s3.HeadBucketOutput, _a1 error) *MockS3Client_HeadBucket_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_HeadBucket_Call) RunAndReturn(run func(context.Context, *s3.HeadBucketInput, ...func(*s3.Options)) (*s3.HeadBucketOutput, error)) *MockS3Client_HeadBucket_Call { - _c.Call.Return(run) - return _c -} - -// HeadObject provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) HeadObject(ctx context.Context, params *s3.HeadObjectInput, opts ...func(*s3.Options)) (*s3.HeadObjectOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for HeadObject") - } - - var r0 *s3.HeadObjectOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.HeadObjectInput, ...func(*s3.Options)) (*s3.HeadObjectOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.HeadObjectInput, ...func(*s3.Options)) *s3.HeadObjectOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.HeadObjectOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.HeadObjectInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_HeadObject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HeadObject' -type MockS3Client_HeadObject_Call struct { - *mock.Call -} - -// HeadObject is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.HeadObjectInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) HeadObject(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_HeadObject_Call { - return &MockS3Client_HeadObject_Call{Call: _e.mock.On("HeadObject", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_HeadObject_Call) Run(run func(ctx context.Context, params *s3.HeadObjectInput, opts ...func(*s3.Options))) *MockS3Client_HeadObject_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.HeadObjectInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_HeadObject_Call) Return(_a0 *s3.HeadObjectOutput, _a1 error) *MockS3Client_HeadObject_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_HeadObject_Call) RunAndReturn(run func(context.Context, *s3.HeadObjectInput, ...func(*s3.Options)) (*s3.HeadObjectOutput, error)) *MockS3Client_HeadObject_Call { - _c.Call.Return(run) - return _c -} - -// ListBuckets provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) ListBuckets(ctx context.Context, params *s3.ListBucketsInput, opts ...func(*s3.Options)) (*s3.ListBucketsOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListBuckets") - } - - var r0 *s3.ListBucketsOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListBucketsInput, ...func(*s3.Options)) (*s3.ListBucketsOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListBucketsInput, ...func(*s3.Options)) *s3.ListBucketsOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.ListBucketsOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.ListBucketsInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_ListBuckets_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListBuckets' -type MockS3Client_ListBuckets_Call struct { - *mock.Call -} - -// ListBuckets is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.ListBucketsInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) ListBuckets(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_ListBuckets_Call { - return &MockS3Client_ListBuckets_Call{Call: _e.mock.On("ListBuckets", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_ListBuckets_Call) Run(run func(ctx context.Context, params *s3.ListBucketsInput, opts ...func(*s3.Options))) *MockS3Client_ListBuckets_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.ListBucketsInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_ListBuckets_Call) Return(_a0 *s3.ListBucketsOutput, _a1 error) *MockS3Client_ListBuckets_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_ListBuckets_Call) RunAndReturn(run func(context.Context, *s3.ListBucketsInput, ...func(*s3.Options)) (*s3.ListBucketsOutput, error)) *MockS3Client_ListBuckets_Call { - _c.Call.Return(run) - return _c -} - -// ListMultipartUploads provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) ListMultipartUploads(ctx context.Context, params *s3.ListMultipartUploadsInput, opts ...func(*s3.Options)) (*s3.ListMultipartUploadsOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListMultipartUploads") - } - - var r0 *s3.ListMultipartUploadsOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListMultipartUploadsInput, ...func(*s3.Options)) (*s3.ListMultipartUploadsOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListMultipartUploadsInput, ...func(*s3.Options)) *s3.ListMultipartUploadsOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.ListMultipartUploadsOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.ListMultipartUploadsInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_ListMultipartUploads_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListMultipartUploads' -type MockS3Client_ListMultipartUploads_Call struct { - *mock.Call -} - -// ListMultipartUploads is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.ListMultipartUploadsInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) ListMultipartUploads(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_ListMultipartUploads_Call { - return &MockS3Client_ListMultipartUploads_Call{Call: _e.mock.On("ListMultipartUploads", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_ListMultipartUploads_Call) Run(run func(ctx context.Context, params *s3.ListMultipartUploadsInput, opts ...func(*s3.Options))) *MockS3Client_ListMultipartUploads_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.ListMultipartUploadsInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_ListMultipartUploads_Call) Return(_a0 *s3.ListMultipartUploadsOutput, _a1 error) *MockS3Client_ListMultipartUploads_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_ListMultipartUploads_Call) RunAndReturn(run func(context.Context, *s3.ListMultipartUploadsInput, ...func(*s3.Options)) (*s3.ListMultipartUploadsOutput, error)) *MockS3Client_ListMultipartUploads_Call { - _c.Call.Return(run) - return _c -} - -// ListObjects provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) ListObjects(ctx context.Context, params *s3.ListObjectsInput, opts ...func(*s3.Options)) (*s3.ListObjectsOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListObjects") - } - - var r0 *s3.ListObjectsOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListObjectsInput, ...func(*s3.Options)) (*s3.ListObjectsOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListObjectsInput, ...func(*s3.Options)) *s3.ListObjectsOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.ListObjectsOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.ListObjectsInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_ListObjects_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListObjects' -type MockS3Client_ListObjects_Call struct { - *mock.Call -} - -// ListObjects is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.ListObjectsInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) ListObjects(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_ListObjects_Call { - return &MockS3Client_ListObjects_Call{Call: _e.mock.On("ListObjects", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_ListObjects_Call) Run(run func(ctx context.Context, params *s3.ListObjectsInput, opts ...func(*s3.Options))) *MockS3Client_ListObjects_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.ListObjectsInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_ListObjects_Call) Return(_a0 *s3.ListObjectsOutput, _a1 error) *MockS3Client_ListObjects_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_ListObjects_Call) RunAndReturn(run func(context.Context, *s3.ListObjectsInput, ...func(*s3.Options)) (*s3.ListObjectsOutput, error)) *MockS3Client_ListObjects_Call { - _c.Call.Return(run) - return _c -} - -// ListObjectsV2 provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) ListObjectsV2(ctx context.Context, params *s3.ListObjectsV2Input, opts ...func(*s3.Options)) (*s3.ListObjectsV2Output, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListObjectsV2") - } - - var r0 *s3.ListObjectsV2Output - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListObjectsV2Input, ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListObjectsV2Input, ...func(*s3.Options)) *s3.ListObjectsV2Output); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.ListObjectsV2Output) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.ListObjectsV2Input, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_ListObjectsV2_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListObjectsV2' -type MockS3Client_ListObjectsV2_Call struct { - *mock.Call -} - -// ListObjectsV2 is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.ListObjectsV2Input -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) ListObjectsV2(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_ListObjectsV2_Call { - return &MockS3Client_ListObjectsV2_Call{Call: _e.mock.On("ListObjectsV2", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_ListObjectsV2_Call) Run(run func(ctx context.Context, params *s3.ListObjectsV2Input, opts ...func(*s3.Options))) *MockS3Client_ListObjectsV2_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.ListObjectsV2Input), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_ListObjectsV2_Call) Return(_a0 *s3.ListObjectsV2Output, _a1 error) *MockS3Client_ListObjectsV2_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_ListObjectsV2_Call) RunAndReturn(run func(context.Context, *s3.ListObjectsV2Input, ...func(*s3.Options)) (*s3.ListObjectsV2Output, error)) *MockS3Client_ListObjectsV2_Call { - _c.Call.Return(run) - return _c -} - -// ListParts provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) ListParts(ctx context.Context, params *s3.ListPartsInput, opts ...func(*s3.Options)) (*s3.ListPartsOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListParts") - } - - var r0 *s3.ListPartsOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListPartsInput, ...func(*s3.Options)) (*s3.ListPartsOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.ListPartsInput, ...func(*s3.Options)) *s3.ListPartsOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.ListPartsOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.ListPartsInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_ListParts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListParts' -type MockS3Client_ListParts_Call struct { - *mock.Call -} - -// ListParts is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.ListPartsInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) ListParts(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_ListParts_Call { - return &MockS3Client_ListParts_Call{Call: _e.mock.On("ListParts", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_ListParts_Call) Run(run func(ctx context.Context, params *s3.ListPartsInput, opts ...func(*s3.Options))) *MockS3Client_ListParts_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.ListPartsInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_ListParts_Call) Return(_a0 *s3.ListPartsOutput, _a1 error) *MockS3Client_ListParts_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_ListParts_Call) RunAndReturn(run func(context.Context, *s3.ListPartsInput, ...func(*s3.Options)) (*s3.ListPartsOutput, error)) *MockS3Client_ListParts_Call { - _c.Call.Return(run) - return _c -} - -// PutBucketAcl provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) PutBucketAcl(ctx context.Context, params *s3.PutBucketAclInput, opts ...func(*s3.Options)) (*s3.PutBucketAclOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for PutBucketAcl") - } - - var r0 *s3.PutBucketAclOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutBucketAclInput, ...func(*s3.Options)) (*s3.PutBucketAclOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutBucketAclInput, ...func(*s3.Options)) *s3.PutBucketAclOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.PutBucketAclOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.PutBucketAclInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_PutBucketAcl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PutBucketAcl' -type MockS3Client_PutBucketAcl_Call struct { - *mock.Call -} - -// PutBucketAcl is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.PutBucketAclInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) PutBucketAcl(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_PutBucketAcl_Call { - return &MockS3Client_PutBucketAcl_Call{Call: _e.mock.On("PutBucketAcl", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_PutBucketAcl_Call) Run(run func(ctx context.Context, params *s3.PutBucketAclInput, opts ...func(*s3.Options))) *MockS3Client_PutBucketAcl_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.PutBucketAclInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_PutBucketAcl_Call) Return(_a0 *s3.PutBucketAclOutput, _a1 error) *MockS3Client_PutBucketAcl_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_PutBucketAcl_Call) RunAndReturn(run func(context.Context, *s3.PutBucketAclInput, ...func(*s3.Options)) (*s3.PutBucketAclOutput, error)) *MockS3Client_PutBucketAcl_Call { - _c.Call.Return(run) - return _c -} - -// PutBucketLifecycleConfiguration provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) PutBucketLifecycleConfiguration(ctx context.Context, params *s3.PutBucketLifecycleConfigurationInput, opts ...func(*s3.Options)) (*s3.PutBucketLifecycleConfigurationOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for PutBucketLifecycleConfiguration") - } - - var r0 *s3.PutBucketLifecycleConfigurationOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutBucketLifecycleConfigurationInput, ...func(*s3.Options)) (*s3.PutBucketLifecycleConfigurationOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutBucketLifecycleConfigurationInput, ...func(*s3.Options)) *s3.PutBucketLifecycleConfigurationOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.PutBucketLifecycleConfigurationOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.PutBucketLifecycleConfigurationInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_PutBucketLifecycleConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PutBucketLifecycleConfiguration' -type MockS3Client_PutBucketLifecycleConfiguration_Call struct { - *mock.Call -} - -// PutBucketLifecycleConfiguration is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.PutBucketLifecycleConfigurationInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) PutBucketLifecycleConfiguration(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_PutBucketLifecycleConfiguration_Call { - return &MockS3Client_PutBucketLifecycleConfiguration_Call{Call: _e.mock.On("PutBucketLifecycleConfiguration", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_PutBucketLifecycleConfiguration_Call) Run(run func(ctx context.Context, params *s3.PutBucketLifecycleConfigurationInput, opts ...func(*s3.Options))) *MockS3Client_PutBucketLifecycleConfiguration_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.PutBucketLifecycleConfigurationInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_PutBucketLifecycleConfiguration_Call) Return(_a0 *s3.PutBucketLifecycleConfigurationOutput, _a1 error) *MockS3Client_PutBucketLifecycleConfiguration_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_PutBucketLifecycleConfiguration_Call) RunAndReturn(run func(context.Context, *s3.PutBucketLifecycleConfigurationInput, ...func(*s3.Options)) (*s3.PutBucketLifecycleConfigurationOutput, error)) *MockS3Client_PutBucketLifecycleConfiguration_Call { - _c.Call.Return(run) - return _c -} - -// PutBucketNotificationConfiguration provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) PutBucketNotificationConfiguration(ctx context.Context, params *s3.PutBucketNotificationConfigurationInput, opts ...func(*s3.Options)) (*s3.PutBucketNotificationConfigurationOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for PutBucketNotificationConfiguration") - } - - var r0 *s3.PutBucketNotificationConfigurationOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutBucketNotificationConfigurationInput, ...func(*s3.Options)) (*s3.PutBucketNotificationConfigurationOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutBucketNotificationConfigurationInput, ...func(*s3.Options)) *s3.PutBucketNotificationConfigurationOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.PutBucketNotificationConfigurationOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.PutBucketNotificationConfigurationInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_PutBucketNotificationConfiguration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PutBucketNotificationConfiguration' -type MockS3Client_PutBucketNotificationConfiguration_Call struct { - *mock.Call -} - -// PutBucketNotificationConfiguration is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.PutBucketNotificationConfigurationInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) PutBucketNotificationConfiguration(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_PutBucketNotificationConfiguration_Call { - return &MockS3Client_PutBucketNotificationConfiguration_Call{Call: _e.mock.On("PutBucketNotificationConfiguration", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_PutBucketNotificationConfiguration_Call) Run(run func(ctx context.Context, params *s3.PutBucketNotificationConfigurationInput, opts ...func(*s3.Options))) *MockS3Client_PutBucketNotificationConfiguration_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.PutBucketNotificationConfigurationInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_PutBucketNotificationConfiguration_Call) Return(_a0 *s3.PutBucketNotificationConfigurationOutput, _a1 error) *MockS3Client_PutBucketNotificationConfiguration_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_PutBucketNotificationConfiguration_Call) RunAndReturn(run func(context.Context, *s3.PutBucketNotificationConfigurationInput, ...func(*s3.Options)) (*s3.PutBucketNotificationConfigurationOutput, error)) *MockS3Client_PutBucketNotificationConfiguration_Call { - _c.Call.Return(run) - return _c -} - -// PutObject provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) PutObject(ctx context.Context, params *s3.PutObjectInput, opts ...func(*s3.Options)) (*s3.PutObjectOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for PutObject") - } - - var r0 *s3.PutObjectOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutObjectInput, ...func(*s3.Options)) (*s3.PutObjectOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutObjectInput, ...func(*s3.Options)) *s3.PutObjectOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.PutObjectOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.PutObjectInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_PutObject_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PutObject' -type MockS3Client_PutObject_Call struct { - *mock.Call -} - -// PutObject is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.PutObjectInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) PutObject(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_PutObject_Call { - return &MockS3Client_PutObject_Call{Call: _e.mock.On("PutObject", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_PutObject_Call) Run(run func(ctx context.Context, params *s3.PutObjectInput, opts ...func(*s3.Options))) *MockS3Client_PutObject_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.PutObjectInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_PutObject_Call) Return(_a0 *s3.PutObjectOutput, _a1 error) *MockS3Client_PutObject_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_PutObject_Call) RunAndReturn(run func(context.Context, *s3.PutObjectInput, ...func(*s3.Options)) (*s3.PutObjectOutput, error)) *MockS3Client_PutObject_Call { - _c.Call.Return(run) - return _c -} - -// PutObjectAcl provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) PutObjectAcl(ctx context.Context, params *s3.PutObjectAclInput, opts ...func(*s3.Options)) (*s3.PutObjectAclOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for PutObjectAcl") - } - - var r0 *s3.PutObjectAclOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutObjectAclInput, ...func(*s3.Options)) (*s3.PutObjectAclOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutObjectAclInput, ...func(*s3.Options)) *s3.PutObjectAclOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.PutObjectAclOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.PutObjectAclInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_PutObjectAcl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PutObjectAcl' -type MockS3Client_PutObjectAcl_Call struct { - *mock.Call -} - -// PutObjectAcl is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.PutObjectAclInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) PutObjectAcl(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_PutObjectAcl_Call { - return &MockS3Client_PutObjectAcl_Call{Call: _e.mock.On("PutObjectAcl", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_PutObjectAcl_Call) Run(run func(ctx context.Context, params *s3.PutObjectAclInput, opts ...func(*s3.Options))) *MockS3Client_PutObjectAcl_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.PutObjectAclInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_PutObjectAcl_Call) Return(_a0 *s3.PutObjectAclOutput, _a1 error) *MockS3Client_PutObjectAcl_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_PutObjectAcl_Call) RunAndReturn(run func(context.Context, *s3.PutObjectAclInput, ...func(*s3.Options)) (*s3.PutObjectAclOutput, error)) *MockS3Client_PutObjectAcl_Call { - _c.Call.Return(run) - return _c -} - -// PutObjectTagging provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) PutObjectTagging(ctx context.Context, params *s3.PutObjectTaggingInput, opts ...func(*s3.Options)) (*s3.PutObjectTaggingOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for PutObjectTagging") - } - - var r0 *s3.PutObjectTaggingOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutObjectTaggingInput, ...func(*s3.Options)) (*s3.PutObjectTaggingOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.PutObjectTaggingInput, ...func(*s3.Options)) *s3.PutObjectTaggingOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.PutObjectTaggingOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.PutObjectTaggingInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_PutObjectTagging_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PutObjectTagging' -type MockS3Client_PutObjectTagging_Call struct { - *mock.Call -} - -// PutObjectTagging is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.PutObjectTaggingInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) PutObjectTagging(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_PutObjectTagging_Call { - return &MockS3Client_PutObjectTagging_Call{Call: _e.mock.On("PutObjectTagging", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_PutObjectTagging_Call) Run(run func(ctx context.Context, params *s3.PutObjectTaggingInput, opts ...func(*s3.Options))) *MockS3Client_PutObjectTagging_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.PutObjectTaggingInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_PutObjectTagging_Call) Return(_a0 *s3.PutObjectTaggingOutput, _a1 error) *MockS3Client_PutObjectTagging_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_PutObjectTagging_Call) RunAndReturn(run func(context.Context, *s3.PutObjectTaggingInput, ...func(*s3.Options)) (*s3.PutObjectTaggingOutput, error)) *MockS3Client_PutObjectTagging_Call { - _c.Call.Return(run) - return _c -} - -// UploadPart provides a mock function with given fields: ctx, params, opts -func (_m *MockS3Client) UploadPart(ctx context.Context, params *s3.UploadPartInput, opts ...func(*s3.Options)) (*s3.UploadPartOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UploadPart") - } - - var r0 *s3.UploadPartOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *s3.UploadPartInput, ...func(*s3.Options)) (*s3.UploadPartOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *s3.UploadPartInput, ...func(*s3.Options)) *s3.UploadPartOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*s3.UploadPartOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *s3.UploadPartInput, ...func(*s3.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockS3Client_UploadPart_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UploadPart' -type MockS3Client_UploadPart_Call struct { - *mock.Call -} - -// UploadPart is a helper method to define mock.On call -// - ctx context.Context -// - params *s3.UploadPartInput -// - opts ...func(*s3.Options) -func (_e *MockS3Client_Expecter) UploadPart(ctx interface{}, params interface{}, opts ...interface{}) *MockS3Client_UploadPart_Call { - return &MockS3Client_UploadPart_Call{Call: _e.mock.On("UploadPart", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockS3Client_UploadPart_Call) Run(run func(ctx context.Context, params *s3.UploadPartInput, opts ...func(*s3.Options))) *MockS3Client_UploadPart_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*s3.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*s3.Options)) - } - } - run(args[0].(context.Context), args[1].(*s3.UploadPartInput), variadicArgs...) - }) - return _c -} - -func (_c *MockS3Client_UploadPart_Call) Return(_a0 *s3.UploadPartOutput, _a1 error) *MockS3Client_UploadPart_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockS3Client_UploadPart_Call) RunAndReturn(run func(context.Context, *s3.UploadPartInput, ...func(*s3.Options)) (*s3.UploadPartOutput, error)) *MockS3Client_UploadPart_Call { - _c.Call.Return(run) - return _c -} - -// NewMockS3Client creates a new instance of MockS3Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockS3Client(t interface { - mock.TestingT - Cleanup(func()) -}) *MockS3Client { - mock := &MockS3Client{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/queryapi/mock_ClientInterface.go b/mocks/queryapi/mock_ClientInterface.go deleted file mode 100644 index d716229f..00000000 --- a/mocks/queryapi/mock_ClientInterface.go +++ /dev/null @@ -1,3846 +0,0 @@ -// Code generated by mockery v2.52.3. DO NOT EDIT. - -package queryapimock - -import ( - context "context" - http "net/http" - - io "io" - - mock "github.com/stretchr/testify/mock" - - queryapi "queryorchestration/pkg/queryAPI" - - types "github.com/oapi-codegen/runtime/types" -) - -// MockClientInterface is an autogenerated mock type for the ClientInterface type -type MockClientInterface struct { - mock.Mock -} - -type MockClientInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockClientInterface) EXPECT() *MockClientInterface_Expecter { - return &MockClientInterface_Expecter{mock: &_m.Mock} -} - -// ApplyLabel provides a mock function with given fields: ctx, documentId, body, reqEditors -func (_m *MockClientInterface) ApplyLabel(ctx context.Context, documentId types.UUID, body queryapi.ApplyLabelJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, documentId, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ApplyLabel") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, queryapi.ApplyLabelJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, documentId, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, queryapi.ApplyLabelJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, documentId, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, queryapi.ApplyLabelJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, documentId, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_ApplyLabel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyLabel' -type MockClientInterface_ApplyLabel_Call struct { - *mock.Call -} - -// ApplyLabel is a helper method to define mock.On call -// - ctx context.Context -// - documentId types.UUID -// - body queryapi.ApplyLabelJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) ApplyLabel(ctx interface{}, documentId interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_ApplyLabel_Call { - return &MockClientInterface_ApplyLabel_Call{Call: _e.mock.On("ApplyLabel", - append([]interface{}{ctx, documentId, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_ApplyLabel_Call) Run(run func(ctx context.Context, documentId types.UUID, body queryapi.ApplyLabelJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_ApplyLabel_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(queryapi.ApplyLabelJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_ApplyLabel_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_ApplyLabel_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_ApplyLabel_Call) RunAndReturn(run func(context.Context, types.UUID, queryapi.ApplyLabelJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_ApplyLabel_Call { - _c.Call.Return(run) - return _c -} - -// ApplyLabelWithBody provides a mock function with given fields: ctx, documentId, contentType, body, reqEditors -func (_m *MockClientInterface) ApplyLabelWithBody(ctx context.Context, documentId types.UUID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, documentId, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ApplyLabelWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, documentId, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, documentId, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, documentId, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_ApplyLabelWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyLabelWithBody' -type MockClientInterface_ApplyLabelWithBody_Call struct { - *mock.Call -} - -// ApplyLabelWithBody is a helper method to define mock.On call -// - ctx context.Context -// - documentId types.UUID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) ApplyLabelWithBody(ctx interface{}, documentId interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_ApplyLabelWithBody_Call { - return &MockClientInterface_ApplyLabelWithBody_Call{Call: _e.mock.On("ApplyLabelWithBody", - append([]interface{}{ctx, documentId, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_ApplyLabelWithBody_Call) Run(run func(ctx context.Context, documentId types.UUID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_ApplyLabelWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_ApplyLabelWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_ApplyLabelWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_ApplyLabelWithBody_Call) RunAndReturn(run func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_ApplyLabelWithBody_Call { - _c.Call.Return(run) - return _c -} - -// CancelDocumentBatch provides a mock function with given fields: ctx, id, batchId, reqEditors -func (_m *MockClientInterface) CancelDocumentBatch(ctx context.Context, id queryapi.ClientID, batchId queryapi.BatchID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, batchId) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CancelDocumentBatch") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, batchId, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, batchId, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, batchId, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CancelDocumentBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CancelDocumentBatch' -type MockClientInterface_CancelDocumentBatch_Call struct { - *mock.Call -} - -// CancelDocumentBatch is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - batchId queryapi.BatchID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CancelDocumentBatch(ctx interface{}, id interface{}, batchId interface{}, reqEditors ...interface{}) *MockClientInterface_CancelDocumentBatch_Call { - return &MockClientInterface_CancelDocumentBatch_Call{Call: _e.mock.On("CancelDocumentBatch", - append([]interface{}{ctx, id, batchId}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CancelDocumentBatch_Call) Run(run func(ctx context.Context, id queryapi.ClientID, batchId queryapi.BatchID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CancelDocumentBatch_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.BatchID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CancelDocumentBatch_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CancelDocumentBatch_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CancelDocumentBatch_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CancelDocumentBatch_Call { - _c.Call.Return(run) - return _c -} - -// CheckAdminUserExists provides a mock function with given fields: ctx, email, reqEditors -func (_m *MockClientInterface) CheckAdminUserExists(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CheckAdminUserExists") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, email, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, email, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CheckAdminUserExists_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckAdminUserExists' -type MockClientInterface_CheckAdminUserExists_Call struct { - *mock.Call -} - -// CheckAdminUserExists is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CheckAdminUserExists(ctx interface{}, email interface{}, reqEditors ...interface{}) *MockClientInterface_CheckAdminUserExists_Call { - return &MockClientInterface_CheckAdminUserExists_Call{Call: _e.mock.On("CheckAdminUserExists", - append([]interface{}{ctx, email}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CheckAdminUserExists_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CheckAdminUserExists_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CheckAdminUserExists_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CheckAdminUserExists_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CheckAdminUserExists_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CheckAdminUserExists_Call { - _c.Call.Return(run) - return _c -} - -// CreateAdminUser provides a mock function with given fields: ctx, body, reqEditors -func (_m *MockClientInterface) CreateAdminUser(ctx context.Context, body queryapi.CreateAdminUserJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateAdminUser") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.CreateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CreateAdminUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAdminUser' -type MockClientInterface_CreateAdminUser_Call struct { - *mock.Call -} - -// CreateAdminUser is a helper method to define mock.On call -// - ctx context.Context -// - body queryapi.CreateAdminUserJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CreateAdminUser(ctx interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_CreateAdminUser_Call { - return &MockClientInterface_CreateAdminUser_Call{Call: _e.mock.On("CreateAdminUser", - append([]interface{}{ctx, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CreateAdminUser_Call) Run(run func(ctx context.Context, body queryapi.CreateAdminUserJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CreateAdminUser_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.CreateAdminUserJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CreateAdminUser_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CreateAdminUser_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CreateAdminUser_Call) RunAndReturn(run func(context.Context, queryapi.CreateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CreateAdminUser_Call { - _c.Call.Return(run) - return _c -} - -// CreateAdminUserWithBody provides a mock function with given fields: ctx, contentType, body, reqEditors -func (_m *MockClientInterface) CreateAdminUserWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateAdminUserWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CreateAdminUserWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAdminUserWithBody' -type MockClientInterface_CreateAdminUserWithBody_Call struct { - *mock.Call -} - -// CreateAdminUserWithBody is a helper method to define mock.On call -// - ctx context.Context -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CreateAdminUserWithBody(ctx interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_CreateAdminUserWithBody_Call { - return &MockClientInterface_CreateAdminUserWithBody_Call{Call: _e.mock.On("CreateAdminUserWithBody", - append([]interface{}{ctx, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CreateAdminUserWithBody_Call) Run(run func(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CreateAdminUserWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CreateAdminUserWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CreateAdminUserWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CreateAdminUserWithBody_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CreateAdminUserWithBody_Call { - _c.Call.Return(run) - return _c -} - -// CreateClient provides a mock function with given fields: ctx, body, reqEditors -func (_m *MockClientInterface) CreateClient(ctx context.Context, body queryapi.CreateClientJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateClient") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateClientJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateClientJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.CreateClientJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CreateClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateClient' -type MockClientInterface_CreateClient_Call struct { - *mock.Call -} - -// CreateClient is a helper method to define mock.On call -// - ctx context.Context -// - body queryapi.CreateClientJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CreateClient(ctx interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_CreateClient_Call { - return &MockClientInterface_CreateClient_Call{Call: _e.mock.On("CreateClient", - append([]interface{}{ctx, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CreateClient_Call) Run(run func(ctx context.Context, body queryapi.CreateClientJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CreateClient_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.CreateClientJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CreateClient_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CreateClient_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CreateClient_Call) RunAndReturn(run func(context.Context, queryapi.CreateClientJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CreateClient_Call { - _c.Call.Return(run) - return _c -} - -// CreateClientWithBody provides a mock function with given fields: ctx, contentType, body, reqEditors -func (_m *MockClientInterface) CreateClientWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateClientWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CreateClientWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateClientWithBody' -type MockClientInterface_CreateClientWithBody_Call struct { - *mock.Call -} - -// CreateClientWithBody is a helper method to define mock.On call -// - ctx context.Context -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CreateClientWithBody(ctx interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_CreateClientWithBody_Call { - return &MockClientInterface_CreateClientWithBody_Call{Call: _e.mock.On("CreateClientWithBody", - append([]interface{}{ctx, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CreateClientWithBody_Call) Run(run func(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CreateClientWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CreateClientWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CreateClientWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CreateClientWithBody_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CreateClientWithBody_Call { - _c.Call.Return(run) - return _c -} - -// CreateFieldExtraction provides a mock function with given fields: ctx, body, reqEditors -func (_m *MockClientInterface) CreateFieldExtraction(ctx context.Context, body queryapi.CreateFieldExtractionJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateFieldExtraction") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateFieldExtractionJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateFieldExtractionJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.CreateFieldExtractionJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CreateFieldExtraction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFieldExtraction' -type MockClientInterface_CreateFieldExtraction_Call struct { - *mock.Call -} - -// CreateFieldExtraction is a helper method to define mock.On call -// - ctx context.Context -// - body queryapi.CreateFieldExtractionJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CreateFieldExtraction(ctx interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_CreateFieldExtraction_Call { - return &MockClientInterface_CreateFieldExtraction_Call{Call: _e.mock.On("CreateFieldExtraction", - append([]interface{}{ctx, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CreateFieldExtraction_Call) Run(run func(ctx context.Context, body queryapi.CreateFieldExtractionJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CreateFieldExtraction_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.CreateFieldExtractionJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CreateFieldExtraction_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CreateFieldExtraction_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CreateFieldExtraction_Call) RunAndReturn(run func(context.Context, queryapi.CreateFieldExtractionJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CreateFieldExtraction_Call { - _c.Call.Return(run) - return _c -} - -// CreateFieldExtractionWithBody provides a mock function with given fields: ctx, contentType, body, reqEditors -func (_m *MockClientInterface) CreateFieldExtractionWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateFieldExtractionWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CreateFieldExtractionWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFieldExtractionWithBody' -type MockClientInterface_CreateFieldExtractionWithBody_Call struct { - *mock.Call -} - -// CreateFieldExtractionWithBody is a helper method to define mock.On call -// - ctx context.Context -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CreateFieldExtractionWithBody(ctx interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_CreateFieldExtractionWithBody_Call { - return &MockClientInterface_CreateFieldExtractionWithBody_Call{Call: _e.mock.On("CreateFieldExtractionWithBody", - append([]interface{}{ctx, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CreateFieldExtractionWithBody_Call) Run(run func(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CreateFieldExtractionWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CreateFieldExtractionWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CreateFieldExtractionWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CreateFieldExtractionWithBody_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CreateFieldExtractionWithBody_Call { - _c.Call.Return(run) - return _c -} - -// CreateFolder provides a mock function with given fields: ctx, body, reqEditors -func (_m *MockClientInterface) CreateFolder(ctx context.Context, body queryapi.CreateFolderJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateFolder") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateFolderJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateFolderJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.CreateFolderJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CreateFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFolder' -type MockClientInterface_CreateFolder_Call struct { - *mock.Call -} - -// CreateFolder is a helper method to define mock.On call -// - ctx context.Context -// - body queryapi.CreateFolderJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CreateFolder(ctx interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_CreateFolder_Call { - return &MockClientInterface_CreateFolder_Call{Call: _e.mock.On("CreateFolder", - append([]interface{}{ctx, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CreateFolder_Call) Run(run func(ctx context.Context, body queryapi.CreateFolderJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CreateFolder_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.CreateFolderJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CreateFolder_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CreateFolder_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CreateFolder_Call) RunAndReturn(run func(context.Context, queryapi.CreateFolderJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CreateFolder_Call { - _c.Call.Return(run) - return _c -} - -// CreateFolderWithBody provides a mock function with given fields: ctx, contentType, body, reqEditors -func (_m *MockClientInterface) CreateFolderWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateFolderWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_CreateFolderWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFolderWithBody' -type MockClientInterface_CreateFolderWithBody_Call struct { - *mock.Call -} - -// CreateFolderWithBody is a helper method to define mock.On call -// - ctx context.Context -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) CreateFolderWithBody(ctx interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_CreateFolderWithBody_Call { - return &MockClientInterface_CreateFolderWithBody_Call{Call: _e.mock.On("CreateFolderWithBody", - append([]interface{}{ctx, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_CreateFolderWithBody_Call) Run(run func(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_CreateFolderWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_CreateFolderWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_CreateFolderWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_CreateFolderWithBody_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_CreateFolderWithBody_Call { - _c.Call.Return(run) - return _c -} - -// DeleteAdminUser provides a mock function with given fields: ctx, email, params, reqEditors -func (_m *MockClientInterface) DeleteAdminUser(ctx context.Context, email queryapi.UserEmail, params *queryapi.DeleteAdminUserParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteAdminUser") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, *queryapi.DeleteAdminUserParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, email, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, *queryapi.DeleteAdminUserParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, email, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, *queryapi.DeleteAdminUserParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_DeleteAdminUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteAdminUser' -type MockClientInterface_DeleteAdminUser_Call struct { - *mock.Call -} - -// DeleteAdminUser is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - params *queryapi.DeleteAdminUserParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) DeleteAdminUser(ctx interface{}, email interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_DeleteAdminUser_Call { - return &MockClientInterface_DeleteAdminUser_Call{Call: _e.mock.On("DeleteAdminUser", - append([]interface{}{ctx, email, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_DeleteAdminUser_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, params *queryapi.DeleteAdminUserParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_DeleteAdminUser_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), args[2].(*queryapi.DeleteAdminUserParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_DeleteAdminUser_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_DeleteAdminUser_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_DeleteAdminUser_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, *queryapi.DeleteAdminUserParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_DeleteAdminUser_Call { - _c.Call.Return(run) - return _c -} - -// DisableAdminUser provides a mock function with given fields: ctx, email, reqEditors -func (_m *MockClientInterface) DisableAdminUser(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DisableAdminUser") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, email, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, email, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_DisableAdminUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisableAdminUser' -type MockClientInterface_DisableAdminUser_Call struct { - *mock.Call -} - -// DisableAdminUser is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) DisableAdminUser(ctx interface{}, email interface{}, reqEditors ...interface{}) *MockClientInterface_DisableAdminUser_Call { - return &MockClientInterface_DisableAdminUser_Call{Call: _e.mock.On("DisableAdminUser", - append([]interface{}{ctx, email}, reqEditors...)...)} -} - -func (_c *MockClientInterface_DisableAdminUser_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_DisableAdminUser_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_DisableAdminUser_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_DisableAdminUser_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_DisableAdminUser_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_DisableAdminUser_Call { - _c.Call.Return(run) - return _c -} - -// EnableAdminUser provides a mock function with given fields: ctx, email, reqEditors -func (_m *MockClientInterface) EnableAdminUser(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for EnableAdminUser") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, email, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, email, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_EnableAdminUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableAdminUser' -type MockClientInterface_EnableAdminUser_Call struct { - *mock.Call -} - -// EnableAdminUser is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) EnableAdminUser(ctx interface{}, email interface{}, reqEditors ...interface{}) *MockClientInterface_EnableAdminUser_Call { - return &MockClientInterface_EnableAdminUser_Call{Call: _e.mock.On("EnableAdminUser", - append([]interface{}{ctx, email}, reqEditors...)...)} -} - -func (_c *MockClientInterface_EnableAdminUser_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_EnableAdminUser_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_EnableAdminUser_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_EnableAdminUser_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_EnableAdminUser_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_EnableAdminUser_Call { - _c.Call.Return(run) - return _c -} - -// ExportState provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientInterface) ExportState(ctx context.Context, id queryapi.ExportID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ExportState") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ExportID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ExportID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ExportID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_ExportState_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExportState' -type MockClientInterface_ExportState_Call struct { - *mock.Call -} - -// ExportState is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ExportID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) ExportState(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientInterface_ExportState_Call { - return &MockClientInterface_ExportState_Call{Call: _e.mock.On("ExportState", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientInterface_ExportState_Call) Run(run func(ctx context.Context, id queryapi.ExportID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_ExportState_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ExportID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_ExportState_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_ExportState_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_ExportState_Call) RunAndReturn(run func(context.Context, queryapi.ExportID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_ExportState_Call { - _c.Call.Return(run) - return _c -} - -// GetAdminUser provides a mock function with given fields: ctx, email, reqEditors -func (_m *MockClientInterface) GetAdminUser(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetAdminUser") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, email, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, email, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetAdminUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAdminUser' -type MockClientInterface_GetAdminUser_Call struct { - *mock.Call -} - -// GetAdminUser is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetAdminUser(ctx interface{}, email interface{}, reqEditors ...interface{}) *MockClientInterface_GetAdminUser_Call { - return &MockClientInterface_GetAdminUser_Call{Call: _e.mock.On("GetAdminUser", - append([]interface{}{ctx, email}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetAdminUser_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetAdminUser_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetAdminUser_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetAdminUser_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetAdminUser_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetAdminUser_Call { - _c.Call.Return(run) - return _c -} - -// GetClient provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientInterface) GetClient(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetClient") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClient' -type MockClientInterface_GetClient_Call struct { - *mock.Call -} - -// GetClient is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetClient(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientInterface_GetClient_Call { - return &MockClientInterface_GetClient_Call{Call: _e.mock.On("GetClient", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetClient_Call) Run(run func(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetClient_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetClient_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetClient_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetClient_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetClient_Call { - _c.Call.Return(run) - return _c -} - -// GetCollectorByClientId provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientInterface) GetCollectorByClientId(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetCollectorByClientId") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetCollectorByClientId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCollectorByClientId' -type MockClientInterface_GetCollectorByClientId_Call struct { - *mock.Call -} - -// GetCollectorByClientId is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetCollectorByClientId(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientInterface_GetCollectorByClientId_Call { - return &MockClientInterface_GetCollectorByClientId_Call{Call: _e.mock.On("GetCollectorByClientId", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetCollectorByClientId_Call) Run(run func(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetCollectorByClientId_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetCollectorByClientId_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetCollectorByClientId_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetCollectorByClientId_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetCollectorByClientId_Call { - _c.Call.Return(run) - return _c -} - -// GetCurrentFieldExtraction provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientInterface) GetCurrentFieldExtraction(ctx context.Context, params *queryapi.GetCurrentFieldExtractionParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetCurrentFieldExtraction") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetCurrentFieldExtractionParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetCurrentFieldExtractionParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.GetCurrentFieldExtractionParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetCurrentFieldExtraction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCurrentFieldExtraction' -type MockClientInterface_GetCurrentFieldExtraction_Call struct { - *mock.Call -} - -// GetCurrentFieldExtraction is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.GetCurrentFieldExtractionParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetCurrentFieldExtraction(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_GetCurrentFieldExtraction_Call { - return &MockClientInterface_GetCurrentFieldExtraction_Call{Call: _e.mock.On("GetCurrentFieldExtraction", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetCurrentFieldExtraction_Call) Run(run func(ctx context.Context, params *queryapi.GetCurrentFieldExtractionParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetCurrentFieldExtraction_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.GetCurrentFieldExtractionParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetCurrentFieldExtraction_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetCurrentFieldExtraction_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetCurrentFieldExtraction_Call) RunAndReturn(run func(context.Context, *queryapi.GetCurrentFieldExtractionParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetCurrentFieldExtraction_Call { - _c.Call.Return(run) - return _c -} - -// GetDocument provides a mock function with given fields: ctx, id, params, reqEditors -func (_m *MockClientInterface) GetDocument(ctx context.Context, id queryapi.DocumentID, params *queryapi.GetDocumentParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocument") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.DocumentID, *queryapi.GetDocumentParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.DocumentID, *queryapi.GetDocumentParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.DocumentID, *queryapi.GetDocumentParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetDocument_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocument' -type MockClientInterface_GetDocument_Call struct { - *mock.Call -} - -// GetDocument is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.DocumentID -// - params *queryapi.GetDocumentParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetDocument(ctx interface{}, id interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_GetDocument_Call { - return &MockClientInterface_GetDocument_Call{Call: _e.mock.On("GetDocument", - append([]interface{}{ctx, id, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetDocument_Call) Run(run func(ctx context.Context, id queryapi.DocumentID, params *queryapi.GetDocumentParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetDocument_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.DocumentID), args[2].(*queryapi.GetDocumentParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetDocument_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetDocument_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetDocument_Call) RunAndReturn(run func(context.Context, queryapi.DocumentID, *queryapi.GetDocumentParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetDocument_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentBatch provides a mock function with given fields: ctx, id, batchId, reqEditors -func (_m *MockClientInterface) GetDocumentBatch(ctx context.Context, id queryapi.ClientID, batchId queryapi.BatchID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, batchId) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentBatch") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, batchId, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, batchId, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, batchId, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetDocumentBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentBatch' -type MockClientInterface_GetDocumentBatch_Call struct { - *mock.Call -} - -// GetDocumentBatch is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - batchId queryapi.BatchID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetDocumentBatch(ctx interface{}, id interface{}, batchId interface{}, reqEditors ...interface{}) *MockClientInterface_GetDocumentBatch_Call { - return &MockClientInterface_GetDocumentBatch_Call{Call: _e.mock.On("GetDocumentBatch", - append([]interface{}{ctx, id, batchId}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetDocumentBatch_Call) Run(run func(ctx context.Context, id queryapi.ClientID, batchId queryapi.BatchID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetDocumentBatch_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.BatchID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetDocumentBatch_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetDocumentBatch_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetDocumentBatch_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetDocumentBatch_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentLabels provides a mock function with given fields: ctx, documentId, reqEditors -func (_m *MockClientInterface) GetDocumentLabels(ctx context.Context, documentId types.UUID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, documentId) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentLabels") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, documentId, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, documentId, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, documentId, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetDocumentLabels_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentLabels' -type MockClientInterface_GetDocumentLabels_Call struct { - *mock.Call -} - -// GetDocumentLabels is a helper method to define mock.On call -// - ctx context.Context -// - documentId types.UUID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetDocumentLabels(ctx interface{}, documentId interface{}, reqEditors ...interface{}) *MockClientInterface_GetDocumentLabels_Call { - return &MockClientInterface_GetDocumentLabels_Call{Call: _e.mock.On("GetDocumentLabels", - append([]interface{}{ctx, documentId}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetDocumentLabels_Call) Run(run func(ctx context.Context, documentId types.UUID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetDocumentLabels_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetDocumentLabels_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetDocumentLabels_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetDocumentLabels_Call) RunAndReturn(run func(context.Context, types.UUID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetDocumentLabels_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentsByLabel provides a mock function with given fields: ctx, labelName, params, reqEditors -func (_m *MockClientInterface) GetDocumentsByLabel(ctx context.Context, labelName string, params *queryapi.GetDocumentsByLabelParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, labelName, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentsByLabel") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, *queryapi.GetDocumentsByLabelParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, labelName, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, *queryapi.GetDocumentsByLabelParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, labelName, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, *queryapi.GetDocumentsByLabelParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, labelName, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetDocumentsByLabel_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentsByLabel' -type MockClientInterface_GetDocumentsByLabel_Call struct { - *mock.Call -} - -// GetDocumentsByLabel is a helper method to define mock.On call -// - ctx context.Context -// - labelName string -// - params *queryapi.GetDocumentsByLabelParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetDocumentsByLabel(ctx interface{}, labelName interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_GetDocumentsByLabel_Call { - return &MockClientInterface_GetDocumentsByLabel_Call{Call: _e.mock.On("GetDocumentsByLabel", - append([]interface{}{ctx, labelName, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetDocumentsByLabel_Call) Run(run func(ctx context.Context, labelName string, params *queryapi.GetDocumentsByLabelParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetDocumentsByLabel_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(*queryapi.GetDocumentsByLabelParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetDocumentsByLabel_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetDocumentsByLabel_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetDocumentsByLabel_Call) RunAndReturn(run func(context.Context, string, *queryapi.GetDocumentsByLabelParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetDocumentsByLabel_Call { - _c.Call.Return(run) - return _c -} - -// GetFieldExtractionByVersion provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientInterface) GetFieldExtractionByVersion(ctx context.Context, params *queryapi.GetFieldExtractionByVersionParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetFieldExtractionByVersion") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetFieldExtractionByVersionParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetFieldExtractionByVersionParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.GetFieldExtractionByVersionParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetFieldExtractionByVersion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFieldExtractionByVersion' -type MockClientInterface_GetFieldExtractionByVersion_Call struct { - *mock.Call -} - -// GetFieldExtractionByVersion is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.GetFieldExtractionByVersionParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetFieldExtractionByVersion(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_GetFieldExtractionByVersion_Call { - return &MockClientInterface_GetFieldExtractionByVersion_Call{Call: _e.mock.On("GetFieldExtractionByVersion", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetFieldExtractionByVersion_Call) Run(run func(ctx context.Context, params *queryapi.GetFieldExtractionByVersionParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetFieldExtractionByVersion_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.GetFieldExtractionByVersionParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetFieldExtractionByVersion_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetFieldExtractionByVersion_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetFieldExtractionByVersion_Call) RunAndReturn(run func(context.Context, *queryapi.GetFieldExtractionByVersionParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetFieldExtractionByVersion_Call { - _c.Call.Return(run) - return _c -} - -// GetFieldExtractionHistory provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientInterface) GetFieldExtractionHistory(ctx context.Context, params *queryapi.GetFieldExtractionHistoryParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetFieldExtractionHistory") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetFieldExtractionHistoryParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetFieldExtractionHistoryParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.GetFieldExtractionHistoryParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetFieldExtractionHistory_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFieldExtractionHistory' -type MockClientInterface_GetFieldExtractionHistory_Call struct { - *mock.Call -} - -// GetFieldExtractionHistory is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.GetFieldExtractionHistoryParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetFieldExtractionHistory(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_GetFieldExtractionHistory_Call { - return &MockClientInterface_GetFieldExtractionHistory_Call{Call: _e.mock.On("GetFieldExtractionHistory", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetFieldExtractionHistory_Call) Run(run func(ctx context.Context, params *queryapi.GetFieldExtractionHistoryParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetFieldExtractionHistory_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.GetFieldExtractionHistoryParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetFieldExtractionHistory_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetFieldExtractionHistory_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetFieldExtractionHistory_Call) RunAndReturn(run func(context.Context, *queryapi.GetFieldExtractionHistoryParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetFieldExtractionHistory_Call { - _c.Call.Return(run) - return _c -} - -// GetFolderDocuments provides a mock function with given fields: ctx, folderId, params, reqEditors -func (_m *MockClientInterface) GetFolderDocuments(ctx context.Context, folderId types.UUID, params *queryapi.GetFolderDocumentsParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, folderId, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetFolderDocuments") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, *queryapi.GetFolderDocumentsParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, folderId, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, *queryapi.GetFolderDocumentsParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, folderId, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, *queryapi.GetFolderDocumentsParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, folderId, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetFolderDocuments_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFolderDocuments' -type MockClientInterface_GetFolderDocuments_Call struct { - *mock.Call -} - -// GetFolderDocuments is a helper method to define mock.On call -// - ctx context.Context -// - folderId types.UUID -// - params *queryapi.GetFolderDocumentsParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetFolderDocuments(ctx interface{}, folderId interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_GetFolderDocuments_Call { - return &MockClientInterface_GetFolderDocuments_Call{Call: _e.mock.On("GetFolderDocuments", - append([]interface{}{ctx, folderId, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetFolderDocuments_Call) Run(run func(ctx context.Context, folderId types.UUID, params *queryapi.GetFolderDocumentsParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetFolderDocuments_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(*queryapi.GetFolderDocumentsParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetFolderDocuments_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetFolderDocuments_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetFolderDocuments_Call) RunAndReturn(run func(context.Context, types.UUID, *queryapi.GetFolderDocumentsParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetFolderDocuments_Call { - _c.Call.Return(run) - return _c -} - -// GetFolderMetrics provides a mock function with given fields: ctx, folderId, reqEditors -func (_m *MockClientInterface) GetFolderMetrics(ctx context.Context, folderId types.UUID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, folderId) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetFolderMetrics") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, folderId, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, folderId, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, folderId, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetFolderMetrics_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFolderMetrics' -type MockClientInterface_GetFolderMetrics_Call struct { - *mock.Call -} - -// GetFolderMetrics is a helper method to define mock.On call -// - ctx context.Context -// - folderId types.UUID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetFolderMetrics(ctx interface{}, folderId interface{}, reqEditors ...interface{}) *MockClientInterface_GetFolderMetrics_Call { - return &MockClientInterface_GetFolderMetrics_Call{Call: _e.mock.On("GetFolderMetrics", - append([]interface{}{ctx, folderId}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetFolderMetrics_Call) Run(run func(ctx context.Context, folderId types.UUID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetFolderMetrics_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetFolderMetrics_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetFolderMetrics_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetFolderMetrics_Call) RunAndReturn(run func(context.Context, types.UUID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetFolderMetrics_Call { - _c.Call.Return(run) - return _c -} - -// GetHomePage provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientInterface) GetHomePage(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetHomePage") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetHomePage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetHomePage' -type MockClientInterface_GetHomePage_Call struct { - *mock.Call -} - -// GetHomePage is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetHomePage(ctx interface{}, reqEditors ...interface{}) *MockClientInterface_GetHomePage_Call { - return &MockClientInterface_GetHomePage_Call{Call: _e.mock.On("GetHomePage", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetHomePage_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetHomePage_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetHomePage_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetHomePage_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetHomePage_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetHomePage_Call { - _c.Call.Return(run) - return _c -} - -// GetIdentity provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientInterface) GetIdentity(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetIdentity") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetIdentity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIdentity' -type MockClientInterface_GetIdentity_Call struct { - *mock.Call -} - -// GetIdentity is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetIdentity(ctx interface{}, reqEditors ...interface{}) *MockClientInterface_GetIdentity_Call { - return &MockClientInterface_GetIdentity_Call{Call: _e.mock.On("GetIdentity", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetIdentity_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetIdentity_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetIdentity_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetIdentity_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetIdentity_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetIdentity_Call { - _c.Call.Return(run) - return _c -} - -// GetStatusByClientId provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientInterface) GetStatusByClientId(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetStatusByClientId") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_GetStatusByClientId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStatusByClientId' -type MockClientInterface_GetStatusByClientId_Call struct { - *mock.Call -} - -// GetStatusByClientId is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) GetStatusByClientId(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientInterface_GetStatusByClientId_Call { - return &MockClientInterface_GetStatusByClientId_Call{Call: _e.mock.On("GetStatusByClientId", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientInterface_GetStatusByClientId_Call) Run(run func(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_GetStatusByClientId_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_GetStatusByClientId_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_GetStatusByClientId_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_GetStatusByClientId_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_GetStatusByClientId_Call { - _c.Call.Return(run) - return _c -} - -// ListAdminUsers provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientInterface) ListAdminUsers(ctx context.Context, params *queryapi.ListAdminUsersParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListAdminUsers") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.ListAdminUsersParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.ListAdminUsersParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.ListAdminUsersParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_ListAdminUsers_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAdminUsers' -type MockClientInterface_ListAdminUsers_Call struct { - *mock.Call -} - -// ListAdminUsers is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.ListAdminUsersParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) ListAdminUsers(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_ListAdminUsers_Call { - return &MockClientInterface_ListAdminUsers_Call{Call: _e.mock.On("ListAdminUsers", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_ListAdminUsers_Call) Run(run func(ctx context.Context, params *queryapi.ListAdminUsersParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_ListAdminUsers_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.ListAdminUsersParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_ListAdminUsers_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_ListAdminUsers_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_ListAdminUsers_Call) RunAndReturn(run func(context.Context, *queryapi.ListAdminUsersParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_ListAdminUsers_Call { - _c.Call.Return(run) - return _c -} - -// ListClientFolders provides a mock function with given fields: ctx, id, params, reqEditors -func (_m *MockClientInterface) ListClientFolders(ctx context.Context, id queryapi.ClientID, params *queryapi.ListClientFoldersParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListClientFolders") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, *queryapi.ListClientFoldersParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, *queryapi.ListClientFoldersParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, *queryapi.ListClientFoldersParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_ListClientFolders_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListClientFolders' -type MockClientInterface_ListClientFolders_Call struct { - *mock.Call -} - -// ListClientFolders is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - params *queryapi.ListClientFoldersParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) ListClientFolders(ctx interface{}, id interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_ListClientFolders_Call { - return &MockClientInterface_ListClientFolders_Call{Call: _e.mock.On("ListClientFolders", - append([]interface{}{ctx, id, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_ListClientFolders_Call) Run(run func(ctx context.Context, id queryapi.ClientID, params *queryapi.ListClientFoldersParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_ListClientFolders_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(*queryapi.ListClientFoldersParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_ListClientFolders_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_ListClientFolders_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_ListClientFolders_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, *queryapi.ListClientFoldersParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_ListClientFolders_Call { - _c.Call.Return(run) - return _c -} - -// ListClients provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientInterface) ListClients(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListClients") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_ListClients_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListClients' -type MockClientInterface_ListClients_Call struct { - *mock.Call -} - -// ListClients is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) ListClients(ctx interface{}, reqEditors ...interface{}) *MockClientInterface_ListClients_Call { - return &MockClientInterface_ListClients_Call{Call: _e.mock.On("ListClients", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientInterface_ListClients_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_ListClients_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_ListClients_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_ListClients_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_ListClients_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_ListClients_Call { - _c.Call.Return(run) - return _c -} - -// ListDocumentBatches provides a mock function with given fields: ctx, id, params, reqEditors -func (_m *MockClientInterface) ListDocumentBatches(ctx context.Context, id queryapi.ClientID, params *queryapi.ListDocumentBatchesParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListDocumentBatches") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, *queryapi.ListDocumentBatchesParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, *queryapi.ListDocumentBatchesParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, *queryapi.ListDocumentBatchesParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_ListDocumentBatches_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDocumentBatches' -type MockClientInterface_ListDocumentBatches_Call struct { - *mock.Call -} - -// ListDocumentBatches is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - params *queryapi.ListDocumentBatchesParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) ListDocumentBatches(ctx interface{}, id interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_ListDocumentBatches_Call { - return &MockClientInterface_ListDocumentBatches_Call{Call: _e.mock.On("ListDocumentBatches", - append([]interface{}{ctx, id, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_ListDocumentBatches_Call) Run(run func(ctx context.Context, id queryapi.ClientID, params *queryapi.ListDocumentBatchesParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_ListDocumentBatches_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(*queryapi.ListDocumentBatchesParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_ListDocumentBatches_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_ListDocumentBatches_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_ListDocumentBatches_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, *queryapi.ListDocumentBatchesParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_ListDocumentBatches_Call { - _c.Call.Return(run) - return _c -} - -// ListDocumentsByClientId provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientInterface) ListDocumentsByClientId(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListDocumentsByClientId") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_ListDocumentsByClientId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDocumentsByClientId' -type MockClientInterface_ListDocumentsByClientId_Call struct { - *mock.Call -} - -// ListDocumentsByClientId is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) ListDocumentsByClientId(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientInterface_ListDocumentsByClientId_Call { - return &MockClientInterface_ListDocumentsByClientId_Call{Call: _e.mock.On("ListDocumentsByClientId", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientInterface_ListDocumentsByClientId_Call) Run(run func(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_ListDocumentsByClientId_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_ListDocumentsByClientId_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_ListDocumentsByClientId_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_ListDocumentsByClientId_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_ListDocumentsByClientId_Call { - _c.Call.Return(run) - return _c -} - -// Login provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientInterface) Login(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for Login") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_Login_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Login' -type MockClientInterface_Login_Call struct { - *mock.Call -} - -// Login is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) Login(ctx interface{}, reqEditors ...interface{}) *MockClientInterface_Login_Call { - return &MockClientInterface_Login_Call{Call: _e.mock.On("Login", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientInterface_Login_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_Login_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_Login_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_Login_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_Login_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_Login_Call { - _c.Call.Return(run) - return _c -} - -// LoginCallback provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientInterface) LoginCallback(ctx context.Context, params *queryapi.LoginCallbackParams, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for LoginCallback") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_LoginCallback_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoginCallback' -type MockClientInterface_LoginCallback_Call struct { - *mock.Call -} - -// LoginCallback is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.LoginCallbackParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) LoginCallback(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientInterface_LoginCallback_Call { - return &MockClientInterface_LoginCallback_Call{Call: _e.mock.On("LoginCallback", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientInterface_LoginCallback_Call) Run(run func(ctx context.Context, params *queryapi.LoginCallbackParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_LoginCallback_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.LoginCallbackParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_LoginCallback_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_LoginCallback_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_LoginCallback_Call) RunAndReturn(run func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_LoginCallback_Call { - _c.Call.Return(run) - return _c -} - -// Logout provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientInterface) Logout(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for Logout") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_Logout_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Logout' -type MockClientInterface_Logout_Call struct { - *mock.Call -} - -// Logout is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) Logout(ctx interface{}, reqEditors ...interface{}) *MockClientInterface_Logout_Call { - return &MockClientInterface_Logout_Call{Call: _e.mock.On("Logout", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientInterface_Logout_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_Logout_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_Logout_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_Logout_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_Logout_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_Logout_Call { - _c.Call.Return(run) - return _c -} - -// RenameFolder provides a mock function with given fields: ctx, folderId, body, reqEditors -func (_m *MockClientInterface) RenameFolder(ctx context.Context, folderId types.UUID, body queryapi.RenameFolderJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, folderId, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for RenameFolder") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, queryapi.RenameFolderJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, folderId, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, queryapi.RenameFolderJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, folderId, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, queryapi.RenameFolderJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, folderId, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_RenameFolder_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenameFolder' -type MockClientInterface_RenameFolder_Call struct { - *mock.Call -} - -// RenameFolder is a helper method to define mock.On call -// - ctx context.Context -// - folderId types.UUID -// - body queryapi.RenameFolderJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) RenameFolder(ctx interface{}, folderId interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_RenameFolder_Call { - return &MockClientInterface_RenameFolder_Call{Call: _e.mock.On("RenameFolder", - append([]interface{}{ctx, folderId, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_RenameFolder_Call) Run(run func(ctx context.Context, folderId types.UUID, body queryapi.RenameFolderJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_RenameFolder_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(queryapi.RenameFolderJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_RenameFolder_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_RenameFolder_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_RenameFolder_Call) RunAndReturn(run func(context.Context, types.UUID, queryapi.RenameFolderJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_RenameFolder_Call { - _c.Call.Return(run) - return _c -} - -// RenameFolderWithBody provides a mock function with given fields: ctx, folderId, contentType, body, reqEditors -func (_m *MockClientInterface) RenameFolderWithBody(ctx context.Context, folderId types.UUID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, folderId, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for RenameFolderWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, folderId, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, folderId, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, folderId, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_RenameFolderWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenameFolderWithBody' -type MockClientInterface_RenameFolderWithBody_Call struct { - *mock.Call -} - -// RenameFolderWithBody is a helper method to define mock.On call -// - ctx context.Context -// - folderId types.UUID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) RenameFolderWithBody(ctx interface{}, folderId interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_RenameFolderWithBody_Call { - return &MockClientInterface_RenameFolderWithBody_Call{Call: _e.mock.On("RenameFolderWithBody", - append([]interface{}{ctx, folderId, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_RenameFolderWithBody_Call) Run(run func(ctx context.Context, folderId types.UUID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_RenameFolderWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_RenameFolderWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_RenameFolderWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_RenameFolderWithBody_Call) RunAndReturn(run func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_RenameFolderWithBody_Call { - _c.Call.Return(run) - return _c -} - -// SetCollectorByClientId provides a mock function with given fields: ctx, id, body, reqEditors -func (_m *MockClientInterface) SetCollectorByClientId(ctx context.Context, id queryapi.ClientID, body queryapi.SetCollectorByClientIdJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for SetCollectorByClientId") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.SetCollectorByClientIdJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.SetCollectorByClientIdJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.SetCollectorByClientIdJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_SetCollectorByClientId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCollectorByClientId' -type MockClientInterface_SetCollectorByClientId_Call struct { - *mock.Call -} - -// SetCollectorByClientId is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - body queryapi.SetCollectorByClientIdJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) SetCollectorByClientId(ctx interface{}, id interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_SetCollectorByClientId_Call { - return &MockClientInterface_SetCollectorByClientId_Call{Call: _e.mock.On("SetCollectorByClientId", - append([]interface{}{ctx, id, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_SetCollectorByClientId_Call) Run(run func(ctx context.Context, id queryapi.ClientID, body queryapi.SetCollectorByClientIdJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_SetCollectorByClientId_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.SetCollectorByClientIdJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_SetCollectorByClientId_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_SetCollectorByClientId_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_SetCollectorByClientId_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.SetCollectorByClientIdJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_SetCollectorByClientId_Call { - _c.Call.Return(run) - return _c -} - -// SetCollectorByClientIdWithBody provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientInterface) SetCollectorByClientIdWithBody(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for SetCollectorByClientIdWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_SetCollectorByClientIdWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCollectorByClientIdWithBody' -type MockClientInterface_SetCollectorByClientIdWithBody_Call struct { - *mock.Call -} - -// SetCollectorByClientIdWithBody is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) SetCollectorByClientIdWithBody(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_SetCollectorByClientIdWithBody_Call { - return &MockClientInterface_SetCollectorByClientIdWithBody_Call{Call: _e.mock.On("SetCollectorByClientIdWithBody", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_SetCollectorByClientIdWithBody_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_SetCollectorByClientIdWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_SetCollectorByClientIdWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_SetCollectorByClientIdWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_SetCollectorByClientIdWithBody_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_SetCollectorByClientIdWithBody_Call { - _c.Call.Return(run) - return _c -} - -// TriggerExport provides a mock function with given fields: ctx, id, body, reqEditors -func (_m *MockClientInterface) TriggerExport(ctx context.Context, id queryapi.ClientID, body queryapi.TriggerExportJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for TriggerExport") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.TriggerExportJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.TriggerExportJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.TriggerExportJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_TriggerExport_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TriggerExport' -type MockClientInterface_TriggerExport_Call struct { - *mock.Call -} - -// TriggerExport is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - body queryapi.TriggerExportJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) TriggerExport(ctx interface{}, id interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_TriggerExport_Call { - return &MockClientInterface_TriggerExport_Call{Call: _e.mock.On("TriggerExport", - append([]interface{}{ctx, id, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_TriggerExport_Call) Run(run func(ctx context.Context, id queryapi.ClientID, body queryapi.TriggerExportJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_TriggerExport_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.TriggerExportJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_TriggerExport_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_TriggerExport_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_TriggerExport_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.TriggerExportJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_TriggerExport_Call { - _c.Call.Return(run) - return _c -} - -// TriggerExportWithBody provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientInterface) TriggerExportWithBody(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for TriggerExportWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_TriggerExportWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TriggerExportWithBody' -type MockClientInterface_TriggerExportWithBody_Call struct { - *mock.Call -} - -// TriggerExportWithBody is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) TriggerExportWithBody(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_TriggerExportWithBody_Call { - return &MockClientInterface_TriggerExportWithBody_Call{Call: _e.mock.On("TriggerExportWithBody", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_TriggerExportWithBody_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_TriggerExportWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_TriggerExportWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_TriggerExportWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_TriggerExportWithBody_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_TriggerExportWithBody_Call { - _c.Call.Return(run) - return _c -} - -// UpdateAdminUser provides a mock function with given fields: ctx, email, body, reqEditors -func (_m *MockClientInterface) UpdateAdminUser(ctx context.Context, email queryapi.UserEmail, body queryapi.UpdateAdminUserJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateAdminUser") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, queryapi.UpdateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, email, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, queryapi.UpdateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, email, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, queryapi.UpdateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_UpdateAdminUser_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAdminUser' -type MockClientInterface_UpdateAdminUser_Call struct { - *mock.Call -} - -// UpdateAdminUser is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - body queryapi.UpdateAdminUserJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) UpdateAdminUser(ctx interface{}, email interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_UpdateAdminUser_Call { - return &MockClientInterface_UpdateAdminUser_Call{Call: _e.mock.On("UpdateAdminUser", - append([]interface{}{ctx, email, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_UpdateAdminUser_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, body queryapi.UpdateAdminUserJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_UpdateAdminUser_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), args[2].(queryapi.UpdateAdminUserJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_UpdateAdminUser_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_UpdateAdminUser_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_UpdateAdminUser_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, queryapi.UpdateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_UpdateAdminUser_Call { - _c.Call.Return(run) - return _c -} - -// UpdateAdminUserWithBody provides a mock function with given fields: ctx, email, contentType, body, reqEditors -func (_m *MockClientInterface) UpdateAdminUserWithBody(ctx context.Context, email queryapi.UserEmail, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateAdminUserWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, email, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, email, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_UpdateAdminUserWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAdminUserWithBody' -type MockClientInterface_UpdateAdminUserWithBody_Call struct { - *mock.Call -} - -// UpdateAdminUserWithBody is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) UpdateAdminUserWithBody(ctx interface{}, email interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_UpdateAdminUserWithBody_Call { - return &MockClientInterface_UpdateAdminUserWithBody_Call{Call: _e.mock.On("UpdateAdminUserWithBody", - append([]interface{}{ctx, email, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_UpdateAdminUserWithBody_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_UpdateAdminUserWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_UpdateAdminUserWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_UpdateAdminUserWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_UpdateAdminUserWithBody_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_UpdateAdminUserWithBody_Call { - _c.Call.Return(run) - return _c -} - -// UpdateClient provides a mock function with given fields: ctx, id, body, reqEditors -func (_m *MockClientInterface) UpdateClient(ctx context.Context, id queryapi.ClientID, body queryapi.UpdateClientJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateClient") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.UpdateClientJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.UpdateClientJSONRequestBody, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.UpdateClientJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_UpdateClient_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateClient' -type MockClientInterface_UpdateClient_Call struct { - *mock.Call -} - -// UpdateClient is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - body queryapi.UpdateClientJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) UpdateClient(ctx interface{}, id interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_UpdateClient_Call { - return &MockClientInterface_UpdateClient_Call{Call: _e.mock.On("UpdateClient", - append([]interface{}{ctx, id, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_UpdateClient_Call) Run(run func(ctx context.Context, id queryapi.ClientID, body queryapi.UpdateClientJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_UpdateClient_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.UpdateClientJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_UpdateClient_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_UpdateClient_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_UpdateClient_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.UpdateClientJSONRequestBody, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_UpdateClient_Call { - _c.Call.Return(run) - return _c -} - -// UpdateClientWithBody provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientInterface) UpdateClientWithBody(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateClientWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_UpdateClientWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateClientWithBody' -type MockClientInterface_UpdateClientWithBody_Call struct { - *mock.Call -} - -// UpdateClientWithBody is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) UpdateClientWithBody(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_UpdateClientWithBody_Call { - return &MockClientInterface_UpdateClientWithBody_Call{Call: _e.mock.On("UpdateClientWithBody", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_UpdateClientWithBody_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_UpdateClientWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_UpdateClientWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_UpdateClientWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_UpdateClientWithBody_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_UpdateClientWithBody_Call { - _c.Call.Return(run) - return _c -} - -// UploadDocumentBatchWithBody provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientInterface) UploadDocumentBatchWithBody(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UploadDocumentBatchWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_UploadDocumentBatchWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UploadDocumentBatchWithBody' -type MockClientInterface_UploadDocumentBatchWithBody_Call struct { - *mock.Call -} - -// UploadDocumentBatchWithBody is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) UploadDocumentBatchWithBody(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_UploadDocumentBatchWithBody_Call { - return &MockClientInterface_UploadDocumentBatchWithBody_Call{Call: _e.mock.On("UploadDocumentBatchWithBody", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_UploadDocumentBatchWithBody_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_UploadDocumentBatchWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_UploadDocumentBatchWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_UploadDocumentBatchWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_UploadDocumentBatchWithBody_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_UploadDocumentBatchWithBody_Call { - _c.Call.Return(run) - return _c -} - -// UploadDocumentWithBody provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientInterface) UploadDocumentWithBody(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*http.Response, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UploadDocumentWithBody") - } - - var r0 *http.Response - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *http.Response); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*http.Response) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientInterface_UploadDocumentWithBody_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UploadDocumentWithBody' -type MockClientInterface_UploadDocumentWithBody_Call struct { - *mock.Call -} - -// UploadDocumentWithBody is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientInterface_Expecter) UploadDocumentWithBody(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientInterface_UploadDocumentWithBody_Call { - return &MockClientInterface_UploadDocumentWithBody_Call{Call: _e.mock.On("UploadDocumentWithBody", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientInterface_UploadDocumentWithBody_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientInterface_UploadDocumentWithBody_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientInterface_UploadDocumentWithBody_Call) Return(_a0 *http.Response, _a1 error) *MockClientInterface_UploadDocumentWithBody_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientInterface_UploadDocumentWithBody_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*http.Response, error)) *MockClientInterface_UploadDocumentWithBody_Call { - _c.Call.Return(run) - return _c -} - -// NewMockClientInterface creates a new instance of MockClientInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockClientInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockClientInterface { - mock := &MockClientInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/queryapi/mock_ClientWithResponsesInterface.go b/mocks/queryapi/mock_ClientWithResponsesInterface.go deleted file mode 100644 index 0649ffc8..00000000 --- a/mocks/queryapi/mock_ClientWithResponsesInterface.go +++ /dev/null @@ -1,3844 +0,0 @@ -// Code generated by mockery v2.52.3. DO NOT EDIT. - -package queryapimock - -import ( - context "context" - io "io" - - mock "github.com/stretchr/testify/mock" - - queryapi "queryorchestration/pkg/queryAPI" - - types "github.com/oapi-codegen/runtime/types" -) - -// MockClientWithResponsesInterface is an autogenerated mock type for the ClientWithResponsesInterface type -type MockClientWithResponsesInterface struct { - mock.Mock -} - -type MockClientWithResponsesInterface_Expecter struct { - mock *mock.Mock -} - -func (_m *MockClientWithResponsesInterface) EXPECT() *MockClientWithResponsesInterface_Expecter { - return &MockClientWithResponsesInterface_Expecter{mock: &_m.Mock} -} - -// ApplyLabelWithBodyWithResponse provides a mock function with given fields: ctx, documentId, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) ApplyLabelWithBodyWithResponse(ctx context.Context, documentId types.UUID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.ApplyLabelResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, documentId, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ApplyLabelWithBodyWithResponse") - } - - var r0 *queryapi.ApplyLabelResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.ApplyLabelResponse, error)); ok { - return rf(ctx, documentId, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.ApplyLabelResponse); ok { - r0 = rf(ctx, documentId, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.ApplyLabelResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, documentId, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyLabelWithBodyWithResponse' -type MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call struct { - *mock.Call -} - -// ApplyLabelWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - documentId types.UUID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) ApplyLabelWithBodyWithResponse(ctx interface{}, documentId interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call{Call: _e.mock.On("ApplyLabelWithBodyWithResponse", - append([]interface{}{ctx, documentId, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call) Run(run func(ctx context.Context, documentId types.UUID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call) Return(_a0 *queryapi.ApplyLabelResponse, _a1 error) *MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.ApplyLabelResponse, error)) *MockClientWithResponsesInterface_ApplyLabelWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// ApplyLabelWithResponse provides a mock function with given fields: ctx, documentId, body, reqEditors -func (_m *MockClientWithResponsesInterface) ApplyLabelWithResponse(ctx context.Context, documentId types.UUID, body queryapi.ApplyLabelJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.ApplyLabelResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, documentId, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ApplyLabelWithResponse") - } - - var r0 *queryapi.ApplyLabelResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, queryapi.ApplyLabelJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.ApplyLabelResponse, error)); ok { - return rf(ctx, documentId, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, queryapi.ApplyLabelJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.ApplyLabelResponse); ok { - r0 = rf(ctx, documentId, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.ApplyLabelResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, queryapi.ApplyLabelJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, documentId, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_ApplyLabelWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ApplyLabelWithResponse' -type MockClientWithResponsesInterface_ApplyLabelWithResponse_Call struct { - *mock.Call -} - -// ApplyLabelWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - documentId types.UUID -// - body queryapi.ApplyLabelJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) ApplyLabelWithResponse(ctx interface{}, documentId interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_ApplyLabelWithResponse_Call { - return &MockClientWithResponsesInterface_ApplyLabelWithResponse_Call{Call: _e.mock.On("ApplyLabelWithResponse", - append([]interface{}{ctx, documentId, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_ApplyLabelWithResponse_Call) Run(run func(ctx context.Context, documentId types.UUID, body queryapi.ApplyLabelJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_ApplyLabelWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(queryapi.ApplyLabelJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_ApplyLabelWithResponse_Call) Return(_a0 *queryapi.ApplyLabelResponse, _a1 error) *MockClientWithResponsesInterface_ApplyLabelWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_ApplyLabelWithResponse_Call) RunAndReturn(run func(context.Context, types.UUID, queryapi.ApplyLabelJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.ApplyLabelResponse, error)) *MockClientWithResponsesInterface_ApplyLabelWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CancelDocumentBatchWithResponse provides a mock function with given fields: ctx, id, batchId, reqEditors -func (_m *MockClientWithResponsesInterface) CancelDocumentBatchWithResponse(ctx context.Context, id queryapi.ClientID, batchId queryapi.BatchID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CancelDocumentBatchResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, batchId) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CancelDocumentBatchWithResponse") - } - - var r0 *queryapi.CancelDocumentBatchResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) (*queryapi.CancelDocumentBatchResponse, error)); ok { - return rf(ctx, id, batchId, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) *queryapi.CancelDocumentBatchResponse); ok { - r0 = rf(ctx, id, batchId, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CancelDocumentBatchResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, batchId, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CancelDocumentBatchWithResponse' -type MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call struct { - *mock.Call -} - -// CancelDocumentBatchWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - batchId queryapi.BatchID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CancelDocumentBatchWithResponse(ctx interface{}, id interface{}, batchId interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call { - return &MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call{Call: _e.mock.On("CancelDocumentBatchWithResponse", - append([]interface{}{ctx, id, batchId}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, batchId queryapi.BatchID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.BatchID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call) Return(_a0 *queryapi.CancelDocumentBatchResponse, _a1 error) *MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) (*queryapi.CancelDocumentBatchResponse, error)) *MockClientWithResponsesInterface_CancelDocumentBatchWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CheckAdminUserExistsWithResponse provides a mock function with given fields: ctx, email, reqEditors -func (_m *MockClientWithResponsesInterface) CheckAdminUserExistsWithResponse(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CheckAdminUserExistsResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CheckAdminUserExistsWithResponse") - } - - var r0 *queryapi.CheckAdminUserExistsResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*queryapi.CheckAdminUserExistsResponse, error)); ok { - return rf(ctx, email, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) *queryapi.CheckAdminUserExistsResponse); ok { - r0 = rf(ctx, email, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CheckAdminUserExistsResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckAdminUserExistsWithResponse' -type MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call struct { - *mock.Call -} - -// CheckAdminUserExistsWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CheckAdminUserExistsWithResponse(ctx interface{}, email interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call { - return &MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call{Call: _e.mock.On("CheckAdminUserExistsWithResponse", - append([]interface{}{ctx, email}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call) Return(_a0 *queryapi.CheckAdminUserExistsResponse, _a1 error) *MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*queryapi.CheckAdminUserExistsResponse, error)) *MockClientWithResponsesInterface_CheckAdminUserExistsWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CreateAdminUserWithBodyWithResponse provides a mock function with given fields: ctx, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) CreateAdminUserWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CreateAdminUserResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateAdminUserWithBodyWithResponse") - } - - var r0 *queryapi.CreateAdminUserResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.CreateAdminUserResponse, error)); ok { - return rf(ctx, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.CreateAdminUserResponse); ok { - r0 = rf(ctx, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CreateAdminUserResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAdminUserWithBodyWithResponse' -type MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call struct { - *mock.Call -} - -// CreateAdminUserWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CreateAdminUserWithBodyWithResponse(ctx interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call{Call: _e.mock.On("CreateAdminUserWithBodyWithResponse", - append([]interface{}{ctx, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call) Run(run func(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call) Return(_a0 *queryapi.CreateAdminUserResponse, _a1 error) *MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.CreateAdminUserResponse, error)) *MockClientWithResponsesInterface_CreateAdminUserWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CreateAdminUserWithResponse provides a mock function with given fields: ctx, body, reqEditors -func (_m *MockClientWithResponsesInterface) CreateAdminUserWithResponse(ctx context.Context, body queryapi.CreateAdminUserJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CreateAdminUserResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateAdminUserWithResponse") - } - - var r0 *queryapi.CreateAdminUserResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.CreateAdminUserResponse, error)); ok { - return rf(ctx, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.CreateAdminUserResponse); ok { - r0 = rf(ctx, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CreateAdminUserResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.CreateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateAdminUserWithResponse' -type MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call struct { - *mock.Call -} - -// CreateAdminUserWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - body queryapi.CreateAdminUserJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CreateAdminUserWithResponse(ctx interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call { - return &MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call{Call: _e.mock.On("CreateAdminUserWithResponse", - append([]interface{}{ctx, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call) Run(run func(ctx context.Context, body queryapi.CreateAdminUserJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.CreateAdminUserJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call) Return(_a0 *queryapi.CreateAdminUserResponse, _a1 error) *MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.CreateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.CreateAdminUserResponse, error)) *MockClientWithResponsesInterface_CreateAdminUserWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CreateClientWithBodyWithResponse provides a mock function with given fields: ctx, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) CreateClientWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CreateClientResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateClientWithBodyWithResponse") - } - - var r0 *queryapi.CreateClientResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.CreateClientResponse, error)); ok { - return rf(ctx, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.CreateClientResponse); ok { - r0 = rf(ctx, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CreateClientResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateClientWithBodyWithResponse' -type MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call struct { - *mock.Call -} - -// CreateClientWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CreateClientWithBodyWithResponse(ctx interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call{Call: _e.mock.On("CreateClientWithBodyWithResponse", - append([]interface{}{ctx, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call) Run(run func(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call) Return(_a0 *queryapi.CreateClientResponse, _a1 error) *MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.CreateClientResponse, error)) *MockClientWithResponsesInterface_CreateClientWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CreateClientWithResponse provides a mock function with given fields: ctx, body, reqEditors -func (_m *MockClientWithResponsesInterface) CreateClientWithResponse(ctx context.Context, body queryapi.CreateClientJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CreateClientResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateClientWithResponse") - } - - var r0 *queryapi.CreateClientResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateClientJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.CreateClientResponse, error)); ok { - return rf(ctx, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateClientJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.CreateClientResponse); ok { - r0 = rf(ctx, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CreateClientResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.CreateClientJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CreateClientWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateClientWithResponse' -type MockClientWithResponsesInterface_CreateClientWithResponse_Call struct { - *mock.Call -} - -// CreateClientWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - body queryapi.CreateClientJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CreateClientWithResponse(ctx interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CreateClientWithResponse_Call { - return &MockClientWithResponsesInterface_CreateClientWithResponse_Call{Call: _e.mock.On("CreateClientWithResponse", - append([]interface{}{ctx, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CreateClientWithResponse_Call) Run(run func(ctx context.Context, body queryapi.CreateClientJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CreateClientWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.CreateClientJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateClientWithResponse_Call) Return(_a0 *queryapi.CreateClientResponse, _a1 error) *MockClientWithResponsesInterface_CreateClientWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateClientWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.CreateClientJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.CreateClientResponse, error)) *MockClientWithResponsesInterface_CreateClientWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CreateFieldExtractionWithBodyWithResponse provides a mock function with given fields: ctx, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) CreateFieldExtractionWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CreateFieldExtractionResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateFieldExtractionWithBodyWithResponse") - } - - var r0 *queryapi.CreateFieldExtractionResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.CreateFieldExtractionResponse, error)); ok { - return rf(ctx, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.CreateFieldExtractionResponse); ok { - r0 = rf(ctx, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CreateFieldExtractionResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFieldExtractionWithBodyWithResponse' -type MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call struct { - *mock.Call -} - -// CreateFieldExtractionWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CreateFieldExtractionWithBodyWithResponse(ctx interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call{Call: _e.mock.On("CreateFieldExtractionWithBodyWithResponse", - append([]interface{}{ctx, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call) Run(run func(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call) Return(_a0 *queryapi.CreateFieldExtractionResponse, _a1 error) *MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.CreateFieldExtractionResponse, error)) *MockClientWithResponsesInterface_CreateFieldExtractionWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CreateFieldExtractionWithResponse provides a mock function with given fields: ctx, body, reqEditors -func (_m *MockClientWithResponsesInterface) CreateFieldExtractionWithResponse(ctx context.Context, body queryapi.CreateFieldExtractionJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CreateFieldExtractionResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateFieldExtractionWithResponse") - } - - var r0 *queryapi.CreateFieldExtractionResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateFieldExtractionJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.CreateFieldExtractionResponse, error)); ok { - return rf(ctx, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateFieldExtractionJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.CreateFieldExtractionResponse); ok { - r0 = rf(ctx, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CreateFieldExtractionResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.CreateFieldExtractionJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFieldExtractionWithResponse' -type MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call struct { - *mock.Call -} - -// CreateFieldExtractionWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - body queryapi.CreateFieldExtractionJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CreateFieldExtractionWithResponse(ctx interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call { - return &MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call{Call: _e.mock.On("CreateFieldExtractionWithResponse", - append([]interface{}{ctx, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call) Run(run func(ctx context.Context, body queryapi.CreateFieldExtractionJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.CreateFieldExtractionJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call) Return(_a0 *queryapi.CreateFieldExtractionResponse, _a1 error) *MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.CreateFieldExtractionJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.CreateFieldExtractionResponse, error)) *MockClientWithResponsesInterface_CreateFieldExtractionWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CreateFolderWithBodyWithResponse provides a mock function with given fields: ctx, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) CreateFolderWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CreateFolderResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateFolderWithBodyWithResponse") - } - - var r0 *queryapi.CreateFolderResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.CreateFolderResponse, error)); ok { - return rf(ctx, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.CreateFolderResponse); ok { - r0 = rf(ctx, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CreateFolderResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFolderWithBodyWithResponse' -type MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call struct { - *mock.Call -} - -// CreateFolderWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CreateFolderWithBodyWithResponse(ctx interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call{Call: _e.mock.On("CreateFolderWithBodyWithResponse", - append([]interface{}{ctx, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call) Run(run func(ctx context.Context, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call) Return(_a0 *queryapi.CreateFolderResponse, _a1 error) *MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.CreateFolderResponse, error)) *MockClientWithResponsesInterface_CreateFolderWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// CreateFolderWithResponse provides a mock function with given fields: ctx, body, reqEditors -func (_m *MockClientWithResponsesInterface) CreateFolderWithResponse(ctx context.Context, body queryapi.CreateFolderJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.CreateFolderResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateFolderWithResponse") - } - - var r0 *queryapi.CreateFolderResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateFolderJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.CreateFolderResponse, error)); ok { - return rf(ctx, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.CreateFolderJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.CreateFolderResponse); ok { - r0 = rf(ctx, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.CreateFolderResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.CreateFolderJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_CreateFolderWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateFolderWithResponse' -type MockClientWithResponsesInterface_CreateFolderWithResponse_Call struct { - *mock.Call -} - -// CreateFolderWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - body queryapi.CreateFolderJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) CreateFolderWithResponse(ctx interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_CreateFolderWithResponse_Call { - return &MockClientWithResponsesInterface_CreateFolderWithResponse_Call{Call: _e.mock.On("CreateFolderWithResponse", - append([]interface{}{ctx, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_CreateFolderWithResponse_Call) Run(run func(ctx context.Context, body queryapi.CreateFolderJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_CreateFolderWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.CreateFolderJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateFolderWithResponse_Call) Return(_a0 *queryapi.CreateFolderResponse, _a1 error) *MockClientWithResponsesInterface_CreateFolderWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_CreateFolderWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.CreateFolderJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.CreateFolderResponse, error)) *MockClientWithResponsesInterface_CreateFolderWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// DeleteAdminUserWithResponse provides a mock function with given fields: ctx, email, params, reqEditors -func (_m *MockClientWithResponsesInterface) DeleteAdminUserWithResponse(ctx context.Context, email queryapi.UserEmail, params *queryapi.DeleteAdminUserParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.DeleteAdminUserResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteAdminUserWithResponse") - } - - var r0 *queryapi.DeleteAdminUserResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, *queryapi.DeleteAdminUserParams, ...queryapi.RequestEditorFn) (*queryapi.DeleteAdminUserResponse, error)); ok { - return rf(ctx, email, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, *queryapi.DeleteAdminUserParams, ...queryapi.RequestEditorFn) *queryapi.DeleteAdminUserResponse); ok { - r0 = rf(ctx, email, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.DeleteAdminUserResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, *queryapi.DeleteAdminUserParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteAdminUserWithResponse' -type MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call struct { - *mock.Call -} - -// DeleteAdminUserWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - params *queryapi.DeleteAdminUserParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) DeleteAdminUserWithResponse(ctx interface{}, email interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call { - return &MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call{Call: _e.mock.On("DeleteAdminUserWithResponse", - append([]interface{}{ctx, email, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, params *queryapi.DeleteAdminUserParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), args[2].(*queryapi.DeleteAdminUserParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call) Return(_a0 *queryapi.DeleteAdminUserResponse, _a1 error) *MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, *queryapi.DeleteAdminUserParams, ...queryapi.RequestEditorFn) (*queryapi.DeleteAdminUserResponse, error)) *MockClientWithResponsesInterface_DeleteAdminUserWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// DisableAdminUserWithResponse provides a mock function with given fields: ctx, email, reqEditors -func (_m *MockClientWithResponsesInterface) DisableAdminUserWithResponse(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn) (*queryapi.DisableAdminUserResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DisableAdminUserWithResponse") - } - - var r0 *queryapi.DisableAdminUserResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*queryapi.DisableAdminUserResponse, error)); ok { - return rf(ctx, email, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) *queryapi.DisableAdminUserResponse); ok { - r0 = rf(ctx, email, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.DisableAdminUserResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DisableAdminUserWithResponse' -type MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call struct { - *mock.Call -} - -// DisableAdminUserWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) DisableAdminUserWithResponse(ctx interface{}, email interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call { - return &MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call{Call: _e.mock.On("DisableAdminUserWithResponse", - append([]interface{}{ctx, email}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call) Return(_a0 *queryapi.DisableAdminUserResponse, _a1 error) *MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*queryapi.DisableAdminUserResponse, error)) *MockClientWithResponsesInterface_DisableAdminUserWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// EnableAdminUserWithResponse provides a mock function with given fields: ctx, email, reqEditors -func (_m *MockClientWithResponsesInterface) EnableAdminUserWithResponse(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn) (*queryapi.EnableAdminUserResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for EnableAdminUserWithResponse") - } - - var r0 *queryapi.EnableAdminUserResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*queryapi.EnableAdminUserResponse, error)); ok { - return rf(ctx, email, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) *queryapi.EnableAdminUserResponse); ok { - r0 = rf(ctx, email, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.EnableAdminUserResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EnableAdminUserWithResponse' -type MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call struct { - *mock.Call -} - -// EnableAdminUserWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) EnableAdminUserWithResponse(ctx interface{}, email interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call { - return &MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call{Call: _e.mock.On("EnableAdminUserWithResponse", - append([]interface{}{ctx, email}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call) Return(_a0 *queryapi.EnableAdminUserResponse, _a1 error) *MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*queryapi.EnableAdminUserResponse, error)) *MockClientWithResponsesInterface_EnableAdminUserWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// ExportStateWithResponse provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientWithResponsesInterface) ExportStateWithResponse(ctx context.Context, id queryapi.ExportID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.ExportStateResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ExportStateWithResponse") - } - - var r0 *queryapi.ExportStateResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ExportID, ...queryapi.RequestEditorFn) (*queryapi.ExportStateResponse, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ExportID, ...queryapi.RequestEditorFn) *queryapi.ExportStateResponse); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.ExportStateResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ExportID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_ExportStateWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExportStateWithResponse' -type MockClientWithResponsesInterface_ExportStateWithResponse_Call struct { - *mock.Call -} - -// ExportStateWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ExportID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) ExportStateWithResponse(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_ExportStateWithResponse_Call { - return &MockClientWithResponsesInterface_ExportStateWithResponse_Call{Call: _e.mock.On("ExportStateWithResponse", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_ExportStateWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ExportID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_ExportStateWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ExportID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_ExportStateWithResponse_Call) Return(_a0 *queryapi.ExportStateResponse, _a1 error) *MockClientWithResponsesInterface_ExportStateWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_ExportStateWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ExportID, ...queryapi.RequestEditorFn) (*queryapi.ExportStateResponse, error)) *MockClientWithResponsesInterface_ExportStateWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetAdminUserWithResponse provides a mock function with given fields: ctx, email, reqEditors -func (_m *MockClientWithResponsesInterface) GetAdminUserWithResponse(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetAdminUserResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetAdminUserWithResponse") - } - - var r0 *queryapi.GetAdminUserResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*queryapi.GetAdminUserResponse, error)); ok { - return rf(ctx, email, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) *queryapi.GetAdminUserResponse); ok { - r0 = rf(ctx, email, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetAdminUserResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetAdminUserWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetAdminUserWithResponse' -type MockClientWithResponsesInterface_GetAdminUserWithResponse_Call struct { - *mock.Call -} - -// GetAdminUserWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetAdminUserWithResponse(ctx interface{}, email interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetAdminUserWithResponse_Call { - return &MockClientWithResponsesInterface_GetAdminUserWithResponse_Call{Call: _e.mock.On("GetAdminUserWithResponse", - append([]interface{}{ctx, email}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetAdminUserWithResponse_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetAdminUserWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetAdminUserWithResponse_Call) Return(_a0 *queryapi.GetAdminUserResponse, _a1 error) *MockClientWithResponsesInterface_GetAdminUserWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetAdminUserWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, ...queryapi.RequestEditorFn) (*queryapi.GetAdminUserResponse, error)) *MockClientWithResponsesInterface_GetAdminUserWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetClientWithResponse provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientWithResponsesInterface) GetClientWithResponse(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetClientResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetClientWithResponse") - } - - var r0 *queryapi.GetClientResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*queryapi.GetClientResponse, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) *queryapi.GetClientResponse); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetClientResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetClientWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClientWithResponse' -type MockClientWithResponsesInterface_GetClientWithResponse_Call struct { - *mock.Call -} - -// GetClientWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetClientWithResponse(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetClientWithResponse_Call { - return &MockClientWithResponsesInterface_GetClientWithResponse_Call{Call: _e.mock.On("GetClientWithResponse", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetClientWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetClientWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetClientWithResponse_Call) Return(_a0 *queryapi.GetClientResponse, _a1 error) *MockClientWithResponsesInterface_GetClientWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetClientWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*queryapi.GetClientResponse, error)) *MockClientWithResponsesInterface_GetClientWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetCollectorByClientIdWithResponse provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientWithResponsesInterface) GetCollectorByClientIdWithResponse(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetCollectorByClientIdResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetCollectorByClientIdWithResponse") - } - - var r0 *queryapi.GetCollectorByClientIdResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*queryapi.GetCollectorByClientIdResponse, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) *queryapi.GetCollectorByClientIdResponse); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetCollectorByClientIdResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCollectorByClientIdWithResponse' -type MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call struct { - *mock.Call -} - -// GetCollectorByClientIdWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetCollectorByClientIdWithResponse(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call { - return &MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call{Call: _e.mock.On("GetCollectorByClientIdWithResponse", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call) Return(_a0 *queryapi.GetCollectorByClientIdResponse, _a1 error) *MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*queryapi.GetCollectorByClientIdResponse, error)) *MockClientWithResponsesInterface_GetCollectorByClientIdWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetCurrentFieldExtractionWithResponse provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientWithResponsesInterface) GetCurrentFieldExtractionWithResponse(ctx context.Context, params *queryapi.GetCurrentFieldExtractionParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetCurrentFieldExtractionResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetCurrentFieldExtractionWithResponse") - } - - var r0 *queryapi.GetCurrentFieldExtractionResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetCurrentFieldExtractionParams, ...queryapi.RequestEditorFn) (*queryapi.GetCurrentFieldExtractionResponse, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetCurrentFieldExtractionParams, ...queryapi.RequestEditorFn) *queryapi.GetCurrentFieldExtractionResponse); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetCurrentFieldExtractionResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.GetCurrentFieldExtractionParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetCurrentFieldExtractionWithResponse' -type MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call struct { - *mock.Call -} - -// GetCurrentFieldExtractionWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.GetCurrentFieldExtractionParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetCurrentFieldExtractionWithResponse(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call { - return &MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call{Call: _e.mock.On("GetCurrentFieldExtractionWithResponse", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call) Run(run func(ctx context.Context, params *queryapi.GetCurrentFieldExtractionParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.GetCurrentFieldExtractionParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call) Return(_a0 *queryapi.GetCurrentFieldExtractionResponse, _a1 error) *MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call) RunAndReturn(run func(context.Context, *queryapi.GetCurrentFieldExtractionParams, ...queryapi.RequestEditorFn) (*queryapi.GetCurrentFieldExtractionResponse, error)) *MockClientWithResponsesInterface_GetCurrentFieldExtractionWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentBatchWithResponse provides a mock function with given fields: ctx, id, batchId, reqEditors -func (_m *MockClientWithResponsesInterface) GetDocumentBatchWithResponse(ctx context.Context, id queryapi.ClientID, batchId queryapi.BatchID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetDocumentBatchResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, batchId) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentBatchWithResponse") - } - - var r0 *queryapi.GetDocumentBatchResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) (*queryapi.GetDocumentBatchResponse, error)); ok { - return rf(ctx, id, batchId, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) *queryapi.GetDocumentBatchResponse); ok { - r0 = rf(ctx, id, batchId, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetDocumentBatchResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, batchId, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentBatchWithResponse' -type MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call struct { - *mock.Call -} - -// GetDocumentBatchWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - batchId queryapi.BatchID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetDocumentBatchWithResponse(ctx interface{}, id interface{}, batchId interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call { - return &MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call{Call: _e.mock.On("GetDocumentBatchWithResponse", - append([]interface{}{ctx, id, batchId}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, batchId queryapi.BatchID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.BatchID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call) Return(_a0 *queryapi.GetDocumentBatchResponse, _a1 error) *MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.BatchID, ...queryapi.RequestEditorFn) (*queryapi.GetDocumentBatchResponse, error)) *MockClientWithResponsesInterface_GetDocumentBatchWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentLabelsWithResponse provides a mock function with given fields: ctx, documentId, reqEditors -func (_m *MockClientWithResponsesInterface) GetDocumentLabelsWithResponse(ctx context.Context, documentId types.UUID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetDocumentLabelsResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, documentId) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentLabelsWithResponse") - } - - var r0 *queryapi.GetDocumentLabelsResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) (*queryapi.GetDocumentLabelsResponse, error)); ok { - return rf(ctx, documentId, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) *queryapi.GetDocumentLabelsResponse); ok { - r0 = rf(ctx, documentId, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetDocumentLabelsResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, documentId, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentLabelsWithResponse' -type MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call struct { - *mock.Call -} - -// GetDocumentLabelsWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - documentId types.UUID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetDocumentLabelsWithResponse(ctx interface{}, documentId interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call { - return &MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call{Call: _e.mock.On("GetDocumentLabelsWithResponse", - append([]interface{}{ctx, documentId}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call) Run(run func(ctx context.Context, documentId types.UUID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call) Return(_a0 *queryapi.GetDocumentLabelsResponse, _a1 error) *MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call) RunAndReturn(run func(context.Context, types.UUID, ...queryapi.RequestEditorFn) (*queryapi.GetDocumentLabelsResponse, error)) *MockClientWithResponsesInterface_GetDocumentLabelsWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentWithResponse provides a mock function with given fields: ctx, id, params, reqEditors -func (_m *MockClientWithResponsesInterface) GetDocumentWithResponse(ctx context.Context, id queryapi.DocumentID, params *queryapi.GetDocumentParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetDocumentResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentWithResponse") - } - - var r0 *queryapi.GetDocumentResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.DocumentID, *queryapi.GetDocumentParams, ...queryapi.RequestEditorFn) (*queryapi.GetDocumentResponse, error)); ok { - return rf(ctx, id, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.DocumentID, *queryapi.GetDocumentParams, ...queryapi.RequestEditorFn) *queryapi.GetDocumentResponse); ok { - r0 = rf(ctx, id, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetDocumentResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.DocumentID, *queryapi.GetDocumentParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetDocumentWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentWithResponse' -type MockClientWithResponsesInterface_GetDocumentWithResponse_Call struct { - *mock.Call -} - -// GetDocumentWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.DocumentID -// - params *queryapi.GetDocumentParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetDocumentWithResponse(ctx interface{}, id interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetDocumentWithResponse_Call { - return &MockClientWithResponsesInterface_GetDocumentWithResponse_Call{Call: _e.mock.On("GetDocumentWithResponse", - append([]interface{}{ctx, id, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetDocumentWithResponse_Call) Run(run func(ctx context.Context, id queryapi.DocumentID, params *queryapi.GetDocumentParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetDocumentWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.DocumentID), args[2].(*queryapi.GetDocumentParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetDocumentWithResponse_Call) Return(_a0 *queryapi.GetDocumentResponse, _a1 error) *MockClientWithResponsesInterface_GetDocumentWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetDocumentWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.DocumentID, *queryapi.GetDocumentParams, ...queryapi.RequestEditorFn) (*queryapi.GetDocumentResponse, error)) *MockClientWithResponsesInterface_GetDocumentWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentsByLabelWithResponse provides a mock function with given fields: ctx, labelName, params, reqEditors -func (_m *MockClientWithResponsesInterface) GetDocumentsByLabelWithResponse(ctx context.Context, labelName string, params *queryapi.GetDocumentsByLabelParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetDocumentsByLabelResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, labelName, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentsByLabelWithResponse") - } - - var r0 *queryapi.GetDocumentsByLabelResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, *queryapi.GetDocumentsByLabelParams, ...queryapi.RequestEditorFn) (*queryapi.GetDocumentsByLabelResponse, error)); ok { - return rf(ctx, labelName, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, string, *queryapi.GetDocumentsByLabelParams, ...queryapi.RequestEditorFn) *queryapi.GetDocumentsByLabelResponse); ok { - r0 = rf(ctx, labelName, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetDocumentsByLabelResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, string, *queryapi.GetDocumentsByLabelParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, labelName, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentsByLabelWithResponse' -type MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call struct { - *mock.Call -} - -// GetDocumentsByLabelWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - labelName string -// - params *queryapi.GetDocumentsByLabelParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetDocumentsByLabelWithResponse(ctx interface{}, labelName interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call { - return &MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call{Call: _e.mock.On("GetDocumentsByLabelWithResponse", - append([]interface{}{ctx, labelName, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call) Run(run func(ctx context.Context, labelName string, params *queryapi.GetDocumentsByLabelParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(string), args[2].(*queryapi.GetDocumentsByLabelParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call) Return(_a0 *queryapi.GetDocumentsByLabelResponse, _a1 error) *MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call) RunAndReturn(run func(context.Context, string, *queryapi.GetDocumentsByLabelParams, ...queryapi.RequestEditorFn) (*queryapi.GetDocumentsByLabelResponse, error)) *MockClientWithResponsesInterface_GetDocumentsByLabelWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetFieldExtractionByVersionWithResponse provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientWithResponsesInterface) GetFieldExtractionByVersionWithResponse(ctx context.Context, params *queryapi.GetFieldExtractionByVersionParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetFieldExtractionByVersionResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetFieldExtractionByVersionWithResponse") - } - - var r0 *queryapi.GetFieldExtractionByVersionResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetFieldExtractionByVersionParams, ...queryapi.RequestEditorFn) (*queryapi.GetFieldExtractionByVersionResponse, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetFieldExtractionByVersionParams, ...queryapi.RequestEditorFn) *queryapi.GetFieldExtractionByVersionResponse); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetFieldExtractionByVersionResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.GetFieldExtractionByVersionParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFieldExtractionByVersionWithResponse' -type MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call struct { - *mock.Call -} - -// GetFieldExtractionByVersionWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.GetFieldExtractionByVersionParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetFieldExtractionByVersionWithResponse(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call { - return &MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call{Call: _e.mock.On("GetFieldExtractionByVersionWithResponse", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call) Run(run func(ctx context.Context, params *queryapi.GetFieldExtractionByVersionParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.GetFieldExtractionByVersionParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call) Return(_a0 *queryapi.GetFieldExtractionByVersionResponse, _a1 error) *MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call) RunAndReturn(run func(context.Context, *queryapi.GetFieldExtractionByVersionParams, ...queryapi.RequestEditorFn) (*queryapi.GetFieldExtractionByVersionResponse, error)) *MockClientWithResponsesInterface_GetFieldExtractionByVersionWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetFieldExtractionHistoryWithResponse provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientWithResponsesInterface) GetFieldExtractionHistoryWithResponse(ctx context.Context, params *queryapi.GetFieldExtractionHistoryParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetFieldExtractionHistoryResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetFieldExtractionHistoryWithResponse") - } - - var r0 *queryapi.GetFieldExtractionHistoryResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetFieldExtractionHistoryParams, ...queryapi.RequestEditorFn) (*queryapi.GetFieldExtractionHistoryResponse, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.GetFieldExtractionHistoryParams, ...queryapi.RequestEditorFn) *queryapi.GetFieldExtractionHistoryResponse); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetFieldExtractionHistoryResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.GetFieldExtractionHistoryParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFieldExtractionHistoryWithResponse' -type MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call struct { - *mock.Call -} - -// GetFieldExtractionHistoryWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.GetFieldExtractionHistoryParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetFieldExtractionHistoryWithResponse(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call { - return &MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call{Call: _e.mock.On("GetFieldExtractionHistoryWithResponse", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call) Run(run func(ctx context.Context, params *queryapi.GetFieldExtractionHistoryParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.GetFieldExtractionHistoryParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call) Return(_a0 *queryapi.GetFieldExtractionHistoryResponse, _a1 error) *MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call) RunAndReturn(run func(context.Context, *queryapi.GetFieldExtractionHistoryParams, ...queryapi.RequestEditorFn) (*queryapi.GetFieldExtractionHistoryResponse, error)) *MockClientWithResponsesInterface_GetFieldExtractionHistoryWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetFolderDocumentsWithResponse provides a mock function with given fields: ctx, folderId, params, reqEditors -func (_m *MockClientWithResponsesInterface) GetFolderDocumentsWithResponse(ctx context.Context, folderId types.UUID, params *queryapi.GetFolderDocumentsParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetFolderDocumentsResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, folderId, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetFolderDocumentsWithResponse") - } - - var r0 *queryapi.GetFolderDocumentsResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, *queryapi.GetFolderDocumentsParams, ...queryapi.RequestEditorFn) (*queryapi.GetFolderDocumentsResponse, error)); ok { - return rf(ctx, folderId, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, *queryapi.GetFolderDocumentsParams, ...queryapi.RequestEditorFn) *queryapi.GetFolderDocumentsResponse); ok { - r0 = rf(ctx, folderId, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetFolderDocumentsResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, *queryapi.GetFolderDocumentsParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, folderId, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFolderDocumentsWithResponse' -type MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call struct { - *mock.Call -} - -// GetFolderDocumentsWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - folderId types.UUID -// - params *queryapi.GetFolderDocumentsParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetFolderDocumentsWithResponse(ctx interface{}, folderId interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call { - return &MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call{Call: _e.mock.On("GetFolderDocumentsWithResponse", - append([]interface{}{ctx, folderId, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call) Run(run func(ctx context.Context, folderId types.UUID, params *queryapi.GetFolderDocumentsParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(*queryapi.GetFolderDocumentsParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call) Return(_a0 *queryapi.GetFolderDocumentsResponse, _a1 error) *MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call) RunAndReturn(run func(context.Context, types.UUID, *queryapi.GetFolderDocumentsParams, ...queryapi.RequestEditorFn) (*queryapi.GetFolderDocumentsResponse, error)) *MockClientWithResponsesInterface_GetFolderDocumentsWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetFolderMetricsWithResponse provides a mock function with given fields: ctx, folderId, reqEditors -func (_m *MockClientWithResponsesInterface) GetFolderMetricsWithResponse(ctx context.Context, folderId types.UUID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetFolderMetricsResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, folderId) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetFolderMetricsWithResponse") - } - - var r0 *queryapi.GetFolderMetricsResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) (*queryapi.GetFolderMetricsResponse, error)); ok { - return rf(ctx, folderId, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) *queryapi.GetFolderMetricsResponse); ok { - r0 = rf(ctx, folderId, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetFolderMetricsResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, folderId, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFolderMetricsWithResponse' -type MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call struct { - *mock.Call -} - -// GetFolderMetricsWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - folderId types.UUID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetFolderMetricsWithResponse(ctx interface{}, folderId interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call { - return &MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call{Call: _e.mock.On("GetFolderMetricsWithResponse", - append([]interface{}{ctx, folderId}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call) Run(run func(ctx context.Context, folderId types.UUID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call) Return(_a0 *queryapi.GetFolderMetricsResponse, _a1 error) *MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call) RunAndReturn(run func(context.Context, types.UUID, ...queryapi.RequestEditorFn) (*queryapi.GetFolderMetricsResponse, error)) *MockClientWithResponsesInterface_GetFolderMetricsWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetHomePageWithResponse provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientWithResponsesInterface) GetHomePageWithResponse(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetHomePageResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetHomePageWithResponse") - } - - var r0 *queryapi.GetHomePageResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.GetHomePageResponse, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *queryapi.GetHomePageResponse); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetHomePageResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetHomePageWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetHomePageWithResponse' -type MockClientWithResponsesInterface_GetHomePageWithResponse_Call struct { - *mock.Call -} - -// GetHomePageWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetHomePageWithResponse(ctx interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetHomePageWithResponse_Call { - return &MockClientWithResponsesInterface_GetHomePageWithResponse_Call{Call: _e.mock.On("GetHomePageWithResponse", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetHomePageWithResponse_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetHomePageWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetHomePageWithResponse_Call) Return(_a0 *queryapi.GetHomePageResponse, _a1 error) *MockClientWithResponsesInterface_GetHomePageWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetHomePageWithResponse_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.GetHomePageResponse, error)) *MockClientWithResponsesInterface_GetHomePageWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetIdentityWithResponse provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientWithResponsesInterface) GetIdentityWithResponse(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetIdentityResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetIdentityWithResponse") - } - - var r0 *queryapi.GetIdentityResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.GetIdentityResponse, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *queryapi.GetIdentityResponse); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetIdentityResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetIdentityWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIdentityWithResponse' -type MockClientWithResponsesInterface_GetIdentityWithResponse_Call struct { - *mock.Call -} - -// GetIdentityWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetIdentityWithResponse(ctx interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetIdentityWithResponse_Call { - return &MockClientWithResponsesInterface_GetIdentityWithResponse_Call{Call: _e.mock.On("GetIdentityWithResponse", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetIdentityWithResponse_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetIdentityWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetIdentityWithResponse_Call) Return(_a0 *queryapi.GetIdentityResponse, _a1 error) *MockClientWithResponsesInterface_GetIdentityWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetIdentityWithResponse_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.GetIdentityResponse, error)) *MockClientWithResponsesInterface_GetIdentityWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// GetStatusByClientIdWithResponse provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientWithResponsesInterface) GetStatusByClientIdWithResponse(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.GetStatusByClientIdResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetStatusByClientIdWithResponse") - } - - var r0 *queryapi.GetStatusByClientIdResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*queryapi.GetStatusByClientIdResponse, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) *queryapi.GetStatusByClientIdResponse); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.GetStatusByClientIdResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetStatusByClientIdWithResponse' -type MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call struct { - *mock.Call -} - -// GetStatusByClientIdWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) GetStatusByClientIdWithResponse(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call { - return &MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call{Call: _e.mock.On("GetStatusByClientIdWithResponse", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call) Return(_a0 *queryapi.GetStatusByClientIdResponse, _a1 error) *MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*queryapi.GetStatusByClientIdResponse, error)) *MockClientWithResponsesInterface_GetStatusByClientIdWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// ListAdminUsersWithResponse provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientWithResponsesInterface) ListAdminUsersWithResponse(ctx context.Context, params *queryapi.ListAdminUsersParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.ListAdminUsersResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListAdminUsersWithResponse") - } - - var r0 *queryapi.ListAdminUsersResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.ListAdminUsersParams, ...queryapi.RequestEditorFn) (*queryapi.ListAdminUsersResponse, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.ListAdminUsersParams, ...queryapi.RequestEditorFn) *queryapi.ListAdminUsersResponse); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.ListAdminUsersResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.ListAdminUsersParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAdminUsersWithResponse' -type MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call struct { - *mock.Call -} - -// ListAdminUsersWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.ListAdminUsersParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) ListAdminUsersWithResponse(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call { - return &MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call{Call: _e.mock.On("ListAdminUsersWithResponse", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call) Run(run func(ctx context.Context, params *queryapi.ListAdminUsersParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.ListAdminUsersParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call) Return(_a0 *queryapi.ListAdminUsersResponse, _a1 error) *MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call) RunAndReturn(run func(context.Context, *queryapi.ListAdminUsersParams, ...queryapi.RequestEditorFn) (*queryapi.ListAdminUsersResponse, error)) *MockClientWithResponsesInterface_ListAdminUsersWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// ListClientFoldersWithResponse provides a mock function with given fields: ctx, id, params, reqEditors -func (_m *MockClientWithResponsesInterface) ListClientFoldersWithResponse(ctx context.Context, id queryapi.ClientID, params *queryapi.ListClientFoldersParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.ListClientFoldersResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListClientFoldersWithResponse") - } - - var r0 *queryapi.ListClientFoldersResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, *queryapi.ListClientFoldersParams, ...queryapi.RequestEditorFn) (*queryapi.ListClientFoldersResponse, error)); ok { - return rf(ctx, id, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, *queryapi.ListClientFoldersParams, ...queryapi.RequestEditorFn) *queryapi.ListClientFoldersResponse); ok { - r0 = rf(ctx, id, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.ListClientFoldersResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, *queryapi.ListClientFoldersParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListClientFoldersWithResponse' -type MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call struct { - *mock.Call -} - -// ListClientFoldersWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - params *queryapi.ListClientFoldersParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) ListClientFoldersWithResponse(ctx interface{}, id interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call { - return &MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call{Call: _e.mock.On("ListClientFoldersWithResponse", - append([]interface{}{ctx, id, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, params *queryapi.ListClientFoldersParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(*queryapi.ListClientFoldersParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call) Return(_a0 *queryapi.ListClientFoldersResponse, _a1 error) *MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, *queryapi.ListClientFoldersParams, ...queryapi.RequestEditorFn) (*queryapi.ListClientFoldersResponse, error)) *MockClientWithResponsesInterface_ListClientFoldersWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// ListClientsWithResponse provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientWithResponsesInterface) ListClientsWithResponse(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*queryapi.ListClientsResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListClientsWithResponse") - } - - var r0 *queryapi.ListClientsResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.ListClientsResponse, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *queryapi.ListClientsResponse); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.ListClientsResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_ListClientsWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListClientsWithResponse' -type MockClientWithResponsesInterface_ListClientsWithResponse_Call struct { - *mock.Call -} - -// ListClientsWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) ListClientsWithResponse(ctx interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_ListClientsWithResponse_Call { - return &MockClientWithResponsesInterface_ListClientsWithResponse_Call{Call: _e.mock.On("ListClientsWithResponse", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_ListClientsWithResponse_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_ListClientsWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListClientsWithResponse_Call) Return(_a0 *queryapi.ListClientsResponse, _a1 error) *MockClientWithResponsesInterface_ListClientsWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListClientsWithResponse_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.ListClientsResponse, error)) *MockClientWithResponsesInterface_ListClientsWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// ListDocumentBatchesWithResponse provides a mock function with given fields: ctx, id, params, reqEditors -func (_m *MockClientWithResponsesInterface) ListDocumentBatchesWithResponse(ctx context.Context, id queryapi.ClientID, params *queryapi.ListDocumentBatchesParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.ListDocumentBatchesResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListDocumentBatchesWithResponse") - } - - var r0 *queryapi.ListDocumentBatchesResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, *queryapi.ListDocumentBatchesParams, ...queryapi.RequestEditorFn) (*queryapi.ListDocumentBatchesResponse, error)); ok { - return rf(ctx, id, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, *queryapi.ListDocumentBatchesParams, ...queryapi.RequestEditorFn) *queryapi.ListDocumentBatchesResponse); ok { - r0 = rf(ctx, id, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.ListDocumentBatchesResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, *queryapi.ListDocumentBatchesParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDocumentBatchesWithResponse' -type MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call struct { - *mock.Call -} - -// ListDocumentBatchesWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - params *queryapi.ListDocumentBatchesParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) ListDocumentBatchesWithResponse(ctx interface{}, id interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call { - return &MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call{Call: _e.mock.On("ListDocumentBatchesWithResponse", - append([]interface{}{ctx, id, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, params *queryapi.ListDocumentBatchesParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(*queryapi.ListDocumentBatchesParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call) Return(_a0 *queryapi.ListDocumentBatchesResponse, _a1 error) *MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, *queryapi.ListDocumentBatchesParams, ...queryapi.RequestEditorFn) (*queryapi.ListDocumentBatchesResponse, error)) *MockClientWithResponsesInterface_ListDocumentBatchesWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// ListDocumentsByClientIdWithResponse provides a mock function with given fields: ctx, id, reqEditors -func (_m *MockClientWithResponsesInterface) ListDocumentsByClientIdWithResponse(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn) (*queryapi.ListDocumentsByClientIdResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListDocumentsByClientIdWithResponse") - } - - var r0 *queryapi.ListDocumentsByClientIdResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*queryapi.ListDocumentsByClientIdResponse, error)); ok { - return rf(ctx, id, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) *queryapi.ListDocumentsByClientIdResponse); ok { - r0 = rf(ctx, id, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.ListDocumentsByClientIdResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListDocumentsByClientIdWithResponse' -type MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call struct { - *mock.Call -} - -// ListDocumentsByClientIdWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) ListDocumentsByClientIdWithResponse(ctx interface{}, id interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call { - return &MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call{Call: _e.mock.On("ListDocumentsByClientIdWithResponse", - append([]interface{}{ctx, id}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call) Return(_a0 *queryapi.ListDocumentsByClientIdResponse, _a1 error) *MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, ...queryapi.RequestEditorFn) (*queryapi.ListDocumentsByClientIdResponse, error)) *MockClientWithResponsesInterface_ListDocumentsByClientIdWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// LoginCallbackWithResponse provides a mock function with given fields: ctx, params, reqEditors -func (_m *MockClientWithResponsesInterface) LoginCallbackWithResponse(ctx context.Context, params *queryapi.LoginCallbackParams, reqEditors ...queryapi.RequestEditorFn) (*queryapi.LoginCallbackResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for LoginCallbackWithResponse") - } - - var r0 *queryapi.LoginCallbackResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) (*queryapi.LoginCallbackResponse, error)); ok { - return rf(ctx, params, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) *queryapi.LoginCallbackResponse); ok { - r0 = rf(ctx, params, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.LoginCallbackResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, params, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_LoginCallbackWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoginCallbackWithResponse' -type MockClientWithResponsesInterface_LoginCallbackWithResponse_Call struct { - *mock.Call -} - -// LoginCallbackWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - params *queryapi.LoginCallbackParams -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) LoginCallbackWithResponse(ctx interface{}, params interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call { - return &MockClientWithResponsesInterface_LoginCallbackWithResponse_Call{Call: _e.mock.On("LoginCallbackWithResponse", - append([]interface{}{ctx, params}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call) Run(run func(ctx context.Context, params *queryapi.LoginCallbackParams, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(*queryapi.LoginCallbackParams), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call) Return(_a0 *queryapi.LoginCallbackResponse, _a1 error) *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call) RunAndReturn(run func(context.Context, *queryapi.LoginCallbackParams, ...queryapi.RequestEditorFn) (*queryapi.LoginCallbackResponse, error)) *MockClientWithResponsesInterface_LoginCallbackWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// LoginWithResponse provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientWithResponsesInterface) LoginWithResponse(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*queryapi.LoginResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for LoginWithResponse") - } - - var r0 *queryapi.LoginResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.LoginResponse, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *queryapi.LoginResponse); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.LoginResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_LoginWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LoginWithResponse' -type MockClientWithResponsesInterface_LoginWithResponse_Call struct { - *mock.Call -} - -// LoginWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) LoginWithResponse(ctx interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_LoginWithResponse_Call { - return &MockClientWithResponsesInterface_LoginWithResponse_Call{Call: _e.mock.On("LoginWithResponse", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_LoginWithResponse_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_LoginWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_LoginWithResponse_Call) Return(_a0 *queryapi.LoginResponse, _a1 error) *MockClientWithResponsesInterface_LoginWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_LoginWithResponse_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.LoginResponse, error)) *MockClientWithResponsesInterface_LoginWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// LogoutWithResponse provides a mock function with given fields: ctx, reqEditors -func (_m *MockClientWithResponsesInterface) LogoutWithResponse(ctx context.Context, reqEditors ...queryapi.RequestEditorFn) (*queryapi.LogoutResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for LogoutWithResponse") - } - - var r0 *queryapi.LogoutResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.LogoutResponse, error)); ok { - return rf(ctx, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, ...queryapi.RequestEditorFn) *queryapi.LogoutResponse); ok { - r0 = rf(ctx, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.LogoutResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_LogoutWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'LogoutWithResponse' -type MockClientWithResponsesInterface_LogoutWithResponse_Call struct { - *mock.Call -} - -// LogoutWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) LogoutWithResponse(ctx interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_LogoutWithResponse_Call { - return &MockClientWithResponsesInterface_LogoutWithResponse_Call{Call: _e.mock.On("LogoutWithResponse", - append([]interface{}{ctx}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_LogoutWithResponse_Call) Run(run func(ctx context.Context, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_LogoutWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-1) - for i, a := range args[1:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_LogoutWithResponse_Call) Return(_a0 *queryapi.LogoutResponse, _a1 error) *MockClientWithResponsesInterface_LogoutWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_LogoutWithResponse_Call) RunAndReturn(run func(context.Context, ...queryapi.RequestEditorFn) (*queryapi.LogoutResponse, error)) *MockClientWithResponsesInterface_LogoutWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// RenameFolderWithBodyWithResponse provides a mock function with given fields: ctx, folderId, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) RenameFolderWithBodyWithResponse(ctx context.Context, folderId types.UUID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.RenameFolderResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, folderId, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for RenameFolderWithBodyWithResponse") - } - - var r0 *queryapi.RenameFolderResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.RenameFolderResponse, error)); ok { - return rf(ctx, folderId, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.RenameFolderResponse); ok { - r0 = rf(ctx, folderId, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.RenameFolderResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, folderId, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenameFolderWithBodyWithResponse' -type MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call struct { - *mock.Call -} - -// RenameFolderWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - folderId types.UUID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) RenameFolderWithBodyWithResponse(ctx interface{}, folderId interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call{Call: _e.mock.On("RenameFolderWithBodyWithResponse", - append([]interface{}{ctx, folderId, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call) Run(run func(ctx context.Context, folderId types.UUID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call) Return(_a0 *queryapi.RenameFolderResponse, _a1 error) *MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, types.UUID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.RenameFolderResponse, error)) *MockClientWithResponsesInterface_RenameFolderWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// RenameFolderWithResponse provides a mock function with given fields: ctx, folderId, body, reqEditors -func (_m *MockClientWithResponsesInterface) RenameFolderWithResponse(ctx context.Context, folderId types.UUID, body queryapi.RenameFolderJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.RenameFolderResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, folderId, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for RenameFolderWithResponse") - } - - var r0 *queryapi.RenameFolderResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, queryapi.RenameFolderJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.RenameFolderResponse, error)); ok { - return rf(ctx, folderId, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, types.UUID, queryapi.RenameFolderJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.RenameFolderResponse); ok { - r0 = rf(ctx, folderId, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.RenameFolderResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, types.UUID, queryapi.RenameFolderJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, folderId, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_RenameFolderWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RenameFolderWithResponse' -type MockClientWithResponsesInterface_RenameFolderWithResponse_Call struct { - *mock.Call -} - -// RenameFolderWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - folderId types.UUID -// - body queryapi.RenameFolderJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) RenameFolderWithResponse(ctx interface{}, folderId interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_RenameFolderWithResponse_Call { - return &MockClientWithResponsesInterface_RenameFolderWithResponse_Call{Call: _e.mock.On("RenameFolderWithResponse", - append([]interface{}{ctx, folderId, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_RenameFolderWithResponse_Call) Run(run func(ctx context.Context, folderId types.UUID, body queryapi.RenameFolderJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_RenameFolderWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(types.UUID), args[2].(queryapi.RenameFolderJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_RenameFolderWithResponse_Call) Return(_a0 *queryapi.RenameFolderResponse, _a1 error) *MockClientWithResponsesInterface_RenameFolderWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_RenameFolderWithResponse_Call) RunAndReturn(run func(context.Context, types.UUID, queryapi.RenameFolderJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.RenameFolderResponse, error)) *MockClientWithResponsesInterface_RenameFolderWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// SetCollectorByClientIdWithBodyWithResponse provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) SetCollectorByClientIdWithBodyWithResponse(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.SetCollectorByClientIdResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for SetCollectorByClientIdWithBodyWithResponse") - } - - var r0 *queryapi.SetCollectorByClientIdResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.SetCollectorByClientIdResponse, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.SetCollectorByClientIdResponse); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.SetCollectorByClientIdResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCollectorByClientIdWithBodyWithResponse' -type MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call struct { - *mock.Call -} - -// SetCollectorByClientIdWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) SetCollectorByClientIdWithBodyWithResponse(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call{Call: _e.mock.On("SetCollectorByClientIdWithBodyWithResponse", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call) Return(_a0 *queryapi.SetCollectorByClientIdResponse, _a1 error) *MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.SetCollectorByClientIdResponse, error)) *MockClientWithResponsesInterface_SetCollectorByClientIdWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// SetCollectorByClientIdWithResponse provides a mock function with given fields: ctx, id, body, reqEditors -func (_m *MockClientWithResponsesInterface) SetCollectorByClientIdWithResponse(ctx context.Context, id queryapi.ClientID, body queryapi.SetCollectorByClientIdJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.SetCollectorByClientIdResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for SetCollectorByClientIdWithResponse") - } - - var r0 *queryapi.SetCollectorByClientIdResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.SetCollectorByClientIdJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.SetCollectorByClientIdResponse, error)); ok { - return rf(ctx, id, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.SetCollectorByClientIdJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.SetCollectorByClientIdResponse); ok { - r0 = rf(ctx, id, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.SetCollectorByClientIdResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.SetCollectorByClientIdJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCollectorByClientIdWithResponse' -type MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call struct { - *mock.Call -} - -// SetCollectorByClientIdWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - body queryapi.SetCollectorByClientIdJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) SetCollectorByClientIdWithResponse(ctx interface{}, id interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call { - return &MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call{Call: _e.mock.On("SetCollectorByClientIdWithResponse", - append([]interface{}{ctx, id, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, body queryapi.SetCollectorByClientIdJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.SetCollectorByClientIdJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call) Return(_a0 *queryapi.SetCollectorByClientIdResponse, _a1 error) *MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.SetCollectorByClientIdJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.SetCollectorByClientIdResponse, error)) *MockClientWithResponsesInterface_SetCollectorByClientIdWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// TriggerExportWithBodyWithResponse provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) TriggerExportWithBodyWithResponse(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.TriggerExportResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for TriggerExportWithBodyWithResponse") - } - - var r0 *queryapi.TriggerExportResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.TriggerExportResponse, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.TriggerExportResponse); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.TriggerExportResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TriggerExportWithBodyWithResponse' -type MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call struct { - *mock.Call -} - -// TriggerExportWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) TriggerExportWithBodyWithResponse(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call{Call: _e.mock.On("TriggerExportWithBodyWithResponse", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call) Return(_a0 *queryapi.TriggerExportResponse, _a1 error) *MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.TriggerExportResponse, error)) *MockClientWithResponsesInterface_TriggerExportWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// TriggerExportWithResponse provides a mock function with given fields: ctx, id, body, reqEditors -func (_m *MockClientWithResponsesInterface) TriggerExportWithResponse(ctx context.Context, id queryapi.ClientID, body queryapi.TriggerExportJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.TriggerExportResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for TriggerExportWithResponse") - } - - var r0 *queryapi.TriggerExportResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.TriggerExportJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.TriggerExportResponse, error)); ok { - return rf(ctx, id, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.TriggerExportJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.TriggerExportResponse); ok { - r0 = rf(ctx, id, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.TriggerExportResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.TriggerExportJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_TriggerExportWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TriggerExportWithResponse' -type MockClientWithResponsesInterface_TriggerExportWithResponse_Call struct { - *mock.Call -} - -// TriggerExportWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - body queryapi.TriggerExportJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) TriggerExportWithResponse(ctx interface{}, id interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_TriggerExportWithResponse_Call { - return &MockClientWithResponsesInterface_TriggerExportWithResponse_Call{Call: _e.mock.On("TriggerExportWithResponse", - append([]interface{}{ctx, id, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_TriggerExportWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, body queryapi.TriggerExportJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_TriggerExportWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.TriggerExportJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_TriggerExportWithResponse_Call) Return(_a0 *queryapi.TriggerExportResponse, _a1 error) *MockClientWithResponsesInterface_TriggerExportWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_TriggerExportWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.TriggerExportJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.TriggerExportResponse, error)) *MockClientWithResponsesInterface_TriggerExportWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// UpdateAdminUserWithBodyWithResponse provides a mock function with given fields: ctx, email, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) UpdateAdminUserWithBodyWithResponse(ctx context.Context, email queryapi.UserEmail, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.UpdateAdminUserResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateAdminUserWithBodyWithResponse") - } - - var r0 *queryapi.UpdateAdminUserResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.UpdateAdminUserResponse, error)); ok { - return rf(ctx, email, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.UpdateAdminUserResponse); ok { - r0 = rf(ctx, email, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.UpdateAdminUserResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAdminUserWithBodyWithResponse' -type MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call struct { - *mock.Call -} - -// UpdateAdminUserWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) UpdateAdminUserWithBodyWithResponse(ctx interface{}, email interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call{Call: _e.mock.On("UpdateAdminUserWithBodyWithResponse", - append([]interface{}{ctx, email, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call) Return(_a0 *queryapi.UpdateAdminUserResponse, _a1 error) *MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.UpdateAdminUserResponse, error)) *MockClientWithResponsesInterface_UpdateAdminUserWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// UpdateAdminUserWithResponse provides a mock function with given fields: ctx, email, body, reqEditors -func (_m *MockClientWithResponsesInterface) UpdateAdminUserWithResponse(ctx context.Context, email queryapi.UserEmail, body queryapi.UpdateAdminUserJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.UpdateAdminUserResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, email, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateAdminUserWithResponse") - } - - var r0 *queryapi.UpdateAdminUserResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, queryapi.UpdateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.UpdateAdminUserResponse, error)); ok { - return rf(ctx, email, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.UserEmail, queryapi.UpdateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.UpdateAdminUserResponse); ok { - r0 = rf(ctx, email, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.UpdateAdminUserResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.UserEmail, queryapi.UpdateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, email, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateAdminUserWithResponse' -type MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call struct { - *mock.Call -} - -// UpdateAdminUserWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - email queryapi.UserEmail -// - body queryapi.UpdateAdminUserJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) UpdateAdminUserWithResponse(ctx interface{}, email interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call { - return &MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call{Call: _e.mock.On("UpdateAdminUserWithResponse", - append([]interface{}{ctx, email, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call) Run(run func(ctx context.Context, email queryapi.UserEmail, body queryapi.UpdateAdminUserJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.UserEmail), args[2].(queryapi.UpdateAdminUserJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call) Return(_a0 *queryapi.UpdateAdminUserResponse, _a1 error) *MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.UserEmail, queryapi.UpdateAdminUserJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.UpdateAdminUserResponse, error)) *MockClientWithResponsesInterface_UpdateAdminUserWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// UpdateClientWithBodyWithResponse provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) UpdateClientWithBodyWithResponse(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.UpdateClientResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateClientWithBodyWithResponse") - } - - var r0 *queryapi.UpdateClientResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.UpdateClientResponse, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.UpdateClientResponse); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.UpdateClientResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateClientWithBodyWithResponse' -type MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call struct { - *mock.Call -} - -// UpdateClientWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) UpdateClientWithBodyWithResponse(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call{Call: _e.mock.On("UpdateClientWithBodyWithResponse", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call) Return(_a0 *queryapi.UpdateClientResponse, _a1 error) *MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.UpdateClientResponse, error)) *MockClientWithResponsesInterface_UpdateClientWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// UpdateClientWithResponse provides a mock function with given fields: ctx, id, body, reqEditors -func (_m *MockClientWithResponsesInterface) UpdateClientWithResponse(ctx context.Context, id queryapi.ClientID, body queryapi.UpdateClientJSONRequestBody, reqEditors ...queryapi.RequestEditorFn) (*queryapi.UpdateClientResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UpdateClientWithResponse") - } - - var r0 *queryapi.UpdateClientResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.UpdateClientJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.UpdateClientResponse, error)); ok { - return rf(ctx, id, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, queryapi.UpdateClientJSONRequestBody, ...queryapi.RequestEditorFn) *queryapi.UpdateClientResponse); ok { - r0 = rf(ctx, id, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.UpdateClientResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, queryapi.UpdateClientJSONRequestBody, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_UpdateClientWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateClientWithResponse' -type MockClientWithResponsesInterface_UpdateClientWithResponse_Call struct { - *mock.Call -} - -// UpdateClientWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - body queryapi.UpdateClientJSONRequestBody -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) UpdateClientWithResponse(ctx interface{}, id interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_UpdateClientWithResponse_Call { - return &MockClientWithResponsesInterface_UpdateClientWithResponse_Call{Call: _e.mock.On("UpdateClientWithResponse", - append([]interface{}{ctx, id, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_UpdateClientWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, body queryapi.UpdateClientJSONRequestBody, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_UpdateClientWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-3) - for i, a := range args[3:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(queryapi.UpdateClientJSONRequestBody), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_UpdateClientWithResponse_Call) Return(_a0 *queryapi.UpdateClientResponse, _a1 error) *MockClientWithResponsesInterface_UpdateClientWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_UpdateClientWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, queryapi.UpdateClientJSONRequestBody, ...queryapi.RequestEditorFn) (*queryapi.UpdateClientResponse, error)) *MockClientWithResponsesInterface_UpdateClientWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// UploadDocumentBatchWithBodyWithResponse provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) UploadDocumentBatchWithBodyWithResponse(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.UploadDocumentBatchResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UploadDocumentBatchWithBodyWithResponse") - } - - var r0 *queryapi.UploadDocumentBatchResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.UploadDocumentBatchResponse, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.UploadDocumentBatchResponse); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.UploadDocumentBatchResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UploadDocumentBatchWithBodyWithResponse' -type MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call struct { - *mock.Call -} - -// UploadDocumentBatchWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) UploadDocumentBatchWithBodyWithResponse(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call{Call: _e.mock.On("UploadDocumentBatchWithBodyWithResponse", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call) Return(_a0 *queryapi.UploadDocumentBatchResponse, _a1 error) *MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.UploadDocumentBatchResponse, error)) *MockClientWithResponsesInterface_UploadDocumentBatchWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// UploadDocumentWithBodyWithResponse provides a mock function with given fields: ctx, id, contentType, body, reqEditors -func (_m *MockClientWithResponsesInterface) UploadDocumentWithBodyWithResponse(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn) (*queryapi.UploadDocumentResponse, error) { - _va := make([]interface{}, len(reqEditors)) - for _i := range reqEditors { - _va[_i] = reqEditors[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, id, contentType, body) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UploadDocumentWithBodyWithResponse") - } - - var r0 *queryapi.UploadDocumentResponse - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.UploadDocumentResponse, error)); ok { - return rf(ctx, id, contentType, body, reqEditors...) - } - if rf, ok := ret.Get(0).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) *queryapi.UploadDocumentResponse); ok { - r0 = rf(ctx, id, contentType, body, reqEditors...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*queryapi.UploadDocumentResponse) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) error); ok { - r1 = rf(ctx, id, contentType, body, reqEditors...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UploadDocumentWithBodyWithResponse' -type MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call struct { - *mock.Call -} - -// UploadDocumentWithBodyWithResponse is a helper method to define mock.On call -// - ctx context.Context -// - id queryapi.ClientID -// - contentType string -// - body io.Reader -// - reqEditors ...queryapi.RequestEditorFn -func (_e *MockClientWithResponsesInterface_Expecter) UploadDocumentWithBodyWithResponse(ctx interface{}, id interface{}, contentType interface{}, body interface{}, reqEditors ...interface{}) *MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call { - return &MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call{Call: _e.mock.On("UploadDocumentWithBodyWithResponse", - append([]interface{}{ctx, id, contentType, body}, reqEditors...)...)} -} - -func (_c *MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call) Run(run func(ctx context.Context, id queryapi.ClientID, contentType string, body io.Reader, reqEditors ...queryapi.RequestEditorFn)) *MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]queryapi.RequestEditorFn, len(args)-4) - for i, a := range args[4:] { - if a != nil { - variadicArgs[i] = a.(queryapi.RequestEditorFn) - } - } - run(args[0].(context.Context), args[1].(queryapi.ClientID), args[2].(string), args[3].(io.Reader), variadicArgs...) - }) - return _c -} - -func (_c *MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call) Return(_a0 *queryapi.UploadDocumentResponse, _a1 error) *MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call) RunAndReturn(run func(context.Context, queryapi.ClientID, string, io.Reader, ...queryapi.RequestEditorFn) (*queryapi.UploadDocumentResponse, error)) *MockClientWithResponsesInterface_UploadDocumentWithBodyWithResponse_Call { - _c.Call.Return(run) - return _c -} - -// NewMockClientWithResponsesInterface creates a new instance of MockClientWithResponsesInterface. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockClientWithResponsesInterface(t interface { - mock.TestingT - Cleanup(func()) -}) *MockClientWithResponsesInterface { - mock := &MockClientWithResponsesInterface{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/queue/mock_SQSClient.go b/mocks/queue/mock_SQSClient.go deleted file mode 100644 index 7677830b..00000000 --- a/mocks/queue/mock_SQSClient.go +++ /dev/null @@ -1,1444 +0,0 @@ -// Code generated by mockery v2.52.3. DO NOT EDIT. - -package queuemock - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - sqs "github.com/aws/aws-sdk-go-v2/service/sqs" -) - -// MockSQSClient is an autogenerated mock type for the SQSClient type -type MockSQSClient struct { - mock.Mock -} - -type MockSQSClient_Expecter struct { - mock *mock.Mock -} - -func (_m *MockSQSClient) EXPECT() *MockSQSClient_Expecter { - return &MockSQSClient_Expecter{mock: &_m.Mock} -} - -// AddPermission provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) AddPermission(ctx context.Context, params *sqs.AddPermissionInput, optFns ...func(*sqs.Options)) (*sqs.AddPermissionOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for AddPermission") - } - - var r0 *sqs.AddPermissionOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.AddPermissionInput, ...func(*sqs.Options)) (*sqs.AddPermissionOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.AddPermissionInput, ...func(*sqs.Options)) *sqs.AddPermissionOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.AddPermissionOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.AddPermissionInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_AddPermission_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddPermission' -type MockSQSClient_AddPermission_Call struct { - *mock.Call -} - -// AddPermission is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.AddPermissionInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) AddPermission(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_AddPermission_Call { - return &MockSQSClient_AddPermission_Call{Call: _e.mock.On("AddPermission", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_AddPermission_Call) Run(run func(ctx context.Context, params *sqs.AddPermissionInput, optFns ...func(*sqs.Options))) *MockSQSClient_AddPermission_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.AddPermissionInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_AddPermission_Call) Return(_a0 *sqs.AddPermissionOutput, _a1 error) *MockSQSClient_AddPermission_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_AddPermission_Call) RunAndReturn(run func(context.Context, *sqs.AddPermissionInput, ...func(*sqs.Options)) (*sqs.AddPermissionOutput, error)) *MockSQSClient_AddPermission_Call { - _c.Call.Return(run) - return _c -} - -// ChangeMessageVisibility provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) ChangeMessageVisibility(ctx context.Context, params *sqs.ChangeMessageVisibilityInput, optFns ...func(*sqs.Options)) (*sqs.ChangeMessageVisibilityOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ChangeMessageVisibility") - } - - var r0 *sqs.ChangeMessageVisibilityOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ChangeMessageVisibilityInput, ...func(*sqs.Options)) (*sqs.ChangeMessageVisibilityOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ChangeMessageVisibilityInput, ...func(*sqs.Options)) *sqs.ChangeMessageVisibilityOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.ChangeMessageVisibilityOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.ChangeMessageVisibilityInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_ChangeMessageVisibility_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChangeMessageVisibility' -type MockSQSClient_ChangeMessageVisibility_Call struct { - *mock.Call -} - -// ChangeMessageVisibility is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.ChangeMessageVisibilityInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) ChangeMessageVisibility(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_ChangeMessageVisibility_Call { - return &MockSQSClient_ChangeMessageVisibility_Call{Call: _e.mock.On("ChangeMessageVisibility", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_ChangeMessageVisibility_Call) Run(run func(ctx context.Context, params *sqs.ChangeMessageVisibilityInput, optFns ...func(*sqs.Options))) *MockSQSClient_ChangeMessageVisibility_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.ChangeMessageVisibilityInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_ChangeMessageVisibility_Call) Return(_a0 *sqs.ChangeMessageVisibilityOutput, _a1 error) *MockSQSClient_ChangeMessageVisibility_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_ChangeMessageVisibility_Call) RunAndReturn(run func(context.Context, *sqs.ChangeMessageVisibilityInput, ...func(*sqs.Options)) (*sqs.ChangeMessageVisibilityOutput, error)) *MockSQSClient_ChangeMessageVisibility_Call { - _c.Call.Return(run) - return _c -} - -// ChangeMessageVisibilityBatch provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) ChangeMessageVisibilityBatch(ctx context.Context, params *sqs.ChangeMessageVisibilityBatchInput, optFns ...func(*sqs.Options)) (*sqs.ChangeMessageVisibilityBatchOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ChangeMessageVisibilityBatch") - } - - var r0 *sqs.ChangeMessageVisibilityBatchOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ChangeMessageVisibilityBatchInput, ...func(*sqs.Options)) (*sqs.ChangeMessageVisibilityBatchOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ChangeMessageVisibilityBatchInput, ...func(*sqs.Options)) *sqs.ChangeMessageVisibilityBatchOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.ChangeMessageVisibilityBatchOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.ChangeMessageVisibilityBatchInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_ChangeMessageVisibilityBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ChangeMessageVisibilityBatch' -type MockSQSClient_ChangeMessageVisibilityBatch_Call struct { - *mock.Call -} - -// ChangeMessageVisibilityBatch is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.ChangeMessageVisibilityBatchInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) ChangeMessageVisibilityBatch(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_ChangeMessageVisibilityBatch_Call { - return &MockSQSClient_ChangeMessageVisibilityBatch_Call{Call: _e.mock.On("ChangeMessageVisibilityBatch", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_ChangeMessageVisibilityBatch_Call) Run(run func(ctx context.Context, params *sqs.ChangeMessageVisibilityBatchInput, optFns ...func(*sqs.Options))) *MockSQSClient_ChangeMessageVisibilityBatch_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.ChangeMessageVisibilityBatchInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_ChangeMessageVisibilityBatch_Call) Return(_a0 *sqs.ChangeMessageVisibilityBatchOutput, _a1 error) *MockSQSClient_ChangeMessageVisibilityBatch_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_ChangeMessageVisibilityBatch_Call) RunAndReturn(run func(context.Context, *sqs.ChangeMessageVisibilityBatchInput, ...func(*sqs.Options)) (*sqs.ChangeMessageVisibilityBatchOutput, error)) *MockSQSClient_ChangeMessageVisibilityBatch_Call { - _c.Call.Return(run) - return _c -} - -// CreateQueue provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) CreateQueue(ctx context.Context, params *sqs.CreateQueueInput, optFns ...func(*sqs.Options)) (*sqs.CreateQueueOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for CreateQueue") - } - - var r0 *sqs.CreateQueueOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.CreateQueueInput, ...func(*sqs.Options)) (*sqs.CreateQueueOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.CreateQueueInput, ...func(*sqs.Options)) *sqs.CreateQueueOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.CreateQueueOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.CreateQueueInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_CreateQueue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateQueue' -type MockSQSClient_CreateQueue_Call struct { - *mock.Call -} - -// CreateQueue is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.CreateQueueInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) CreateQueue(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_CreateQueue_Call { - return &MockSQSClient_CreateQueue_Call{Call: _e.mock.On("CreateQueue", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_CreateQueue_Call) Run(run func(ctx context.Context, params *sqs.CreateQueueInput, optFns ...func(*sqs.Options))) *MockSQSClient_CreateQueue_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.CreateQueueInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_CreateQueue_Call) Return(_a0 *sqs.CreateQueueOutput, _a1 error) *MockSQSClient_CreateQueue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_CreateQueue_Call) RunAndReturn(run func(context.Context, *sqs.CreateQueueInput, ...func(*sqs.Options)) (*sqs.CreateQueueOutput, error)) *MockSQSClient_CreateQueue_Call { - _c.Call.Return(run) - return _c -} - -// DeleteMessage provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) DeleteMessage(ctx context.Context, params *sqs.DeleteMessageInput, optFns ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteMessage") - } - - var r0 *sqs.DeleteMessageOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.DeleteMessageInput, ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.DeleteMessageInput, ...func(*sqs.Options)) *sqs.DeleteMessageOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.DeleteMessageOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.DeleteMessageInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_DeleteMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteMessage' -type MockSQSClient_DeleteMessage_Call struct { - *mock.Call -} - -// DeleteMessage is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.DeleteMessageInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) DeleteMessage(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_DeleteMessage_Call { - return &MockSQSClient_DeleteMessage_Call{Call: _e.mock.On("DeleteMessage", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_DeleteMessage_Call) Run(run func(ctx context.Context, params *sqs.DeleteMessageInput, optFns ...func(*sqs.Options))) *MockSQSClient_DeleteMessage_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.DeleteMessageInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_DeleteMessage_Call) Return(_a0 *sqs.DeleteMessageOutput, _a1 error) *MockSQSClient_DeleteMessage_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_DeleteMessage_Call) RunAndReturn(run func(context.Context, *sqs.DeleteMessageInput, ...func(*sqs.Options)) (*sqs.DeleteMessageOutput, error)) *MockSQSClient_DeleteMessage_Call { - _c.Call.Return(run) - return _c -} - -// DeleteMessageBatch provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) DeleteMessageBatch(ctx context.Context, params *sqs.DeleteMessageBatchInput, optFns ...func(*sqs.Options)) (*sqs.DeleteMessageBatchOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteMessageBatch") - } - - var r0 *sqs.DeleteMessageBatchOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.DeleteMessageBatchInput, ...func(*sqs.Options)) (*sqs.DeleteMessageBatchOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.DeleteMessageBatchInput, ...func(*sqs.Options)) *sqs.DeleteMessageBatchOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.DeleteMessageBatchOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.DeleteMessageBatchInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_DeleteMessageBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteMessageBatch' -type MockSQSClient_DeleteMessageBatch_Call struct { - *mock.Call -} - -// DeleteMessageBatch is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.DeleteMessageBatchInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) DeleteMessageBatch(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_DeleteMessageBatch_Call { - return &MockSQSClient_DeleteMessageBatch_Call{Call: _e.mock.On("DeleteMessageBatch", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_DeleteMessageBatch_Call) Run(run func(ctx context.Context, params *sqs.DeleteMessageBatchInput, optFns ...func(*sqs.Options))) *MockSQSClient_DeleteMessageBatch_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.DeleteMessageBatchInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_DeleteMessageBatch_Call) Return(_a0 *sqs.DeleteMessageBatchOutput, _a1 error) *MockSQSClient_DeleteMessageBatch_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_DeleteMessageBatch_Call) RunAndReturn(run func(context.Context, *sqs.DeleteMessageBatchInput, ...func(*sqs.Options)) (*sqs.DeleteMessageBatchOutput, error)) *MockSQSClient_DeleteMessageBatch_Call { - _c.Call.Return(run) - return _c -} - -// DeleteQueue provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) DeleteQueue(ctx context.Context, params *sqs.DeleteQueueInput, optFns ...func(*sqs.Options)) (*sqs.DeleteQueueOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DeleteQueue") - } - - var r0 *sqs.DeleteQueueOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.DeleteQueueInput, ...func(*sqs.Options)) (*sqs.DeleteQueueOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.DeleteQueueInput, ...func(*sqs.Options)) *sqs.DeleteQueueOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.DeleteQueueOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.DeleteQueueInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_DeleteQueue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteQueue' -type MockSQSClient_DeleteQueue_Call struct { - *mock.Call -} - -// DeleteQueue is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.DeleteQueueInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) DeleteQueue(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_DeleteQueue_Call { - return &MockSQSClient_DeleteQueue_Call{Call: _e.mock.On("DeleteQueue", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_DeleteQueue_Call) Run(run func(ctx context.Context, params *sqs.DeleteQueueInput, optFns ...func(*sqs.Options))) *MockSQSClient_DeleteQueue_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.DeleteQueueInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_DeleteQueue_Call) Return(_a0 *sqs.DeleteQueueOutput, _a1 error) *MockSQSClient_DeleteQueue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_DeleteQueue_Call) RunAndReturn(run func(context.Context, *sqs.DeleteQueueInput, ...func(*sqs.Options)) (*sqs.DeleteQueueOutput, error)) *MockSQSClient_DeleteQueue_Call { - _c.Call.Return(run) - return _c -} - -// GetQueueAttributes provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) GetQueueAttributes(ctx context.Context, params *sqs.GetQueueAttributesInput, optFns ...func(*sqs.Options)) (*sqs.GetQueueAttributesOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetQueueAttributes") - } - - var r0 *sqs.GetQueueAttributesOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.GetQueueAttributesInput, ...func(*sqs.Options)) (*sqs.GetQueueAttributesOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.GetQueueAttributesInput, ...func(*sqs.Options)) *sqs.GetQueueAttributesOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.GetQueueAttributesOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.GetQueueAttributesInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_GetQueueAttributes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetQueueAttributes' -type MockSQSClient_GetQueueAttributes_Call struct { - *mock.Call -} - -// GetQueueAttributes is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.GetQueueAttributesInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) GetQueueAttributes(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_GetQueueAttributes_Call { - return &MockSQSClient_GetQueueAttributes_Call{Call: _e.mock.On("GetQueueAttributes", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_GetQueueAttributes_Call) Run(run func(ctx context.Context, params *sqs.GetQueueAttributesInput, optFns ...func(*sqs.Options))) *MockSQSClient_GetQueueAttributes_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.GetQueueAttributesInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_GetQueueAttributes_Call) Return(_a0 *sqs.GetQueueAttributesOutput, _a1 error) *MockSQSClient_GetQueueAttributes_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_GetQueueAttributes_Call) RunAndReturn(run func(context.Context, *sqs.GetQueueAttributesInput, ...func(*sqs.Options)) (*sqs.GetQueueAttributesOutput, error)) *MockSQSClient_GetQueueAttributes_Call { - _c.Call.Return(run) - return _c -} - -// GetQueueUrl provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) GetQueueUrl(ctx context.Context, params *sqs.GetQueueUrlInput, optFns ...func(*sqs.Options)) (*sqs.GetQueueUrlOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetQueueUrl") - } - - var r0 *sqs.GetQueueUrlOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.GetQueueUrlInput, ...func(*sqs.Options)) (*sqs.GetQueueUrlOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.GetQueueUrlInput, ...func(*sqs.Options)) *sqs.GetQueueUrlOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.GetQueueUrlOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.GetQueueUrlInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_GetQueueUrl_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetQueueUrl' -type MockSQSClient_GetQueueUrl_Call struct { - *mock.Call -} - -// GetQueueUrl is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.GetQueueUrlInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) GetQueueUrl(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_GetQueueUrl_Call { - return &MockSQSClient_GetQueueUrl_Call{Call: _e.mock.On("GetQueueUrl", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_GetQueueUrl_Call) Run(run func(ctx context.Context, params *sqs.GetQueueUrlInput, optFns ...func(*sqs.Options))) *MockSQSClient_GetQueueUrl_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.GetQueueUrlInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_GetQueueUrl_Call) Return(_a0 *sqs.GetQueueUrlOutput, _a1 error) *MockSQSClient_GetQueueUrl_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_GetQueueUrl_Call) RunAndReturn(run func(context.Context, *sqs.GetQueueUrlInput, ...func(*sqs.Options)) (*sqs.GetQueueUrlOutput, error)) *MockSQSClient_GetQueueUrl_Call { - _c.Call.Return(run) - return _c -} - -// ListQueueTags provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) ListQueueTags(ctx context.Context, params *sqs.ListQueueTagsInput, optFns ...func(*sqs.Options)) (*sqs.ListQueueTagsOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListQueueTags") - } - - var r0 *sqs.ListQueueTagsOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ListQueueTagsInput, ...func(*sqs.Options)) (*sqs.ListQueueTagsOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ListQueueTagsInput, ...func(*sqs.Options)) *sqs.ListQueueTagsOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.ListQueueTagsOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.ListQueueTagsInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_ListQueueTags_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListQueueTags' -type MockSQSClient_ListQueueTags_Call struct { - *mock.Call -} - -// ListQueueTags is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.ListQueueTagsInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) ListQueueTags(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_ListQueueTags_Call { - return &MockSQSClient_ListQueueTags_Call{Call: _e.mock.On("ListQueueTags", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_ListQueueTags_Call) Run(run func(ctx context.Context, params *sqs.ListQueueTagsInput, optFns ...func(*sqs.Options))) *MockSQSClient_ListQueueTags_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.ListQueueTagsInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_ListQueueTags_Call) Return(_a0 *sqs.ListQueueTagsOutput, _a1 error) *MockSQSClient_ListQueueTags_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_ListQueueTags_Call) RunAndReturn(run func(context.Context, *sqs.ListQueueTagsInput, ...func(*sqs.Options)) (*sqs.ListQueueTagsOutput, error)) *MockSQSClient_ListQueueTags_Call { - _c.Call.Return(run) - return _c -} - -// ListQueues provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) ListQueues(ctx context.Context, params *sqs.ListQueuesInput, optFns ...func(*sqs.Options)) (*sqs.ListQueuesOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ListQueues") - } - - var r0 *sqs.ListQueuesOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ListQueuesInput, ...func(*sqs.Options)) (*sqs.ListQueuesOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ListQueuesInput, ...func(*sqs.Options)) *sqs.ListQueuesOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.ListQueuesOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.ListQueuesInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_ListQueues_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListQueues' -type MockSQSClient_ListQueues_Call struct { - *mock.Call -} - -// ListQueues is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.ListQueuesInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) ListQueues(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_ListQueues_Call { - return &MockSQSClient_ListQueues_Call{Call: _e.mock.On("ListQueues", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_ListQueues_Call) Run(run func(ctx context.Context, params *sqs.ListQueuesInput, optFns ...func(*sqs.Options))) *MockSQSClient_ListQueues_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.ListQueuesInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_ListQueues_Call) Return(_a0 *sqs.ListQueuesOutput, _a1 error) *MockSQSClient_ListQueues_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_ListQueues_Call) RunAndReturn(run func(context.Context, *sqs.ListQueuesInput, ...func(*sqs.Options)) (*sqs.ListQueuesOutput, error)) *MockSQSClient_ListQueues_Call { - _c.Call.Return(run) - return _c -} - -// PurgeQueue provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) PurgeQueue(ctx context.Context, params *sqs.PurgeQueueInput, optFns ...func(*sqs.Options)) (*sqs.PurgeQueueOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for PurgeQueue") - } - - var r0 *sqs.PurgeQueueOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.PurgeQueueInput, ...func(*sqs.Options)) (*sqs.PurgeQueueOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.PurgeQueueInput, ...func(*sqs.Options)) *sqs.PurgeQueueOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.PurgeQueueOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.PurgeQueueInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_PurgeQueue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'PurgeQueue' -type MockSQSClient_PurgeQueue_Call struct { - *mock.Call -} - -// PurgeQueue is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.PurgeQueueInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) PurgeQueue(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_PurgeQueue_Call { - return &MockSQSClient_PurgeQueue_Call{Call: _e.mock.On("PurgeQueue", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_PurgeQueue_Call) Run(run func(ctx context.Context, params *sqs.PurgeQueueInput, optFns ...func(*sqs.Options))) *MockSQSClient_PurgeQueue_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.PurgeQueueInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_PurgeQueue_Call) Return(_a0 *sqs.PurgeQueueOutput, _a1 error) *MockSQSClient_PurgeQueue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_PurgeQueue_Call) RunAndReturn(run func(context.Context, *sqs.PurgeQueueInput, ...func(*sqs.Options)) (*sqs.PurgeQueueOutput, error)) *MockSQSClient_PurgeQueue_Call { - _c.Call.Return(run) - return _c -} - -// ReceiveMessage provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) ReceiveMessage(ctx context.Context, params *sqs.ReceiveMessageInput, optFns ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for ReceiveMessage") - } - - var r0 *sqs.ReceiveMessageOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ReceiveMessageInput, ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.ReceiveMessageInput, ...func(*sqs.Options)) *sqs.ReceiveMessageOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.ReceiveMessageOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.ReceiveMessageInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_ReceiveMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ReceiveMessage' -type MockSQSClient_ReceiveMessage_Call struct { - *mock.Call -} - -// ReceiveMessage is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.ReceiveMessageInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) ReceiveMessage(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_ReceiveMessage_Call { - return &MockSQSClient_ReceiveMessage_Call{Call: _e.mock.On("ReceiveMessage", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_ReceiveMessage_Call) Run(run func(ctx context.Context, params *sqs.ReceiveMessageInput, optFns ...func(*sqs.Options))) *MockSQSClient_ReceiveMessage_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.ReceiveMessageInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_ReceiveMessage_Call) Return(_a0 *sqs.ReceiveMessageOutput, _a1 error) *MockSQSClient_ReceiveMessage_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_ReceiveMessage_Call) RunAndReturn(run func(context.Context, *sqs.ReceiveMessageInput, ...func(*sqs.Options)) (*sqs.ReceiveMessageOutput, error)) *MockSQSClient_ReceiveMessage_Call { - _c.Call.Return(run) - return _c -} - -// RemovePermission provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) RemovePermission(ctx context.Context, params *sqs.RemovePermissionInput, optFns ...func(*sqs.Options)) (*sqs.RemovePermissionOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for RemovePermission") - } - - var r0 *sqs.RemovePermissionOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.RemovePermissionInput, ...func(*sqs.Options)) (*sqs.RemovePermissionOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.RemovePermissionInput, ...func(*sqs.Options)) *sqs.RemovePermissionOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.RemovePermissionOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.RemovePermissionInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_RemovePermission_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemovePermission' -type MockSQSClient_RemovePermission_Call struct { - *mock.Call -} - -// RemovePermission is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.RemovePermissionInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) RemovePermission(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_RemovePermission_Call { - return &MockSQSClient_RemovePermission_Call{Call: _e.mock.On("RemovePermission", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_RemovePermission_Call) Run(run func(ctx context.Context, params *sqs.RemovePermissionInput, optFns ...func(*sqs.Options))) *MockSQSClient_RemovePermission_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.RemovePermissionInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_RemovePermission_Call) Return(_a0 *sqs.RemovePermissionOutput, _a1 error) *MockSQSClient_RemovePermission_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_RemovePermission_Call) RunAndReturn(run func(context.Context, *sqs.RemovePermissionInput, ...func(*sqs.Options)) (*sqs.RemovePermissionOutput, error)) *MockSQSClient_RemovePermission_Call { - _c.Call.Return(run) - return _c -} - -// SendMessage provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) SendMessage(ctx context.Context, params *sqs.SendMessageInput, optFns ...func(*sqs.Options)) (*sqs.SendMessageOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for SendMessage") - } - - var r0 *sqs.SendMessageOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.SendMessageInput, ...func(*sqs.Options)) (*sqs.SendMessageOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.SendMessageInput, ...func(*sqs.Options)) *sqs.SendMessageOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.SendMessageOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.SendMessageInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_SendMessage_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendMessage' -type MockSQSClient_SendMessage_Call struct { - *mock.Call -} - -// SendMessage is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.SendMessageInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) SendMessage(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_SendMessage_Call { - return &MockSQSClient_SendMessage_Call{Call: _e.mock.On("SendMessage", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_SendMessage_Call) Run(run func(ctx context.Context, params *sqs.SendMessageInput, optFns ...func(*sqs.Options))) *MockSQSClient_SendMessage_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.SendMessageInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_SendMessage_Call) Return(_a0 *sqs.SendMessageOutput, _a1 error) *MockSQSClient_SendMessage_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_SendMessage_Call) RunAndReturn(run func(context.Context, *sqs.SendMessageInput, ...func(*sqs.Options)) (*sqs.SendMessageOutput, error)) *MockSQSClient_SendMessage_Call { - _c.Call.Return(run) - return _c -} - -// SendMessageBatch provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) SendMessageBatch(ctx context.Context, params *sqs.SendMessageBatchInput, optFns ...func(*sqs.Options)) (*sqs.SendMessageBatchOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for SendMessageBatch") - } - - var r0 *sqs.SendMessageBatchOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.SendMessageBatchInput, ...func(*sqs.Options)) (*sqs.SendMessageBatchOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.SendMessageBatchInput, ...func(*sqs.Options)) *sqs.SendMessageBatchOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.SendMessageBatchOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.SendMessageBatchInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_SendMessageBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SendMessageBatch' -type MockSQSClient_SendMessageBatch_Call struct { - *mock.Call -} - -// SendMessageBatch is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.SendMessageBatchInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) SendMessageBatch(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_SendMessageBatch_Call { - return &MockSQSClient_SendMessageBatch_Call{Call: _e.mock.On("SendMessageBatch", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_SendMessageBatch_Call) Run(run func(ctx context.Context, params *sqs.SendMessageBatchInput, optFns ...func(*sqs.Options))) *MockSQSClient_SendMessageBatch_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.SendMessageBatchInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_SendMessageBatch_Call) Return(_a0 *sqs.SendMessageBatchOutput, _a1 error) *MockSQSClient_SendMessageBatch_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_SendMessageBatch_Call) RunAndReturn(run func(context.Context, *sqs.SendMessageBatchInput, ...func(*sqs.Options)) (*sqs.SendMessageBatchOutput, error)) *MockSQSClient_SendMessageBatch_Call { - _c.Call.Return(run) - return _c -} - -// SetQueueAttributes provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) SetQueueAttributes(ctx context.Context, params *sqs.SetQueueAttributesInput, optFns ...func(*sqs.Options)) (*sqs.SetQueueAttributesOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for SetQueueAttributes") - } - - var r0 *sqs.SetQueueAttributesOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.SetQueueAttributesInput, ...func(*sqs.Options)) (*sqs.SetQueueAttributesOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.SetQueueAttributesInput, ...func(*sqs.Options)) *sqs.SetQueueAttributesOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.SetQueueAttributesOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.SetQueueAttributesInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_SetQueueAttributes_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetQueueAttributes' -type MockSQSClient_SetQueueAttributes_Call struct { - *mock.Call -} - -// SetQueueAttributes is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.SetQueueAttributesInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) SetQueueAttributes(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_SetQueueAttributes_Call { - return &MockSQSClient_SetQueueAttributes_Call{Call: _e.mock.On("SetQueueAttributes", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_SetQueueAttributes_Call) Run(run func(ctx context.Context, params *sqs.SetQueueAttributesInput, optFns ...func(*sqs.Options))) *MockSQSClient_SetQueueAttributes_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.SetQueueAttributesInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_SetQueueAttributes_Call) Return(_a0 *sqs.SetQueueAttributesOutput, _a1 error) *MockSQSClient_SetQueueAttributes_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_SetQueueAttributes_Call) RunAndReturn(run func(context.Context, *sqs.SetQueueAttributesInput, ...func(*sqs.Options)) (*sqs.SetQueueAttributesOutput, error)) *MockSQSClient_SetQueueAttributes_Call { - _c.Call.Return(run) - return _c -} - -// TagQueue provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) TagQueue(ctx context.Context, params *sqs.TagQueueInput, optFns ...func(*sqs.Options)) (*sqs.TagQueueOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for TagQueue") - } - - var r0 *sqs.TagQueueOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.TagQueueInput, ...func(*sqs.Options)) (*sqs.TagQueueOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.TagQueueInput, ...func(*sqs.Options)) *sqs.TagQueueOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.TagQueueOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.TagQueueInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_TagQueue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'TagQueue' -type MockSQSClient_TagQueue_Call struct { - *mock.Call -} - -// TagQueue is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.TagQueueInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) TagQueue(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_TagQueue_Call { - return &MockSQSClient_TagQueue_Call{Call: _e.mock.On("TagQueue", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_TagQueue_Call) Run(run func(ctx context.Context, params *sqs.TagQueueInput, optFns ...func(*sqs.Options))) *MockSQSClient_TagQueue_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.TagQueueInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_TagQueue_Call) Return(_a0 *sqs.TagQueueOutput, _a1 error) *MockSQSClient_TagQueue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_TagQueue_Call) RunAndReturn(run func(context.Context, *sqs.TagQueueInput, ...func(*sqs.Options)) (*sqs.TagQueueOutput, error)) *MockSQSClient_TagQueue_Call { - _c.Call.Return(run) - return _c -} - -// UntagQueue provides a mock function with given fields: ctx, params, optFns -func (_m *MockSQSClient) UntagQueue(ctx context.Context, params *sqs.UntagQueueInput, optFns ...func(*sqs.Options)) (*sqs.UntagQueueOutput, error) { - _va := make([]interface{}, len(optFns)) - for _i := range optFns { - _va[_i] = optFns[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for UntagQueue") - } - - var r0 *sqs.UntagQueueOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *sqs.UntagQueueInput, ...func(*sqs.Options)) (*sqs.UntagQueueOutput, error)); ok { - return rf(ctx, params, optFns...) - } - if rf, ok := ret.Get(0).(func(context.Context, *sqs.UntagQueueInput, ...func(*sqs.Options)) *sqs.UntagQueueOutput); ok { - r0 = rf(ctx, params, optFns...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*sqs.UntagQueueOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *sqs.UntagQueueInput, ...func(*sqs.Options)) error); ok { - r1 = rf(ctx, params, optFns...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockSQSClient_UntagQueue_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UntagQueue' -type MockSQSClient_UntagQueue_Call struct { - *mock.Call -} - -// UntagQueue is a helper method to define mock.On call -// - ctx context.Context -// - params *sqs.UntagQueueInput -// - optFns ...func(*sqs.Options) -func (_e *MockSQSClient_Expecter) UntagQueue(ctx interface{}, params interface{}, optFns ...interface{}) *MockSQSClient_UntagQueue_Call { - return &MockSQSClient_UntagQueue_Call{Call: _e.mock.On("UntagQueue", - append([]interface{}{ctx, params}, optFns...)...)} -} - -func (_c *MockSQSClient_UntagQueue_Call) Run(run func(ctx context.Context, params *sqs.UntagQueueInput, optFns ...func(*sqs.Options))) *MockSQSClient_UntagQueue_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*sqs.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*sqs.Options)) - } - } - run(args[0].(context.Context), args[1].(*sqs.UntagQueueInput), variadicArgs...) - }) - return _c -} - -func (_c *MockSQSClient_UntagQueue_Call) Return(_a0 *sqs.UntagQueueOutput, _a1 error) *MockSQSClient_UntagQueue_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockSQSClient_UntagQueue_Call) RunAndReturn(run func(context.Context, *sqs.UntagQueueInput, ...func(*sqs.Options)) (*sqs.UntagQueueOutput, error)) *MockSQSClient_UntagQueue_Call { - _c.Call.Return(run) - return _c -} - -// NewMockSQSClient creates a new instance of MockSQSClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockSQSClient(t interface { - mock.TestingT - Cleanup(func()) -}) *MockSQSClient { - mock := &MockSQSClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/runner/mock_Controller.go b/mocks/runner/mock_Controller.go deleted file mode 100644 index b8bbe506..00000000 --- a/mocks/runner/mock_Controller.go +++ /dev/null @@ -1,83 +0,0 @@ -// Code generated by mockery v2.52.3. DO NOT EDIT. - -package runnermock - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" -) - -// MockController is an autogenerated mock type for the Controller type -type MockController[B any] struct { - mock.Mock -} - -type MockController_Expecter[B any] struct { - mock *mock.Mock -} - -func (_m *MockController[B]) EXPECT() *MockController_Expecter[B] { - return &MockController_Expecter[B]{mock: &_m.Mock} -} - -// Process provides a mock function with given fields: ctx, body -func (_m *MockController[B]) Process(ctx context.Context, body B) bool { - ret := _m.Called(ctx, body) - - if len(ret) == 0 { - panic("no return value specified for Process") - } - - var r0 bool - if rf, ok := ret.Get(0).(func(context.Context, B) bool); ok { - r0 = rf(ctx, body) - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// MockController_Process_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Process' -type MockController_Process_Call[B any] struct { - *mock.Call -} - -// Process is a helper method to define mock.On call -// - ctx context.Context -// - body B -func (_e *MockController_Expecter[B]) Process(ctx interface{}, body interface{}) *MockController_Process_Call[B] { - return &MockController_Process_Call[B]{Call: _e.mock.On("Process", ctx, body)} -} - -func (_c *MockController_Process_Call[B]) Run(run func(ctx context.Context, body B)) *MockController_Process_Call[B] { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(B)) - }) - return _c -} - -func (_c *MockController_Process_Call[B]) Return(_a0 bool) *MockController_Process_Call[B] { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockController_Process_Call[B]) RunAndReturn(run func(context.Context, B) bool) *MockController_Process_Call[B] { - _c.Call.Return(run) - return _c -} - -// NewMockController creates a new instance of MockController. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockController[B any](t interface { - mock.TestingT - Cleanup(func()) -}) *MockController[B] { - mock := &MockController[B]{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/textract/mock_TextractClient.go b/mocks/textract/mock_TextractClient.go deleted file mode 100644 index 12baa577..00000000 --- a/mocks/textract/mock_TextractClient.go +++ /dev/null @@ -1,778 +0,0 @@ -// Code generated by mockery v2.52.3. DO NOT EDIT. - -package textractmock - -import ( - context "context" - - mock "github.com/stretchr/testify/mock" - - textract "github.com/aws/aws-sdk-go-v2/service/textract" -) - -// MockTextractClient is an autogenerated mock type for the TextractClient type -type MockTextractClient struct { - mock.Mock -} - -type MockTextractClient_Expecter struct { - mock *mock.Mock -} - -func (_m *MockTextractClient) EXPECT() *MockTextractClient_Expecter { - return &MockTextractClient_Expecter{mock: &_m.Mock} -} - -// AnalyzeDocument provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) AnalyzeDocument(ctx context.Context, params *textract.AnalyzeDocumentInput, opts ...func(*textract.Options)) (*textract.AnalyzeDocumentOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for AnalyzeDocument") - } - - var r0 *textract.AnalyzeDocumentOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.AnalyzeDocumentInput, ...func(*textract.Options)) (*textract.AnalyzeDocumentOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.AnalyzeDocumentInput, ...func(*textract.Options)) *textract.AnalyzeDocumentOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.AnalyzeDocumentOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.AnalyzeDocumentInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_AnalyzeDocument_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AnalyzeDocument' -type MockTextractClient_AnalyzeDocument_Call struct { - *mock.Call -} - -// AnalyzeDocument is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.AnalyzeDocumentInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) AnalyzeDocument(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_AnalyzeDocument_Call { - return &MockTextractClient_AnalyzeDocument_Call{Call: _e.mock.On("AnalyzeDocument", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_AnalyzeDocument_Call) Run(run func(ctx context.Context, params *textract.AnalyzeDocumentInput, opts ...func(*textract.Options))) *MockTextractClient_AnalyzeDocument_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.AnalyzeDocumentInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_AnalyzeDocument_Call) Return(_a0 *textract.AnalyzeDocumentOutput, _a1 error) *MockTextractClient_AnalyzeDocument_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_AnalyzeDocument_Call) RunAndReturn(run func(context.Context, *textract.AnalyzeDocumentInput, ...func(*textract.Options)) (*textract.AnalyzeDocumentOutput, error)) *MockTextractClient_AnalyzeDocument_Call { - _c.Call.Return(run) - return _c -} - -// AnalyzeExpense provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) AnalyzeExpense(ctx context.Context, params *textract.AnalyzeExpenseInput, opts ...func(*textract.Options)) (*textract.AnalyzeExpenseOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for AnalyzeExpense") - } - - var r0 *textract.AnalyzeExpenseOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.AnalyzeExpenseInput, ...func(*textract.Options)) (*textract.AnalyzeExpenseOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.AnalyzeExpenseInput, ...func(*textract.Options)) *textract.AnalyzeExpenseOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.AnalyzeExpenseOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.AnalyzeExpenseInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_AnalyzeExpense_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AnalyzeExpense' -type MockTextractClient_AnalyzeExpense_Call struct { - *mock.Call -} - -// AnalyzeExpense is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.AnalyzeExpenseInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) AnalyzeExpense(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_AnalyzeExpense_Call { - return &MockTextractClient_AnalyzeExpense_Call{Call: _e.mock.On("AnalyzeExpense", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_AnalyzeExpense_Call) Run(run func(ctx context.Context, params *textract.AnalyzeExpenseInput, opts ...func(*textract.Options))) *MockTextractClient_AnalyzeExpense_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.AnalyzeExpenseInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_AnalyzeExpense_Call) Return(_a0 *textract.AnalyzeExpenseOutput, _a1 error) *MockTextractClient_AnalyzeExpense_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_AnalyzeExpense_Call) RunAndReturn(run func(context.Context, *textract.AnalyzeExpenseInput, ...func(*textract.Options)) (*textract.AnalyzeExpenseOutput, error)) *MockTextractClient_AnalyzeExpense_Call { - _c.Call.Return(run) - return _c -} - -// AnalyzeID provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) AnalyzeID(ctx context.Context, params *textract.AnalyzeIDInput, opts ...func(*textract.Options)) (*textract.AnalyzeIDOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for AnalyzeID") - } - - var r0 *textract.AnalyzeIDOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.AnalyzeIDInput, ...func(*textract.Options)) (*textract.AnalyzeIDOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.AnalyzeIDInput, ...func(*textract.Options)) *textract.AnalyzeIDOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.AnalyzeIDOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.AnalyzeIDInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_AnalyzeID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AnalyzeID' -type MockTextractClient_AnalyzeID_Call struct { - *mock.Call -} - -// AnalyzeID is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.AnalyzeIDInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) AnalyzeID(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_AnalyzeID_Call { - return &MockTextractClient_AnalyzeID_Call{Call: _e.mock.On("AnalyzeID", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_AnalyzeID_Call) Run(run func(ctx context.Context, params *textract.AnalyzeIDInput, opts ...func(*textract.Options))) *MockTextractClient_AnalyzeID_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.AnalyzeIDInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_AnalyzeID_Call) Return(_a0 *textract.AnalyzeIDOutput, _a1 error) *MockTextractClient_AnalyzeID_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_AnalyzeID_Call) RunAndReturn(run func(context.Context, *textract.AnalyzeIDInput, ...func(*textract.Options)) (*textract.AnalyzeIDOutput, error)) *MockTextractClient_AnalyzeID_Call { - _c.Call.Return(run) - return _c -} - -// DetectDocumentText provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) DetectDocumentText(ctx context.Context, params *textract.DetectDocumentTextInput, opts ...func(*textract.Options)) (*textract.DetectDocumentTextOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for DetectDocumentText") - } - - var r0 *textract.DetectDocumentTextOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.DetectDocumentTextInput, ...func(*textract.Options)) (*textract.DetectDocumentTextOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.DetectDocumentTextInput, ...func(*textract.Options)) *textract.DetectDocumentTextOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.DetectDocumentTextOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.DetectDocumentTextInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_DetectDocumentText_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DetectDocumentText' -type MockTextractClient_DetectDocumentText_Call struct { - *mock.Call -} - -// DetectDocumentText is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.DetectDocumentTextInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) DetectDocumentText(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_DetectDocumentText_Call { - return &MockTextractClient_DetectDocumentText_Call{Call: _e.mock.On("DetectDocumentText", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_DetectDocumentText_Call) Run(run func(ctx context.Context, params *textract.DetectDocumentTextInput, opts ...func(*textract.Options))) *MockTextractClient_DetectDocumentText_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.DetectDocumentTextInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_DetectDocumentText_Call) Return(_a0 *textract.DetectDocumentTextOutput, _a1 error) *MockTextractClient_DetectDocumentText_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_DetectDocumentText_Call) RunAndReturn(run func(context.Context, *textract.DetectDocumentTextInput, ...func(*textract.Options)) (*textract.DetectDocumentTextOutput, error)) *MockTextractClient_DetectDocumentText_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentAnalysis provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) GetDocumentAnalysis(ctx context.Context, params *textract.GetDocumentAnalysisInput, opts ...func(*textract.Options)) (*textract.GetDocumentAnalysisOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentAnalysis") - } - - var r0 *textract.GetDocumentAnalysisOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.GetDocumentAnalysisInput, ...func(*textract.Options)) (*textract.GetDocumentAnalysisOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.GetDocumentAnalysisInput, ...func(*textract.Options)) *textract.GetDocumentAnalysisOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.GetDocumentAnalysisOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.GetDocumentAnalysisInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_GetDocumentAnalysis_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentAnalysis' -type MockTextractClient_GetDocumentAnalysis_Call struct { - *mock.Call -} - -// GetDocumentAnalysis is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.GetDocumentAnalysisInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) GetDocumentAnalysis(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_GetDocumentAnalysis_Call { - return &MockTextractClient_GetDocumentAnalysis_Call{Call: _e.mock.On("GetDocumentAnalysis", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_GetDocumentAnalysis_Call) Run(run func(ctx context.Context, params *textract.GetDocumentAnalysisInput, opts ...func(*textract.Options))) *MockTextractClient_GetDocumentAnalysis_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.GetDocumentAnalysisInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_GetDocumentAnalysis_Call) Return(_a0 *textract.GetDocumentAnalysisOutput, _a1 error) *MockTextractClient_GetDocumentAnalysis_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_GetDocumentAnalysis_Call) RunAndReturn(run func(context.Context, *textract.GetDocumentAnalysisInput, ...func(*textract.Options)) (*textract.GetDocumentAnalysisOutput, error)) *MockTextractClient_GetDocumentAnalysis_Call { - _c.Call.Return(run) - return _c -} - -// GetDocumentTextDetection provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) GetDocumentTextDetection(ctx context.Context, params *textract.GetDocumentTextDetectionInput, opts ...func(*textract.Options)) (*textract.GetDocumentTextDetectionOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetDocumentTextDetection") - } - - var r0 *textract.GetDocumentTextDetectionOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.GetDocumentTextDetectionInput, ...func(*textract.Options)) (*textract.GetDocumentTextDetectionOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.GetDocumentTextDetectionInput, ...func(*textract.Options)) *textract.GetDocumentTextDetectionOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.GetDocumentTextDetectionOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.GetDocumentTextDetectionInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_GetDocumentTextDetection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetDocumentTextDetection' -type MockTextractClient_GetDocumentTextDetection_Call struct { - *mock.Call -} - -// GetDocumentTextDetection is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.GetDocumentTextDetectionInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) GetDocumentTextDetection(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_GetDocumentTextDetection_Call { - return &MockTextractClient_GetDocumentTextDetection_Call{Call: _e.mock.On("GetDocumentTextDetection", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_GetDocumentTextDetection_Call) Run(run func(ctx context.Context, params *textract.GetDocumentTextDetectionInput, opts ...func(*textract.Options))) *MockTextractClient_GetDocumentTextDetection_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.GetDocumentTextDetectionInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_GetDocumentTextDetection_Call) Return(_a0 *textract.GetDocumentTextDetectionOutput, _a1 error) *MockTextractClient_GetDocumentTextDetection_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_GetDocumentTextDetection_Call) RunAndReturn(run func(context.Context, *textract.GetDocumentTextDetectionInput, ...func(*textract.Options)) (*textract.GetDocumentTextDetectionOutput, error)) *MockTextractClient_GetDocumentTextDetection_Call { - _c.Call.Return(run) - return _c -} - -// GetExpenseAnalysis provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) GetExpenseAnalysis(ctx context.Context, params *textract.GetExpenseAnalysisInput, opts ...func(*textract.Options)) (*textract.GetExpenseAnalysisOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for GetExpenseAnalysis") - } - - var r0 *textract.GetExpenseAnalysisOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.GetExpenseAnalysisInput, ...func(*textract.Options)) (*textract.GetExpenseAnalysisOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.GetExpenseAnalysisInput, ...func(*textract.Options)) *textract.GetExpenseAnalysisOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.GetExpenseAnalysisOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.GetExpenseAnalysisInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_GetExpenseAnalysis_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetExpenseAnalysis' -type MockTextractClient_GetExpenseAnalysis_Call struct { - *mock.Call -} - -// GetExpenseAnalysis is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.GetExpenseAnalysisInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) GetExpenseAnalysis(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_GetExpenseAnalysis_Call { - return &MockTextractClient_GetExpenseAnalysis_Call{Call: _e.mock.On("GetExpenseAnalysis", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_GetExpenseAnalysis_Call) Run(run func(ctx context.Context, params *textract.GetExpenseAnalysisInput, opts ...func(*textract.Options))) *MockTextractClient_GetExpenseAnalysis_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.GetExpenseAnalysisInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_GetExpenseAnalysis_Call) Return(_a0 *textract.GetExpenseAnalysisOutput, _a1 error) *MockTextractClient_GetExpenseAnalysis_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_GetExpenseAnalysis_Call) RunAndReturn(run func(context.Context, *textract.GetExpenseAnalysisInput, ...func(*textract.Options)) (*textract.GetExpenseAnalysisOutput, error)) *MockTextractClient_GetExpenseAnalysis_Call { - _c.Call.Return(run) - return _c -} - -// StartDocumentAnalysis provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) StartDocumentAnalysis(ctx context.Context, params *textract.StartDocumentAnalysisInput, opts ...func(*textract.Options)) (*textract.StartDocumentAnalysisOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for StartDocumentAnalysis") - } - - var r0 *textract.StartDocumentAnalysisOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.StartDocumentAnalysisInput, ...func(*textract.Options)) (*textract.StartDocumentAnalysisOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.StartDocumentAnalysisInput, ...func(*textract.Options)) *textract.StartDocumentAnalysisOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.StartDocumentAnalysisOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.StartDocumentAnalysisInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_StartDocumentAnalysis_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartDocumentAnalysis' -type MockTextractClient_StartDocumentAnalysis_Call struct { - *mock.Call -} - -// StartDocumentAnalysis is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.StartDocumentAnalysisInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) StartDocumentAnalysis(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_StartDocumentAnalysis_Call { - return &MockTextractClient_StartDocumentAnalysis_Call{Call: _e.mock.On("StartDocumentAnalysis", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_StartDocumentAnalysis_Call) Run(run func(ctx context.Context, params *textract.StartDocumentAnalysisInput, opts ...func(*textract.Options))) *MockTextractClient_StartDocumentAnalysis_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.StartDocumentAnalysisInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_StartDocumentAnalysis_Call) Return(_a0 *textract.StartDocumentAnalysisOutput, _a1 error) *MockTextractClient_StartDocumentAnalysis_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_StartDocumentAnalysis_Call) RunAndReturn(run func(context.Context, *textract.StartDocumentAnalysisInput, ...func(*textract.Options)) (*textract.StartDocumentAnalysisOutput, error)) *MockTextractClient_StartDocumentAnalysis_Call { - _c.Call.Return(run) - return _c -} - -// StartDocumentTextDetection provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) StartDocumentTextDetection(ctx context.Context, params *textract.StartDocumentTextDetectionInput, opts ...func(*textract.Options)) (*textract.StartDocumentTextDetectionOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for StartDocumentTextDetection") - } - - var r0 *textract.StartDocumentTextDetectionOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.StartDocumentTextDetectionInput, ...func(*textract.Options)) (*textract.StartDocumentTextDetectionOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.StartDocumentTextDetectionInput, ...func(*textract.Options)) *textract.StartDocumentTextDetectionOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.StartDocumentTextDetectionOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.StartDocumentTextDetectionInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_StartDocumentTextDetection_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartDocumentTextDetection' -type MockTextractClient_StartDocumentTextDetection_Call struct { - *mock.Call -} - -// StartDocumentTextDetection is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.StartDocumentTextDetectionInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) StartDocumentTextDetection(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_StartDocumentTextDetection_Call { - return &MockTextractClient_StartDocumentTextDetection_Call{Call: _e.mock.On("StartDocumentTextDetection", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_StartDocumentTextDetection_Call) Run(run func(ctx context.Context, params *textract.StartDocumentTextDetectionInput, opts ...func(*textract.Options))) *MockTextractClient_StartDocumentTextDetection_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.StartDocumentTextDetectionInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_StartDocumentTextDetection_Call) Return(_a0 *textract.StartDocumentTextDetectionOutput, _a1 error) *MockTextractClient_StartDocumentTextDetection_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_StartDocumentTextDetection_Call) RunAndReturn(run func(context.Context, *textract.StartDocumentTextDetectionInput, ...func(*textract.Options)) (*textract.StartDocumentTextDetectionOutput, error)) *MockTextractClient_StartDocumentTextDetection_Call { - _c.Call.Return(run) - return _c -} - -// StartExpenseAnalysis provides a mock function with given fields: ctx, params, opts -func (_m *MockTextractClient) StartExpenseAnalysis(ctx context.Context, params *textract.StartExpenseAnalysisInput, opts ...func(*textract.Options)) (*textract.StartExpenseAnalysisOutput, error) { - _va := make([]interface{}, len(opts)) - for _i := range opts { - _va[_i] = opts[_i] - } - var _ca []interface{} - _ca = append(_ca, ctx, params) - _ca = append(_ca, _va...) - ret := _m.Called(_ca...) - - if len(ret) == 0 { - panic("no return value specified for StartExpenseAnalysis") - } - - var r0 *textract.StartExpenseAnalysisOutput - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, *textract.StartExpenseAnalysisInput, ...func(*textract.Options)) (*textract.StartExpenseAnalysisOutput, error)); ok { - return rf(ctx, params, opts...) - } - if rf, ok := ret.Get(0).(func(context.Context, *textract.StartExpenseAnalysisInput, ...func(*textract.Options)) *textract.StartExpenseAnalysisOutput); ok { - r0 = rf(ctx, params, opts...) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*textract.StartExpenseAnalysisOutput) - } - } - - if rf, ok := ret.Get(1).(func(context.Context, *textract.StartExpenseAnalysisInput, ...func(*textract.Options)) error); ok { - r1 = rf(ctx, params, opts...) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockTextractClient_StartExpenseAnalysis_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'StartExpenseAnalysis' -type MockTextractClient_StartExpenseAnalysis_Call struct { - *mock.Call -} - -// StartExpenseAnalysis is a helper method to define mock.On call -// - ctx context.Context -// - params *textract.StartExpenseAnalysisInput -// - opts ...func(*textract.Options) -func (_e *MockTextractClient_Expecter) StartExpenseAnalysis(ctx interface{}, params interface{}, opts ...interface{}) *MockTextractClient_StartExpenseAnalysis_Call { - return &MockTextractClient_StartExpenseAnalysis_Call{Call: _e.mock.On("StartExpenseAnalysis", - append([]interface{}{ctx, params}, opts...)...)} -} - -func (_c *MockTextractClient_StartExpenseAnalysis_Call) Run(run func(ctx context.Context, params *textract.StartExpenseAnalysisInput, opts ...func(*textract.Options))) *MockTextractClient_StartExpenseAnalysis_Call { - _c.Call.Run(func(args mock.Arguments) { - variadicArgs := make([]func(*textract.Options), len(args)-2) - for i, a := range args[2:] { - if a != nil { - variadicArgs[i] = a.(func(*textract.Options)) - } - } - run(args[0].(context.Context), args[1].(*textract.StartExpenseAnalysisInput), variadicArgs...) - }) - return _c -} - -func (_c *MockTextractClient_StartExpenseAnalysis_Call) Return(_a0 *textract.StartExpenseAnalysisOutput, _a1 error) *MockTextractClient_StartExpenseAnalysis_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockTextractClient_StartExpenseAnalysis_Call) RunAndReturn(run func(context.Context, *textract.StartExpenseAnalysisInput, ...func(*textract.Options)) (*textract.StartExpenseAnalysisOutput, error)) *MockTextractClient_StartExpenseAnalysis_Call { - _c.Call.Return(run) - return _c -} - -// NewMockTextractClient creates a new instance of MockTextractClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewMockTextractClient(t interface { - mock.TestingT - Cleanup(func()) -}) *MockTextractClient { - mock := &MockTextractClient{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/queryAPI/api.gen.go b/pkg/queryAPI/api.gen.go index 42ab6d2b..823df7b2 100644 --- a/pkg/queryAPI/api.gen.go +++ b/pkg/queryAPI/api.gen.go @@ -505,7 +505,7 @@ type ClientUpdate struct { // CodeVersion The desired code version. type CodeVersion = int64 -// Collector Collector model. +// Collector Collector model. Note - minimum_text_version has been removed since text extraction is deprecated. type Collector struct { // ActiveVersion The desired version. ActiveVersion Version `json:"active_version"` @@ -518,24 +518,18 @@ type Collector struct { // MinimumCleanerVersion The desired code version. MinimumCleanerVersion CodeVersion `json:"minimum_cleaner_version"` - - // MinimumTextVersion The desired code version. - MinimumTextVersion CodeVersion `json:"minimum_text_version"` } // CollectorFieldName The output field name. type CollectorFieldName = string -// CollectorSet Payload for updating a Collector. +// CollectorSet Payload for updating a Collector. Note - minimum_text_version has been removed. type CollectorSet struct { // ActiveVersion The desired version. ActiveVersion *Version `json:"active_version,omitempty"` // MinimumCleanerVersion The desired code version. MinimumCleanerVersion *CodeVersion `json:"minimum_cleaner_version,omitempty"` - - // MinimumTextVersion The desired code version. - MinimumTextVersion *CodeVersion `json:"minimum_text_version,omitempty"` } // DocClient The properties of a client. diff --git a/scripts/Taskfile.yml b/scripts/Taskfile.yml index a9bd069a..a75498c0 100644 --- a/scripts/Taskfile.yml +++ b/scripts/Taskfile.yml @@ -64,7 +64,7 @@ tasks: cmds: - task: db:generate - task: openapi:generate - - task: test:mocks:generate + # NOTE: test:mocks:generate removed - mocks are deprecated - task: docs:generate - task: go:generate go:generate: go generate ./... diff --git a/scripts/tests.yml b/scripts/tests.yml index 68a7e45a..fbbdfaba 100644 --- a/scripts/tests.yml +++ b/scripts/tests.yml @@ -32,24 +32,21 @@ vars: sh: echo "1" # Single package at a time TEST_PARALLEL: sh: echo "2" # Minimal test parallelism + # Files excluded from coverage: generated files, auth middleware, test infrastructure, metrics setup # yamllint disable-line rule:line-length - EXCLUDED_FILES: ".gen.go|.sql.go|internal/serviceconfig/observability/prometheus/generator/main.go|internal/cognitoauth/middleware.go|internal/cognitoauth/token.go|internal/cognitoauth/auth.go|internal/cognitoauth/handler.go|internal/cognitoauth/models.go|api/queryAPI/authHandlers.go|api/queryAPI/homehandler.go|api/queryAPI/controllers.go|api/queryAPI/test_helpers.go|internal/serviceconfig/common.go|internal/test/queryAPI/service.go|api/queryAPI/adminHandlers.go|internal/usermanagement/audit.go|internal/usermanagement/cognito.go|internal/usermanagement/permitio.go|internal/usermanagement/types.go" + EXCLUDED_FILES: ".gen.go|.sql.go|internal/serviceconfig/observability/prometheus/generator/main.go|internal/cognitoauth/middleware.go|internal/cognitoauth/token.go|internal/cognitoauth/auth.go|internal/cognitoauth/handler.go|internal/cognitoauth/models.go|api/queryAPI/authHandlers.go|api/queryAPI/homehandler.go|api/queryAPI/controllers.go|api/queryAPI/test_helpers.go|internal/serviceconfig/common.go|internal/test/queryAPI/service.go|api/queryAPI/adminHandlers.go|internal/usermanagement/audit.go|internal/usermanagement/cognito.go|internal/usermanagement/permitio.go|internal/usermanagement/types.go|internal/test/container.go|internal/test/ecosystem.go|internal/test/objectstore.go|internal/test/runner.go|internal/test/aws.go|internal/test/api.go|internal/test/db.go|internal/test/network.go|internal/test/queue.go|internal/test/helpers.go|internal/test/assertions.go|internal/server/runner/|internal/serviceconfig/observability/config.go|internal/serviceconfig/observability/prometheus/common.go|internal/serviceconfig/aws/config.go|internal/serviceconfig/objectstore/config.go|api/docCleanRunner/|internal/document/clean/|internal/document/types/" # yamllint disable-line rule:line-length - TESTS: "./internal/database/repository ./test ./test/queryAPI ./test/... ./internal/serviceconfig/queue ./internal/server/... ./..." + TESTS: "./internal/database/repository ./test/queryAPI ./test/... ./internal/serviceconfig/queue ./internal/server/... ./..." tasks: - mocks:generate: - run: once - cmds: - - rm -rf mocks/* - - go tool mockery --log-level="" + # NOTE: mocks:generate task removed - mocks are deprecated cleanup: desc: "Remove stale test containers from previous runs" cmds: - | echo "Cleaning up stale test containers..." # Remove specific test containers if they exist (running or stopped) - for container in postgres_test_queryorchestration localstack_test_queryorchestration mockserver_test_queryorchestration; do + for container in postgres_test_queryorchestration localstack_test_queryorchestration; do if docker ps -a --format '{{.Names}}' | grep -q "^${container}$"; then echo "Removing container: $container" docker rm -f "$container" 2>/dev/null || true @@ -282,8 +279,6 @@ tasks: - go test -run ^Benchmark -bench=. ./... > {{.BENCH_FILE}} - benchstat {{.BENCH_FILE}} unit:short: - deps: - - mocks:generate cmds: - mkdir -p {{.OUT_DIR}} - task: wait diff --git a/serviceAPIs/queryAPI.yaml b/serviceAPIs/queryAPI.yaml index 09fb2c95..61056070 100644 --- a/serviceAPIs/queryAPI.yaml +++ b/serviceAPIs/queryAPI.yaml @@ -2320,13 +2320,10 @@ components: $ref: "#/components/schemas/Version" minimum_cleaner_version: $ref: "#/components/schemas/CodeVersion" - minimum_text_version: - $ref: "#/components/schemas/CodeVersion" - description: Collector model. + description: Collector model. Note - minimum_text_version has been removed since text extraction is deprecated. required: - client_id - minimum_cleaner_version - - minimum_text_version - latest_version - active_version @@ -2335,11 +2332,9 @@ components: properties: minimum_cleaner_version: $ref: "#/components/schemas/CodeVersion" - minimum_text_version: - $ref: "#/components/schemas/CodeVersion" active_version: $ref: "#/components/schemas/Version" - description: Payload for updating a Collector. + description: Payload for updating a Collector. Note - minimum_text_version has been removed. CollectorFieldName: type: string diff --git a/test/queryAPI/collectorservice_test.go b/test/queryAPI/collectorservice_test.go index cf40ed9b..acd2c171 100644 --- a/test/queryAPI/collectorservice_test.go +++ b/test/queryAPI/collectorservice_test.go @@ -26,6 +26,7 @@ type Config struct { // TestCollectorService tests the collector API endpoints. // Note: Query functionality has been removed. See remove_query_plan.md for details. +// Note: MinimumTextVersion has been removed since text extraction is deprecated. func TestCollectorService(t *testing.T) { ctx := t.Context() @@ -51,14 +52,12 @@ func TestCollectorService(t *testing.T) { assert.Equal(t, int32(0), collRes.JSON200.ActiveVersion) assert.Equal(t, int32(0), collRes.JSON200.LatestVersion) assert.Equal(t, int64(0), collRes.JSON200.MinimumCleanerVersion) - assert.Equal(t, int64(0), collRes.JSON200.MinimumTextVersion) av := int32(1) minVersion := int64(1000) uRes, err := client.SetCollectorByClientIdWithResponse(ctx, id, queryapi.CollectorSet{ ActiveVersion: &av, MinimumCleanerVersion: &minVersion, - MinimumTextVersion: &minVersion, }) require.NoError(t, err) test.AssertStatus(t, http.StatusOK, uRes.HTTPResponse) @@ -70,7 +69,6 @@ func TestCollectorService(t *testing.T) { assert.Equal(t, int32(1), collRes.JSON200.ActiveVersion) assert.Equal(t, int32(1), collRes.JSON200.LatestVersion) assert.Equal(t, minVersion, collRes.JSON200.MinimumCleanerVersion) - assert.Equal(t, minVersion, collRes.JSON200.MinimumTextVersion) test.AssertMessageBody(t, cfg, c.Dependencies.QueueURLs[test.ClientSyncRunnerName], regexp.MustCompile(`{"id":".+"}`)) } diff --git a/test/text_extraction_integration_test.go b/test/text_extraction_integration_test.go deleted file mode 100644 index bbcf30e7..00000000 --- a/test/text_extraction_integration_test.go +++ /dev/null @@ -1,1417 +0,0 @@ -package endtoend_test - -import ( - "archive/zip" - "bytes" - "fmt" - "io" - "mime/multipart" - "net/http" - "testing" - "time" - - "queryorchestration/internal/serviceconfig" - "queryorchestration/internal/serviceconfig/aws" - "queryorchestration/internal/serviceconfig/objectstore" - "queryorchestration/internal/test" - - queryapi "queryorchestration/pkg/queryAPI" - - openapi_types "github.com/oapi-codegen/runtime/types" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -// TextExtractionConfig embeds the configuration needed for the text extraction integration tests. -type TextExtractionConfig struct { - serviceconfig.BaseConfig - aws.AWSConfig - objectstore.ObjectStoreConfig -} - -// TestE2EDocWorkflow is a comprehensive integration test that exercises the -// document upload, folder management, label, and field extraction APIs via HTTP REST calls. -// -// The test performs the following steps: -// -// Document Upload Phase: -// 1. Create a new client via POST /client -// 2. Verify client exists via GET /client/{id} -// 2b. List all clients via GET /clients and verify new client is present -// 3. Update client to allow sync via PATCH /client/{id} -// 4. Confirm client status via GET /client/{id}/status -// 5. Create a ZIP with 3 PDFs in folder structures -// 6. Upload batch via POST /client/{id}/document/batch -// 7. Verify batch via GET /client/{id}/document/batch -// 8. Get documents via GET /client/{id}/document and verify 3 documents -// 9-10. Verify folder-based document retrieval (skipped - requires folder IDs from processing) -// 11. POST a single document to root -// 12. Verify 4 documents total -// -// Label Operations Phase: -// 13. Apply all labels one by one to a document via POST /documents/{documentId}/labels -// 14. After each label, verify via GET /documents/{documentId}/labels -// 15. List all folders for client via GET /clients/{clientId}/folders -// 16. Get metrics for each folder via GET /folders/{folderId}/metrics -// 17. Get documents by label via GET /labels/{labelName}/documents -// -// Field Extractions Phase: -// 18. Verify no field extraction exists via GET /field-extractions -// 19. Create field extraction via POST /field-extractions -// 20. Verify single extraction via GET /field-extractions/history -// 21. Modify and create new version via POST /field-extractions -// 22. Verify two versions via GET /field-extractions/history -// 23. Retrieve specific version via GET /field-extractions/version -func TestE2EDocWorkflow(t *testing.T) { - t.Run("docs", func(t *testing.T) { - cfg := &TextExtractionConfig{} - - // Create full network with database, S3, and HTTP server - net, cleanup := test.CreateFullNetwork(t, t.Context(), cfg) - defer cleanup() - - // Phase 1: Client and Document Upload - clientID, clientName := runClientSetupPhase(t, net) - documents := runDocumentUploadPhase(t, net, clientID) - - // Phase 2: Label Operations - targetDocID := documents[0].Id - runLabelOperationsPhase(t, net, clientID, targetDocID) - - // Phase 3: Field Extractions - runFieldExtractionsPhase(t, net, targetDocID) - - fmt.Println("\n=== Test Complete: All steps passed ===") - _ = clientName // Used in output - }) -} - -// runClientSetupPhase handles steps 1-4: client creation, verification, and configuration. -// Returns the client ID and client name. -func runClientSetupPhase(t *testing.T, net test.Network) (string, string) { - t.Helper() - - fmt.Println("=== Step 1: Create a new client ===") - clientName := fmt.Sprintf("TextExtractionTestClient_%d", time.Now().UnixNano()) - clientExternalID := fmt.Sprintf("text-ext-%d", time.Now().UnixNano()) - - createClientRes, err := net.Client.CreateClientWithResponse(t.Context(), queryapi.ClientCreate{ - Name: clientName, - Id: clientExternalID, - }) - require.NoError(t, err, "Failed to create client") - if createClientRes.JSON400 != nil { - t.Fatalf("Got 400 error: %s", createClientRes.JSON400.Message) - } - if createClientRes.JSON201 == nil { - t.Fatalf("Expected 201 response, got status %d with body: %s", createClientRes.StatusCode(), string(createClientRes.Body)) - } - clientID := createClientRes.JSON201.Id - fmt.Printf(" Created client: ID=%s, Name=%s, ExternalID=%s\n", clientID, clientName, clientExternalID) - - fmt.Println("\n=== Step 2: Verify client exists via GET /client/{id} ===") - getClientRes, err := net.Client.GetClientWithResponse(t.Context(), clientID) - require.NoError(t, err, "Failed to get client") - require.NotNil(t, getClientRes.JSON200, "Expected 200 response, got status %d", getClientRes.StatusCode()) - fmt.Printf(" Client verified: ID=%s, Name=%s\n", getClientRes.JSON200.Id, getClientRes.JSON200.Name) - assert.Equal(t, clientName, getClientRes.JSON200.Name, "Client name mismatch") - - fmt.Println("\n=== Step 2b: List all clients via GET /clients ===") - listClientsRes, err := net.Client.ListClientsWithResponse(t.Context()) - require.NoError(t, err, "Failed to list clients") - require.NotNil(t, listClientsRes.JSON200, "Expected 200 response, got status %d", listClientsRes.StatusCode()) - fmt.Printf(" Found %d clients in system\n", listClientsRes.JSON200.TotalCount) - // Verify our newly created client is in the list - foundClient := false - for _, c := range listClientsRes.JSON200.Clients { - if c.Id == clientID { - foundClient = true - assert.Equal(t, clientName, c.Name, "Client name in list doesn't match") - fmt.Printf(" Verified client %s is in the list\n", clientID) - break - } - } - require.True(t, foundClient, "Newly created client %s not found in list of clients", clientID) - - fmt.Println("\n=== Step 3: Update client to allow sync ===") - canSync := true - updateClientRes, err := net.Client.UpdateClientWithResponse(t.Context(), clientID, queryapi.ClientUpdate{ - CanSync: &canSync, - }) - require.NoError(t, err, "Failed to update client") - require.Equal(t, http.StatusOK, updateClientRes.StatusCode(), "Expected 200 response for update") - fmt.Printf(" Client updated: canSync=%t\n", canSync) - - fmt.Println("\n=== Step 4: Confirm client status ===") - statusRes, err := net.Client.GetStatusByClientIdWithResponse(t.Context(), clientID) - require.NoError(t, err, "Failed to get client status") - require.NotNil(t, statusRes.JSON200, "Expected 200 response, got status %d", statusRes.StatusCode()) - fmt.Printf(" Client status: %s\n", statusRes.JSON200.Status) - - return clientID, clientName -} - -// runDocumentUploadPhase handles steps 5-12: ZIP creation, batch upload, and document verification. -// Returns the list of documents. -func runDocumentUploadPhase(t *testing.T, net test.Network, clientID string) []queryapi.DocumentSummary { - t.Helper() - - fmt.Println("\n=== Step 5: Create ZIP with 3 PDFs ===") - zipBuffer := createTestZIP(t) - fmt.Printf(" ZIP created: %d bytes with 3 PDF files\n", zipBuffer.Len()) - fmt.Println(" Files in ZIP:") - fmt.Println(" - folder1/subfolder2/file1.pdf") - fmt.Println(" - folder1/subfolder2/file2.pdf") - fmt.Println(" - folder2/subfolder1/file1.pdf") - - fmt.Println("\n=== Step 6: Upload batch via POST /client/{id}/document/batch ===") - batchID := uploadBatchZIP(t, net.Client, clientID, zipBuffer.Bytes()) - fmt.Printf(" Batch uploaded: batchID=%s\n", batchID) - - fmt.Println("\n=== Step 7: Verify batch status ===") - verifyBatchStatus(t, net, clientID, batchID) - - fmt.Println("\n=== Step 8: Get documents and verify count ===") - var documents []queryapi.DocumentSummary - waitForDocumentCount(t, net.Client, clientID, 3, &documents) - fmt.Printf(" Documents found: %d\n", len(documents)) - for i, doc := range documents { - fmt.Printf(" Document %d: ID=%s, Hash=%s\n", i+1, doc.Id, doc.Hash) - } - assert.Len(t, documents, 3, "Expected 3 documents from batch upload") - - fmt.Println("\n=== Step 9: Get documents for folder1 (should see 2) ===") - fmt.Println(" Note: Folder-based document retrieval requires folder IDs from folder creation during processing") - fmt.Println(" Skipping folder-specific document retrieval - documents verified at client level") - - fmt.Println("\n=== Step 10: Get documents for folder2 (should see 1) ===") - fmt.Println(" Note: Folder-based document retrieval requires folder IDs from folder creation during processing") - fmt.Println(" Skipping folder-specific document retrieval - documents verified at client level") - - fmt.Println("\n=== Step 11: Upload single document to root ===") - uploadSingleDocument(t, net.Client, clientID, "single_root_document.pdf") - fmt.Println(" Single document uploaded: single_root_document.pdf") - - fmt.Println("\n=== Step 12: Verify 4 documents total ===") - waitForDocumentCount(t, net.Client, clientID, 4, &documents) - fmt.Printf(" Final document count: %d\n", len(documents)) - for i, doc := range documents { - fmt.Printf(" Document %d: ID=%s, Hash=%s\n", i+1, doc.Id, doc.Hash) - } - assert.Len(t, documents, 4, "Expected 4 documents total") - - return documents -} - -// verifyBatchStatus polls for batch status and verifies completion. -func verifyBatchStatus(t *testing.T, net test.Network, clientID string, batchID queryapi.BatchID) { - t.Helper() - - var batchStatus string - for i := 0; i < 30; i++ { - batchRes, err := net.Client.GetDocumentBatchWithResponse(t.Context(), clientID, batchID) - require.NoError(t, err, "Failed to get batch status") - require.NotNil(t, batchRes.JSON200, "Expected 200 response for batch, got status %d", batchRes.StatusCode()) - batchStatus = string(batchRes.JSON200.Status) - fmt.Printf(" Batch status check %d: status=%s, processed=%d, total=%d\n", - i+1, batchStatus, batchRes.JSON200.ProcessedDocuments, batchRes.JSON200.TotalDocuments) - - if batchStatus == "completed" || batchStatus == "failed" { - break - } - time.Sleep(500 * time.Millisecond) - } - fmt.Printf(" Final batch status: %s\n", batchStatus) - - listBatchesRes, err := net.Client.ListDocumentBatchesWithResponse(t.Context(), clientID, nil) - require.NoError(t, err, "Failed to list batches") - require.NotNil(t, listBatchesRes.JSON200, "Expected 200 response for batch list") - fmt.Printf(" Total batches for client: %d\n", listBatchesRes.JSON200.TotalCount) -} - -// runLabelOperationsPhase handles steps 13-17: applying labels, verifying, and querying by label. -func runLabelOperationsPhase(t *testing.T, net test.Network, clientID string, targetDocID openapi_types.UUID) { - t.Helper() - - fmt.Println("\n=== Step 13: Apply all labels to a document ===") - fmt.Printf(" Target document for labels: ID=%s\n", targetDocID) - - labels := []string{"Ingested", "OCR_Processed", "GenAI_Processed", "Doczy_AI_Completed", "Dashboard_Ready"} - applyAndVerifyLabels(t, net, targetDocID, labels) - - fmt.Println("\n=== Step 15: List folders and get folder metrics ===") - verifyFolderMetrics(t, net, clientID) - - fmt.Println("\n=== Step 17: Get documents by label ===") - verifyDocumentsByLabel(t, net, clientID, "Ingested") -} - -// verifyFolderMetrics lists all folders for a client and verifies folder metrics. -func verifyFolderMetrics(t *testing.T, net test.Network, clientID string) { - t.Helper() - - // List all folders for the client using the new endpoint - foldersRes, err := net.Client.ListClientFoldersWithResponse(t.Context(), queryapi.ClientID(clientID), nil) - require.NoError(t, err, "Failed to list client folders") - if foldersRes.JSON200 == nil { - t.Logf("Response status: %d, body: %s", foldersRes.StatusCode(), string(foldersRes.Body)) - if foldersRes.JSON404 != nil { - t.Logf("404 error: %s", foldersRes.JSON404.Message) - } - if foldersRes.JSON500 != nil { - t.Logf("500 error: %s", foldersRes.JSON500.Message) - // Print container logs to diagnose the issue - fmt.Println("\n=== QueryAPI Container Logs (for 500 error diagnosis) ===") - if apiContainer, ok := net.APIs[test.QueryAPIName]; ok && apiContainer != nil { - test.PrintContainerLogs(t, apiContainer.Container) - } - fmt.Println("=== End Container Logs ===") - t.Fatalf("ListClientFolders returned 500 error: %s", foldersRes.JSON500.Message) - } - } - require.NotNil(t, foldersRes.JSON200, "Expected 200 response for folder list") - - folders := foldersRes.JSON200.Folders - fmt.Printf(" Folders found for client: %d\n", len(folders)) - - if len(folders) == 0 { - fmt.Println(" Note: No folders found - documents may be at root level") - return - } - - // Print folder hierarchy - fmt.Println(" Folder hierarchy:") - for _, folder := range folders { - parentInfo := "root" - if folder.ParentId.IsSpecified() { - val, _ := folder.ParentId.Get() - parentInfo = fmt.Sprintf("parent=%s", val) - } - fmt.Printf(" - %s (ID=%s, %s)\n", folder.Path, folder.Id, parentInfo) - } - - // Test metrics for each folder - fmt.Println("\n=== Step 16: Get metrics for each folder ===") - for _, folder := range folders { - metricsRes, err := net.Client.GetFolderMetricsWithResponse(t.Context(), folder.Id) - require.NoError(t, err, "Failed to get metrics for folder %s", folder.Path) - require.NotNil(t, metricsRes.JSON200, "Expected 200 response for folder metrics") - - fmt.Printf(" Folder '%s': totalDocuments=%d, labels=%v\n", - folder.Path, metricsRes.JSON200.TotalDocuments, metricsRes.JSON200.ByLabel) - } -} - -// applyAndVerifyLabels applies each label and verifies after each application. -func applyAndVerifyLabels(t *testing.T, net test.Network, docID openapi_types.UUID, labels []string) { - t.Helper() - - for i, label := range labels { - fmt.Printf("\n=== Step 13.%d: Applying label '%s' ===\n", i+1, label) - applyLabelRes, err := net.Client.ApplyLabelWithResponse(t.Context(), docID, queryapi.ApplyLabelJSONRequestBody{ - Label: label, - AppliedBy: openapi_types.Email("test@example.com"), - }) - require.NoError(t, err, "Failed to apply label %s", label) - if applyLabelRes.JSON400 != nil { - t.Logf("WARNING: Got 400 error applying label '%s': %s", label, applyLabelRes.JSON400.Message) - continue - } - if applyLabelRes.JSON201 == nil { - t.Logf("WARNING: Expected 201 response for label '%s', got status %d with body: %s", label, applyLabelRes.StatusCode(), string(applyLabelRes.Body)) - continue - } - fmt.Printf(" Label '%s' applied: recordID=%s\n", label, applyLabelRes.JSON201.Id) - - fmt.Println(" Verifying labels via GET /documents/{documentId}/labels") - getLabelsRes, err := net.Client.GetDocumentLabelsWithResponse(t.Context(), docID) - require.NoError(t, err, "Failed to get document labels") - if getLabelsRes.JSON200 == nil { - t.Logf("WARNING: Expected 200 for get labels, got %d", getLabelsRes.StatusCode()) - continue - } - fmt.Printf(" Labels on document: count=%d\n", len(*getLabelsRes.JSON200.Labels)) - assert.Len(t, *getLabelsRes.JSON200.Labels, i+1, "Expected %d labels after applying '%s'", i+1, label) - } -} - -// verifyDocumentsByLabel queries documents by label and verifies the result. -func verifyDocumentsByLabel(t *testing.T, net test.Network, clientID string, label string) { - t.Helper() - - fmt.Printf(" Getting documents with label '%s' for client '%s'\n", label, clientID) - getDocsByLabelRes, err := net.Client.GetDocumentsByLabelWithResponse(t.Context(), label, &queryapi.GetDocumentsByLabelParams{ - ClientId: queryapi.ClientID(clientID), - }) - require.NoError(t, err, "Failed to get documents by label") - if getDocsByLabelRes.JSON200 == nil { - t.Logf("WARNING: Expected 200 for get documents by label, got %d with body: %s", getDocsByLabelRes.StatusCode(), string(getDocsByLabelRes.Body)) - } else { - docCount := 0 - if getDocsByLabelRes.JSON200.Documents != nil { - docCount = len(*getDocsByLabelRes.JSON200.Documents) - } - fmt.Printf(" Documents with label '%s': count=%d\n", label, docCount) - assert.GreaterOrEqual(t, docCount, 1, "Expected at least 1 document with label '%s'", label) - } -} - -// runFieldExtractionsPhase handles steps 18-23: field extraction creation, versioning, and specific version retrieval. -func runFieldExtractionsPhase(t *testing.T, net test.Network, targetDocID openapi_types.UUID) { - t.Helper() - - fmt.Println("\n=== Step 18: Verify no field extraction exists ===") - verifyNoFieldExtraction(t, net, targetDocID) - - fmt.Println("\n=== Step 19: Create field extraction ===") - createFieldExtraction(t, net, targetDocID, "Test Contract Title", "Test Client Name") - - fmt.Println("\n=== Step 20: Verify single extraction via history ===") - verifyFieldExtractionHistory(t, net, targetDocID, 1) - - fmt.Println("\n=== Step 21: Create second version of field extraction ===") - createFieldExtraction(t, net, targetDocID, "Updated Contract Title v2", "Updated Client Name v2") - - fmt.Println("\n=== Step 22: Verify two versions in history ===") - verifyFieldExtractionHistory(t, net, targetDocID, 2) - - fmt.Println("\n=== Step 23: Retrieve specific versions via GET /field-extractions/version ===") - verifySpecificVersionRetrieval(t, net, targetDocID) -} - -// verifyNoFieldExtraction checks that no field extraction exists for the document. -func verifyNoFieldExtraction(t *testing.T, net test.Network, docID openapi_types.UUID) { - t.Helper() - - getFieldExtRes, err := net.Client.GetCurrentFieldExtractionWithResponse(t.Context(), &queryapi.GetCurrentFieldExtractionParams{ - DocumentId: docID, - }) - require.NoError(t, err, "Failed to get current field extraction") - if getFieldExtRes.JSON404 != nil { - fmt.Println(" Confirmed: No field extraction exists for document (404)") - } else if getFieldExtRes.JSON200 != nil { - fmt.Printf(" WARNING: Field extraction already exists: version=%d\n", getFieldExtRes.JSON200.Version) - } else { - fmt.Printf(" Got status %d: %s\n", getFieldExtRes.StatusCode(), string(getFieldExtRes.Body)) - } -} - -// createFieldExtraction creates a field extraction with the given values. -func createFieldExtraction(t *testing.T, net test.Network, docID openapi_types.UUID, contractTitle, clientName string) { - t.Helper() - - createFieldExtRes, err := net.Client.CreateFieldExtractionWithResponse(t.Context(), queryapi.CreateFieldExtractionJSONRequestBody{ - DocumentId: docID, - SingleFields: queryapi.SingleFields{ - FileName: ptr("test_document.pdf"), - ContractTitle: &contractTitle, - ClientName: &clientName, - }, - ArrayFields: []queryapi.ArrayFieldItem{}, - CreatedBy: openapi_types.Email("test@example.com"), - }) - require.NoError(t, err, "Failed to create field extraction") - if createFieldExtRes.JSON400 != nil { - t.Logf("WARNING: Got 400 error creating field extraction: %s", createFieldExtRes.JSON400.Message) - } else if createFieldExtRes.JSON201 == nil { - t.Logf("WARNING: Expected 201 for field extraction, got %d with body: %s", createFieldExtRes.StatusCode(), string(createFieldExtRes.Body)) - } else { - fmt.Printf(" Field extraction created: version=%d\n", createFieldExtRes.JSON201.Version) - } -} - -// verifyFieldExtractionHistory checks that the expected number of versions exist. -func verifyFieldExtractionHistory(t *testing.T, net test.Network, docID openapi_types.UUID, expectedCount int) { - t.Helper() - - historyRes, err := net.Client.GetFieldExtractionHistoryWithResponse(t.Context(), &queryapi.GetFieldExtractionHistoryParams{ - DocumentId: docID, - }) - require.NoError(t, err, "Failed to get field extraction history") - if historyRes.JSON200 == nil { - t.Logf("WARNING: Expected 200 for history, got %d with body: %s", historyRes.StatusCode(), string(historyRes.Body)) - } else { - historyCount := 0 - if historyRes.JSON200.Versions != nil { - historyCount = len(*historyRes.JSON200.Versions) - } - fmt.Printf(" Field extraction history: count=%d\n", historyCount) - assert.Equal(t, expectedCount, historyCount, "Expected %d field extraction(s) in history", expectedCount) - } -} - -// verifySpecificVersionRetrieval tests the GET /field-extractions/version endpoint -// to retrieve specific versions of field extractions by document ID and version number. -func verifySpecificVersionRetrieval(t *testing.T, net test.Network, docID openapi_types.UUID) { - t.Helper() - - // Test retrieving version 1 - fmt.Println(" Testing retrieval of version 1...") - version1Res, err := net.Client.GetFieldExtractionByVersionWithResponse(t.Context(), &queryapi.GetFieldExtractionByVersionParams{ - DocumentId: docID, - Version: 1, - }) - require.NoError(t, err, "Failed to get field extraction version 1") - require.NotNil(t, version1Res.JSON200, "Expected 200 for version 1, got %d with body: %s", version1Res.StatusCode(), string(version1Res.Body)) - assert.Equal(t, int32(1), version1Res.JSON200.Version, "Expected version number 1") - assert.NotNil(t, version1Res.JSON200.SingleFields.ContractTitle, "Expected contractTitle in version 1") - if version1Res.JSON200.SingleFields.ContractTitle != nil { - assert.Equal(t, "Test Contract Title", *version1Res.JSON200.SingleFields.ContractTitle, "Expected original contract title in version 1") - } - fmt.Printf(" Version 1 retrieved: contractTitle=%s\n", *version1Res.JSON200.SingleFields.ContractTitle) - - // Test retrieving version 2 - fmt.Println(" Testing retrieval of version 2...") - version2Res, err := net.Client.GetFieldExtractionByVersionWithResponse(t.Context(), &queryapi.GetFieldExtractionByVersionParams{ - DocumentId: docID, - Version: 2, - }) - require.NoError(t, err, "Failed to get field extraction version 2") - require.NotNil(t, version2Res.JSON200, "Expected 200 for version 2, got %d with body: %s", version2Res.StatusCode(), string(version2Res.Body)) - assert.Equal(t, int32(2), version2Res.JSON200.Version, "Expected version number 2") - assert.NotNil(t, version2Res.JSON200.SingleFields.ContractTitle, "Expected contractTitle in version 2") - if version2Res.JSON200.SingleFields.ContractTitle != nil { - assert.Equal(t, "Updated Contract Title v2", *version2Res.JSON200.SingleFields.ContractTitle, "Expected updated contract title in version 2") - } - fmt.Printf(" Version 2 retrieved: contractTitle=%s\n", *version2Res.JSON200.SingleFields.ContractTitle) - - // Test retrieving non-existent version (should return 404) - fmt.Println(" Testing retrieval of non-existent version 999...") - version999Res, err := net.Client.GetFieldExtractionByVersionWithResponse(t.Context(), &queryapi.GetFieldExtractionByVersionParams{ - DocumentId: docID, - Version: 999, - }) - require.NoError(t, err, "Failed to query for non-existent version") - assert.NotNil(t, version999Res.JSON404, "Expected 404 for non-existent version 999, got status %d", version999Res.StatusCode()) - fmt.Println(" Non-existent version correctly returned 404") -} - -// createTestZIP creates a ZIP file in memory containing 3 simple PDF files -// in the specified folder structure. -func createTestZIP(t *testing.T) *bytes.Buffer { - t.Helper() - - buf := new(bytes.Buffer) - zipWriter := zip.NewWriter(buf) - - // PDF files to create in the ZIP - files := []struct { - path string - content string - }{ - {"folder1/subfolder2/file1.pdf", pdfContent("Document 1 in folder1/subfolder2")}, - {"folder1/subfolder2/file2.pdf", pdfContent("Document 2 in folder1/subfolder2")}, - {"folder2/subfolder1/file1.pdf", pdfContent("Document 1 in folder2/subfolder1")}, - } - - for _, file := range files { - writer, err := zipWriter.Create(file.path) - require.NoError(t, err, "Failed to create file in ZIP: %s", file.path) - - _, err = writer.Write([]byte(file.content)) - require.NoError(t, err, "Failed to write content to ZIP file: %s", file.path) - } - - err := zipWriter.Close() - require.NoError(t, err, "Failed to close ZIP writer") - - return buf -} - -// pdfContent generates a minimal valid PDF with the given text content. -func pdfContent(text string) string { - // Minimal valid PDF structure - return fmt.Sprintf(`%%PDF-1.4 -%%âãÏÓ -1 0 obj -<< - /Type /Catalog - /Pages 2 0 R ->> -endobj -2 0 obj -<< - /Type /Pages - /Kids [3 0 R] - /Count 1 ->> -endobj -3 0 obj -<< - /Type /Page - /Parent 2 0 R - /MediaBox [0 0 612 792] - /Resources << - /Font << - /F1 << - /Type /Font - /Subtype /Type1 - /BaseFont /Helvetica - >> - >> - >> - /Contents 4 0 R ->> -endobj -4 0 obj -<< - /Length 50 ->> -stream -BT -/F1 12 Tf -100 700 Td -(%s) Tj -ET -endstream -endobj -xref -0 5 -0000000000 65535 f -0000000015 00000 n -0000000066 00000 n -0000000125 00000 n -0000000330 00000 n -trailer -<< - /Size 5 - /Root 1 0 R ->> -startxref -430 -%%%%EOF`, text) -} - -// uploadBatchZIP uploads a ZIP file to the batch upload endpoint and returns the batch ID. -func uploadBatchZIP(t *testing.T, client *queryapi.ClientWithResponses, clientID string, zipContent []byte) queryapi.BatchID { - t.Helper() - - // Create multipart form - var buf bytes.Buffer - writer := multipart.NewWriter(&buf) - - part, err := writer.CreateFormFile("archive", "test_batch.zip") - require.NoError(t, err, "Failed to create form file") - - _, err = part.Write(zipContent) - require.NoError(t, err, "Failed to write ZIP content") - - err = writer.Close() - require.NoError(t, err, "Failed to close multipart writer") - - // Upload using the generated client - res, err := client.UploadDocumentBatchWithBodyWithResponse( - t.Context(), - clientID, - writer.FormDataContentType(), - bytes.NewReader(buf.Bytes()), - ) - require.NoError(t, err, "Failed to upload batch") - require.NotNil(t, res.JSON202, "Expected 202 response, got status %d", res.StatusCode()) - - return res.JSON202.BatchId -} - -// uploadSingleDocument uploads a single PDF document to the client's root folder. -func uploadSingleDocument(t *testing.T, client *queryapi.ClientWithResponses, clientID string, filename string) { - t.Helper() - - // Create multipart form - var buf bytes.Buffer - writer := multipart.NewWriter(&buf) - - part, err := writer.CreateFormFile("file", filename) - require.NoError(t, err, "Failed to create form file") - - pdfBytes := []byte(pdfContent("Single root document")) - _, err = part.Write(pdfBytes) - require.NoError(t, err, "Failed to write PDF content") - - err = writer.Close() - require.NoError(t, err, "Failed to close multipart writer") - - // Upload using the generated client - res, err := client.UploadDocumentWithBodyWithResponse( - t.Context(), - clientID, - writer.FormDataContentType(), - bytes.NewReader(buf.Bytes()), - ) - require.NoError(t, err, "Failed to upload single document") - require.Equal(t, http.StatusOK, res.StatusCode(), "Expected 200 response for single document upload") -} - -// waitForDocumentCount polls the documents endpoint until the expected count is reached or timeout. -func waitForDocumentCount(t *testing.T, client *queryapi.ClientWithResponses, clientID string, expectedCount int, documents *[]queryapi.DocumentSummary) { - t.Helper() - - timeout := time.After(60 * time.Second) - ticker := time.NewTicker(500 * time.Millisecond) - defer ticker.Stop() - - for { - select { - case <-timeout: - t.Fatalf("Timeout waiting for %d documents, got %d", expectedCount, len(*documents)) - case <-ticker.C: - res, err := client.ListDocumentsByClientIdWithResponse(t.Context(), clientID) - if err != nil { - continue - } - if res.JSON200 == nil { - continue - } - *documents = *res.JSON200 - if len(*documents) >= expectedCount { - return - } - } - } -} - -// TestFolderAPI is a more detailed test that also verifies folder creation -// and folder-based document retrieval. -func TestFolderAPI(t *testing.T) { - t.Run("create_folders", func(t *testing.T) { - cfg := &TextExtractionConfig{} - - // Create full network - net, cleanup := test.CreateFullNetwork(t, t.Context(), cfg) - defer cleanup() - - // Create test client - clientName := fmt.Sprintf("FolderTestClient_%d", time.Now().UnixNano()) - createRes, err := net.Client.CreateClientWithResponse(t.Context(), queryapi.ClientCreate{ - Name: clientName, - Id: fmt.Sprintf("folder-test-%d", time.Now().UnixNano()), - }) - require.NoError(t, err) - if createRes.JSON400 != nil { - t.Fatalf("Got 400 error creating client: %s", createRes.JSON400.Message) - } - if createRes.JSON201 == nil { - t.Fatalf("Expected 201 response for client creation, got status %d with body: %s", createRes.StatusCode(), string(createRes.Body)) - } - clientID := createRes.JSON201.Id - fmt.Printf("Created client: %s\n", clientID) - - // Enable sync - canSync := true - _, err = net.Client.UpdateClientWithResponse(t.Context(), clientID, queryapi.ClientUpdate{ - CanSync: &canSync, - }) - require.NoError(t, err) - - // Create folders manually to test folder API - fmt.Println("\n=== Creating folders via API ===") - - // Create root folder1 - folder1Res, err := net.Client.CreateFolderWithResponse(t.Context(), queryapi.CreateFolderJSONRequestBody{ - Path: "/folder1", - ClientId: clientID, - CreatedBy: "test@example.com", - }) - require.NoError(t, err, "Failed to create folder1") - if folder1Res.JSON400 != nil { - t.Fatalf("Got 400 error creating folder1: %s", folder1Res.JSON400.Message) - } - if folder1Res.JSON201 == nil { - t.Fatalf("Expected 201 for folder1, got %d with body: %s", folder1Res.StatusCode(), string(folder1Res.Body)) - } - folder1ID := folder1Res.JSON201.Id - fmt.Printf(" Created folder1: ID=%s, Path=%s\n", folder1ID, folder1Res.JSON201.Path) - - // Create subfolder2 under folder1 - subfolder2Res, err := net.Client.CreateFolderWithResponse(t.Context(), queryapi.CreateFolderJSONRequestBody{ - Path: "/folder1/subfolder2", - ClientId: clientID, - ParentId: &folder1ID, - CreatedBy: "test@example.com", - }) - require.NoError(t, err, "Failed to create subfolder2") - require.NotNil(t, subfolder2Res.JSON201, "Expected 201 for subfolder2, got %d", subfolder2Res.StatusCode()) - subfolder2ID := subfolder2Res.JSON201.Id - fmt.Printf(" Created subfolder2: ID=%s, Path=%s\n", subfolder2ID, subfolder2Res.JSON201.Path) - - // Create root folder2 - folder2Res, err := net.Client.CreateFolderWithResponse(t.Context(), queryapi.CreateFolderJSONRequestBody{ - Path: "/folder2", - ClientId: clientID, - CreatedBy: "test@example.com", - }) - require.NoError(t, err, "Failed to create folder2") - require.NotNil(t, folder2Res.JSON201, "Expected 201 for folder2, got %d", folder2Res.StatusCode()) - folder2ID := folder2Res.JSON201.Id - fmt.Printf(" Created folder2: ID=%s, Path=%s\n", folder2ID, folder2Res.JSON201.Path) - - // Create subfolder1 under folder2 - subfolder1Res, err := net.Client.CreateFolderWithResponse(t.Context(), queryapi.CreateFolderJSONRequestBody{ - Path: "/folder2/subfolder1", - ClientId: clientID, - ParentId: &folder2ID, - CreatedBy: "test@example.com", - }) - require.NoError(t, err, "Failed to create subfolder1 under folder2") - require.NotNil(t, subfolder1Res.JSON201, "Expected 201 for subfolder1, got %d", subfolder1Res.StatusCode()) - fmt.Printf(" Created subfolder1: ID=%s, Path=%s\n", subfolder1Res.JSON201.Id, subfolder1Res.JSON201.Path) - - // Test folder metrics (should be empty initially) - fmt.Println("\n=== Testing folder metrics (empty folders) ===") - metricsRes, err := net.Client.GetFolderMetricsWithResponse(t.Context(), folder1ID) - require.NoError(t, err, "Failed to get folder1 metrics") - require.NotNil(t, metricsRes.JSON200, "Expected 200 for metrics") - fmt.Printf(" folder1 metrics: totalDocuments=%d\n", metricsRes.JSON200.TotalDocuments) - - // Test folder documents endpoint (should be empty initially) - fmt.Println("\n=== Testing folder documents (empty folders) ===") - folderDocsRes, err := net.Client.GetFolderDocumentsWithResponse(t.Context(), subfolder2ID, nil) - require.NoError(t, err, "Failed to get subfolder2 documents") - require.NotNil(t, folderDocsRes.JSON200, "Expected 200 for folder documents") - docCount := 0 - if folderDocsRes.JSON200.Documents != nil { - docCount = len(*folderDocsRes.JSON200.Documents) - } - fmt.Printf(" subfolder2 documents: count=%d\n", docCount) - - // Test folder rename - fmt.Println("\n=== Testing folder rename ===") - renameRes, err := net.Client.RenameFolderWithResponse(t.Context(), folder1ID, queryapi.RenameFolderJSONRequestBody{ - Path: "/folder1_renamed", - }) - require.NoError(t, err, "Failed to rename folder1") - // Note: Implementation returns 204 No Content for successful rename - require.Equal(t, http.StatusNoContent, renameRes.StatusCode(), "Expected 204 for rename") - fmt.Printf(" Renamed folder1 to /folder1_renamed\n") - - fmt.Println("\n=== Folder test complete ===") - }) - - // TestFolderMetricsSpecific tests that GetFolderMetrics returns metrics for only the - // specified folder, not aggregated metrics across all folders. - t.Run("folder_metrics_specific", func(t *testing.T) { - cfg := &TextExtractionConfig{} - - // Create full network - net, cleanup := test.CreateFullNetwork(t, t.Context(), cfg) - defer cleanup() - - // Create test client - // Note: Client external ID has maxLength of 36, so use Unix seconds instead of nanoseconds - clientName := fmt.Sprintf("FolderMetricsTestClient_%d", time.Now().UnixNano()) - clientExternalID := fmt.Sprintf("fld-metrics-%d", time.Now().Unix()) - createRes, err := net.Client.CreateClientWithResponse(t.Context(), queryapi.ClientCreate{ - Name: clientName, - Id: clientExternalID, - }) - require.NoError(t, err) - if createRes.JSON400 != nil { - t.Fatalf("Got 400 error creating client: %s", createRes.JSON400.Message) - } - if createRes.JSON201 == nil { - t.Fatalf("Expected 201 response for client creation, got status %d with body: %s", createRes.StatusCode(), string(createRes.Body)) - } - clientID := createRes.JSON201.Id - fmt.Printf("Created client: %s\n", clientID) - - // Enable sync - canSync := true - _, err = net.Client.UpdateClientWithResponse(t.Context(), clientID, queryapi.ClientUpdate{ - CanSync: &canSync, - }) - require.NoError(t, err) - - // Create two separate folders at root level - fmt.Println("\n=== Creating folders for metrics test ===") - - folder1Res, err := net.Client.CreateFolderWithResponse(t.Context(), queryapi.CreateFolderJSONRequestBody{ - Path: "/metrics_folder1", - ClientId: clientID, - CreatedBy: "test@example.com", - }) - require.NoError(t, err, "Failed to create metrics_folder1") - require.NotNil(t, folder1Res.JSON201, "Expected 201 for metrics_folder1, got %d", folder1Res.StatusCode()) - folder1ID := folder1Res.JSON201.Id - fmt.Printf(" Created metrics_folder1: ID=%s\n", folder1ID) - - folder2Res, err := net.Client.CreateFolderWithResponse(t.Context(), queryapi.CreateFolderJSONRequestBody{ - Path: "/metrics_folder2", - ClientId: clientID, - CreatedBy: "test@example.com", - }) - require.NoError(t, err, "Failed to create metrics_folder2") - require.NotNil(t, folder2Res.JSON201, "Expected 201 for metrics_folder2, got %d", folder2Res.StatusCode()) - folder2ID := folder2Res.JSON201.Id - fmt.Printf(" Created metrics_folder2: ID=%s\n", folder2ID) - - // Get metrics for folder1 - should return metrics specific to folder1 only - fmt.Println("\n=== Testing specific folder metrics for folder1 ===") - metrics1Res, err := net.Client.GetFolderMetricsWithResponse(t.Context(), folder1ID) - require.NoError(t, err, "Failed to get metrics for folder1") - require.NotNil(t, metrics1Res.JSON200, "Expected 200 for folder1 metrics, got %d", metrics1Res.StatusCode()) - - // Verify the returned folderId matches the requested folder - assert.Equal(t, folder1ID, metrics1Res.JSON200.FolderId, - "Metrics folderId should match the requested folder1 ID") - fmt.Printf(" folder1 metrics: folderId=%s, totalDocuments=%d\n", - metrics1Res.JSON200.FolderId, metrics1Res.JSON200.TotalDocuments) - - // Get metrics for folder2 - should return metrics specific to folder2 only - fmt.Println("\n=== Testing specific folder metrics for folder2 ===") - metrics2Res, err := net.Client.GetFolderMetricsWithResponse(t.Context(), folder2ID) - require.NoError(t, err, "Failed to get metrics for folder2") - require.NotNil(t, metrics2Res.JSON200, "Expected 200 for folder2 metrics, got %d", metrics2Res.StatusCode()) - - // Verify the returned folderId matches the requested folder - assert.Equal(t, folder2ID, metrics2Res.JSON200.FolderId, - "Metrics folderId should match the requested folder2 ID") - fmt.Printf(" folder2 metrics: folderId=%s, totalDocuments=%d\n", - metrics2Res.JSON200.FolderId, metrics2Res.JSON200.TotalDocuments) - - // Verify that folder1 and folder2 metrics are independent (different folder IDs returned) - assert.NotEqual(t, metrics1Res.JSON200.FolderId, metrics2Res.JSON200.FolderId, - "Each folder should have its own distinct metrics with its own folderId") - - // Get the root folder and verify its metrics separately - fmt.Println("\n=== Testing root folder metrics ===") - foldersRes, err := net.Client.ListClientFoldersWithResponse(t.Context(), queryapi.ClientID(clientID), nil) - require.NoError(t, err, "Failed to list client folders") - require.NotNil(t, foldersRes.JSON200, "Expected 200 for folder list") - - var rootFolderID openapi_types.UUID - for _, folder := range foldersRes.JSON200.Folders { - if folder.Path == "/" { - rootFolderID = folder.Id - break - } - } - - if rootFolderID != (openapi_types.UUID{}) { - rootMetricsRes, err := net.Client.GetFolderMetricsWithResponse(t.Context(), rootFolderID) - require.NoError(t, err, "Failed to get root folder metrics") - require.NotNil(t, rootMetricsRes.JSON200, "Expected 200 for root folder metrics") - - assert.Equal(t, rootFolderID, rootMetricsRes.JSON200.FolderId, - "Root folder metrics folderId should match root folder ID") - fmt.Printf(" root folder metrics: folderId=%s, totalDocuments=%d\n", - rootMetricsRes.JSON200.FolderId, rootMetricsRes.JSON200.TotalDocuments) - - // Verify root folder metrics are distinct from folder1 and folder2 - assert.NotEqual(t, rootFolderID, folder1ID, "Root folder should be different from folder1") - assert.NotEqual(t, rootFolderID, folder2ID, "Root folder should be different from folder2") - } else { - fmt.Println(" Note: Root folder not found in folder list") - } - - fmt.Println("\n=== Folder metrics specific test complete ===") - }) -} - -// ptr returns a pointer to the given string value. -// Helper for creating pointers to string literals. -func ptr(s string) *string { - return &s -} - -// ptrFloat64 returns a pointer to a float64 value. -func ptrFloat64(f float64) *float64 { - return &f -} - -// ptrBool returns a pointer to a bool value. -func ptrBool(b bool) *bool { - return &b -} - -// TestDeepFolderHierarchy tests folder creation with 10+ levels of nesting -// (Phase 10 - Scenario 4: Folder hierarchy with recursive queries). -func TestDeepFolderHierarchy(t *testing.T) { - cfg := &TextExtractionConfig{} - - // Create full network - net, cleanup := test.CreateFullNetwork(t, t.Context(), cfg) - defer cleanup() - - // Create test client - clientName := fmt.Sprintf("DeepFolderTestClient_%d", time.Now().UnixNano()) - clientExternalID := fmt.Sprintf("deep-fld-%d", time.Now().Unix()) - createRes, err := net.Client.CreateClientWithResponse(t.Context(), queryapi.ClientCreate{ - Name: clientName, - Id: clientExternalID, - }) - require.NoError(t, err) - require.NotNil(t, createRes.JSON201, "Expected 201 response for client creation, got status %d", createRes.StatusCode()) - clientID := createRes.JSON201.Id - fmt.Printf("Created client: %s\n", clientID) - - // Enable sync - canSync := true - _, err = net.Client.UpdateClientWithResponse(t.Context(), clientID, queryapi.ClientUpdate{ - CanSync: &canSync, - }) - require.NoError(t, err) - - // Create 12 levels of nested folders - fmt.Println("\n=== Creating 12 levels of nested folders ===") - const folderDepth = 12 - var parentID *openapi_types.UUID - var folderIDs []openapi_types.UUID - var currentPath string - - for i := 1; i <= folderDepth; i++ { - currentPath = fmt.Sprintf("%s/level%d", currentPath, i) - createFolderReq := queryapi.CreateFolderJSONRequestBody{ - Path: currentPath, - ClientId: clientID, - CreatedBy: "test@example.com", - } - if parentID != nil { - createFolderReq.ParentId = parentID - } - - folderRes, err := net.Client.CreateFolderWithResponse(t.Context(), createFolderReq) - require.NoError(t, err, "Failed to create folder at level %d", i) - require.NotNil(t, folderRes.JSON201, "Expected 201 for folder at level %d, got %d with body: %s", - i, folderRes.StatusCode(), string(folderRes.Body)) - - folderID := folderRes.JSON201.Id - folderIDs = append(folderIDs, folderID) - parentID = &folderID - fmt.Printf(" Level %d: ID=%s, Path=%s\n", i, folderID, currentPath) - } - - assert.Len(t, folderIDs, folderDepth, "Should have created %d folders", folderDepth) - - // List all folders and verify count - fmt.Println("\n=== Listing all folders for client ===") - foldersRes, err := net.Client.ListClientFoldersWithResponse(t.Context(), queryapi.ClientID(clientID), nil) - require.NoError(t, err, "Failed to list client folders") - require.NotNil(t, foldersRes.JSON200, "Expected 200 response for folder list") - - // Should have at least 12 folders (plus root if created) - fmt.Printf(" Total folders found: %d\n", len(foldersRes.JSON200.Folders)) - assert.GreaterOrEqual(t, len(foldersRes.JSON200.Folders), folderDepth, - "Expected at least %d folders", folderDepth) - - // Verify we can get metrics for the deepest folder - fmt.Println("\n=== Testing metrics for deepest folder (level 12) ===") - deepestFolderID := folderIDs[len(folderIDs)-1] - metricsRes, err := net.Client.GetFolderMetricsWithResponse(t.Context(), deepestFolderID) - require.NoError(t, err, "Failed to get metrics for deepest folder") - require.NotNil(t, metricsRes.JSON200, "Expected 200 for deepest folder metrics") - fmt.Printf(" Deepest folder metrics: folderId=%s, totalDocuments=%d\n", - metricsRes.JSON200.FolderId, metricsRes.JSON200.TotalDocuments) - assert.Equal(t, deepestFolderID, metricsRes.JSON200.FolderId, - "Metrics should be for the requested folder") - - // Verify we can get documents for the deepest folder (should be empty) - fmt.Println("\n=== Testing documents for deepest folder ===") - docsRes, err := net.Client.GetFolderDocumentsWithResponse(t.Context(), deepestFolderID, nil) - require.NoError(t, err, "Failed to get documents for deepest folder") - require.NotNil(t, docsRes.JSON200, "Expected 200 for folder documents") - docCount := 0 - if docsRes.JSON200.Documents != nil { - docCount = len(*docsRes.JSON200.Documents) - } - fmt.Printf(" Documents in deepest folder: %d\n", docCount) - - fmt.Println("\n=== Deep folder hierarchy test complete ===") -} - -// TestLargeArrayFieldExtraction tests field extraction creation with large array sizes (N=100) -// (Phase 10 - Performance test: Large array sizes). -func TestLargeArrayFieldExtraction(t *testing.T) { - cfg := &TextExtractionConfig{} - - // Create full network - net, cleanup := test.CreateFullNetwork(t, t.Context(), cfg) - defer cleanup() - - // Create test client - clientName := fmt.Sprintf("LargeArrayTestClient_%d", time.Now().UnixNano()) - clientExternalID := fmt.Sprintf("lg-array-%d", time.Now().Unix()) - createRes, err := net.Client.CreateClientWithResponse(t.Context(), queryapi.ClientCreate{ - Name: clientName, - Id: clientExternalID, - }) - require.NoError(t, err) - require.NotNil(t, createRes.JSON201, "Expected 201 response for client creation") - clientID := createRes.JSON201.Id - fmt.Printf("Created client: %s\n", clientID) - - // Enable sync - canSync := true - _, err = net.Client.UpdateClientWithResponse(t.Context(), clientID, queryapi.ClientUpdate{ - CanSync: &canSync, - }) - require.NoError(t, err) - - // Upload a single document - fmt.Println("\n=== Uploading document ===") - uploadSingleDocument(t, net.Client, clientID, "large_array_test.pdf") - - // Wait for document to appear - var documents []queryapi.DocumentSummary - waitForDocumentCount(t, net.Client, clientID, 1, &documents) - require.Len(t, documents, 1, "Expected 1 document") - docID := documents[0].Id - fmt.Printf(" Document uploaded: ID=%s\n", docID) - - // Create field extraction with 100 array field items - fmt.Println("\n=== Creating field extraction with 100 array items ===") - const arraySize = 100 - arrayFields := make([]queryapi.ArrayFieldItem, arraySize) - for i := 0; i < arraySize; i++ { - arrayFields[i] = queryapi.ArrayFieldItem{ - ExhibitTitle: ptr(fmt.Sprintf("Exhibit %d", i+1)), - ExhibitPage: ptr(fmt.Sprintf("%d", i+1)), - ReimbProvTin: ptr(fmt.Sprintf("%09d", i+100000000)), - ReimbProvNpi: ptr(fmt.Sprintf("%010d", i+1000000000)), - ReimbProvName: ptr(fmt.Sprintf("Provider %d", i+1)), - AareteDerivedClaimTypeCd: ptr("INPATIENT"), - ReimbPctRate: ptrFloat64(float64(80+i%20) + float64(i%100)/100.0), - ReimbFeeRate: ptrFloat64(float64(100 + i*10)), - CarveoutInd: ptrBool(i%2 == 0), - DefaultInd: ptrBool(i == 0), - } - } - - startTime := time.Now() - createFieldExtRes, err := net.Client.CreateFieldExtractionWithResponse(t.Context(), queryapi.CreateFieldExtractionJSONRequestBody{ - DocumentId: docID, - SingleFields: queryapi.SingleFields{ - FileName: ptr("large_array_test.pdf"), - ContractTitle: ptr("Large Array Performance Test Contract"), - ClientName: ptr("Performance Test Client"), - }, - ArrayFields: arrayFields, - CreatedBy: openapi_types.Email("test@example.com"), - }) - createDuration := time.Since(startTime) - require.NoError(t, err, "Failed to create field extraction") - - if createFieldExtRes.JSON400 != nil { - t.Fatalf("Got 400 error creating field extraction: %s", createFieldExtRes.JSON400.Message) - } - require.NotNil(t, createFieldExtRes.JSON201, "Expected 201 for field extraction, got %d with body: %s", - createFieldExtRes.StatusCode(), string(createFieldExtRes.Body)) - - fmt.Printf(" Field extraction created in %v\n", createDuration) - fmt.Printf(" Version: %d\n", createFieldExtRes.JSON201.Version) - - // Verify the current field extraction - fmt.Println("\n=== Verifying current field extraction ===") - getFieldExtRes, err := net.Client.GetCurrentFieldExtractionWithResponse(t.Context(), &queryapi.GetCurrentFieldExtractionParams{ - DocumentId: docID, - }) - require.NoError(t, err, "Failed to get current field extraction") - require.NotNil(t, getFieldExtRes.JSON200, "Expected 200 for get field extraction") - - // Verify array field count - actualArraySize := len(getFieldExtRes.JSON200.ArrayFields) - fmt.Printf(" Array fields returned: %d\n", actualArraySize) - assert.Equal(t, arraySize, actualArraySize, "Expected %d array fields", arraySize) - - // Verify single fields - assert.NotNil(t, getFieldExtRes.JSON200.SingleFields.ContractTitle) - if getFieldExtRes.JSON200.SingleFields.ContractTitle != nil { - assert.Equal(t, "Large Array Performance Test Contract", *getFieldExtRes.JSON200.SingleFields.ContractTitle) - } - - // Performance assertion: should complete reasonably quickly (under 30 seconds) - assert.Less(t, createDuration, 30*time.Second, - "Field extraction with 100 array items should complete in under 30 seconds") - - fmt.Println("\n=== Large array field extraction test complete ===") -} - -// TestLabelReapplicationHistory tests applying the same label multiple times to track history -// (Phase 10 - Performance test: Many labels per document history). -func TestLabelReapplicationHistory(t *testing.T) { - cfg := &TextExtractionConfig{} - - // Create full network - net, cleanup := test.CreateFullNetwork(t, t.Context(), cfg) - defer cleanup() - - // Create test client - clientName := fmt.Sprintf("LabelHistoryTestClient_%d", time.Now().UnixNano()) - clientExternalID := fmt.Sprintf("lbl-hist-%d", time.Now().Unix()) - createRes, err := net.Client.CreateClientWithResponse(t.Context(), queryapi.ClientCreate{ - Name: clientName, - Id: clientExternalID, - }) - require.NoError(t, err) - require.NotNil(t, createRes.JSON201, "Expected 201 response for client creation") - clientID := createRes.JSON201.Id - fmt.Printf("Created client: %s\n", clientID) - - // Enable sync - canSync := true - _, err = net.Client.UpdateClientWithResponse(t.Context(), clientID, queryapi.ClientUpdate{ - CanSync: &canSync, - }) - require.NoError(t, err) - - // Upload a single document - fmt.Println("\n=== Uploading document ===") - uploadSingleDocument(t, net.Client, clientID, "label_history_test.pdf") - - // Wait for document to appear - var documents []queryapi.DocumentSummary - waitForDocumentCount(t, net.Client, clientID, 1, &documents) - require.Len(t, documents, 1, "Expected 1 document") - docID := documents[0].Id - fmt.Printf(" Document uploaded: ID=%s\n", docID) - - // Apply each of the 5 available labels multiple times to build history - // Note: The system has 5 predefined labels: Ingested, OCR_Processed, GenAI_Processed, Doczy_AI_Completed, Dashboard_Ready - labels := []string{"Ingested", "OCR_Processed", "GenAI_Processed", "Doczy_AI_Completed", "Dashboard_Ready"} - const applicationsPerLabel = 4 - - fmt.Printf("\n=== Applying each label %d times (total %d label applications) ===\n", - applicationsPerLabel, len(labels)*applicationsPerLabel) - - totalApplications := 0 - for round := 1; round <= applicationsPerLabel; round++ { - for _, label := range labels { - applyLabelRes, err := net.Client.ApplyLabelWithResponse(t.Context(), docID, queryapi.ApplyLabelJSONRequestBody{ - Label: label, - AppliedBy: openapi_types.Email(fmt.Sprintf("user%d@example.com", round)), - }) - require.NoError(t, err, "Failed to apply label %s in round %d", label, round) - - if applyLabelRes.JSON201 != nil { - totalApplications++ - if round == 1 || round == applicationsPerLabel { - fmt.Printf(" Round %d: Applied '%s'\n", round, label) - } - } else if applyLabelRes.JSON400 != nil { - // This might happen if re-application isn't allowed - that's informative - t.Logf(" Round %d: Label '%s' returned 400: %s", round, label, applyLabelRes.JSON400.Message) - } - } - if round == 1 { - fmt.Println(" ...") - } - } - - fmt.Printf(" Total successful label applications: %d\n", totalApplications) - - // Get all labels for the document and verify history - fmt.Println("\n=== Verifying label history ===") - getLabelsRes, err := net.Client.GetDocumentLabelsWithResponse(t.Context(), docID) - require.NoError(t, err, "Failed to get document labels") - require.NotNil(t, getLabelsRes.JSON200, "Expected 200 for get labels") - - labelCount := 0 - if getLabelsRes.JSON200.Labels != nil { - labelCount = len(*getLabelsRes.JSON200.Labels) - } - fmt.Printf(" Total label entries in history: %d\n", labelCount) - - // If re-application is allowed, we should have multiple entries - // If not, we should have exactly 5 (one per unique label) - if labelCount == len(labels) { - fmt.Println(" Note: System appears to keep only most recent application per label") - } else if labelCount == totalApplications { - fmt.Println(" Note: System preserves full history of all label applications") - } - - // The key test: verify we have at least one entry per label - assert.GreaterOrEqual(t, labelCount, len(labels), - "Should have at least one entry per label type") - - // Verify we can query documents by each label - fmt.Println("\n=== Verifying query by label ===") - for _, label := range labels { - getDocsByLabelRes, err := net.Client.GetDocumentsByLabelWithResponse(t.Context(), label, &queryapi.GetDocumentsByLabelParams{ - ClientId: queryapi.ClientID(clientID), - }) - require.NoError(t, err, "Failed to get documents by label %s", label) - require.NotNil(t, getDocsByLabelRes.JSON200, "Expected 200 for get documents by label %s", label) - - docCount := 0 - if getDocsByLabelRes.JSON200.Documents != nil { - docCount = len(*getDocsByLabelRes.JSON200.Documents) - } - assert.Equal(t, 1, docCount, "Expected 1 document with label '%s'", label) - } - fmt.Println(" All labels return the document correctly") - - fmt.Println("\n=== Label reapplication history test complete ===") -} - -// TestFieldExtractionByFolderAndLabel tests Scenario 2: Query field extractions by folder and label -// (Phase 10 - Scenario 2: Cross-feature integration). -// This test uses a simpler approach - single document upload to test cross-feature integration. -func TestFieldExtractionByFolderAndLabel(t *testing.T) { - cfg := &TextExtractionConfig{} - - // Create full network - net, cleanup := test.CreateFullNetwork(t, t.Context(), cfg) - defer cleanup() - - // Create test client - clientName := fmt.Sprintf("FolderLabelFETestClient_%d", time.Now().UnixNano()) - clientExternalID := fmt.Sprintf("fld-lbl-fe-%d", time.Now().Unix()) - createRes, err := net.Client.CreateClientWithResponse(t.Context(), queryapi.ClientCreate{ - Name: clientName, - Id: clientExternalID, - }) - require.NoError(t, err) - require.NotNil(t, createRes.JSON201, "Expected 201 response for client creation, got status: %d, body: %s", - createRes.StatusCode(), string(createRes.Body)) - clientID := createRes.JSON201.Id - fmt.Printf("Created client: %s\n", clientID) - - // Enable sync - canSync := true - _, err = net.Client.UpdateClientWithResponse(t.Context(), clientID, queryapi.ClientUpdate{ - CanSync: &canSync, - }) - require.NoError(t, err) - - // Create two folders - fmt.Println("\n=== Creating folders ===") - folder1Res, err := net.Client.CreateFolderWithResponse(t.Context(), queryapi.CreateFolderJSONRequestBody{ - Path: "/contracts", - ClientId: clientID, - CreatedBy: "test@example.com", - }) - require.NoError(t, err, "Failed to create folder1") - require.NotNil(t, folder1Res.JSON201, "Expected 201 for folder1") - folder1ID := folder1Res.JSON201.Id - fmt.Printf(" Created /contracts folder: ID=%s\n", folder1ID) - - folder2Res, err := net.Client.CreateFolderWithResponse(t.Context(), queryapi.CreateFolderJSONRequestBody{ - Path: "/invoices", - ClientId: clientID, - CreatedBy: "test@example.com", - }) - require.NoError(t, err, "Failed to create folder2") - require.NotNil(t, folder2Res.JSON201, "Expected 201 for folder2") - folder2ID := folder2Res.JSON201.Id - fmt.Printf(" Created /invoices folder: ID=%s\n", folder2ID) - - // Upload single document and wait for it - fmt.Println("\n=== Uploading document ===") - uploadSingleDocument(t, net.Client, clientID, "contract_doc.pdf") - - var documents []queryapi.DocumentSummary - waitForDocumentCount(t, net.Client, clientID, 1, &documents) - require.Len(t, documents, 1, "Expected 1 document") - docID := documents[0].Id - fmt.Printf(" Uploaded document: ID=%s\n", docID) - - // Apply labels to document - fmt.Println("\n=== Applying labels ===") - for _, label := range []string{"Ingested", "OCR_Processed", "Dashboard_Ready"} { - _, err := net.Client.ApplyLabelWithResponse(t.Context(), docID, queryapi.ApplyLabelJSONRequestBody{ - Label: label, - AppliedBy: openapi_types.Email("test@example.com"), - }) - require.NoError(t, err, "Failed to apply label %s", label) - } - fmt.Printf(" Applied Ingested, OCR_Processed, Dashboard_Ready\n") - - // Create field extraction - fmt.Println("\n=== Creating field extraction ===") - feRes, err := net.Client.CreateFieldExtractionWithResponse(t.Context(), queryapi.CreateFieldExtractionJSONRequestBody{ - DocumentId: docID, - SingleFields: queryapi.SingleFields{ - FileName: ptr("contract_doc.pdf"), - ContractTitle: ptr("Service Agreement"), - ClientName: ptr("Test Client"), - }, - ArrayFields: []queryapi.ArrayFieldItem{ - { - ExhibitTitle: ptr("Exhibit A"), - ReimbPctRate: ptrFloat64(85.0), - ReimbFeeRate: ptrFloat64(150.0), - }, - }, - CreatedBy: openapi_types.Email("test@example.com"), - }) - require.NoError(t, err, "Failed to create field extraction") - require.NotNil(t, feRes.JSON201, "Expected 201 for field extraction") - fmt.Printf(" Field extraction created: version=%d\n", feRes.JSON201.Version) - - // Query by label and verify field extraction exists - fmt.Println("\n=== Querying documents by label and verifying field extractions ===") - - // Get documents with Dashboard_Ready label - dashboardReadyDocsRes, err := net.Client.GetDocumentsByLabelWithResponse(t.Context(), "Dashboard_Ready", &queryapi.GetDocumentsByLabelParams{ - ClientId: queryapi.ClientID(clientID), - }) - require.NoError(t, err, "Failed to get documents by Dashboard_Ready label") - require.NotNil(t, dashboardReadyDocsRes.JSON200, "Expected 200 for get documents by label") - - dashboardReadyDocs := dashboardReadyDocsRes.JSON200.Documents - require.NotNil(t, dashboardReadyDocs, "Expected documents list") - assert.Len(t, *dashboardReadyDocs, 1, "Expected 1 document with Dashboard_Ready label") - fmt.Printf(" Documents with Dashboard_Ready: %d\n", len(*dashboardReadyDocs)) - - // Verify that document has a field extraction - for _, doc := range *dashboardReadyDocs { - feGetRes, err := net.Client.GetCurrentFieldExtractionWithResponse(t.Context(), &queryapi.GetCurrentFieldExtractionParams{ - DocumentId: doc.Id, - }) - require.NoError(t, err, "Failed to get field extraction for document %s", doc.Id) - require.NotNil(t, feGetRes.JSON200, "Expected field extraction for Dashboard_Ready document") - assert.NotNil(t, feGetRes.JSON200.SingleFields.ContractTitle, "Expected contract title") - fmt.Printf(" Document %s has field extraction with title: %s\n", - doc.Id, *feGetRes.JSON200.SingleFields.ContractTitle) - } - - // Get documents with OCR_Processed label - ocrDocsRes, err := net.Client.GetDocumentsByLabelWithResponse(t.Context(), "OCR_Processed", &queryapi.GetDocumentsByLabelParams{ - ClientId: queryapi.ClientID(clientID), - }) - require.NoError(t, err, "Failed to get documents by OCR_Processed label") - require.NotNil(t, ocrDocsRes.JSON200, "Expected 200 for get documents by label") - - ocrDocs := ocrDocsRes.JSON200.Documents - require.NotNil(t, ocrDocs, "Expected documents list") - assert.Len(t, *ocrDocs, 1, "Expected 1 document with OCR_Processed label") - fmt.Printf(" Documents with OCR_Processed: %d\n", len(*ocrDocs)) - - // Verify folder metrics - fmt.Println("\n=== Verifying folder metrics ===") - metrics1Res, err := net.Client.GetFolderMetricsWithResponse(t.Context(), folder1ID) - require.NoError(t, err, "Failed to get folder1 metrics") - require.NotNil(t, metrics1Res.JSON200, "Expected 200 for folder1 metrics") - fmt.Printf(" /contracts folder metrics: totalDocs=%d\n", metrics1Res.JSON200.TotalDocuments) - - metrics2Res, err := net.Client.GetFolderMetricsWithResponse(t.Context(), folder2ID) - require.NoError(t, err, "Failed to get folder2 metrics") - require.NotNil(t, metrics2Res.JSON200, "Expected 200 for folder2 metrics") - fmt.Printf(" /invoices folder metrics: totalDocs=%d\n", metrics2Res.JSON200.TotalDocuments) - - // Test: Get all documents with Ingested label - fmt.Println("\n=== Verifying Ingested documents ===") - allIngestedRes, err := net.Client.GetDocumentsByLabelWithResponse(t.Context(), "Ingested", &queryapi.GetDocumentsByLabelParams{ - ClientId: queryapi.ClientID(clientID), - }) - require.NoError(t, err, "Failed to get documents by Ingested label") - require.NotNil(t, allIngestedRes.JSON200, "Expected 200 for get documents by label") - ingestedDocs := allIngestedRes.JSON200.Documents - require.NotNil(t, ingestedDocs, "Expected documents list") - assert.Len(t, *ingestedDocs, 1, "Expected 1 document with Ingested label") - fmt.Printf(" Documents with Ingested label: %d\n", len(*ingestedDocs)) - - // Verify field extraction on the ingested document - fmt.Println("\n=== Checking field extraction on Ingested document ===") - for _, doc := range *ingestedDocs { - feGetRes, err := net.Client.GetCurrentFieldExtractionWithResponse(t.Context(), &queryapi.GetCurrentFieldExtractionParams{ - DocumentId: doc.Id, - }) - require.NoError(t, err, "Failed to query field extraction for document %s", doc.Id) - require.NotNil(t, feGetRes.JSON200, "Expected field extraction for Ingested document") - fmt.Printf(" Document %s has field extraction\n", doc.Id) - } - - fmt.Println("\n=== Field extraction by folder and label test complete ===") -} - -// Ensure io import is used -var _ = io.EOF diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/CHANGELOG.md deleted file mode 100644 index 9cf13d0f..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/CHANGELOG.md +++ /dev/null @@ -1,596 +0,0 @@ -# v1.35.1 (2025-03-04.2) - -* **Bug Fix**: Add assurance test for operation order. - -# v1.35.0 (2025-02-27) - -* **Feature**: Track credential providers via User-Agent Feature ids -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.19 (2025-02-18) - -* **Bug Fix**: Bump go version to 1.22 -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.18 (2025-02-05) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.17 (2025-02-04) - -* No change notes available for this release. - -# v1.34.16 (2025-01-31) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.15 (2025-01-30) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.14 (2025-01-24) - -* **Dependency Update**: Updated to the latest SDK module versions -* **Dependency Update**: Upgrade to smithy-go v1.22.2. - -# v1.34.13 (2025-01-17) - -* **Bug Fix**: Fix bug where credentials weren't refreshed during retry loop. - -# v1.34.12 (2025-01-15) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.11 (2025-01-09) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.10 (2024-12-19) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.9 (2024-12-02) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.8 (2024-11-18) - -* **Dependency Update**: Update to smithy-go v1.22.1. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.7 (2024-11-07) - -* **Bug Fix**: Adds case-insensitive handling of error message fields in service responses - -# v1.34.6 (2024-11-06) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.5 (2024-10-31) - -* No change notes available for this release. - -# v1.34.4 (2024-10-29) - -* No change notes available for this release. - -# v1.34.3 (2024-10-28) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.2 (2024-10-08) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.1 (2024-10-07) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.34.0 (2024-10-04) - -* **Feature**: Add support for HTTP client metrics. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.33.4 (2024-10-03) - -* No change notes available for this release. - -# v1.33.3 (2024-09-27) - -* No change notes available for this release. - -# v1.33.2 (2024-09-25) - -* No change notes available for this release. - -# v1.33.1 (2024-09-23) - -* No change notes available for this release. - -# v1.33.0 (2024-09-20) - -* **Feature**: Add tracing and metrics support to service clients. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.32.7 (2024-09-17) - -* **Bug Fix**: **BREAKFIX**: Only generate AccountIDEndpointMode config for services that use it. This is a compiler break, but removes no actual functionality, as no services currently use the account ID in endpoint resolution. - -# v1.32.6 (2024-09-04) - -* No change notes available for this release. - -# v1.32.5 (2024-09-03) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.32.4 (2024-08-15) - -* **Dependency Update**: Bump minimum Go version to 1.21. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.32.3 (2024-07-10.2) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.32.2 (2024-07-10) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.32.1 (2024-06-28) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.32.0 (2024-06-26) - -* **Feature**: Support list-of-string endpoint parameter. - -# v1.31.1 (2024-06-19) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.31.0 (2024-06-18) - -* **Feature**: Track usage of various AWS SDK features in user-agent string. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.12 (2024-06-17) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.11 (2024-06-07) - -* **Bug Fix**: Add clock skew correction on all service clients -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.10 (2024-06-03) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.9 (2024-05-23) - -* No change notes available for this release. - -# v1.30.8 (2024-05-16) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.7 (2024-05-15) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.6 (2024-05-08) - -* **Bug Fix**: GoDoc improvement - -# v1.30.5 (2024-03-29) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.4 (2024-03-18) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.3 (2024-03-15) - -* No change notes available for this release. - -# v1.30.2 (2024-03-07) - -* **Bug Fix**: Remove dependency on go-cmp. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.1 (2024-02-23) - -* **Bug Fix**: Move all common, SDK-side middleware stack ops into the service client module to prevent cross-module compatibility issues in the future. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.30.0 (2024-02-22) - -* **Feature**: Add middleware stack snapshot tests. - -# v1.29.3 (2024-02-21) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.29.2 (2024-02-20) - -* **Bug Fix**: When sourcing values for a service's `EndpointParameters`, the lack of a configured region (i.e. `options.Region == ""`) will now translate to a `nil` value for `EndpointParameters.Region` instead of a pointer to the empty string `""`. This will result in a much more explicit error when calling an operation instead of an obscure hostname lookup failure. - -# v1.29.1 (2024-02-15) - -* **Bug Fix**: Correct failure to determine the error type in awsJson services that could occur when errors were modeled with a non-string `code` field. - -# v1.29.0 (2024-02-13) - -* **Feature**: Bump minimum Go version to 1.20 per our language support policy. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.28.6 (2024-01-04) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.28.5 (2023-12-08) - -* **Bug Fix**: Reinstate presence of default Retryer in functional options, but still respect max attempts set therein. - -# v1.28.4 (2023-12-07) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.28.3 (2023-12-06) - -* **Bug Fix**: Restore pre-refactor auth behavior where all operations could technically be performed anonymously. - -# v1.28.2 (2023-12-01) - -* **Bug Fix**: Correct wrapping of errors in authentication workflow. -* **Bug Fix**: Correctly recognize cache-wrapped instances of AnonymousCredentials at client construction. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.28.1 (2023-11-30) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.28.0 (2023-11-29) - -* **Feature**: Expose Options() accessor on service clients. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.27.5 (2023-11-28.2) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.27.4 (2023-11-28) - -* **Bug Fix**: Respect setting RetryMaxAttempts in functional options at client construction. - -# v1.27.3 (2023-11-20) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.27.2 (2023-11-15) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.27.1 (2023-11-09) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.27.0 (2023-11-01) - -* **Feature**: Adds support for configured endpoints via environment variables and the AWS shared configuration file. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.26.0 (2023-10-31) - -* **Feature**: **BREAKING CHANGE**: Bump minimum go version to 1.19 per the revised [go version support policy](https://aws.amazon.com/blogs/developer/aws-sdk-for-go-aligns-with-go-release-policy-on-supported-runtimes/). -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.25.0 (2023-10-12) - -* **Feature**: This release adds 9 new APIs for adapter and adapter version management, 3 new APIs for tagging, and updates AnalyzeDocument and StartDocumentAnalysis API parameters for using adapters. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.24.1 (2023-10-06) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.24.0 (2023-09-27) - -* **Feature**: This release adds new feature - Layout to Analyze Document API which can automatically extract layout elements such as titles, paragraphs, headers, section headers, lists, page numbers, footers, table areas, key-value areas and figure areas and order the elements as a human would read. - -# v1.23.0 (2023-09-18) - -* **Announcement**: [BREAKFIX] Change in MaxResults datatype from value to pointer type in cognito-sync service. -* **Feature**: Adds several endpoint ruleset changes across all models: smaller rulesets, removed non-unique regional endpoints, fixes FIPS and DualStack endpoints, and make region not required in SDK::Endpoint. Additional breakfix to cognito-sync field. - -# v1.22.5 (2023-08-21) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.22.4 (2023-08-18) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.22.3 (2023-08-17) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.22.2 (2023-08-07) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.22.1 (2023-08-01) - -* No change notes available for this release. - -# v1.22.0 (2023-07-31) - -* **Feature**: Adds support for smithy-modeled endpoint resolution. A new rules-based endpoint resolution will be added to the SDK which will supercede and deprecate existing endpoint resolution. Specifically, EndpointResolver will be deprecated while BaseEndpoint and EndpointResolverV2 will take its place. For more information, please see the Endpoints section in our Developer Guide. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.21.8 (2023-07-28) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.21.7 (2023-07-13) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.21.6 (2023-06-15) - -* No change notes available for this release. - -# v1.21.5 (2023-06-13) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.21.4 (2023-05-04) - -* No change notes available for this release. - -# v1.21.3 (2023-04-24) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.21.2 (2023-04-10) - -* No change notes available for this release. - -# v1.21.1 (2023-04-07) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.21.0 (2023-03-23) - -* **Feature**: The AnalyzeDocument - Tables feature adds support for new elements in the API: table titles, footers, section titles, summary cells/tables, and table type. - -# v1.20.6 (2023-03-21) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.20.5 (2023-03-10) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.20.4 (2023-02-22) - -* **Bug Fix**: Prevent nil pointer dereference when retrieving error codes. - -# v1.20.3 (2023-02-20) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.20.2 (2023-02-15) - -* **Announcement**: When receiving an error response in restJson-based services, an incorrect error type may have been returned based on the content of the response. This has been fixed via PR #2012 tracked in issue #1910. -* **Bug Fix**: Correct error type parsing for restJson services. - -# v1.20.1 (2023-02-03) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.20.0 (2023-01-05) - -* **Feature**: Add `ErrorCodeOverride` field to all error structs (aws/smithy-go#401). - -# v1.19.2 (2022-12-15) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.19.1 (2022-12-02) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.19.0 (2022-11-28) - -* **Feature**: This release adds support for classifying and splitting lending documents by type, and extracting information by using the Analyze Lending APIs. This release also includes support for summarized information of the processed lending document package, in addition to per document results. - -# v1.18.0 (2022-11-17) - -* **Feature**: This release adds support for specifying and extracting information from documents using the Signatures feature within Analyze Document API - -# v1.17.0 (2022-11-01) - -* **Feature**: Add ocr results in AnalyzeIDResponse as blocks - -# v1.16.0 (2022-10-31) - -* **Feature**: This release introduces additional support for 30+ normalized fields such as vendor address and currency. It also includes OCR output in the response and accuracy improvements for the already supported fields in previous version - -# v1.15.16 (2022-10-24) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.15 (2022-10-21) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.14 (2022-09-20) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.13 (2022-09-14) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.12 (2022-09-02) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.11 (2022-08-31) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.10 (2022-08-29) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.9 (2022-08-11) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.8 (2022-08-09) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.7 (2022-08-08) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.6 (2022-08-01) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.5 (2022-07-05) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.4 (2022-06-29) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.3 (2022-06-07) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.2 (2022-05-17) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.1 (2022-04-25) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.15.0 (2022-04-19) - -* **Feature**: This release adds support for specifying and extracting information from documents using the Queries feature within Analyze Document API - -# v1.14.3 (2022-03-30) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.14.2 (2022-03-24) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.14.1 (2022-03-23) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.14.0 (2022-03-08) - -* **Feature**: Updated `github.com/aws/smithy-go` to latest version -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.13.0 (2022-02-24) - -* **Feature**: API client updated -* **Feature**: Adds RetryMaxAttempts and RetryMod to API client Options. This allows the API clients' default Retryer to be configured from the shared configuration files or environment variables. Adding a new Retry mode of `Adaptive`. `Adaptive` retry mode is an experimental mode, adding client rate limiting when throttles reponses are received from an API. See [retry.AdaptiveMode](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/aws/retry#AdaptiveMode) for more details, and configuration options. -* **Feature**: Updated `github.com/aws/smithy-go` to latest version -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.12.0 (2022-01-14) - -* **Feature**: Updated `github.com/aws/smithy-go` to latest version -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.11.0 (2022-01-07) - -* **Feature**: Updated `github.com/aws/smithy-go` to latest version -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.10.1 (2021-12-02) - -* **Bug Fix**: Fixes a bug that prevented aws.EndpointResolverWithOptions from being used by the service client. ([#1514](https://github.com/aws/aws-sdk-go-v2/pull/1514)) -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.10.0 (2021-11-30) - -* **Feature**: API client updated - -# v1.9.1 (2021-11-19) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.9.0 (2021-11-12) - -* **Feature**: Service clients now support custom endpoints that have an initial URI path defined. - -# v1.8.0 (2021-11-06) - -* **Feature**: The SDK now supports configuration of FIPS and DualStack endpoints using environment variables, shared configuration, or programmatically. -* **Feature**: Updated `github.com/aws/smithy-go` to latest version -* **Feature**: Updated service to latest API model. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.7.0 (2021-10-21) - -* **Feature**: Updated to latest version -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.6.0 (2021-10-11) - -* **Feature**: API client updated -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.5.1 (2021-09-17) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.5.0 (2021-08-27) - -* **Feature**: Updated API model to latest revision. -* **Feature**: Updated `github.com/aws/smithy-go` to latest version -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.4.1 (2021-08-19) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.4.0 (2021-08-04) - -* **Feature**: Updated to latest API model. -* **Dependency Update**: Updated `github.com/aws/smithy-go` to latest version. -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.3.1 (2021-07-15) - -* **Dependency Update**: Updated `github.com/aws/smithy-go` to latest version -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.3.0 (2021-06-25) - -* **Feature**: Updated `github.com/aws/smithy-go` to latest version -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.2.1 (2021-05-20) - -* **Dependency Update**: Updated to the latest SDK module versions - -# v1.2.0 (2021-05-14) - -* **Feature**: Constant has been added to modules to enable runtime version inspection for reporting. -* **Dependency Update**: Updated to the latest SDK module versions - diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/LICENSE.txt b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/LICENSE.txt deleted file mode 100644 index d6456956..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/LICENSE.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_client.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_client.go deleted file mode 100644 index 4f27811b..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_client.go +++ /dev/null @@ -1,959 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - cryptorand "crypto/rand" - "errors" - "fmt" - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/aws/defaults" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/aws/retry" - "github.com/aws/aws-sdk-go-v2/aws/signer/v4" - awshttp "github.com/aws/aws-sdk-go-v2/aws/transport/http" - internalauth "github.com/aws/aws-sdk-go-v2/internal/auth" - internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" - internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" - internalmiddleware "github.com/aws/aws-sdk-go-v2/internal/middleware" - smithy "github.com/aws/smithy-go" - smithyauth "github.com/aws/smithy-go/auth" - smithydocument "github.com/aws/smithy-go/document" - "github.com/aws/smithy-go/logging" - "github.com/aws/smithy-go/metrics" - "github.com/aws/smithy-go/middleware" - smithyrand "github.com/aws/smithy-go/rand" - "github.com/aws/smithy-go/tracing" - smithyhttp "github.com/aws/smithy-go/transport/http" - "net" - "net/http" - "sync/atomic" - "time" -) - -const ServiceID = "Textract" -const ServiceAPIVersion = "2018-06-27" - -type operationMetrics struct { - Duration metrics.Float64Histogram - SerializeDuration metrics.Float64Histogram - ResolveIdentityDuration metrics.Float64Histogram - ResolveEndpointDuration metrics.Float64Histogram - SignRequestDuration metrics.Float64Histogram - DeserializeDuration metrics.Float64Histogram -} - -func (m *operationMetrics) histogramFor(name string) metrics.Float64Histogram { - switch name { - case "client.call.duration": - return m.Duration - case "client.call.serialization_duration": - return m.SerializeDuration - case "client.call.resolve_identity_duration": - return m.ResolveIdentityDuration - case "client.call.resolve_endpoint_duration": - return m.ResolveEndpointDuration - case "client.call.signing_duration": - return m.SignRequestDuration - case "client.call.deserialization_duration": - return m.DeserializeDuration - default: - panic("unrecognized operation metric") - } -} - -func timeOperationMetric[T any]( - ctx context.Context, metric string, fn func() (T, error), - opts ...metrics.RecordMetricOption, -) (T, error) { - instr := getOperationMetrics(ctx).histogramFor(metric) - opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...) - - start := time.Now() - v, err := fn() - end := time.Now() - - elapsed := end.Sub(start) - instr.Record(ctx, float64(elapsed)/1e9, opts...) - return v, err -} - -func startMetricTimer(ctx context.Context, metric string, opts ...metrics.RecordMetricOption) func() { - instr := getOperationMetrics(ctx).histogramFor(metric) - opts = append([]metrics.RecordMetricOption{withOperationMetadata(ctx)}, opts...) - - var ended bool - start := time.Now() - return func() { - if ended { - return - } - ended = true - - end := time.Now() - - elapsed := end.Sub(start) - instr.Record(ctx, float64(elapsed)/1e9, opts...) - } -} - -func withOperationMetadata(ctx context.Context) metrics.RecordMetricOption { - return func(o *metrics.RecordMetricOptions) { - o.Properties.Set("rpc.service", middleware.GetServiceID(ctx)) - o.Properties.Set("rpc.method", middleware.GetOperationName(ctx)) - } -} - -type operationMetricsKey struct{} - -func withOperationMetrics(parent context.Context, mp metrics.MeterProvider) (context.Context, error) { - meter := mp.Meter("github.com/aws/aws-sdk-go-v2/service/textract") - om := &operationMetrics{} - - var err error - - om.Duration, err = operationMetricTimer(meter, "client.call.duration", - "Overall call duration (including retries and time to send or receive request and response body)") - if err != nil { - return nil, err - } - om.SerializeDuration, err = operationMetricTimer(meter, "client.call.serialization_duration", - "The time it takes to serialize a message body") - if err != nil { - return nil, err - } - om.ResolveIdentityDuration, err = operationMetricTimer(meter, "client.call.auth.resolve_identity_duration", - "The time taken to acquire an identity (AWS credentials, bearer token, etc) from an Identity Provider") - if err != nil { - return nil, err - } - om.ResolveEndpointDuration, err = operationMetricTimer(meter, "client.call.resolve_endpoint_duration", - "The time it takes to resolve an endpoint (endpoint resolver, not DNS) for the request") - if err != nil { - return nil, err - } - om.SignRequestDuration, err = operationMetricTimer(meter, "client.call.auth.signing_duration", - "The time it takes to sign a request") - if err != nil { - return nil, err - } - om.DeserializeDuration, err = operationMetricTimer(meter, "client.call.deserialization_duration", - "The time it takes to deserialize a message body") - if err != nil { - return nil, err - } - - return context.WithValue(parent, operationMetricsKey{}, om), nil -} - -func operationMetricTimer(m metrics.Meter, name, desc string) (metrics.Float64Histogram, error) { - return m.Float64Histogram(name, func(o *metrics.InstrumentOptions) { - o.UnitLabel = "s" - o.Description = desc - }) -} - -func getOperationMetrics(ctx context.Context) *operationMetrics { - return ctx.Value(operationMetricsKey{}).(*operationMetrics) -} - -func operationTracer(p tracing.TracerProvider) tracing.Tracer { - return p.Tracer("github.com/aws/aws-sdk-go-v2/service/textract") -} - -// Client provides the API client to make operations call for Amazon Textract. -type Client struct { - options Options - - // Difference between the time reported by the server and the client - timeOffset *atomic.Int64 -} - -// New returns an initialized Client based on the functional options. Provide -// additional functional options to further configure the behavior of the client, -// such as changing the client's endpoint or adding custom middleware behavior. -func New(options Options, optFns ...func(*Options)) *Client { - options = options.Copy() - - resolveDefaultLogger(&options) - - setResolvedDefaultsMode(&options) - - resolveRetryer(&options) - - resolveHTTPClient(&options) - - resolveHTTPSignerV4(&options) - - resolveIdempotencyTokenProvider(&options) - - resolveEndpointResolverV2(&options) - - resolveTracerProvider(&options) - - resolveMeterProvider(&options) - - resolveAuthSchemeResolver(&options) - - for _, fn := range optFns { - fn(&options) - } - - finalizeRetryMaxAttempts(&options) - - ignoreAnonymousAuth(&options) - - wrapWithAnonymousAuth(&options) - - resolveAuthSchemes(&options) - - client := &Client{ - options: options, - } - - initializeTimeOffsetResolver(client) - - return client -} - -// Options returns a copy of the client configuration. -// -// Callers SHOULD NOT perform mutations on any inner structures within client -// config. Config overrides should instead be made on a per-operation basis through -// functional options. -func (c *Client) Options() Options { - return c.options.Copy() -} - -func (c *Client) invokeOperation( - ctx context.Context, opID string, params interface{}, optFns []func(*Options), stackFns ...func(*middleware.Stack, Options) error, -) ( - result interface{}, metadata middleware.Metadata, err error, -) { - ctx = middleware.ClearStackValues(ctx) - ctx = middleware.WithServiceID(ctx, ServiceID) - ctx = middleware.WithOperationName(ctx, opID) - - stack := middleware.NewStack(opID, smithyhttp.NewStackRequest) - options := c.options.Copy() - - for _, fn := range optFns { - fn(&options) - } - - finalizeOperationRetryMaxAttempts(&options, *c) - - finalizeClientEndpointResolverOptions(&options) - - for _, fn := range stackFns { - if err := fn(stack, options); err != nil { - return nil, metadata, err - } - } - - for _, fn := range options.APIOptions { - if err := fn(stack); err != nil { - return nil, metadata, err - } - } - - ctx, err = withOperationMetrics(ctx, options.MeterProvider) - if err != nil { - return nil, metadata, err - } - - tracer := operationTracer(options.TracerProvider) - spanName := fmt.Sprintf("%s.%s", ServiceID, opID) - - ctx = tracing.WithOperationTracer(ctx, tracer) - - ctx, span := tracer.StartSpan(ctx, spanName, func(o *tracing.SpanOptions) { - o.Kind = tracing.SpanKindClient - o.Properties.Set("rpc.system", "aws-api") - o.Properties.Set("rpc.method", opID) - o.Properties.Set("rpc.service", ServiceID) - }) - endTimer := startMetricTimer(ctx, "client.call.duration") - defer endTimer() - defer span.End() - - handler := smithyhttp.NewClientHandlerWithOptions(options.HTTPClient, func(o *smithyhttp.ClientHandler) { - o.Meter = options.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/textract") - }) - decorated := middleware.DecorateHandler(handler, stack) - result, metadata, err = decorated.Handle(ctx, params) - if err != nil { - span.SetProperty("exception.type", fmt.Sprintf("%T", err)) - span.SetProperty("exception.message", err.Error()) - - var aerr smithy.APIError - if errors.As(err, &aerr) { - span.SetProperty("api.error_code", aerr.ErrorCode()) - span.SetProperty("api.error_message", aerr.ErrorMessage()) - span.SetProperty("api.error_fault", aerr.ErrorFault().String()) - } - - err = &smithy.OperationError{ - ServiceID: ServiceID, - OperationName: opID, - Err: err, - } - } - - span.SetProperty("error", err != nil) - if err == nil { - span.SetStatus(tracing.SpanStatusOK) - } else { - span.SetStatus(tracing.SpanStatusError) - } - - return result, metadata, err -} - -type operationInputKey struct{} - -func setOperationInput(ctx context.Context, input interface{}) context.Context { - return middleware.WithStackValue(ctx, operationInputKey{}, input) -} - -func getOperationInput(ctx context.Context) interface{} { - return middleware.GetStackValue(ctx, operationInputKey{}) -} - -type setOperationInputMiddleware struct { -} - -func (*setOperationInputMiddleware) ID() string { - return "setOperationInput" -} - -func (m *setOperationInputMiddleware) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - ctx = setOperationInput(ctx, in.Parameters) - return next.HandleSerialize(ctx, in) -} - -func addProtocolFinalizerMiddlewares(stack *middleware.Stack, options Options, operation string) error { - if err := stack.Finalize.Add(&resolveAuthSchemeMiddleware{operation: operation, options: options}, middleware.Before); err != nil { - return fmt.Errorf("add ResolveAuthScheme: %w", err) - } - if err := stack.Finalize.Insert(&getIdentityMiddleware{options: options}, "ResolveAuthScheme", middleware.After); err != nil { - return fmt.Errorf("add GetIdentity: %v", err) - } - if err := stack.Finalize.Insert(&resolveEndpointV2Middleware{options: options}, "GetIdentity", middleware.After); err != nil { - return fmt.Errorf("add ResolveEndpointV2: %v", err) - } - if err := stack.Finalize.Insert(&signRequestMiddleware{options: options}, "ResolveEndpointV2", middleware.After); err != nil { - return fmt.Errorf("add Signing: %w", err) - } - return nil -} -func resolveAuthSchemeResolver(options *Options) { - if options.AuthSchemeResolver == nil { - options.AuthSchemeResolver = &defaultAuthSchemeResolver{} - } -} - -func resolveAuthSchemes(options *Options) { - if options.AuthSchemes == nil { - options.AuthSchemes = []smithyhttp.AuthScheme{ - internalauth.NewHTTPAuthScheme("aws.auth#sigv4", &internalauthsmithy.V4SignerAdapter{ - Signer: options.HTTPSignerV4, - Logger: options.Logger, - LogSigning: options.ClientLogMode.IsSigning(), - }), - } - } -} - -type noSmithyDocumentSerde = smithydocument.NoSerde - -type legacyEndpointContextSetter struct { - LegacyResolver EndpointResolver -} - -func (*legacyEndpointContextSetter) ID() string { - return "legacyEndpointContextSetter" -} - -func (m *legacyEndpointContextSetter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - if m.LegacyResolver != nil { - ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, true) - } - - return next.HandleInitialize(ctx, in) - -} -func addlegacyEndpointContextSetter(stack *middleware.Stack, o Options) error { - return stack.Initialize.Add(&legacyEndpointContextSetter{ - LegacyResolver: o.EndpointResolver, - }, middleware.Before) -} - -func resolveDefaultLogger(o *Options) { - if o.Logger != nil { - return - } - o.Logger = logging.Nop{} -} - -func addSetLoggerMiddleware(stack *middleware.Stack, o Options) error { - return middleware.AddSetLoggerMiddleware(stack, o.Logger) -} - -func setResolvedDefaultsMode(o *Options) { - if len(o.resolvedDefaultsMode) > 0 { - return - } - - var mode aws.DefaultsMode - mode.SetFromString(string(o.DefaultsMode)) - - if mode == aws.DefaultsModeAuto { - mode = defaults.ResolveDefaultsModeAuto(o.Region, o.RuntimeEnvironment) - } - - o.resolvedDefaultsMode = mode -} - -// NewFromConfig returns a new client from the provided config. -func NewFromConfig(cfg aws.Config, optFns ...func(*Options)) *Client { - opts := Options{ - Region: cfg.Region, - DefaultsMode: cfg.DefaultsMode, - RuntimeEnvironment: cfg.RuntimeEnvironment, - HTTPClient: cfg.HTTPClient, - Credentials: cfg.Credentials, - APIOptions: cfg.APIOptions, - Logger: cfg.Logger, - ClientLogMode: cfg.ClientLogMode, - AppID: cfg.AppID, - } - resolveAWSRetryerProvider(cfg, &opts) - resolveAWSRetryMaxAttempts(cfg, &opts) - resolveAWSRetryMode(cfg, &opts) - resolveAWSEndpointResolver(cfg, &opts) - resolveUseDualStackEndpoint(cfg, &opts) - resolveUseFIPSEndpoint(cfg, &opts) - resolveBaseEndpoint(cfg, &opts) - return New(opts, optFns...) -} - -func resolveHTTPClient(o *Options) { - var buildable *awshttp.BuildableClient - - if o.HTTPClient != nil { - var ok bool - buildable, ok = o.HTTPClient.(*awshttp.BuildableClient) - if !ok { - return - } - } else { - buildable = awshttp.NewBuildableClient() - } - - modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) - if err == nil { - buildable = buildable.WithDialerOptions(func(dialer *net.Dialer) { - if dialerTimeout, ok := modeConfig.GetConnectTimeout(); ok { - dialer.Timeout = dialerTimeout - } - }) - - buildable = buildable.WithTransportOptions(func(transport *http.Transport) { - if tlsHandshakeTimeout, ok := modeConfig.GetTLSNegotiationTimeout(); ok { - transport.TLSHandshakeTimeout = tlsHandshakeTimeout - } - }) - } - - o.HTTPClient = buildable -} - -func resolveRetryer(o *Options) { - if o.Retryer != nil { - return - } - - if len(o.RetryMode) == 0 { - modeConfig, err := defaults.GetModeConfiguration(o.resolvedDefaultsMode) - if err == nil { - o.RetryMode = modeConfig.RetryMode - } - } - if len(o.RetryMode) == 0 { - o.RetryMode = aws.RetryModeStandard - } - - var standardOptions []func(*retry.StandardOptions) - if v := o.RetryMaxAttempts; v != 0 { - standardOptions = append(standardOptions, func(so *retry.StandardOptions) { - so.MaxAttempts = v - }) - } - - switch o.RetryMode { - case aws.RetryModeAdaptive: - var adaptiveOptions []func(*retry.AdaptiveModeOptions) - if len(standardOptions) != 0 { - adaptiveOptions = append(adaptiveOptions, func(ao *retry.AdaptiveModeOptions) { - ao.StandardOptions = append(ao.StandardOptions, standardOptions...) - }) - } - o.Retryer = retry.NewAdaptiveMode(adaptiveOptions...) - - default: - o.Retryer = retry.NewStandard(standardOptions...) - } -} - -func resolveAWSRetryerProvider(cfg aws.Config, o *Options) { - if cfg.Retryer == nil { - return - } - o.Retryer = cfg.Retryer() -} - -func resolveAWSRetryMode(cfg aws.Config, o *Options) { - if len(cfg.RetryMode) == 0 { - return - } - o.RetryMode = cfg.RetryMode -} -func resolveAWSRetryMaxAttempts(cfg aws.Config, o *Options) { - if cfg.RetryMaxAttempts == 0 { - return - } - o.RetryMaxAttempts = cfg.RetryMaxAttempts -} - -func finalizeRetryMaxAttempts(o *Options) { - if o.RetryMaxAttempts == 0 { - return - } - - o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) -} - -func finalizeOperationRetryMaxAttempts(o *Options, client Client) { - if v := o.RetryMaxAttempts; v == 0 || v == client.options.RetryMaxAttempts { - return - } - - o.Retryer = retry.AddWithMaxAttempts(o.Retryer, o.RetryMaxAttempts) -} - -func resolveAWSEndpointResolver(cfg aws.Config, o *Options) { - if cfg.EndpointResolver == nil && cfg.EndpointResolverWithOptions == nil { - return - } - o.EndpointResolver = withEndpointResolver(cfg.EndpointResolver, cfg.EndpointResolverWithOptions) -} - -func addClientUserAgent(stack *middleware.Stack, options Options) error { - ua, err := getOrAddRequestUserAgent(stack) - if err != nil { - return err - } - - ua.AddSDKAgentKeyValue(awsmiddleware.APIMetadata, "textract", goModuleVersion) - if len(options.AppID) > 0 { - ua.AddSDKAgentKey(awsmiddleware.ApplicationIdentifier, options.AppID) - } - - return nil -} - -func getOrAddRequestUserAgent(stack *middleware.Stack) (*awsmiddleware.RequestUserAgent, error) { - id := (*awsmiddleware.RequestUserAgent)(nil).ID() - mw, ok := stack.Build.Get(id) - if !ok { - mw = awsmiddleware.NewRequestUserAgent() - if err := stack.Build.Add(mw, middleware.After); err != nil { - return nil, err - } - } - - ua, ok := mw.(*awsmiddleware.RequestUserAgent) - if !ok { - return nil, fmt.Errorf("%T for %s middleware did not match expected type", mw, id) - } - - return ua, nil -} - -type HTTPSignerV4 interface { - SignHTTP(ctx context.Context, credentials aws.Credentials, r *http.Request, payloadHash string, service string, region string, signingTime time.Time, optFns ...func(*v4.SignerOptions)) error -} - -func resolveHTTPSignerV4(o *Options) { - if o.HTTPSignerV4 != nil { - return - } - o.HTTPSignerV4 = newDefaultV4Signer(*o) -} - -func newDefaultV4Signer(o Options) *v4.Signer { - return v4.NewSigner(func(so *v4.SignerOptions) { - so.Logger = o.Logger - so.LogSigning = o.ClientLogMode.IsSigning() - }) -} - -func addClientRequestID(stack *middleware.Stack) error { - return stack.Build.Add(&awsmiddleware.ClientRequestID{}, middleware.After) -} - -func addComputeContentLength(stack *middleware.Stack) error { - return stack.Build.Add(&smithyhttp.ComputeContentLength{}, middleware.After) -} - -func addRawResponseToMetadata(stack *middleware.Stack) error { - return stack.Deserialize.Add(&awsmiddleware.AddRawResponse{}, middleware.Before) -} - -func addRecordResponseTiming(stack *middleware.Stack) error { - return stack.Deserialize.Add(&awsmiddleware.RecordResponseTiming{}, middleware.After) -} - -func addSpanRetryLoop(stack *middleware.Stack, options Options) error { - return stack.Finalize.Insert(&spanRetryLoop{options: options}, "Retry", middleware.Before) -} - -type spanRetryLoop struct { - options Options -} - -func (*spanRetryLoop) ID() string { - return "spanRetryLoop" -} - -func (m *spanRetryLoop) HandleFinalize( - ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, -) ( - middleware.FinalizeOutput, middleware.Metadata, error, -) { - tracer := operationTracer(m.options.TracerProvider) - ctx, span := tracer.StartSpan(ctx, "RetryLoop") - defer span.End() - - return next.HandleFinalize(ctx, in) -} -func addStreamingEventsPayload(stack *middleware.Stack) error { - return stack.Finalize.Add(&v4.StreamingEventsPayload{}, middleware.Before) -} - -func addUnsignedPayload(stack *middleware.Stack) error { - return stack.Finalize.Insert(&v4.UnsignedPayload{}, "ResolveEndpointV2", middleware.After) -} - -func addComputePayloadSHA256(stack *middleware.Stack) error { - return stack.Finalize.Insert(&v4.ComputePayloadSHA256{}, "ResolveEndpointV2", middleware.After) -} - -func addContentSHA256Header(stack *middleware.Stack) error { - return stack.Finalize.Insert(&v4.ContentSHA256Header{}, (*v4.ComputePayloadSHA256)(nil).ID(), middleware.After) -} - -func addIsWaiterUserAgent(o *Options) { - o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { - ua, err := getOrAddRequestUserAgent(stack) - if err != nil { - return err - } - - ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureWaiter) - return nil - }) -} - -func addIsPaginatorUserAgent(o *Options) { - o.APIOptions = append(o.APIOptions, func(stack *middleware.Stack) error { - ua, err := getOrAddRequestUserAgent(stack) - if err != nil { - return err - } - - ua.AddUserAgentFeature(awsmiddleware.UserAgentFeaturePaginator) - return nil - }) -} - -func resolveIdempotencyTokenProvider(o *Options) { - if o.IdempotencyTokenProvider != nil { - return - } - o.IdempotencyTokenProvider = smithyrand.NewUUIDIdempotencyToken(cryptorand.Reader) -} - -func addRetry(stack *middleware.Stack, o Options) error { - attempt := retry.NewAttemptMiddleware(o.Retryer, smithyhttp.RequestCloner, func(m *retry.Attempt) { - m.LogAttempts = o.ClientLogMode.IsRetries() - m.OperationMeter = o.MeterProvider.Meter("github.com/aws/aws-sdk-go-v2/service/textract") - }) - if err := stack.Finalize.Insert(attempt, "ResolveAuthScheme", middleware.Before); err != nil { - return err - } - if err := stack.Finalize.Insert(&retry.MetricsHeader{}, attempt.ID(), middleware.After); err != nil { - return err - } - return nil -} - -// resolves dual-stack endpoint configuration -func resolveUseDualStackEndpoint(cfg aws.Config, o *Options) error { - if len(cfg.ConfigSources) == 0 { - return nil - } - value, found, err := internalConfig.ResolveUseDualStackEndpoint(context.Background(), cfg.ConfigSources) - if err != nil { - return err - } - if found { - o.EndpointOptions.UseDualStackEndpoint = value - } - return nil -} - -// resolves FIPS endpoint configuration -func resolveUseFIPSEndpoint(cfg aws.Config, o *Options) error { - if len(cfg.ConfigSources) == 0 { - return nil - } - value, found, err := internalConfig.ResolveUseFIPSEndpoint(context.Background(), cfg.ConfigSources) - if err != nil { - return err - } - if found { - o.EndpointOptions.UseFIPSEndpoint = value - } - return nil -} - -func resolveAccountID(identity smithyauth.Identity, mode aws.AccountIDEndpointMode) *string { - if mode == aws.AccountIDEndpointModeDisabled { - return nil - } - - if ca, ok := identity.(*internalauthsmithy.CredentialsAdapter); ok && ca.Credentials.AccountID != "" { - return aws.String(ca.Credentials.AccountID) - } - - return nil -} - -func addTimeOffsetBuild(stack *middleware.Stack, c *Client) error { - mw := internalmiddleware.AddTimeOffsetMiddleware{Offset: c.timeOffset} - if err := stack.Build.Add(&mw, middleware.After); err != nil { - return err - } - return stack.Deserialize.Insert(&mw, "RecordResponseTiming", middleware.Before) -} -func initializeTimeOffsetResolver(c *Client) { - c.timeOffset = new(atomic.Int64) -} - -func addUserAgentRetryMode(stack *middleware.Stack, options Options) error { - ua, err := getOrAddRequestUserAgent(stack) - if err != nil { - return err - } - - switch options.Retryer.(type) { - case *retry.Standard: - ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureRetryModeStandard) - case *retry.AdaptiveMode: - ua.AddUserAgentFeature(awsmiddleware.UserAgentFeatureRetryModeAdaptive) - } - return nil -} - -type setCredentialSourceMiddleware struct { - ua *awsmiddleware.RequestUserAgent - options Options -} - -func (m setCredentialSourceMiddleware) ID() string { return "SetCredentialSourceMiddleware" } - -func (m setCredentialSourceMiddleware) HandleBuild(ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler) ( - out middleware.BuildOutput, metadata middleware.Metadata, err error, -) { - asProviderSource, ok := m.options.Credentials.(aws.CredentialProviderSource) - if !ok { - return next.HandleBuild(ctx, in) - } - providerSources := asProviderSource.ProviderSources() - for _, source := range providerSources { - m.ua.AddCredentialsSource(source) - } - return next.HandleBuild(ctx, in) -} - -func addCredentialSource(stack *middleware.Stack, options Options) error { - ua, err := getOrAddRequestUserAgent(stack) - if err != nil { - return err - } - - mw := setCredentialSourceMiddleware{ua: ua, options: options} - return stack.Build.Insert(&mw, "UserAgent", middleware.Before) -} - -func resolveTracerProvider(options *Options) { - if options.TracerProvider == nil { - options.TracerProvider = &tracing.NopTracerProvider{} - } -} - -func resolveMeterProvider(options *Options) { - if options.MeterProvider == nil { - options.MeterProvider = metrics.NopMeterProvider{} - } -} - -// IdempotencyTokenProvider interface for providing idempotency token -type IdempotencyTokenProvider interface { - GetIdempotencyToken() (string, error) -} - -func addRecursionDetection(stack *middleware.Stack) error { - return stack.Build.Add(&awsmiddleware.RecursionDetection{}, middleware.After) -} - -func addRequestIDRetrieverMiddleware(stack *middleware.Stack) error { - return stack.Deserialize.Insert(&awsmiddleware.RequestIDRetriever{}, "OperationDeserializer", middleware.Before) - -} - -func addResponseErrorMiddleware(stack *middleware.Stack) error { - return stack.Deserialize.Insert(&awshttp.ResponseErrorWrapper{}, "RequestIDRetriever", middleware.Before) - -} - -func addRequestResponseLogging(stack *middleware.Stack, o Options) error { - return stack.Deserialize.Add(&smithyhttp.RequestResponseLogger{ - LogRequest: o.ClientLogMode.IsRequest(), - LogRequestWithBody: o.ClientLogMode.IsRequestWithBody(), - LogResponse: o.ClientLogMode.IsResponse(), - LogResponseWithBody: o.ClientLogMode.IsResponseWithBody(), - }, middleware.After) -} - -type disableHTTPSMiddleware struct { - DisableHTTPS bool -} - -func (*disableHTTPSMiddleware) ID() string { - return "disableHTTPS" -} - -func (m *disableHTTPSMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( - out middleware.FinalizeOutput, metadata middleware.Metadata, err error, -) { - req, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) - } - - if m.DisableHTTPS && !smithyhttp.GetHostnameImmutable(ctx) { - req.URL.Scheme = "http" - } - - return next.HandleFinalize(ctx, in) -} - -func addDisableHTTPSMiddleware(stack *middleware.Stack, o Options) error { - return stack.Finalize.Insert(&disableHTTPSMiddleware{ - DisableHTTPS: o.EndpointOptions.DisableHTTPS, - }, "ResolveEndpointV2", middleware.After) -} - -type spanInitializeStart struct { -} - -func (*spanInitializeStart) ID() string { - return "spanInitializeStart" -} - -func (m *spanInitializeStart) HandleInitialize( - ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler, -) ( - middleware.InitializeOutput, middleware.Metadata, error, -) { - ctx, _ = tracing.StartSpan(ctx, "Initialize") - - return next.HandleInitialize(ctx, in) -} - -type spanInitializeEnd struct { -} - -func (*spanInitializeEnd) ID() string { - return "spanInitializeEnd" -} - -func (m *spanInitializeEnd) HandleInitialize( - ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler, -) ( - middleware.InitializeOutput, middleware.Metadata, error, -) { - ctx, span := tracing.PopSpan(ctx) - span.End() - - return next.HandleInitialize(ctx, in) -} - -type spanBuildRequestStart struct { -} - -func (*spanBuildRequestStart) ID() string { - return "spanBuildRequestStart" -} - -func (m *spanBuildRequestStart) HandleSerialize( - ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler, -) ( - middleware.SerializeOutput, middleware.Metadata, error, -) { - ctx, _ = tracing.StartSpan(ctx, "BuildRequest") - - return next.HandleSerialize(ctx, in) -} - -type spanBuildRequestEnd struct { -} - -func (*spanBuildRequestEnd) ID() string { - return "spanBuildRequestEnd" -} - -func (m *spanBuildRequestEnd) HandleBuild( - ctx context.Context, in middleware.BuildInput, next middleware.BuildHandler, -) ( - middleware.BuildOutput, middleware.Metadata, error, -) { - ctx, span := tracing.PopSpan(ctx) - span.End() - - return next.HandleBuild(ctx, in) -} - -func addSpanInitializeStart(stack *middleware.Stack) error { - return stack.Initialize.Add(&spanInitializeStart{}, middleware.Before) -} - -func addSpanInitializeEnd(stack *middleware.Stack) error { - return stack.Initialize.Add(&spanInitializeEnd{}, middleware.After) -} - -func addSpanBuildRequestStart(stack *middleware.Stack) error { - return stack.Serialize.Add(&spanBuildRequestStart{}, middleware.Before) -} - -func addSpanBuildRequestEnd(stack *middleware.Stack) error { - return stack.Build.Add(&spanBuildRequestEnd{}, middleware.After) -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeDocument.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeDocument.go deleted file mode 100644 index 21889418..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeDocument.go +++ /dev/null @@ -1,237 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Analyzes an input document for relationships between detected items. -// -// The types of information returned are as follows: -// -// - Form data (key-value pairs). The related information is returned in two Block -// objects, each of type KEY_VALUE_SET : a KEY Block object and a VALUE Block -// object. For example, Name: Ana Silva Carolina contains a key and value. Name: is -// the key. Ana Silva Carolina is the value. -// -// - Table and table cell data. A TABLE Block object contains information about a -// detected table. A CELL Block object is returned for each cell in a table. -// -// - Lines and words of text. A LINE Block object contains one or more WORD Block -// objects. All lines and words that are detected in the document are returned -// (including text that doesn't have a relationship with the value of -// FeatureTypes ). -// -// - Signatures. A SIGNATURE Block object contains the location information of a -// signature in a document. If used in conjunction with forms or tables, a -// signature can be given a Key-Value pairing or be detected in the cell of a -// table. -// -// - Query. A QUERY Block object contains the query text, alias and link to the -// associated Query results block object. -// -// - Query Result. A QUERY_RESULT Block object contains the answer to the query -// and an ID that connects it to the query asked. This Block also contains a -// confidence score. -// -// Selection elements such as check boxes and option buttons (radio buttons) can -// be detected in form data and in tables. A SELECTION_ELEMENT Block object -// contains information about a selection element, including the selection status. -// -// You can choose which type of analysis to perform by specifying the FeatureTypes -// list. -// -// The output is returned in a list of Block objects. -// -// AnalyzeDocument is a synchronous operation. To analyze documents -// asynchronously, use StartDocumentAnalysis. -// -// For more information, see [Document Text Analysis]. -// -// [Document Text Analysis]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html -func (c *Client) AnalyzeDocument(ctx context.Context, params *AnalyzeDocumentInput, optFns ...func(*Options)) (*AnalyzeDocumentOutput, error) { - if params == nil { - params = &AnalyzeDocumentInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "AnalyzeDocument", params, optFns, c.addOperationAnalyzeDocumentMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*AnalyzeDocumentOutput) - out.ResultMetadata = metadata - return out, nil -} - -type AnalyzeDocumentInput struct { - - // The input document as base64-encoded bytes or an Amazon S3 object. If you use - // the AWS CLI to call Amazon Textract operations, you can't pass image bytes. The - // document must be an image in JPEG, PNG, PDF, or TIFF format. - // - // If you're using an AWS SDK to call Amazon Textract, you might not need to - // base64-encode image bytes that are passed using the Bytes field. - // - // This member is required. - Document *types.Document - - // A list of the types of analysis to perform. Add TABLES to the list to return - // information about the tables that are detected in the input document. Add FORMS - // to return detected form data. Add SIGNATURES to return the locations of detected - // signatures. Add LAYOUT to the list to return information about the layout of the - // document. All lines and words detected in the document are included in the - // response (including text that isn't related to the value of FeatureTypes ). - // - // This member is required. - FeatureTypes []types.FeatureType - - // Specifies the adapter to be used when analyzing a document. - AdaptersConfig *types.AdaptersConfig - - // Sets the configuration for the human in the loop workflow for analyzing - // documents. - HumanLoopConfig *types.HumanLoopConfig - - // Contains Queries and the alias for those Queries, as determined by the input. - QueriesConfig *types.QueriesConfig - - noSmithyDocumentSerde -} - -type AnalyzeDocumentOutput struct { - - // The version of the model used to analyze the document. - AnalyzeDocumentModelVersion *string - - // The items that are detected and analyzed by AnalyzeDocument . - Blocks []types.Block - - // Metadata about the analyzed document. An example is the number of pages. - DocumentMetadata *types.DocumentMetadata - - // Shows the results of the human in the loop evaluation. - HumanLoopActivationOutput *types.HumanLoopActivationOutput - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationAnalyzeDocumentMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpAnalyzeDocument{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAnalyzeDocument{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "AnalyzeDocument"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpAnalyzeDocumentValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAnalyzeDocument(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opAnalyzeDocument(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "AnalyzeDocument", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeExpense.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeExpense.go deleted file mode 100644 index 6db6f7e3..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeExpense.go +++ /dev/null @@ -1,192 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// AnalyzeExpense synchronously analyzes an input document for financially related -// relationships between text. -// -// Information is returned as ExpenseDocuments and seperated as follows: -// -// - LineItemGroups - A data set containing LineItems which store information -// about the lines of text, such as an item purchased and its price on a receipt. -// -// - SummaryFields - Contains all other information a receipt, such as header -// information or the vendors name. -func (c *Client) AnalyzeExpense(ctx context.Context, params *AnalyzeExpenseInput, optFns ...func(*Options)) (*AnalyzeExpenseOutput, error) { - if params == nil { - params = &AnalyzeExpenseInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "AnalyzeExpense", params, optFns, c.addOperationAnalyzeExpenseMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*AnalyzeExpenseOutput) - out.ResultMetadata = metadata - return out, nil -} - -type AnalyzeExpenseInput struct { - - // The input document, either as bytes or as an S3 object. - // - // You pass image bytes to an Amazon Textract API operation by using the Bytes - // property. For example, you would use the Bytes property to pass a document - // loaded from a local file system. Image bytes passed by using the Bytes property - // must be base64 encoded. Your code might not need to encode document file bytes - // if you're using an AWS SDK to call Amazon Textract API operations. - // - // You pass images stored in an S3 bucket to an Amazon Textract API operation by - // using the S3Object property. Documents stored in an S3 bucket don't need to be - // base64 encoded. - // - // The AWS Region for the S3 bucket that contains the S3 object must match the AWS - // Region that you use for Amazon Textract operations. - // - // If you use the AWS CLI to call Amazon Textract operations, passing image bytes - // using the Bytes property isn't supported. You must first upload the document to - // an Amazon S3 bucket, and then call the operation using the S3Object property. - // - // For Amazon Textract to process an S3 object, the user must have permission to - // access the S3 object. - // - // This member is required. - Document *types.Document - - noSmithyDocumentSerde -} - -type AnalyzeExpenseOutput struct { - - // Information about the input document. - DocumentMetadata *types.DocumentMetadata - - // The expenses detected by Amazon Textract. - ExpenseDocuments []types.ExpenseDocument - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationAnalyzeExpenseMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpAnalyzeExpense{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAnalyzeExpense{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "AnalyzeExpense"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpAnalyzeExpenseValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAnalyzeExpense(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opAnalyzeExpense(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "AnalyzeExpense", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeID.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeID.go deleted file mode 100644 index c79776e7..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_AnalyzeID.go +++ /dev/null @@ -1,170 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Analyzes identity documents for relevant information. This information is -// extracted and returned as IdentityDocumentFields , which records both the -// normalized field and value of the extracted text. Unlike other Amazon Textract -// operations, AnalyzeID doesn't return any Geometry data. -func (c *Client) AnalyzeID(ctx context.Context, params *AnalyzeIDInput, optFns ...func(*Options)) (*AnalyzeIDOutput, error) { - if params == nil { - params = &AnalyzeIDInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "AnalyzeID", params, optFns, c.addOperationAnalyzeIDMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*AnalyzeIDOutput) - out.ResultMetadata = metadata - return out, nil -} - -type AnalyzeIDInput struct { - - // The document being passed to AnalyzeID. - // - // This member is required. - DocumentPages []types.Document - - noSmithyDocumentSerde -} - -type AnalyzeIDOutput struct { - - // The version of the AnalyzeIdentity API being used to process documents. - AnalyzeIDModelVersion *string - - // Information about the input document. - DocumentMetadata *types.DocumentMetadata - - // The list of documents processed by AnalyzeID. Includes a number denoting their - // place in the list and the response structure for the document. - IdentityDocuments []types.IdentityDocument - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationAnalyzeIDMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpAnalyzeID{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpAnalyzeID{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "AnalyzeID"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpAnalyzeIDValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opAnalyzeID(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opAnalyzeID(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "AnalyzeID", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_CreateAdapter.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_CreateAdapter.go deleted file mode 100644 index e9b79b71..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_CreateAdapter.go +++ /dev/null @@ -1,221 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Creates an adapter, which can be fine-tuned for enhanced performance on user -// provided documents. Takes an AdapterName and FeatureType. Currently the only -// supported feature type is QUERIES . You can also provide a Description, Tags, -// and a ClientRequestToken. You can choose whether or not the adapter should be -// AutoUpdated with the AutoUpdate argument. By default, AutoUpdate is set to -// DISABLED. -func (c *Client) CreateAdapter(ctx context.Context, params *CreateAdapterInput, optFns ...func(*Options)) (*CreateAdapterOutput, error) { - if params == nil { - params = &CreateAdapterInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "CreateAdapter", params, optFns, c.addOperationCreateAdapterMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*CreateAdapterOutput) - out.ResultMetadata = metadata - return out, nil -} - -type CreateAdapterInput struct { - - // The name to be assigned to the adapter being created. - // - // This member is required. - AdapterName *string - - // The type of feature that the adapter is being trained on. Currrenly, supported - // feature types are: QUERIES - // - // This member is required. - FeatureTypes []types.FeatureType - - // Controls whether or not the adapter should automatically update. - AutoUpdate types.AutoUpdate - - // Idempotent token is used to recognize the request. If the same token is used - // with multiple CreateAdapter requests, the same session is returned. This token - // is employed to avoid unintentionally creating the same session multiple times. - ClientRequestToken *string - - // The description to be assigned to the adapter being created. - Description *string - - // A list of tags to be added to the adapter. - Tags map[string]string - - noSmithyDocumentSerde -} - -type CreateAdapterOutput struct { - - // A string containing the unique ID for the adapter that has been created. - AdapterId *string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationCreateAdapterMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateAdapter{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateAdapter{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAdapter"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addIdempotencyToken_opCreateAdapterMiddleware(stack, options); err != nil { - return err - } - if err = addOpCreateAdapterValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAdapter(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -type idempotencyToken_initializeOpCreateAdapter struct { - tokenProvider IdempotencyTokenProvider -} - -func (*idempotencyToken_initializeOpCreateAdapter) ID() string { - return "OperationIdempotencyTokenAutoFill" -} - -func (m *idempotencyToken_initializeOpCreateAdapter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - if m.tokenProvider == nil { - return next.HandleInitialize(ctx, in) - } - - input, ok := in.Parameters.(*CreateAdapterInput) - if !ok { - return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAdapterInput ") - } - - if input.ClientRequestToken == nil { - t, err := m.tokenProvider.GetIdempotencyToken() - if err != nil { - return out, metadata, err - } - input.ClientRequestToken = &t - } - return next.HandleInitialize(ctx, in) -} -func addIdempotencyToken_opCreateAdapterMiddleware(stack *middleware.Stack, cfg Options) error { - return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAdapter{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) -} - -func newServiceMetadataMiddleware_opCreateAdapter(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "CreateAdapter", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_CreateAdapterVersion.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_CreateAdapterVersion.go deleted file mode 100644 index d67b4017..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_CreateAdapterVersion.go +++ /dev/null @@ -1,249 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Creates a new version of an adapter. Operates on a provided AdapterId and a -// specified dataset provided via the DatasetConfig argument. Requires that you -// specify an Amazon S3 bucket with the OutputConfig argument. You can provide an -// optional KMSKeyId, an optional ClientRequestToken, and optional tags. -func (c *Client) CreateAdapterVersion(ctx context.Context, params *CreateAdapterVersionInput, optFns ...func(*Options)) (*CreateAdapterVersionOutput, error) { - if params == nil { - params = &CreateAdapterVersionInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "CreateAdapterVersion", params, optFns, c.addOperationCreateAdapterVersionMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*CreateAdapterVersionOutput) - out.ResultMetadata = metadata - return out, nil -} - -type CreateAdapterVersionInput struct { - - // A string containing a unique ID for the adapter that will receive a new version. - // - // This member is required. - AdapterId *string - - // Specifies a dataset used to train a new adapter version. Takes a - // ManifestS3Object as the value. - // - // This member is required. - DatasetConfig *types.AdapterVersionDatasetConfig - - // Sets whether or not your output will go to a user created bucket. Used to set - // the name of the bucket, and the prefix on the output file. - // - // OutputConfig is an optional parameter which lets you adjust where your output - // will be placed. By default, Amazon Textract will store the results internally - // and can only be accessed by the Get API operations. With OutputConfig enabled, - // you can set the name of the bucket the output will be sent to the file prefix of - // the results where you can download your results. Additionally, you can set the - // KMSKeyID parameter to a customer master key (CMK) to encrypt your output. - // Without this parameter set Amazon Textract will encrypt server-side using the - // AWS managed CMK for Amazon S3. - // - // Decryption of Customer Content is necessary for processing of the documents by - // Amazon Textract. If your account is opted out under an AI services opt out - // policy then all unencrypted Customer Content is immediately and permanently - // deleted after the Customer Content has been processed by the service. No copy of - // of the output is retained by Amazon Textract. For information about how to opt - // out, see [Managing AI services opt-out policy.] - // - // For more information on data privacy, see the [Data Privacy FAQ]. - // - // [Managing AI services opt-out policy.]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html - // [Data Privacy FAQ]: https://aws.amazon.com/compliance/data-privacy-faq/ - // - // This member is required. - OutputConfig *types.OutputConfig - - // Idempotent token is used to recognize the request. If the same token is used - // with multiple CreateAdapterVersion requests, the same session is returned. This - // token is employed to avoid unintentionally creating the same session multiple - // times. - ClientRequestToken *string - - // The identifier for your AWS Key Management Service key (AWS KMS key). Used to - // encrypt your documents. - KMSKeyId *string - - // A set of tags (key-value pairs) that you want to attach to the adapter version. - Tags map[string]string - - noSmithyDocumentSerde -} - -type CreateAdapterVersionOutput struct { - - // A string containing the unique ID for the adapter that has received a new - // version. - AdapterId *string - - // A string describing the new version of the adapter. - AdapterVersion *string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationCreateAdapterVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateAdapterVersion{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateAdapterVersion{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "CreateAdapterVersion"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addIdempotencyToken_opCreateAdapterVersionMiddleware(stack, options); err != nil { - return err - } - if err = addOpCreateAdapterVersionValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAdapterVersion(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -type idempotencyToken_initializeOpCreateAdapterVersion struct { - tokenProvider IdempotencyTokenProvider -} - -func (*idempotencyToken_initializeOpCreateAdapterVersion) ID() string { - return "OperationIdempotencyTokenAutoFill" -} - -func (m *idempotencyToken_initializeOpCreateAdapterVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - if m.tokenProvider == nil { - return next.HandleInitialize(ctx, in) - } - - input, ok := in.Parameters.(*CreateAdapterVersionInput) - if !ok { - return out, metadata, fmt.Errorf("expected middleware input to be of type *CreateAdapterVersionInput ") - } - - if input.ClientRequestToken == nil { - t, err := m.tokenProvider.GetIdempotencyToken() - if err != nil { - return out, metadata, err - } - input.ClientRequestToken = &t - } - return next.HandleInitialize(ctx, in) -} -func addIdempotencyToken_opCreateAdapterVersionMiddleware(stack *middleware.Stack, cfg Options) error { - return stack.Initialize.Add(&idempotencyToken_initializeOpCreateAdapterVersion{tokenProvider: cfg.IdempotencyTokenProvider}, middleware.Before) -} - -func newServiceMetadataMiddleware_opCreateAdapterVersion(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "CreateAdapterVersion", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DeleteAdapter.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DeleteAdapter.go deleted file mode 100644 index 6a36fdb2..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DeleteAdapter.go +++ /dev/null @@ -1,156 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Deletes an Amazon Textract adapter. Takes an AdapterId and deletes the adapter -// specified by the ID. -func (c *Client) DeleteAdapter(ctx context.Context, params *DeleteAdapterInput, optFns ...func(*Options)) (*DeleteAdapterOutput, error) { - if params == nil { - params = &DeleteAdapterInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "DeleteAdapter", params, optFns, c.addOperationDeleteAdapterMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*DeleteAdapterOutput) - out.ResultMetadata = metadata - return out, nil -} - -type DeleteAdapterInput struct { - - // A string containing a unique ID for the adapter to be deleted. - // - // This member is required. - AdapterId *string - - noSmithyDocumentSerde -} - -type DeleteAdapterOutput struct { - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationDeleteAdapterMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteAdapter{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteAdapter{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAdapter"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpDeleteAdapterValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAdapter(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opDeleteAdapter(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "DeleteAdapter", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DeleteAdapterVersion.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DeleteAdapterVersion.go deleted file mode 100644 index f97bb5e9..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DeleteAdapterVersion.go +++ /dev/null @@ -1,162 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Deletes an Amazon Textract adapter version. Requires that you specify both an -// AdapterId and a AdapterVersion. Deletes the adapter version specified by the -// AdapterId and the AdapterVersion. -func (c *Client) DeleteAdapterVersion(ctx context.Context, params *DeleteAdapterVersionInput, optFns ...func(*Options)) (*DeleteAdapterVersionOutput, error) { - if params == nil { - params = &DeleteAdapterVersionInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "DeleteAdapterVersion", params, optFns, c.addOperationDeleteAdapterVersionMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*DeleteAdapterVersionOutput) - out.ResultMetadata = metadata - return out, nil -} - -type DeleteAdapterVersionInput struct { - - // A string containing a unique ID for the adapter version that will be deleted. - // - // This member is required. - AdapterId *string - - // Specifies the adapter version to be deleted. - // - // This member is required. - AdapterVersion *string - - noSmithyDocumentSerde -} - -type DeleteAdapterVersionOutput struct { - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationDeleteAdapterVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpDeleteAdapterVersion{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDeleteAdapterVersion{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "DeleteAdapterVersion"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpDeleteAdapterVersionValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeleteAdapterVersion(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opDeleteAdapterVersion(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "DeleteAdapterVersion", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DetectDocumentText.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DetectDocumentText.go deleted file mode 100644 index 63c78c63..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_DetectDocumentText.go +++ /dev/null @@ -1,187 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Detects text in the input document. Amazon Textract can detect lines of text -// and the words that make up a line of text. The input document must be in one of -// the following image formats: JPEG, PNG, PDF, or TIFF. DetectDocumentText -// returns the detected text in an array of Blockobjects. -// -// Each document page has as an associated Block of type PAGE. Each PAGE Block -// object is the parent of LINE Block objects that represent the lines of detected -// text on a page. A LINE Block object is a parent for each word that makes up the -// line. Words are represented by Block objects of type WORD. -// -// DetectDocumentText is a synchronous operation. To analyze documents -// asynchronously, use StartDocumentTextDetection. -// -// For more information, see [Document Text Detection]. -// -// [Document Text Detection]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html -func (c *Client) DetectDocumentText(ctx context.Context, params *DetectDocumentTextInput, optFns ...func(*Options)) (*DetectDocumentTextOutput, error) { - if params == nil { - params = &DetectDocumentTextInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "DetectDocumentText", params, optFns, c.addOperationDetectDocumentTextMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*DetectDocumentTextOutput) - out.ResultMetadata = metadata - return out, nil -} - -type DetectDocumentTextInput struct { - - // The input document as base64-encoded bytes or an Amazon S3 object. If you use - // the AWS CLI to call Amazon Textract operations, you can't pass image bytes. The - // document must be an image in JPEG or PNG format. - // - // If you're using an AWS SDK to call Amazon Textract, you might not need to - // base64-encode image bytes that are passed using the Bytes field. - // - // This member is required. - Document *types.Document - - noSmithyDocumentSerde -} - -type DetectDocumentTextOutput struct { - - // An array of Block objects that contain the text that's detected in the document. - Blocks []types.Block - - // - DetectDocumentTextModelVersion *string - - // Metadata about the document. It contains the number of pages that are detected - // in the document. - DocumentMetadata *types.DocumentMetadata - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationDetectDocumentTextMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpDetectDocumentText{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpDetectDocumentText{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "DetectDocumentText"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpDetectDocumentTextValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDetectDocumentText(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opDetectDocumentText(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "DetectDocumentText", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetAdapter.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetAdapter.go deleted file mode 100644 index 37ddfc14..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetAdapter.go +++ /dev/null @@ -1,182 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" - "time" -) - -// Gets configuration information for an adapter specified by an AdapterId, -// returning information on AdapterName, Description, CreationTime, AutoUpdate -// status, and FeatureTypes. -func (c *Client) GetAdapter(ctx context.Context, params *GetAdapterInput, optFns ...func(*Options)) (*GetAdapterOutput, error) { - if params == nil { - params = &GetAdapterInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "GetAdapter", params, optFns, c.addOperationGetAdapterMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*GetAdapterOutput) - out.ResultMetadata = metadata - return out, nil -} - -type GetAdapterInput struct { - - // A string containing a unique ID for the adapter. - // - // This member is required. - AdapterId *string - - noSmithyDocumentSerde -} - -type GetAdapterOutput struct { - - // A string identifying the adapter that information has been retrieved for. - AdapterId *string - - // The name of the requested adapter. - AdapterName *string - - // Binary value indicating if the adapter is being automatically updated or not. - AutoUpdate types.AutoUpdate - - // The date and time the requested adapter was created at. - CreationTime *time.Time - - // The description for the requested adapter. - Description *string - - // List of the targeted feature types for the requested adapter. - FeatureTypes []types.FeatureType - - // A set of tags (key-value pairs) associated with the adapter that has been - // retrieved. - Tags map[string]string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationGetAdapterMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetAdapter{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetAdapter{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "GetAdapter"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpGetAdapterValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAdapter(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opGetAdapter(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "GetAdapter", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetAdapterVersion.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetAdapterVersion.go deleted file mode 100644 index 9e009a62..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetAdapterVersion.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" - "time" -) - -// Gets configuration information for the specified adapter version, including: -// AdapterId, AdapterVersion, FeatureTypes, Status, StatusMessage, DatasetConfig, -// KMSKeyId, OutputConfig, Tags and EvaluationMetrics. -func (c *Client) GetAdapterVersion(ctx context.Context, params *GetAdapterVersionInput, optFns ...func(*Options)) (*GetAdapterVersionOutput, error) { - if params == nil { - params = &GetAdapterVersionInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "GetAdapterVersion", params, optFns, c.addOperationGetAdapterVersionMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*GetAdapterVersionOutput) - out.ResultMetadata = metadata - return out, nil -} - -type GetAdapterVersionInput struct { - - // A string specifying a unique ID for the adapter version you want to retrieve - // information for. - // - // This member is required. - AdapterId *string - - // A string specifying the adapter version you want to retrieve information for. - // - // This member is required. - AdapterVersion *string - - noSmithyDocumentSerde -} - -type GetAdapterVersionOutput struct { - - // A string containing a unique ID for the adapter version being retrieved. - AdapterId *string - - // A string containing the adapter version that has been retrieved. - AdapterVersion *string - - // The time that the adapter version was created. - CreationTime *time.Time - - // Specifies a dataset used to train a new adapter version. Takes a - // ManifestS3Objec as the value. - DatasetConfig *types.AdapterVersionDatasetConfig - - // The evaluation metrics (F1 score, Precision, and Recall) for the requested - // version, grouped by baseline metrics and adapter version. - EvaluationMetrics []types.AdapterVersionEvaluationMetric - - // List of the targeted feature types for the requested adapter version. - FeatureTypes []types.FeatureType - - // The identifier for your AWS Key Management Service key (AWS KMS key). Used to - // encrypt your documents. - KMSKeyId *string - - // Sets whether or not your output will go to a user created bucket. Used to set - // the name of the bucket, and the prefix on the output file. - // - // OutputConfig is an optional parameter which lets you adjust where your output - // will be placed. By default, Amazon Textract will store the results internally - // and can only be accessed by the Get API operations. With OutputConfig enabled, - // you can set the name of the bucket the output will be sent to the file prefix of - // the results where you can download your results. Additionally, you can set the - // KMSKeyID parameter to a customer master key (CMK) to encrypt your output. - // Without this parameter set Amazon Textract will encrypt server-side using the - // AWS managed CMK for Amazon S3. - // - // Decryption of Customer Content is necessary for processing of the documents by - // Amazon Textract. If your account is opted out under an AI services opt out - // policy then all unencrypted Customer Content is immediately and permanently - // deleted after the Customer Content has been processed by the service. No copy of - // of the output is retained by Amazon Textract. For information about how to opt - // out, see [Managing AI services opt-out policy.] - // - // For more information on data privacy, see the [Data Privacy FAQ]. - // - // [Managing AI services opt-out policy.]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html - // [Data Privacy FAQ]: https://aws.amazon.com/compliance/data-privacy-faq/ - OutputConfig *types.OutputConfig - - // The status of the adapter version that has been requested. - Status types.AdapterVersionStatus - - // A message that describes the status of the requested adapter version. - StatusMessage *string - - // A set of tags (key-value pairs) that are associated with the adapter version. - Tags map[string]string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationGetAdapterVersionMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetAdapterVersion{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetAdapterVersion{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "GetAdapterVersion"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpGetAdapterVersionValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetAdapterVersion(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opGetAdapterVersion(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "GetAdapterVersion", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetDocumentAnalysis.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetDocumentAnalysis.go deleted file mode 100644 index aa2d7008..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetDocumentAnalysis.go +++ /dev/null @@ -1,247 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Gets the results for an Amazon Textract asynchronous operation that analyzes -// text in a document. -// -// You start asynchronous text analysis by calling StartDocumentAnalysis, which returns a job -// identifier ( JobId ). When the text analysis operation finishes, Amazon Textract -// publishes a completion status to the Amazon Simple Notification Service (Amazon -// SNS) topic that's registered in the initial call to StartDocumentAnalysis . To -// get the results of the text-detection operation, first check that the status -// value published to the Amazon SNS topic is SUCCEEDED . If so, call -// GetDocumentAnalysis , and pass the job identifier ( JobId ) from the initial -// call to StartDocumentAnalysis . -// -// GetDocumentAnalysis returns an array of Block objects. The following types of -// information are returned: -// -// - Form data (key-value pairs). The related information is returned in two Block -// objects, each of type KEY_VALUE_SET : a KEY Block object and a VALUE Block -// object. For example, Name: Ana Silva Carolina contains a key and value. Name: is -// the key. Ana Silva Carolina is the value. -// -// - Table and table cell data. A TABLE Block object contains information about a -// detected table. A CELL Block object is returned for each cell in a table. -// -// - Lines and words of text. A LINE Block object contains one or more WORD Block -// objects. All lines and words that are detected in the document are returned -// (including text that doesn't have a relationship with the value of the -// StartDocumentAnalysis FeatureTypes input parameter). -// -// - Query. A QUERY Block object contains the query text, alias and link to the -// associated Query results block object. -// -// - Query Results. A QUERY_RESULT Block object contains the answer to the query -// and an ID that connects it to the query asked. This Block also contains a -// confidence score. -// -// While processing a document with queries, look out for -// INVALID_REQUEST_PARAMETERS output. This indicates that either the per page query -// limit has been exceeded or that the operation is trying to query a page in the -// document which doesn’t exist. -// -// Selection elements such as check boxes and option buttons (radio buttons) can -// be detected in form data and in tables. A SELECTION_ELEMENT Block object -// contains information about a selection element, including the selection status. -// -// Use the MaxResults parameter to limit the number of blocks that are returned. -// If there are more results than specified in MaxResults , the value of NextToken -// in the operation response contains a pagination token for getting the next set -// of results. To get the next page of results, call GetDocumentAnalysis , and -// populate the NextToken request parameter with the token value that's returned -// from the previous call to GetDocumentAnalysis . -// -// For more information, see [Document Text Analysis]. -// -// [Document Text Analysis]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html -func (c *Client) GetDocumentAnalysis(ctx context.Context, params *GetDocumentAnalysisInput, optFns ...func(*Options)) (*GetDocumentAnalysisOutput, error) { - if params == nil { - params = &GetDocumentAnalysisInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "GetDocumentAnalysis", params, optFns, c.addOperationGetDocumentAnalysisMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*GetDocumentAnalysisOutput) - out.ResultMetadata = metadata - return out, nil -} - -type GetDocumentAnalysisInput struct { - - // A unique identifier for the text-detection job. The JobId is returned from - // StartDocumentAnalysis . A JobId value is only valid for 7 days. - // - // This member is required. - JobId *string - - // The maximum number of results to return per paginated call. The largest value - // that you can specify is 1,000. If you specify a value greater than 1,000, a - // maximum of 1,000 results is returned. The default value is 1,000. - MaxResults *int32 - - // If the previous response was incomplete (because there are more blocks to - // retrieve), Amazon Textract returns a pagination token in the response. You can - // use this pagination token to retrieve the next set of blocks. - NextToken *string - - noSmithyDocumentSerde -} - -type GetDocumentAnalysisOutput struct { - - // - AnalyzeDocumentModelVersion *string - - // The results of the text-analysis operation. - Blocks []types.Block - - // Information about a document that Amazon Textract processed. DocumentMetadata - // is returned in every page of paginated responses from an Amazon Textract video - // operation. - DocumentMetadata *types.DocumentMetadata - - // The current status of the text detection job. - JobStatus types.JobStatus - - // If the response is truncated, Amazon Textract returns this token. You can use - // this token in the subsequent request to retrieve the next set of text detection - // results. - NextToken *string - - // Returns if the detection job could not be completed. Contains explanation for - // what error occured. - StatusMessage *string - - // A list of warnings that occurred during the document-analysis operation. - Warnings []types.Warning - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationGetDocumentAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDocumentAnalysis{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDocumentAnalysis{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "GetDocumentAnalysis"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpGetDocumentAnalysisValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDocumentAnalysis(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opGetDocumentAnalysis(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "GetDocumentAnalysis", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetDocumentTextDetection.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetDocumentTextDetection.go deleted file mode 100644 index 7a5d3922..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetDocumentTextDetection.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Gets the results for an Amazon Textract asynchronous operation that detects -// text in a document. Amazon Textract can detect lines of text and the words that -// make up a line of text. -// -// You start asynchronous text detection by calling StartDocumentTextDetection, which returns a job -// identifier ( JobId ). When the text detection operation finishes, Amazon -// Textract publishes a completion status to the Amazon Simple Notification Service -// (Amazon SNS) topic that's registered in the initial call to -// StartDocumentTextDetection . To get the results of the text-detection operation, -// first check that the status value published to the Amazon SNS topic is SUCCEEDED -// . If so, call GetDocumentTextDetection , and pass the job identifier ( JobId ) -// from the initial call to StartDocumentTextDetection . -// -// GetDocumentTextDetection returns an array of Block objects. -// -// Each document page has as an associated Block of type PAGE. Each PAGE Block -// object is the parent of LINE Block objects that represent the lines of detected -// text on a page. A LINE Block object is a parent for each word that makes up the -// line. Words are represented by Block objects of type WORD. -// -// Use the MaxResults parameter to limit the number of blocks that are returned. -// If there are more results than specified in MaxResults , the value of NextToken -// in the operation response contains a pagination token for getting the next set -// of results. To get the next page of results, call GetDocumentTextDetection , and -// populate the NextToken request parameter with the token value that's returned -// from the previous call to GetDocumentTextDetection . -// -// For more information, see [Document Text Detection]. -// -// [Document Text Detection]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html -func (c *Client) GetDocumentTextDetection(ctx context.Context, params *GetDocumentTextDetectionInput, optFns ...func(*Options)) (*GetDocumentTextDetectionOutput, error) { - if params == nil { - params = &GetDocumentTextDetectionInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "GetDocumentTextDetection", params, optFns, c.addOperationGetDocumentTextDetectionMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*GetDocumentTextDetectionOutput) - out.ResultMetadata = metadata - return out, nil -} - -type GetDocumentTextDetectionInput struct { - - // A unique identifier for the text detection job. The JobId is returned from - // StartDocumentTextDetection . A JobId value is only valid for 7 days. - // - // This member is required. - JobId *string - - // The maximum number of results to return per paginated call. The largest value - // you can specify is 1,000. If you specify a value greater than 1,000, a maximum - // of 1,000 results is returned. The default value is 1,000. - MaxResults *int32 - - // If the previous response was incomplete (because there are more blocks to - // retrieve), Amazon Textract returns a pagination token in the response. You can - // use this pagination token to retrieve the next set of blocks. - NextToken *string - - noSmithyDocumentSerde -} - -type GetDocumentTextDetectionOutput struct { - - // The results of the text-detection operation. - Blocks []types.Block - - // - DetectDocumentTextModelVersion *string - - // Information about a document that Amazon Textract processed. DocumentMetadata - // is returned in every page of paginated responses from an Amazon Textract video - // operation. - DocumentMetadata *types.DocumentMetadata - - // The current status of the text detection job. - JobStatus types.JobStatus - - // If the response is truncated, Amazon Textract returns this token. You can use - // this token in the subsequent request to retrieve the next set of text-detection - // results. - NextToken *string - - // Returns if the detection job could not be completed. Contains explanation for - // what error occured. - StatusMessage *string - - // A list of warnings that occurred during the text-detection operation for the - // document. - Warnings []types.Warning - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationGetDocumentTextDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetDocumentTextDetection{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetDocumentTextDetection{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "GetDocumentTextDetection"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpGetDocumentTextDetectionValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetDocumentTextDetection(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opGetDocumentTextDetection(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "GetDocumentTextDetection", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetExpenseAnalysis.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetExpenseAnalysis.go deleted file mode 100644 index 6d74eb52..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetExpenseAnalysis.go +++ /dev/null @@ -1,217 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Gets the results for an Amazon Textract asynchronous operation that analyzes -// invoices and receipts. Amazon Textract finds contact information, items -// purchased, and vendor name, from input invoices and receipts. -// -// You start asynchronous invoice/receipt analysis by calling StartExpenseAnalysis, which returns a -// job identifier ( JobId ). Upon completion of the invoice/receipt analysis, -// Amazon Textract publishes the completion status to the Amazon Simple -// Notification Service (Amazon SNS) topic. This topic must be registered in the -// initial call to StartExpenseAnalysis . To get the results of the invoice/receipt -// analysis operation, first ensure that the status value published to the Amazon -// SNS topic is SUCCEEDED . If so, call GetExpenseAnalysis , and pass the job -// identifier ( JobId ) from the initial call to StartExpenseAnalysis . -// -// Use the MaxResults parameter to limit the number of blocks that are returned. -// If there are more results than specified in MaxResults , the value of NextToken -// in the operation response contains a pagination token for getting the next set -// of results. To get the next page of results, call GetExpenseAnalysis , and -// populate the NextToken request parameter with the token value that's returned -// from the previous call to GetExpenseAnalysis . -// -// For more information, see [Analyzing Invoices and Receipts]. -// -// [Analyzing Invoices and Receipts]: https://docs.aws.amazon.com/textract/latest/dg/invoices-receipts.html -func (c *Client) GetExpenseAnalysis(ctx context.Context, params *GetExpenseAnalysisInput, optFns ...func(*Options)) (*GetExpenseAnalysisOutput, error) { - if params == nil { - params = &GetExpenseAnalysisInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "GetExpenseAnalysis", params, optFns, c.addOperationGetExpenseAnalysisMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*GetExpenseAnalysisOutput) - out.ResultMetadata = metadata - return out, nil -} - -type GetExpenseAnalysisInput struct { - - // A unique identifier for the text detection job. The JobId is returned from - // StartExpenseAnalysis . A JobId value is only valid for 7 days. - // - // This member is required. - JobId *string - - // The maximum number of results to return per paginated call. The largest value - // you can specify is 20. If you specify a value greater than 20, a maximum of 20 - // results is returned. The default value is 20. - MaxResults *int32 - - // If the previous response was incomplete (because there are more blocks to - // retrieve), Amazon Textract returns a pagination token in the response. You can - // use this pagination token to retrieve the next set of blocks. - NextToken *string - - noSmithyDocumentSerde -} - -type GetExpenseAnalysisOutput struct { - - // The current model version of AnalyzeExpense. - AnalyzeExpenseModelVersion *string - - // Information about a document that Amazon Textract processed. DocumentMetadata - // is returned in every page of paginated responses from an Amazon Textract - // operation. - DocumentMetadata *types.DocumentMetadata - - // The expenses detected by Amazon Textract. - ExpenseDocuments []types.ExpenseDocument - - // The current status of the text detection job. - JobStatus types.JobStatus - - // If the response is truncated, Amazon Textract returns this token. You can use - // this token in the subsequent request to retrieve the next set of text-detection - // results. - NextToken *string - - // Returns if the detection job could not be completed. Contains explanation for - // what error occured. - StatusMessage *string - - // A list of warnings that occurred during the text-detection operation for the - // document. - Warnings []types.Warning - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationGetExpenseAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetExpenseAnalysis{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetExpenseAnalysis{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "GetExpenseAnalysis"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpGetExpenseAnalysisValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetExpenseAnalysis(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opGetExpenseAnalysis(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "GetExpenseAnalysis", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetLendingAnalysis.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetLendingAnalysis.go deleted file mode 100644 index 72449187..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetLendingAnalysis.go +++ /dev/null @@ -1,205 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Gets the results for an Amazon Textract asynchronous operation that analyzes -// text in a lending document. -// -// You start asynchronous text analysis by calling StartLendingAnalysis , which -// returns a job identifier ( JobId ). When the text analysis operation finishes, -// Amazon Textract publishes a completion status to the Amazon Simple Notification -// Service (Amazon SNS) topic that's registered in the initial call to -// StartLendingAnalysis . -// -// To get the results of the text analysis operation, first check that the status -// value published to the Amazon SNS topic is SUCCEEDED. If so, call -// GetLendingAnalysis, and pass the job identifier ( JobId ) from the initial call -// to StartLendingAnalysis . -func (c *Client) GetLendingAnalysis(ctx context.Context, params *GetLendingAnalysisInput, optFns ...func(*Options)) (*GetLendingAnalysisOutput, error) { - if params == nil { - params = &GetLendingAnalysisInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "GetLendingAnalysis", params, optFns, c.addOperationGetLendingAnalysisMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*GetLendingAnalysisOutput) - out.ResultMetadata = metadata - return out, nil -} - -type GetLendingAnalysisInput struct { - - // A unique identifier for the lending or text-detection job. The JobId is - // returned from StartLendingAnalysis . A JobId value is only valid for 7 days. - // - // This member is required. - JobId *string - - // The maximum number of results to return per paginated call. The largest value - // that you can specify is 30. If you specify a value greater than 30, a maximum of - // 30 results is returned. The default value is 30. - MaxResults *int32 - - // If the previous response was incomplete, Amazon Textract returns a pagination - // token in the response. You can use this pagination token to retrieve the next - // set of lending results. - NextToken *string - - noSmithyDocumentSerde -} - -type GetLendingAnalysisOutput struct { - - // The current model version of the Analyze Lending API. - AnalyzeLendingModelVersion *string - - // Information about the input document. - DocumentMetadata *types.DocumentMetadata - - // The current status of the lending analysis job. - JobStatus types.JobStatus - - // If the response is truncated, Amazon Textract returns this token. You can use - // this token in the subsequent request to retrieve the next set of lending - // results. - NextToken *string - - // Holds the information returned by one of AmazonTextract's document analysis - // operations for the pinstripe. - Results []types.LendingResult - - // Returns if the lending analysis job could not be completed. Contains - // explanation for what error occurred. - StatusMessage *string - - // A list of warnings that occurred during the lending analysis operation. - Warnings []types.Warning - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationGetLendingAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLendingAnalysis{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetLendingAnalysis{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "GetLendingAnalysis"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpGetLendingAnalysisValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLendingAnalysis(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opGetLendingAnalysis(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "GetLendingAnalysis", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetLendingAnalysisSummary.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetLendingAnalysisSummary.go deleted file mode 100644 index 669f9e98..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_GetLendingAnalysisSummary.go +++ /dev/null @@ -1,192 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Gets summarized results for the StartLendingAnalysis operation, which analyzes -// text in a lending document. The returned summary consists of information about -// documents grouped together by a common document type. Information like detected -// signatures, page numbers, and split documents is returned with respect to the -// type of grouped document. -// -// You start asynchronous text analysis by calling StartLendingAnalysis , which -// returns a job identifier ( JobId ). When the text analysis operation finishes, -// Amazon Textract publishes a completion status to the Amazon Simple Notification -// Service (Amazon SNS) topic that's registered in the initial call to -// StartLendingAnalysis . -// -// To get the results of the text analysis operation, first check that the status -// value published to the Amazon SNS topic is SUCCEEDED. If so, call -// GetLendingAnalysisSummary , and pass the job identifier ( JobId ) from the -// initial call to StartLendingAnalysis . -func (c *Client) GetLendingAnalysisSummary(ctx context.Context, params *GetLendingAnalysisSummaryInput, optFns ...func(*Options)) (*GetLendingAnalysisSummaryOutput, error) { - if params == nil { - params = &GetLendingAnalysisSummaryInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "GetLendingAnalysisSummary", params, optFns, c.addOperationGetLendingAnalysisSummaryMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*GetLendingAnalysisSummaryOutput) - out.ResultMetadata = metadata - return out, nil -} - -type GetLendingAnalysisSummaryInput struct { - - // A unique identifier for the lending or text-detection job. The JobId is - // returned from StartLendingAnalysis. A JobId value is only valid for 7 days. - // - // This member is required. - JobId *string - - noSmithyDocumentSerde -} - -type GetLendingAnalysisSummaryOutput struct { - - // The current model version of the Analyze Lending API. - AnalyzeLendingModelVersion *string - - // Information about the input document. - DocumentMetadata *types.DocumentMetadata - - // The current status of the lending analysis job. - JobStatus types.JobStatus - - // Returns if the lending analysis could not be completed. Contains explanation - // for what error occurred. - StatusMessage *string - - // Contains summary information for documents grouped by type. - Summary *types.LendingSummary - - // A list of warnings that occurred during the lending analysis operation. - Warnings []types.Warning - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationGetLendingAnalysisSummaryMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetLendingAnalysisSummary{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetLendingAnalysisSummary{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "GetLendingAnalysisSummary"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpGetLendingAnalysisSummaryValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetLendingAnalysisSummary(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opGetLendingAnalysisSummary(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "GetLendingAnalysisSummary", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListAdapterVersions.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListAdapterVersions.go deleted file mode 100644 index 47da0c84..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListAdapterVersions.go +++ /dev/null @@ -1,271 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" - "time" -) - -// List all version of an adapter that meet the specified filtration criteria. -func (c *Client) ListAdapterVersions(ctx context.Context, params *ListAdapterVersionsInput, optFns ...func(*Options)) (*ListAdapterVersionsOutput, error) { - if params == nil { - params = &ListAdapterVersionsInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "ListAdapterVersions", params, optFns, c.addOperationListAdapterVersionsMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*ListAdapterVersionsOutput) - out.ResultMetadata = metadata - return out, nil -} - -type ListAdapterVersionsInput struct { - - // A string containing a unique ID for the adapter to match for when listing - // adapter versions. - AdapterId *string - - // Specifies the lower bound for the ListAdapterVersions operation. Ensures - // ListAdapterVersions returns only adapter versions created after the specified - // creation time. - AfterCreationTime *time.Time - - // Specifies the upper bound for the ListAdapterVersions operation. Ensures - // ListAdapterVersions returns only adapter versions created after the specified - // creation time. - BeforeCreationTime *time.Time - - // The maximum number of results to return when listing adapter versions. - MaxResults *int32 - - // Identifies the next page of results to return when listing adapter versions. - NextToken *string - - noSmithyDocumentSerde -} - -type ListAdapterVersionsOutput struct { - - // Adapter versions that match the filtering criteria specified when calling - // ListAdapters. - AdapterVersions []types.AdapterVersionOverview - - // Identifies the next page of results to return when listing adapter versions. - NextToken *string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationListAdapterVersionsMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpListAdapterVersions{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListAdapterVersions{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "ListAdapterVersions"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAdapterVersions(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -// ListAdapterVersionsPaginatorOptions is the paginator options for -// ListAdapterVersions -type ListAdapterVersionsPaginatorOptions struct { - // The maximum number of results to return when listing adapter versions. - Limit int32 - - // Set to true if pagination should stop if the service returns a pagination token - // that matches the most recent token provided to the service. - StopOnDuplicateToken bool -} - -// ListAdapterVersionsPaginator is a paginator for ListAdapterVersions -type ListAdapterVersionsPaginator struct { - options ListAdapterVersionsPaginatorOptions - client ListAdapterVersionsAPIClient - params *ListAdapterVersionsInput - nextToken *string - firstPage bool -} - -// NewListAdapterVersionsPaginator returns a new ListAdapterVersionsPaginator -func NewListAdapterVersionsPaginator(client ListAdapterVersionsAPIClient, params *ListAdapterVersionsInput, optFns ...func(*ListAdapterVersionsPaginatorOptions)) *ListAdapterVersionsPaginator { - if params == nil { - params = &ListAdapterVersionsInput{} - } - - options := ListAdapterVersionsPaginatorOptions{} - if params.MaxResults != nil { - options.Limit = *params.MaxResults - } - - for _, fn := range optFns { - fn(&options) - } - - return &ListAdapterVersionsPaginator{ - options: options, - client: client, - params: params, - firstPage: true, - nextToken: params.NextToken, - } -} - -// HasMorePages returns a boolean indicating whether more pages are available -func (p *ListAdapterVersionsPaginator) HasMorePages() bool { - return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) -} - -// NextPage retrieves the next ListAdapterVersions page. -func (p *ListAdapterVersionsPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAdapterVersionsOutput, error) { - if !p.HasMorePages() { - return nil, fmt.Errorf("no more pages available") - } - - params := *p.params - params.NextToken = p.nextToken - - var limit *int32 - if p.options.Limit > 0 { - limit = &p.options.Limit - } - params.MaxResults = limit - - optFns = append([]func(*Options){ - addIsPaginatorUserAgent, - }, optFns...) - result, err := p.client.ListAdapterVersions(ctx, ¶ms, optFns...) - if err != nil { - return nil, err - } - p.firstPage = false - - prevToken := p.nextToken - p.nextToken = result.NextToken - - if p.options.StopOnDuplicateToken && - prevToken != nil && - p.nextToken != nil && - *prevToken == *p.nextToken { - p.nextToken = nil - } - - return result, nil -} - -// ListAdapterVersionsAPIClient is a client that implements the -// ListAdapterVersions operation. -type ListAdapterVersionsAPIClient interface { - ListAdapterVersions(context.Context, *ListAdapterVersionsInput, ...func(*Options)) (*ListAdapterVersionsOutput, error) -} - -var _ ListAdapterVersionsAPIClient = (*Client)(nil) - -func newServiceMetadataMiddleware_opListAdapterVersions(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "ListAdapterVersions", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListAdapters.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListAdapters.go deleted file mode 100644 index 10371554..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListAdapters.go +++ /dev/null @@ -1,263 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" - "time" -) - -// Lists all adapters that match the specified filtration criteria. -func (c *Client) ListAdapters(ctx context.Context, params *ListAdaptersInput, optFns ...func(*Options)) (*ListAdaptersOutput, error) { - if params == nil { - params = &ListAdaptersInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "ListAdapters", params, optFns, c.addOperationListAdaptersMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*ListAdaptersOutput) - out.ResultMetadata = metadata - return out, nil -} - -type ListAdaptersInput struct { - - // Specifies the lower bound for the ListAdapters operation. Ensures ListAdapters - // returns only adapters created after the specified creation time. - AfterCreationTime *time.Time - - // Specifies the upper bound for the ListAdapters operation. Ensures ListAdapters - // returns only adapters created before the specified creation time. - BeforeCreationTime *time.Time - - // The maximum number of results to return when listing adapters. - MaxResults *int32 - - // Identifies the next page of results to return when listing adapters. - NextToken *string - - noSmithyDocumentSerde -} - -type ListAdaptersOutput struct { - - // A list of adapters that matches the filtering criteria specified when calling - // ListAdapters. - Adapters []types.AdapterOverview - - // Identifies the next page of results to return when listing adapters. - NextToken *string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationListAdaptersMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpListAdapters{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListAdapters{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "ListAdapters"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListAdapters(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -// ListAdaptersPaginatorOptions is the paginator options for ListAdapters -type ListAdaptersPaginatorOptions struct { - // The maximum number of results to return when listing adapters. - Limit int32 - - // Set to true if pagination should stop if the service returns a pagination token - // that matches the most recent token provided to the service. - StopOnDuplicateToken bool -} - -// ListAdaptersPaginator is a paginator for ListAdapters -type ListAdaptersPaginator struct { - options ListAdaptersPaginatorOptions - client ListAdaptersAPIClient - params *ListAdaptersInput - nextToken *string - firstPage bool -} - -// NewListAdaptersPaginator returns a new ListAdaptersPaginator -func NewListAdaptersPaginator(client ListAdaptersAPIClient, params *ListAdaptersInput, optFns ...func(*ListAdaptersPaginatorOptions)) *ListAdaptersPaginator { - if params == nil { - params = &ListAdaptersInput{} - } - - options := ListAdaptersPaginatorOptions{} - if params.MaxResults != nil { - options.Limit = *params.MaxResults - } - - for _, fn := range optFns { - fn(&options) - } - - return &ListAdaptersPaginator{ - options: options, - client: client, - params: params, - firstPage: true, - nextToken: params.NextToken, - } -} - -// HasMorePages returns a boolean indicating whether more pages are available -func (p *ListAdaptersPaginator) HasMorePages() bool { - return p.firstPage || (p.nextToken != nil && len(*p.nextToken) != 0) -} - -// NextPage retrieves the next ListAdapters page. -func (p *ListAdaptersPaginator) NextPage(ctx context.Context, optFns ...func(*Options)) (*ListAdaptersOutput, error) { - if !p.HasMorePages() { - return nil, fmt.Errorf("no more pages available") - } - - params := *p.params - params.NextToken = p.nextToken - - var limit *int32 - if p.options.Limit > 0 { - limit = &p.options.Limit - } - params.MaxResults = limit - - optFns = append([]func(*Options){ - addIsPaginatorUserAgent, - }, optFns...) - result, err := p.client.ListAdapters(ctx, ¶ms, optFns...) - if err != nil { - return nil, err - } - p.firstPage = false - - prevToken := p.nextToken - p.nextToken = result.NextToken - - if p.options.StopOnDuplicateToken && - prevToken != nil && - p.nextToken != nil && - *prevToken == *p.nextToken { - p.nextToken = nil - } - - return result, nil -} - -// ListAdaptersAPIClient is a client that implements the ListAdapters operation. -type ListAdaptersAPIClient interface { - ListAdapters(context.Context, *ListAdaptersInput, ...func(*Options)) (*ListAdaptersOutput, error) -} - -var _ ListAdaptersAPIClient = (*Client)(nil) - -func newServiceMetadataMiddleware_opListAdapters(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "ListAdapters", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListTagsForResource.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListTagsForResource.go deleted file mode 100644 index db76f397..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_ListTagsForResource.go +++ /dev/null @@ -1,159 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Lists all tags for an Amazon Textract resource. -func (c *Client) ListTagsForResource(ctx context.Context, params *ListTagsForResourceInput, optFns ...func(*Options)) (*ListTagsForResourceOutput, error) { - if params == nil { - params = &ListTagsForResourceInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "ListTagsForResource", params, optFns, c.addOperationListTagsForResourceMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*ListTagsForResourceOutput) - out.ResultMetadata = metadata - return out, nil -} - -type ListTagsForResourceInput struct { - - // The Amazon Resource Name (ARN) that specifies the resource to list tags for. - // - // This member is required. - ResourceARN *string - - noSmithyDocumentSerde -} - -type ListTagsForResourceOutput struct { - - // A set of tags (key-value pairs) that are part of the requested resource. - Tags map[string]string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationListTagsForResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpListTagsForResource{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpListTagsForResource{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "ListTagsForResource"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpListTagsForResourceValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opListTagsForResource(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opListTagsForResource(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "ListTagsForResource", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartDocumentAnalysis.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartDocumentAnalysis.go deleted file mode 100644 index 11363ac3..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartDocumentAnalysis.go +++ /dev/null @@ -1,224 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Starts the asynchronous analysis of an input document for relationships between -// detected items such as key-value pairs, tables, and selection elements. -// -// StartDocumentAnalysis can analyze text in documents that are in JPEG, PNG, -// TIFF, and PDF format. The documents are stored in an Amazon S3 bucket. Use DocumentLocationto -// specify the bucket name and file name of the document. -// -// StartDocumentAnalysis returns a job identifier ( JobId ) that you use to get the -// results of the operation. When text analysis is finished, Amazon Textract -// publishes a completion status to the Amazon Simple Notification Service (Amazon -// SNS) topic that you specify in NotificationChannel . To get the results of the -// text analysis operation, first check that the status value published to the -// Amazon SNS topic is SUCCEEDED . If so, call GetDocumentAnalysis, and pass the job identifier ( JobId -// ) from the initial call to StartDocumentAnalysis . -// -// For more information, see [Document Text Analysis]. -// -// [Document Text Analysis]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-analyzing.html -func (c *Client) StartDocumentAnalysis(ctx context.Context, params *StartDocumentAnalysisInput, optFns ...func(*Options)) (*StartDocumentAnalysisOutput, error) { - if params == nil { - params = &StartDocumentAnalysisInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "StartDocumentAnalysis", params, optFns, c.addOperationStartDocumentAnalysisMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*StartDocumentAnalysisOutput) - out.ResultMetadata = metadata - return out, nil -} - -type StartDocumentAnalysisInput struct { - - // The location of the document to be processed. - // - // This member is required. - DocumentLocation *types.DocumentLocation - - // A list of the types of analysis to perform. Add TABLES to the list to return - // information about the tables that are detected in the input document. Add FORMS - // to return detected form data. To perform both types of analysis, add TABLES and - // FORMS to FeatureTypes . All lines and words detected in the document are - // included in the response (including text that isn't related to the value of - // FeatureTypes ). - // - // This member is required. - FeatureTypes []types.FeatureType - - // Specifies the adapter to be used when analyzing a document. - AdaptersConfig *types.AdaptersConfig - - // The idempotent token that you use to identify the start request. If you use the - // same token with multiple StartDocumentAnalysis requests, the same JobId is - // returned. Use ClientRequestToken to prevent the same job from being - // accidentally started more than once. For more information, see [Calling Amazon Textract Asynchronous Operations]. - // - // [Calling Amazon Textract Asynchronous Operations]: https://docs.aws.amazon.com/textract/latest/dg/api-async.html - ClientRequestToken *string - - // An identifier that you specify that's included in the completion notification - // published to the Amazon SNS topic. For example, you can use JobTag to identify - // the type of document that the completion notification corresponds to (such as a - // tax form or a receipt). - JobTag *string - - // The KMS key used to encrypt the inference results. This can be in either Key ID - // or Key Alias format. When a KMS key is provided, the KMS key will be used for - // server-side encryption of the objects in the customer bucket. When this - // parameter is not enabled, the result will be encrypted server side,using SSE-S3. - KMSKeyId *string - - // The Amazon SNS topic ARN that you want Amazon Textract to publish the - // completion status of the operation to. - NotificationChannel *types.NotificationChannel - - // Sets if the output will go to a customer defined bucket. By default, Amazon - // Textract will save the results internally to be accessed by the - // GetDocumentAnalysis operation. - OutputConfig *types.OutputConfig - - // - QueriesConfig *types.QueriesConfig - - noSmithyDocumentSerde -} - -type StartDocumentAnalysisOutput struct { - - // The identifier for the document text detection job. Use JobId to identify the - // job in a subsequent call to GetDocumentAnalysis . A JobId value is only valid - // for 7 days. - JobId *string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationStartDocumentAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartDocumentAnalysis{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartDocumentAnalysis{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "StartDocumentAnalysis"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpStartDocumentAnalysisValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartDocumentAnalysis(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opStartDocumentAnalysis(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "StartDocumentAnalysis", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartDocumentTextDetection.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartDocumentTextDetection.go deleted file mode 100644 index bf1d4b27..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartDocumentTextDetection.go +++ /dev/null @@ -1,208 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Starts the asynchronous detection of text in a document. Amazon Textract can -// detect lines of text and the words that make up a line of text. -// -// StartDocumentTextDetection can analyze text in documents that are in JPEG, PNG, -// TIFF, and PDF format. The documents are stored in an Amazon S3 bucket. Use DocumentLocationto -// specify the bucket name and file name of the document. -// -// StartTextDetection returns a job identifier ( JobId ) that you use to get the -// results of the operation. When text detection is finished, Amazon Textract -// publishes a completion status to the Amazon Simple Notification Service (Amazon -// SNS) topic that you specify in NotificationChannel . To get the results of the -// text detection operation, first check that the status value published to the -// Amazon SNS topic is SUCCEEDED . If so, call GetDocumentTextDetection, and pass the job identifier ( JobId -// ) from the initial call to StartDocumentTextDetection . -// -// For more information, see [Document Text Detection]. -// -// [Document Text Detection]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works-detecting.html -func (c *Client) StartDocumentTextDetection(ctx context.Context, params *StartDocumentTextDetectionInput, optFns ...func(*Options)) (*StartDocumentTextDetectionOutput, error) { - if params == nil { - params = &StartDocumentTextDetectionInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "StartDocumentTextDetection", params, optFns, c.addOperationStartDocumentTextDetectionMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*StartDocumentTextDetectionOutput) - out.ResultMetadata = metadata - return out, nil -} - -type StartDocumentTextDetectionInput struct { - - // The location of the document to be processed. - // - // This member is required. - DocumentLocation *types.DocumentLocation - - // The idempotent token that's used to identify the start request. If you use the - // same token with multiple StartDocumentTextDetection requests, the same JobId is - // returned. Use ClientRequestToken to prevent the same job from being - // accidentally started more than once. For more information, see [Calling Amazon Textract Asynchronous Operations]. - // - // [Calling Amazon Textract Asynchronous Operations]: https://docs.aws.amazon.com/textract/latest/dg/api-async.html - ClientRequestToken *string - - // An identifier that you specify that's included in the completion notification - // published to the Amazon SNS topic. For example, you can use JobTag to identify - // the type of document that the completion notification corresponds to (such as a - // tax form or a receipt). - JobTag *string - - // The KMS key used to encrypt the inference results. This can be in either Key ID - // or Key Alias format. When a KMS key is provided, the KMS key will be used for - // server-side encryption of the objects in the customer bucket. When this - // parameter is not enabled, the result will be encrypted server side,using SSE-S3. - KMSKeyId *string - - // The Amazon SNS topic ARN that you want Amazon Textract to publish the - // completion status of the operation to. - NotificationChannel *types.NotificationChannel - - // Sets if the output will go to a customer defined bucket. By default Amazon - // Textract will save the results internally to be accessed with the - // GetDocumentTextDetection operation. - OutputConfig *types.OutputConfig - - noSmithyDocumentSerde -} - -type StartDocumentTextDetectionOutput struct { - - // The identifier of the text detection job for the document. Use JobId to - // identify the job in a subsequent call to GetDocumentTextDetection . A JobId - // value is only valid for 7 days. - JobId *string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationStartDocumentTextDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartDocumentTextDetection{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartDocumentTextDetection{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "StartDocumentTextDetection"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpStartDocumentTextDetectionValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartDocumentTextDetection(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opStartDocumentTextDetection(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "StartDocumentTextDetection", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartExpenseAnalysis.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartExpenseAnalysis.go deleted file mode 100644 index d4b6a78a..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartExpenseAnalysis.go +++ /dev/null @@ -1,209 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Starts the asynchronous analysis of invoices or receipts for data like contact -// information, items purchased, and vendor names. -// -// StartExpenseAnalysis can analyze text in documents that are in JPEG, PNG, and -// PDF format. The documents must be stored in an Amazon S3 bucket. Use the DocumentLocation -// parameter to specify the name of your S3 bucket and the name of the document in -// that bucket. -// -// StartExpenseAnalysis returns a job identifier ( JobId ) that you will provide to -// GetExpenseAnalysis to retrieve the results of the operation. When the analysis -// of the input invoices/receipts is finished, Amazon Textract publishes a -// completion status to the Amazon Simple Notification Service (Amazon SNS) topic -// that you provide to the NotificationChannel . To obtain the results of the -// invoice and receipt analysis operation, ensure that the status value published -// to the Amazon SNS topic is SUCCEEDED . If so, call GetExpenseAnalysis, and pass the job -// identifier ( JobId ) that was returned by your call to StartExpenseAnalysis . -// -// For more information, see [Analyzing Invoices and Receipts]. -// -// [Analyzing Invoices and Receipts]: https://docs.aws.amazon.com/textract/latest/dg/invoice-receipts.html -func (c *Client) StartExpenseAnalysis(ctx context.Context, params *StartExpenseAnalysisInput, optFns ...func(*Options)) (*StartExpenseAnalysisOutput, error) { - if params == nil { - params = &StartExpenseAnalysisInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "StartExpenseAnalysis", params, optFns, c.addOperationStartExpenseAnalysisMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*StartExpenseAnalysisOutput) - out.ResultMetadata = metadata - return out, nil -} - -type StartExpenseAnalysisInput struct { - - // The location of the document to be processed. - // - // This member is required. - DocumentLocation *types.DocumentLocation - - // The idempotent token that's used to identify the start request. If you use the - // same token with multiple StartDocumentTextDetection requests, the same JobId is - // returned. Use ClientRequestToken to prevent the same job from being - // accidentally started more than once. For more information, see [Calling Amazon Textract Asynchronous Operations] - // - // [Calling Amazon Textract Asynchronous Operations]: https://docs.aws.amazon.com/textract/latest/dg/api-async.html - ClientRequestToken *string - - // An identifier you specify that's included in the completion notification - // published to the Amazon SNS topic. For example, you can use JobTag to identify - // the type of document that the completion notification corresponds to (such as a - // tax form or a receipt). - JobTag *string - - // The KMS key used to encrypt the inference results. This can be in either Key ID - // or Key Alias format. When a KMS key is provided, the KMS key will be used for - // server-side encryption of the objects in the customer bucket. When this - // parameter is not enabled, the result will be encrypted server side,using SSE-S3. - KMSKeyId *string - - // The Amazon SNS topic ARN that you want Amazon Textract to publish the - // completion status of the operation to. - NotificationChannel *types.NotificationChannel - - // Sets if the output will go to a customer defined bucket. By default, Amazon - // Textract will save the results internally to be accessed by the - // GetExpenseAnalysis operation. - OutputConfig *types.OutputConfig - - noSmithyDocumentSerde -} - -type StartExpenseAnalysisOutput struct { - - // A unique identifier for the text detection job. The JobId is returned from - // StartExpenseAnalysis . A JobId value is only valid for 7 days. - JobId *string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationStartExpenseAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartExpenseAnalysis{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartExpenseAnalysis{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "StartExpenseAnalysis"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpStartExpenseAnalysisValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartExpenseAnalysis(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opStartExpenseAnalysis(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "StartExpenseAnalysis", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartLendingAnalysis.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartLendingAnalysis.go deleted file mode 100644 index 633da403..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_StartLendingAnalysis.go +++ /dev/null @@ -1,241 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Starts the classification and analysis of an input document. -// StartLendingAnalysis initiates the classification and analysis of a packet of -// lending documents. StartLendingAnalysis operates on a document file located in -// an Amazon S3 bucket. -// -// StartLendingAnalysis can analyze text in documents that are in one of the -// following formats: JPEG, PNG, TIFF, PDF. Use DocumentLocation to specify the -// bucket name and the file name of the document. -// -// StartLendingAnalysis returns a job identifier ( JobId ) that you use to get the -// results of the operation. When the text analysis is finished, Amazon Textract -// publishes a completion status to the Amazon Simple Notification Service (Amazon -// SNS) topic that you specify in NotificationChannel . To get the results of the -// text analysis operation, first check that the status value published to the -// Amazon SNS topic is SUCCEEDED. If the status is SUCCEEDED you can call either -// GetLendingAnalysis or GetLendingAnalysisSummary and provide the JobId to obtain -// the results of the analysis. -// -// If using OutputConfig to specify an Amazon S3 bucket, the output will be -// contained within the specified prefix in a directory labeled with the job-id. In -// the directory there are 3 sub-directories: -// -// - detailedResponse (contains the GetLendingAnalysis response) -// -// - summaryResponse (for the GetLendingAnalysisSummary response) -// -// - splitDocuments (documents split across logical boundaries) -func (c *Client) StartLendingAnalysis(ctx context.Context, params *StartLendingAnalysisInput, optFns ...func(*Options)) (*StartLendingAnalysisOutput, error) { - if params == nil { - params = &StartLendingAnalysisInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "StartLendingAnalysis", params, optFns, c.addOperationStartLendingAnalysisMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*StartLendingAnalysisOutput) - out.ResultMetadata = metadata - return out, nil -} - -type StartLendingAnalysisInput struct { - - // The Amazon S3 bucket that contains the document to be processed. It's used by - // asynchronous operations. - // - // The input document can be an image file in JPEG or PNG format. It can also be a - // file in PDF format. - // - // This member is required. - DocumentLocation *types.DocumentLocation - - // The idempotent token that you use to identify the start request. If you use the - // same token with multiple StartLendingAnalysis requests, the same JobId is - // returned. Use ClientRequestToken to prevent the same job from being - // accidentally started more than once. For more information, see [Calling Amazon Textract Asynchronous Operations]. - // - // [Calling Amazon Textract Asynchronous Operations]: https://docs.aws.amazon.com/textract/latest/dg/api-sync.html - ClientRequestToken *string - - // An identifier that you specify to be included in the completion notification - // published to the Amazon SNS topic. For example, you can use JobTag to identify - // the type of document that the completion notification corresponds to (such as a - // tax form or a receipt). - JobTag *string - - // The KMS key used to encrypt the inference results. This can be in either Key ID - // or Key Alias format. When a KMS key is provided, the KMS key will be used for - // server-side encryption of the objects in the customer bucket. When this - // parameter is not enabled, the result will be encrypted server side, using - // SSE-S3. - KMSKeyId *string - - // The Amazon Simple Notification Service (Amazon SNS) topic to which Amazon - // Textract publishes the completion status of an asynchronous document operation. - NotificationChannel *types.NotificationChannel - - // Sets whether or not your output will go to a user created bucket. Used to set - // the name of the bucket, and the prefix on the output file. - // - // OutputConfig is an optional parameter which lets you adjust where your output - // will be placed. By default, Amazon Textract will store the results internally - // and can only be accessed by the Get API operations. With OutputConfig enabled, - // you can set the name of the bucket the output will be sent to the file prefix of - // the results where you can download your results. Additionally, you can set the - // KMSKeyID parameter to a customer master key (CMK) to encrypt your output. - // Without this parameter set Amazon Textract will encrypt server-side using the - // AWS managed CMK for Amazon S3. - // - // Decryption of Customer Content is necessary for processing of the documents by - // Amazon Textract. If your account is opted out under an AI services opt out - // policy then all unencrypted Customer Content is immediately and permanently - // deleted after the Customer Content has been processed by the service. No copy of - // of the output is retained by Amazon Textract. For information about how to opt - // out, see [Managing AI services opt-out policy.] - // - // For more information on data privacy, see the [Data Privacy FAQ]. - // - // [Managing AI services opt-out policy.]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html - // [Data Privacy FAQ]: https://aws.amazon.com/compliance/data-privacy-faq/ - OutputConfig *types.OutputConfig - - noSmithyDocumentSerde -} - -type StartLendingAnalysisOutput struct { - - // A unique identifier for the lending or text-detection job. The JobId is - // returned from StartLendingAnalysis . A JobId value is only valid for 7 days. - JobId *string - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationStartLendingAnalysisMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartLendingAnalysis{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartLendingAnalysis{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "StartLendingAnalysis"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpStartLendingAnalysisValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartLendingAnalysis(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opStartLendingAnalysis(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "StartLendingAnalysis", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_TagResource.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_TagResource.go deleted file mode 100644 index 4cc35e94..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_TagResource.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Adds one or more tags to the specified resource. -func (c *Client) TagResource(ctx context.Context, params *TagResourceInput, optFns ...func(*Options)) (*TagResourceOutput, error) { - if params == nil { - params = &TagResourceInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "TagResource", params, optFns, c.addOperationTagResourceMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*TagResourceOutput) - out.ResultMetadata = metadata - return out, nil -} - -type TagResourceInput struct { - - // The Amazon Resource Name (ARN) that specifies the resource to be tagged. - // - // This member is required. - ResourceARN *string - - // A set of tags (key-value pairs) that you want to assign to the resource. - // - // This member is required. - Tags map[string]string - - noSmithyDocumentSerde -} - -type TagResourceOutput struct { - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationTagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpTagResource{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpTagResource{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "TagResource"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpTagResourceValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opTagResource(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opTagResource(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "TagResource", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_UntagResource.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_UntagResource.go deleted file mode 100644 index 8626efbf..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_UntagResource.go +++ /dev/null @@ -1,160 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -// Removes any tags with the specified keys from the specified resource. -func (c *Client) UntagResource(ctx context.Context, params *UntagResourceInput, optFns ...func(*Options)) (*UntagResourceOutput, error) { - if params == nil { - params = &UntagResourceInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "UntagResource", params, optFns, c.addOperationUntagResourceMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*UntagResourceOutput) - out.ResultMetadata = metadata - return out, nil -} - -type UntagResourceInput struct { - - // The Amazon Resource Name (ARN) that specifies the resource to be untagged. - // - // This member is required. - ResourceARN *string - - // Specifies the tags to be removed from the resource specified by the ResourceARN. - // - // This member is required. - TagKeys []string - - noSmithyDocumentSerde -} - -type UntagResourceOutput struct { - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationUntagResourceMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpUntagResource{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUntagResource{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "UntagResource"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpUntagResourceValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUntagResource(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opUntagResource(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "UntagResource", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_UpdateAdapter.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_UpdateAdapter.go deleted file mode 100644 index 3224671f..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/api_op_UpdateAdapter.go +++ /dev/null @@ -1,186 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - "github.com/aws/smithy-go/middleware" - smithyhttp "github.com/aws/smithy-go/transport/http" - "time" -) - -// Update the configuration for an adapter. FeatureTypes configurations cannot be -// updated. At least one new parameter must be specified as an argument. -func (c *Client) UpdateAdapter(ctx context.Context, params *UpdateAdapterInput, optFns ...func(*Options)) (*UpdateAdapterOutput, error) { - if params == nil { - params = &UpdateAdapterInput{} - } - - result, metadata, err := c.invokeOperation(ctx, "UpdateAdapter", params, optFns, c.addOperationUpdateAdapterMiddlewares) - if err != nil { - return nil, err - } - - out := result.(*UpdateAdapterOutput) - out.ResultMetadata = metadata - return out, nil -} - -type UpdateAdapterInput struct { - - // A string containing a unique ID for the adapter that will be updated. - // - // This member is required. - AdapterId *string - - // The new name to be applied to the adapter. - AdapterName *string - - // The new auto-update status to be applied to the adapter. - AutoUpdate types.AutoUpdate - - // The new description to be applied to the adapter. - Description *string - - noSmithyDocumentSerde -} - -type UpdateAdapterOutput struct { - - // A string containing a unique ID for the adapter that has been updated. - AdapterId *string - - // A string containing the name of the adapter that has been updated. - AdapterName *string - - // The auto-update status of the adapter that has been updated. - AutoUpdate types.AutoUpdate - - // An object specifying the creation time of the the adapter that has been updated. - CreationTime *time.Time - - // A string containing the description of the adapter that has been updated. - Description *string - - // List of the targeted feature types for the updated adapter. - FeatureTypes []types.FeatureType - - // Metadata pertaining to the operation's result. - ResultMetadata middleware.Metadata - - noSmithyDocumentSerde -} - -func (c *Client) addOperationUpdateAdapterMiddlewares(stack *middleware.Stack, options Options) (err error) { - if err := stack.Serialize.Add(&setOperationInputMiddleware{}, middleware.After); err != nil { - return err - } - err = stack.Serialize.Add(&awsAwsjson11_serializeOpUpdateAdapter{}, middleware.After) - if err != nil { - return err - } - err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpUpdateAdapter{}, middleware.After) - if err != nil { - return err - } - if err := addProtocolFinalizerMiddlewares(stack, options, "UpdateAdapter"); err != nil { - return fmt.Errorf("add protocol finalizers: %v", err) - } - - if err = addlegacyEndpointContextSetter(stack, options); err != nil { - return err - } - if err = addSetLoggerMiddleware(stack, options); err != nil { - return err - } - if err = addClientRequestID(stack); err != nil { - return err - } - if err = addComputeContentLength(stack); err != nil { - return err - } - if err = addResolveEndpointMiddleware(stack, options); err != nil { - return err - } - if err = addComputePayloadSHA256(stack); err != nil { - return err - } - if err = addRetry(stack, options); err != nil { - return err - } - if err = addRawResponseToMetadata(stack); err != nil { - return err - } - if err = addRecordResponseTiming(stack); err != nil { - return err - } - if err = addSpanRetryLoop(stack, options); err != nil { - return err - } - if err = addClientUserAgent(stack, options); err != nil { - return err - } - if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { - return err - } - if err = addSetLegacyContextSigningOptionsMiddleware(stack); err != nil { - return err - } - if err = addTimeOffsetBuild(stack, c); err != nil { - return err - } - if err = addUserAgentRetryMode(stack, options); err != nil { - return err - } - if err = addCredentialSource(stack, options); err != nil { - return err - } - if err = addOpUpdateAdapterValidationMiddleware(stack); err != nil { - return err - } - if err = stack.Initialize.Add(newServiceMetadataMiddleware_opUpdateAdapter(options.Region), middleware.Before); err != nil { - return err - } - if err = addRecursionDetection(stack); err != nil { - return err - } - if err = addRequestIDRetrieverMiddleware(stack); err != nil { - return err - } - if err = addResponseErrorMiddleware(stack); err != nil { - return err - } - if err = addRequestResponseLogging(stack, options); err != nil { - return err - } - if err = addDisableHTTPSMiddleware(stack, options); err != nil { - return err - } - if err = addSpanInitializeStart(stack); err != nil { - return err - } - if err = addSpanInitializeEnd(stack); err != nil { - return err - } - if err = addSpanBuildRequestStart(stack); err != nil { - return err - } - if err = addSpanBuildRequestEnd(stack); err != nil { - return err - } - return nil -} - -func newServiceMetadataMiddleware_opUpdateAdapter(region string) *awsmiddleware.RegisterServiceMetadata { - return &awsmiddleware.RegisterServiceMetadata{ - Region: region, - ServiceID: ServiceID, - OperationName: "UpdateAdapter", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/auth.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/auth.go deleted file mode 100644 index 3009b9db..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/auth.go +++ /dev/null @@ -1,313 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - smithy "github.com/aws/smithy-go" - smithyauth "github.com/aws/smithy-go/auth" - "github.com/aws/smithy-go/metrics" - "github.com/aws/smithy-go/middleware" - "github.com/aws/smithy-go/tracing" - smithyhttp "github.com/aws/smithy-go/transport/http" -) - -func bindAuthParamsRegion(_ interface{}, params *AuthResolverParameters, _ interface{}, options Options) { - params.Region = options.Region -} - -type setLegacyContextSigningOptionsMiddleware struct { -} - -func (*setLegacyContextSigningOptionsMiddleware) ID() string { - return "setLegacyContextSigningOptions" -} - -func (m *setLegacyContextSigningOptionsMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( - out middleware.FinalizeOutput, metadata middleware.Metadata, err error, -) { - rscheme := getResolvedAuthScheme(ctx) - schemeID := rscheme.Scheme.SchemeID() - - if sn := awsmiddleware.GetSigningName(ctx); sn != "" { - if schemeID == "aws.auth#sigv4" { - smithyhttp.SetSigV4SigningName(&rscheme.SignerProperties, sn) - } else if schemeID == "aws.auth#sigv4a" { - smithyhttp.SetSigV4ASigningName(&rscheme.SignerProperties, sn) - } - } - - if sr := awsmiddleware.GetSigningRegion(ctx); sr != "" { - if schemeID == "aws.auth#sigv4" { - smithyhttp.SetSigV4SigningRegion(&rscheme.SignerProperties, sr) - } else if schemeID == "aws.auth#sigv4a" { - smithyhttp.SetSigV4ASigningRegions(&rscheme.SignerProperties, []string{sr}) - } - } - - return next.HandleFinalize(ctx, in) -} - -func addSetLegacyContextSigningOptionsMiddleware(stack *middleware.Stack) error { - return stack.Finalize.Insert(&setLegacyContextSigningOptionsMiddleware{}, "Signing", middleware.Before) -} - -type withAnonymous struct { - resolver AuthSchemeResolver -} - -var _ AuthSchemeResolver = (*withAnonymous)(nil) - -func (v *withAnonymous) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) { - opts, err := v.resolver.ResolveAuthSchemes(ctx, params) - if err != nil { - return nil, err - } - - opts = append(opts, &smithyauth.Option{ - SchemeID: smithyauth.SchemeIDAnonymous, - }) - return opts, nil -} - -func wrapWithAnonymousAuth(options *Options) { - if _, ok := options.AuthSchemeResolver.(*defaultAuthSchemeResolver); !ok { - return - } - - options.AuthSchemeResolver = &withAnonymous{ - resolver: options.AuthSchemeResolver, - } -} - -// AuthResolverParameters contains the set of inputs necessary for auth scheme -// resolution. -type AuthResolverParameters struct { - // The name of the operation being invoked. - Operation string - - // The region in which the operation is being invoked. - Region string -} - -func bindAuthResolverParams(ctx context.Context, operation string, input interface{}, options Options) *AuthResolverParameters { - params := &AuthResolverParameters{ - Operation: operation, - } - - bindAuthParamsRegion(ctx, params, input, options) - - return params -} - -// AuthSchemeResolver returns a set of possible authentication options for an -// operation. -type AuthSchemeResolver interface { - ResolveAuthSchemes(context.Context, *AuthResolverParameters) ([]*smithyauth.Option, error) -} - -type defaultAuthSchemeResolver struct{} - -var _ AuthSchemeResolver = (*defaultAuthSchemeResolver)(nil) - -func (*defaultAuthSchemeResolver) ResolveAuthSchemes(ctx context.Context, params *AuthResolverParameters) ([]*smithyauth.Option, error) { - if overrides, ok := operationAuthOptions[params.Operation]; ok { - return overrides(params), nil - } - return serviceAuthOptions(params), nil -} - -var operationAuthOptions = map[string]func(*AuthResolverParameters) []*smithyauth.Option{} - -func serviceAuthOptions(params *AuthResolverParameters) []*smithyauth.Option { - return []*smithyauth.Option{ - { - SchemeID: smithyauth.SchemeIDSigV4, - SignerProperties: func() smithy.Properties { - var props smithy.Properties - smithyhttp.SetSigV4SigningName(&props, "textract") - smithyhttp.SetSigV4SigningRegion(&props, params.Region) - return props - }(), - }, - } -} - -type resolveAuthSchemeMiddleware struct { - operation string - options Options -} - -func (*resolveAuthSchemeMiddleware) ID() string { - return "ResolveAuthScheme" -} - -func (m *resolveAuthSchemeMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( - out middleware.FinalizeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "ResolveAuthScheme") - defer span.End() - - params := bindAuthResolverParams(ctx, m.operation, getOperationInput(ctx), m.options) - options, err := m.options.AuthSchemeResolver.ResolveAuthSchemes(ctx, params) - if err != nil { - return out, metadata, fmt.Errorf("resolve auth scheme: %w", err) - } - - scheme, ok := m.selectScheme(options) - if !ok { - return out, metadata, fmt.Errorf("could not select an auth scheme") - } - - ctx = setResolvedAuthScheme(ctx, scheme) - - span.SetProperty("auth.scheme_id", scheme.Scheme.SchemeID()) - span.End() - return next.HandleFinalize(ctx, in) -} - -func (m *resolveAuthSchemeMiddleware) selectScheme(options []*smithyauth.Option) (*resolvedAuthScheme, bool) { - for _, option := range options { - if option.SchemeID == smithyauth.SchemeIDAnonymous { - return newResolvedAuthScheme(smithyhttp.NewAnonymousScheme(), option), true - } - - for _, scheme := range m.options.AuthSchemes { - if scheme.SchemeID() != option.SchemeID { - continue - } - - if scheme.IdentityResolver(m.options) != nil { - return newResolvedAuthScheme(scheme, option), true - } - } - } - - return nil, false -} - -type resolvedAuthSchemeKey struct{} - -type resolvedAuthScheme struct { - Scheme smithyhttp.AuthScheme - IdentityProperties smithy.Properties - SignerProperties smithy.Properties -} - -func newResolvedAuthScheme(scheme smithyhttp.AuthScheme, option *smithyauth.Option) *resolvedAuthScheme { - return &resolvedAuthScheme{ - Scheme: scheme, - IdentityProperties: option.IdentityProperties, - SignerProperties: option.SignerProperties, - } -} - -func setResolvedAuthScheme(ctx context.Context, scheme *resolvedAuthScheme) context.Context { - return middleware.WithStackValue(ctx, resolvedAuthSchemeKey{}, scheme) -} - -func getResolvedAuthScheme(ctx context.Context) *resolvedAuthScheme { - v, _ := middleware.GetStackValue(ctx, resolvedAuthSchemeKey{}).(*resolvedAuthScheme) - return v -} - -type getIdentityMiddleware struct { - options Options -} - -func (*getIdentityMiddleware) ID() string { - return "GetIdentity" -} - -func (m *getIdentityMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( - out middleware.FinalizeOutput, metadata middleware.Metadata, err error, -) { - innerCtx, span := tracing.StartSpan(ctx, "GetIdentity") - defer span.End() - - rscheme := getResolvedAuthScheme(innerCtx) - if rscheme == nil { - return out, metadata, fmt.Errorf("no resolved auth scheme") - } - - resolver := rscheme.Scheme.IdentityResolver(m.options) - if resolver == nil { - return out, metadata, fmt.Errorf("no identity resolver") - } - - identity, err := timeOperationMetric(ctx, "client.call.resolve_identity_duration", - func() (smithyauth.Identity, error) { - return resolver.GetIdentity(innerCtx, rscheme.IdentityProperties) - }, - func(o *metrics.RecordMetricOptions) { - o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID()) - }) - if err != nil { - return out, metadata, fmt.Errorf("get identity: %w", err) - } - - ctx = setIdentity(ctx, identity) - - span.End() - return next.HandleFinalize(ctx, in) -} - -type identityKey struct{} - -func setIdentity(ctx context.Context, identity smithyauth.Identity) context.Context { - return middleware.WithStackValue(ctx, identityKey{}, identity) -} - -func getIdentity(ctx context.Context) smithyauth.Identity { - v, _ := middleware.GetStackValue(ctx, identityKey{}).(smithyauth.Identity) - return v -} - -type signRequestMiddleware struct { - options Options -} - -func (*signRequestMiddleware) ID() string { - return "Signing" -} - -func (m *signRequestMiddleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( - out middleware.FinalizeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "SignRequest") - defer span.End() - - req, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, fmt.Errorf("unexpected transport type %T", in.Request) - } - - rscheme := getResolvedAuthScheme(ctx) - if rscheme == nil { - return out, metadata, fmt.Errorf("no resolved auth scheme") - } - - identity := getIdentity(ctx) - if identity == nil { - return out, metadata, fmt.Errorf("no identity") - } - - signer := rscheme.Scheme.Signer() - if signer == nil { - return out, metadata, fmt.Errorf("no signer") - } - - _, err = timeOperationMetric(ctx, "client.call.signing_duration", func() (any, error) { - return nil, signer.SignRequest(ctx, req, identity, rscheme.SignerProperties) - }, func(o *metrics.RecordMetricOptions) { - o.Properties.Set("auth.scheme_id", rscheme.Scheme.SchemeID()) - }) - if err != nil { - return out, metadata, fmt.Errorf("sign request: %w", err) - } - - span.End() - return next.HandleFinalize(ctx, in) -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/deserializers.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/deserializers.go deleted file mode 100644 index 5ec14e45..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/deserializers.go +++ /dev/null @@ -1,10173 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "bytes" - "context" - "encoding/json" - "fmt" - "github.com/aws/aws-sdk-go-v2/aws/protocol/restjson" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - smithy "github.com/aws/smithy-go" - smithyio "github.com/aws/smithy-go/io" - "github.com/aws/smithy-go/middleware" - "github.com/aws/smithy-go/ptr" - smithytime "github.com/aws/smithy-go/time" - "github.com/aws/smithy-go/tracing" - smithyhttp "github.com/aws/smithy-go/transport/http" - "io" - "math" - "strings" - "time" -) - -func deserializeS3Expires(v string) (*time.Time, error) { - t, err := smithytime.ParseHTTPDate(v) - if err != nil { - return nil, nil - } - return &t, nil -} - -type awsAwsjson11_deserializeOpAnalyzeDocument struct { -} - -func (*awsAwsjson11_deserializeOpAnalyzeDocument) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpAnalyzeDocument) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorAnalyzeDocument(response, &metadata) - } - output := &AnalyzeDocumentOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentAnalyzeDocumentOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorAnalyzeDocument(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("BadDocumentException", errorCode): - return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody) - - case strings.EqualFold("DocumentTooLargeException", errorCode): - return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody) - - case strings.EqualFold("HumanLoopQuotaExceededException", errorCode): - return awsAwsjson11_deserializeErrorHumanLoopQuotaExceededException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("UnsupportedDocumentException", errorCode): - return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpAnalyzeExpense struct { -} - -func (*awsAwsjson11_deserializeOpAnalyzeExpense) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpAnalyzeExpense) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorAnalyzeExpense(response, &metadata) - } - output := &AnalyzeExpenseOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentAnalyzeExpenseOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorAnalyzeExpense(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("BadDocumentException", errorCode): - return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody) - - case strings.EqualFold("DocumentTooLargeException", errorCode): - return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("UnsupportedDocumentException", errorCode): - return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpAnalyzeID struct { -} - -func (*awsAwsjson11_deserializeOpAnalyzeID) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpAnalyzeID) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorAnalyzeID(response, &metadata) - } - output := &AnalyzeIDOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentAnalyzeIDOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorAnalyzeID(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("BadDocumentException", errorCode): - return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody) - - case strings.EqualFold("DocumentTooLargeException", errorCode): - return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("UnsupportedDocumentException", errorCode): - return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpCreateAdapter struct { -} - -func (*awsAwsjson11_deserializeOpCreateAdapter) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpCreateAdapter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorCreateAdapter(response, &metadata) - } - output := &CreateAdapterOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentCreateAdapterOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorCreateAdapter(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("ConflictException", errorCode): - return awsAwsjson11_deserializeErrorConflictException(response, errorBody) - - case strings.EqualFold("IdempotentParameterMismatchException", errorCode): - return awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("LimitExceededException", errorCode): - return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ServiceQuotaExceededException", errorCode): - return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpCreateAdapterVersion struct { -} - -func (*awsAwsjson11_deserializeOpCreateAdapterVersion) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpCreateAdapterVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorCreateAdapterVersion(response, &metadata) - } - output := &CreateAdapterVersionOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentCreateAdapterVersionOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorCreateAdapterVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("ConflictException", errorCode): - return awsAwsjson11_deserializeErrorConflictException(response, errorBody) - - case strings.EqualFold("IdempotentParameterMismatchException", errorCode): - return awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("LimitExceededException", errorCode): - return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ServiceQuotaExceededException", errorCode): - return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpDeleteAdapter struct { -} - -func (*awsAwsjson11_deserializeOpDeleteAdapter) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpDeleteAdapter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorDeleteAdapter(response, &metadata) - } - output := &DeleteAdapterOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentDeleteAdapterOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorDeleteAdapter(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("ConflictException", errorCode): - return awsAwsjson11_deserializeErrorConflictException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpDeleteAdapterVersion struct { -} - -func (*awsAwsjson11_deserializeOpDeleteAdapterVersion) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpDeleteAdapterVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorDeleteAdapterVersion(response, &metadata) - } - output := &DeleteAdapterVersionOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentDeleteAdapterVersionOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorDeleteAdapterVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("ConflictException", errorCode): - return awsAwsjson11_deserializeErrorConflictException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpDetectDocumentText struct { -} - -func (*awsAwsjson11_deserializeOpDetectDocumentText) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpDetectDocumentText) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorDetectDocumentText(response, &metadata) - } - output := &DetectDocumentTextOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentDetectDocumentTextOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorDetectDocumentText(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("BadDocumentException", errorCode): - return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody) - - case strings.EqualFold("DocumentTooLargeException", errorCode): - return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("UnsupportedDocumentException", errorCode): - return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpGetAdapter struct { -} - -func (*awsAwsjson11_deserializeOpGetAdapter) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpGetAdapter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetAdapter(response, &metadata) - } - output := &GetAdapterOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentGetAdapterOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorGetAdapter(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpGetAdapterVersion struct { -} - -func (*awsAwsjson11_deserializeOpGetAdapterVersion) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpGetAdapterVersion) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetAdapterVersion(response, &metadata) - } - output := &GetAdapterVersionOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentGetAdapterVersionOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorGetAdapterVersion(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpGetDocumentAnalysis struct { -} - -func (*awsAwsjson11_deserializeOpGetDocumentAnalysis) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpGetDocumentAnalysis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetDocumentAnalysis(response, &metadata) - } - output := &GetDocumentAnalysisOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentGetDocumentAnalysisOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorGetDocumentAnalysis(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidJobIdException", errorCode): - return awsAwsjson11_deserializeErrorInvalidJobIdException(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpGetDocumentTextDetection struct { -} - -func (*awsAwsjson11_deserializeOpGetDocumentTextDetection) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpGetDocumentTextDetection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetDocumentTextDetection(response, &metadata) - } - output := &GetDocumentTextDetectionOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentGetDocumentTextDetectionOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorGetDocumentTextDetection(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidJobIdException", errorCode): - return awsAwsjson11_deserializeErrorInvalidJobIdException(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpGetExpenseAnalysis struct { -} - -func (*awsAwsjson11_deserializeOpGetExpenseAnalysis) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpGetExpenseAnalysis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetExpenseAnalysis(response, &metadata) - } - output := &GetExpenseAnalysisOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentGetExpenseAnalysisOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorGetExpenseAnalysis(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidJobIdException", errorCode): - return awsAwsjson11_deserializeErrorInvalidJobIdException(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpGetLendingAnalysis struct { -} - -func (*awsAwsjson11_deserializeOpGetLendingAnalysis) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpGetLendingAnalysis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetLendingAnalysis(response, &metadata) - } - output := &GetLendingAnalysisOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentGetLendingAnalysisOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorGetLendingAnalysis(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidJobIdException", errorCode): - return awsAwsjson11_deserializeErrorInvalidJobIdException(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpGetLendingAnalysisSummary struct { -} - -func (*awsAwsjson11_deserializeOpGetLendingAnalysisSummary) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpGetLendingAnalysisSummary) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorGetLendingAnalysisSummary(response, &metadata) - } - output := &GetLendingAnalysisSummaryOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentGetLendingAnalysisSummaryOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorGetLendingAnalysisSummary(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidJobIdException", errorCode): - return awsAwsjson11_deserializeErrorInvalidJobIdException(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpListAdapters struct { -} - -func (*awsAwsjson11_deserializeOpListAdapters) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpListAdapters) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorListAdapters(response, &metadata) - } - output := &ListAdaptersOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentListAdaptersOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorListAdapters(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpListAdapterVersions struct { -} - -func (*awsAwsjson11_deserializeOpListAdapterVersions) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpListAdapterVersions) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorListAdapterVersions(response, &metadata) - } - output := &ListAdapterVersionsOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentListAdapterVersionsOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorListAdapterVersions(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpListTagsForResource struct { -} - -func (*awsAwsjson11_deserializeOpListTagsForResource) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpListTagsForResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorListTagsForResource(response, &metadata) - } - output := &ListTagsForResourceOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentListTagsForResourceOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorListTagsForResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpStartDocumentAnalysis struct { -} - -func (*awsAwsjson11_deserializeOpStartDocumentAnalysis) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpStartDocumentAnalysis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorStartDocumentAnalysis(response, &metadata) - } - output := &StartDocumentAnalysisOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentStartDocumentAnalysisOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorStartDocumentAnalysis(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("BadDocumentException", errorCode): - return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody) - - case strings.EqualFold("DocumentTooLargeException", errorCode): - return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody) - - case strings.EqualFold("IdempotentParameterMismatchException", errorCode): - return awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("LimitExceededException", errorCode): - return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("UnsupportedDocumentException", errorCode): - return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpStartDocumentTextDetection struct { -} - -func (*awsAwsjson11_deserializeOpStartDocumentTextDetection) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpStartDocumentTextDetection) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorStartDocumentTextDetection(response, &metadata) - } - output := &StartDocumentTextDetectionOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentStartDocumentTextDetectionOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorStartDocumentTextDetection(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("BadDocumentException", errorCode): - return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody) - - case strings.EqualFold("DocumentTooLargeException", errorCode): - return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody) - - case strings.EqualFold("IdempotentParameterMismatchException", errorCode): - return awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("LimitExceededException", errorCode): - return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("UnsupportedDocumentException", errorCode): - return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpStartExpenseAnalysis struct { -} - -func (*awsAwsjson11_deserializeOpStartExpenseAnalysis) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpStartExpenseAnalysis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorStartExpenseAnalysis(response, &metadata) - } - output := &StartExpenseAnalysisOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentStartExpenseAnalysisOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorStartExpenseAnalysis(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("BadDocumentException", errorCode): - return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody) - - case strings.EqualFold("DocumentTooLargeException", errorCode): - return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody) - - case strings.EqualFold("IdempotentParameterMismatchException", errorCode): - return awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("LimitExceededException", errorCode): - return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("UnsupportedDocumentException", errorCode): - return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpStartLendingAnalysis struct { -} - -func (*awsAwsjson11_deserializeOpStartLendingAnalysis) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpStartLendingAnalysis) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorStartLendingAnalysis(response, &metadata) - } - output := &StartLendingAnalysisOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentStartLendingAnalysisOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorStartLendingAnalysis(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("BadDocumentException", errorCode): - return awsAwsjson11_deserializeErrorBadDocumentException(response, errorBody) - - case strings.EqualFold("DocumentTooLargeException", errorCode): - return awsAwsjson11_deserializeErrorDocumentTooLargeException(response, errorBody) - - case strings.EqualFold("IdempotentParameterMismatchException", errorCode): - return awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidKMSKeyException", errorCode): - return awsAwsjson11_deserializeErrorInvalidKMSKeyException(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("InvalidS3ObjectException", errorCode): - return awsAwsjson11_deserializeErrorInvalidS3ObjectException(response, errorBody) - - case strings.EqualFold("LimitExceededException", errorCode): - return awsAwsjson11_deserializeErrorLimitExceededException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("UnsupportedDocumentException", errorCode): - return awsAwsjson11_deserializeErrorUnsupportedDocumentException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpTagResource struct { -} - -func (*awsAwsjson11_deserializeOpTagResource) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpTagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorTagResource(response, &metadata) - } - output := &TagResourceOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentTagResourceOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorTagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ServiceQuotaExceededException", errorCode): - return awsAwsjson11_deserializeErrorServiceQuotaExceededException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpUntagResource struct { -} - -func (*awsAwsjson11_deserializeOpUntagResource) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpUntagResource) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorUntagResource(response, &metadata) - } - output := &UntagResourceOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentUntagResourceOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorUntagResource(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -type awsAwsjson11_deserializeOpUpdateAdapter struct { -} - -func (*awsAwsjson11_deserializeOpUpdateAdapter) ID() string { - return "OperationDeserializer" -} - -func (m *awsAwsjson11_deserializeOpUpdateAdapter) HandleDeserialize(ctx context.Context, in middleware.DeserializeInput, next middleware.DeserializeHandler) ( - out middleware.DeserializeOutput, metadata middleware.Metadata, err error, -) { - out, metadata, err = next.HandleDeserialize(ctx, in) - if err != nil { - return out, metadata, err - } - - _, span := tracing.StartSpan(ctx, "OperationDeserializer") - endTimer := startMetricTimer(ctx, "client.call.deserialization_duration") - defer endTimer() - defer span.End() - response, ok := out.RawResponse.(*smithyhttp.Response) - if !ok { - return out, metadata, &smithy.DeserializationError{Err: fmt.Errorf("unknown transport type %T", out.RawResponse)} - } - - if response.StatusCode < 200 || response.StatusCode >= 300 { - return out, metadata, awsAwsjson11_deserializeOpErrorUpdateAdapter(response, &metadata) - } - output := &UpdateAdapterOutput{} - out.Result = output - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(response.Body, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - err = awsAwsjson11_deserializeOpDocumentUpdateAdapterOutput(&output, shape) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return out, metadata, err - } - - return out, metadata, err -} - -func awsAwsjson11_deserializeOpErrorUpdateAdapter(response *smithyhttp.Response, metadata *middleware.Metadata) error { - var errorBuffer bytes.Buffer - if _, err := io.Copy(&errorBuffer, response.Body); err != nil { - return &smithy.DeserializationError{Err: fmt.Errorf("failed to copy error response body, %w", err)} - } - errorBody := bytes.NewReader(errorBuffer.Bytes()) - - errorCode := "UnknownError" - errorMessage := errorCode - - headerCode := response.Header.Get("X-Amzn-ErrorType") - - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - bodyInfo, err := getProtocolErrorInfo(decoder) - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - if typ, ok := resolveProtocolErrorType(headerCode, bodyInfo); ok { - errorCode = restjson.SanitizeErrorCode(typ) - } - if len(bodyInfo.Message) != 0 { - errorMessage = bodyInfo.Message - } - switch { - case strings.EqualFold("AccessDeniedException", errorCode): - return awsAwsjson11_deserializeErrorAccessDeniedException(response, errorBody) - - case strings.EqualFold("ConflictException", errorCode): - return awsAwsjson11_deserializeErrorConflictException(response, errorBody) - - case strings.EqualFold("InternalServerError", errorCode): - return awsAwsjson11_deserializeErrorInternalServerError(response, errorBody) - - case strings.EqualFold("InvalidParameterException", errorCode): - return awsAwsjson11_deserializeErrorInvalidParameterException(response, errorBody) - - case strings.EqualFold("ProvisionedThroughputExceededException", errorCode): - return awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response, errorBody) - - case strings.EqualFold("ResourceNotFoundException", errorCode): - return awsAwsjson11_deserializeErrorResourceNotFoundException(response, errorBody) - - case strings.EqualFold("ThrottlingException", errorCode): - return awsAwsjson11_deserializeErrorThrottlingException(response, errorBody) - - case strings.EqualFold("ValidationException", errorCode): - return awsAwsjson11_deserializeErrorValidationException(response, errorBody) - - default: - genericError := &smithy.GenericAPIError{ - Code: errorCode, - Message: errorMessage, - } - return genericError - - } -} - -func awsAwsjson11_deserializeErrorAccessDeniedException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.AccessDeniedException{} - err := awsAwsjson11_deserializeDocumentAccessDeniedException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorBadDocumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.BadDocumentException{} - err := awsAwsjson11_deserializeDocumentBadDocumentException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorConflictException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.ConflictException{} - err := awsAwsjson11_deserializeDocumentConflictException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorDocumentTooLargeException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.DocumentTooLargeException{} - err := awsAwsjson11_deserializeDocumentDocumentTooLargeException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorHumanLoopQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.HumanLoopQuotaExceededException{} - err := awsAwsjson11_deserializeDocumentHumanLoopQuotaExceededException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorIdempotentParameterMismatchException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.IdempotentParameterMismatchException{} - err := awsAwsjson11_deserializeDocumentIdempotentParameterMismatchException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorInternalServerError(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.InternalServerError{} - err := awsAwsjson11_deserializeDocumentInternalServerError(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorInvalidJobIdException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.InvalidJobIdException{} - err := awsAwsjson11_deserializeDocumentInvalidJobIdException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorInvalidKMSKeyException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.InvalidKMSKeyException{} - err := awsAwsjson11_deserializeDocumentInvalidKMSKeyException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorInvalidParameterException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.InvalidParameterException{} - err := awsAwsjson11_deserializeDocumentInvalidParameterException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorInvalidS3ObjectException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.InvalidS3ObjectException{} - err := awsAwsjson11_deserializeDocumentInvalidS3ObjectException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorLimitExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.LimitExceededException{} - err := awsAwsjson11_deserializeDocumentLimitExceededException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorProvisionedThroughputExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.ProvisionedThroughputExceededException{} - err := awsAwsjson11_deserializeDocumentProvisionedThroughputExceededException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorResourceNotFoundException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.ResourceNotFoundException{} - err := awsAwsjson11_deserializeDocumentResourceNotFoundException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorServiceQuotaExceededException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.ServiceQuotaExceededException{} - err := awsAwsjson11_deserializeDocumentServiceQuotaExceededException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorThrottlingException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.ThrottlingException{} - err := awsAwsjson11_deserializeDocumentThrottlingException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorUnsupportedDocumentException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.UnsupportedDocumentException{} - err := awsAwsjson11_deserializeDocumentUnsupportedDocumentException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeErrorValidationException(response *smithyhttp.Response, errorBody *bytes.Reader) error { - var buff [1024]byte - ringBuffer := smithyio.NewRingBuffer(buff[:]) - - body := io.TeeReader(errorBody, ringBuffer) - decoder := json.NewDecoder(body) - decoder.UseNumber() - var shape interface{} - if err := decoder.Decode(&shape); err != nil && err != io.EOF { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - output := &types.ValidationException{} - err := awsAwsjson11_deserializeDocumentValidationException(&output, shape) - - if err != nil { - var snapshot bytes.Buffer - io.Copy(&snapshot, ringBuffer) - err = &smithy.DeserializationError{ - Err: fmt.Errorf("failed to decode response body, %w", err), - Snapshot: snapshot.Bytes(), - } - return err - } - - errorBody.Seek(0, io.SeekStart) - return output -} - -func awsAwsjson11_deserializeDocumentAccessDeniedException(v **types.AccessDeniedException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.AccessDeniedException - if *v == nil { - sv = &types.AccessDeniedException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentAdapterList(v *[]types.AdapterOverview, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.AdapterOverview - if *v == nil { - cv = []types.AdapterOverview{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.AdapterOverview - destAddr := &col - if err := awsAwsjson11_deserializeDocumentAdapterOverview(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentAdapterOverview(v **types.AdapterOverview, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.AdapterOverview - if *v == nil { - sv = &types.AdapterOverview{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterId to be of type string, got %T instead", value) - } - sv.AdapterId = ptr.String(jtv) - } - - case "AdapterName": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterName to be of type string, got %T instead", value) - } - sv.AdapterName = ptr.String(jtv) - } - - case "CreationTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value) - - } - } - - case "FeatureTypes": - if err := awsAwsjson11_deserializeDocumentFeatureTypes(&sv.FeatureTypes, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentAdapterVersionDatasetConfig(v **types.AdapterVersionDatasetConfig, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.AdapterVersionDatasetConfig - if *v == nil { - sv = &types.AdapterVersionDatasetConfig{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "ManifestS3Object": - if err := awsAwsjson11_deserializeDocumentS3Object(&sv.ManifestS3Object, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentAdapterVersionEvaluationMetric(v **types.AdapterVersionEvaluationMetric, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.AdapterVersionEvaluationMetric - if *v == nil { - sv = &types.AdapterVersionEvaluationMetric{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterVersion": - if err := awsAwsjson11_deserializeDocumentEvaluationMetric(&sv.AdapterVersion, value); err != nil { - return err - } - - case "Baseline": - if err := awsAwsjson11_deserializeDocumentEvaluationMetric(&sv.Baseline, value); err != nil { - return err - } - - case "FeatureType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected FeatureType to be of type string, got %T instead", value) - } - sv.FeatureType = types.FeatureType(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentAdapterVersionEvaluationMetrics(v *[]types.AdapterVersionEvaluationMetric, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.AdapterVersionEvaluationMetric - if *v == nil { - cv = []types.AdapterVersionEvaluationMetric{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.AdapterVersionEvaluationMetric - destAddr := &col - if err := awsAwsjson11_deserializeDocumentAdapterVersionEvaluationMetric(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentAdapterVersionList(v *[]types.AdapterVersionOverview, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.AdapterVersionOverview - if *v == nil { - cv = []types.AdapterVersionOverview{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.AdapterVersionOverview - destAddr := &col - if err := awsAwsjson11_deserializeDocumentAdapterVersionOverview(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentAdapterVersionOverview(v **types.AdapterVersionOverview, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.AdapterVersionOverview - if *v == nil { - sv = &types.AdapterVersionOverview{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterId to be of type string, got %T instead", value) - } - sv.AdapterId = ptr.String(jtv) - } - - case "AdapterVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterVersion to be of type string, got %T instead", value) - } - sv.AdapterVersion = ptr.String(jtv) - } - - case "CreationTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value) - - } - } - - case "FeatureTypes": - if err := awsAwsjson11_deserializeDocumentFeatureTypes(&sv.FeatureTypes, value); err != nil { - return err - } - - case "Status": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterVersionStatus to be of type string, got %T instead", value) - } - sv.Status = types.AdapterVersionStatus(jtv) - } - - case "StatusMessage": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterVersionStatusMessage to be of type string, got %T instead", value) - } - sv.StatusMessage = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentAnalyzeIDDetections(v **types.AnalyzeIDDetections, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.AnalyzeIDDetections - if *v == nil { - sv = &types.AnalyzeIDDetections{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Confidence": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Confidence = ptr.Float32(float32(f64)) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Confidence = ptr.Float32(float32(f64)) - - default: - return fmt.Errorf("expected Percent to be a JSON Number, got %T instead", value) - - } - } - - case "NormalizedValue": - if err := awsAwsjson11_deserializeDocumentNormalizedValue(&sv.NormalizedValue, value); err != nil { - return err - } - - case "Text": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Text = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentBadDocumentException(v **types.BadDocumentException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.BadDocumentException - if *v == nil { - sv = &types.BadDocumentException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentBlock(v **types.Block, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.Block - if *v == nil { - sv = &types.Block{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "BlockType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected BlockType to be of type string, got %T instead", value) - } - sv.BlockType = types.BlockType(jtv) - } - - case "ColumnIndex": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.ColumnIndex = ptr.Int32(int32(i64)) - } - - case "ColumnSpan": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.ColumnSpan = ptr.Int32(int32(i64)) - } - - case "Confidence": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Confidence = ptr.Float32(float32(f64)) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Confidence = ptr.Float32(float32(f64)) - - default: - return fmt.Errorf("expected Percent to be a JSON Number, got %T instead", value) - - } - } - - case "EntityTypes": - if err := awsAwsjson11_deserializeDocumentEntityTypes(&sv.EntityTypes, value); err != nil { - return err - } - - case "Geometry": - if err := awsAwsjson11_deserializeDocumentGeometry(&sv.Geometry, value); err != nil { - return err - } - - case "Id": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) - } - sv.Id = ptr.String(jtv) - } - - case "Page": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.Page = ptr.Int32(int32(i64)) - } - - case "Query": - if err := awsAwsjson11_deserializeDocumentQuery(&sv.Query, value); err != nil { - return err - } - - case "Relationships": - if err := awsAwsjson11_deserializeDocumentRelationshipList(&sv.Relationships, value); err != nil { - return err - } - - case "RowIndex": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.RowIndex = ptr.Int32(int32(i64)) - } - - case "RowSpan": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.RowSpan = ptr.Int32(int32(i64)) - } - - case "SelectionStatus": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected SelectionStatus to be of type string, got %T instead", value) - } - sv.SelectionStatus = types.SelectionStatus(jtv) - } - - case "Text": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Text = ptr.String(jtv) - } - - case "TextType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected TextType to be of type string, got %T instead", value) - } - sv.TextType = types.TextType(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentBlockList(v *[]types.Block, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.Block - if *v == nil { - cv = []types.Block{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.Block - destAddr := &col - if err := awsAwsjson11_deserializeDocumentBlock(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentBoundingBox(v **types.BoundingBox, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.BoundingBox - if *v == nil { - sv = &types.BoundingBox{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Height": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Height = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Height = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - case "Left": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Left = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Left = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - case "Top": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Top = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Top = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - case "Width": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Width = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Width = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentConflictException(v **types.ConflictException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ConflictException - if *v == nil { - sv = &types.ConflictException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentDetectedSignature(v **types.DetectedSignature, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.DetectedSignature - if *v == nil { - sv = &types.DetectedSignature{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Page": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.Page = ptr.Int32(int32(i64)) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentDetectedSignatureList(v *[]types.DetectedSignature, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.DetectedSignature - if *v == nil { - cv = []types.DetectedSignature{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.DetectedSignature - destAddr := &col - if err := awsAwsjson11_deserializeDocumentDetectedSignature(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentDocumentGroup(v **types.DocumentGroup, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.DocumentGroup - if *v == nil { - sv = &types.DocumentGroup{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "DetectedSignatures": - if err := awsAwsjson11_deserializeDocumentDetectedSignatureList(&sv.DetectedSignatures, value); err != nil { - return err - } - - case "SplitDocuments": - if err := awsAwsjson11_deserializeDocumentSplitDocumentList(&sv.SplitDocuments, value); err != nil { - return err - } - - case "Type": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) - } - sv.Type = ptr.String(jtv) - } - - case "UndetectedSignatures": - if err := awsAwsjson11_deserializeDocumentUndetectedSignatureList(&sv.UndetectedSignatures, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentDocumentGroupList(v *[]types.DocumentGroup, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.DocumentGroup - if *v == nil { - cv = []types.DocumentGroup{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.DocumentGroup - destAddr := &col - if err := awsAwsjson11_deserializeDocumentDocumentGroup(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentDocumentMetadata(v **types.DocumentMetadata, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.DocumentMetadata - if *v == nil { - sv = &types.DocumentMetadata{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Pages": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.Pages = ptr.Int32(int32(i64)) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentDocumentTooLargeException(v **types.DocumentTooLargeException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.DocumentTooLargeException - if *v == nil { - sv = &types.DocumentTooLargeException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentEntityTypes(v *[]types.EntityType, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.EntityType - if *v == nil { - cv = []types.EntityType{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.EntityType - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected EntityType to be of type string, got %T instead", value) - } - col = types.EntityType(jtv) - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentEvaluationMetric(v **types.EvaluationMetric, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.EvaluationMetric - if *v == nil { - sv = &types.EvaluationMetric{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "F1Score": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.F1Score = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.F1Score = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - case "Precision": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Precision = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Precision = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - case "Recall": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Recall = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Recall = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseCurrency(v **types.ExpenseCurrency, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ExpenseCurrency - if *v == nil { - sv = &types.ExpenseCurrency{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "Confidence": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Confidence = ptr.Float32(float32(f64)) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Confidence = ptr.Float32(float32(f64)) - - default: - return fmt.Errorf("expected Percent to be a JSON Number, got %T instead", value) - - } - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseDetection(v **types.ExpenseDetection, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ExpenseDetection - if *v == nil { - sv = &types.ExpenseDetection{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Confidence": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Confidence = ptr.Float32(float32(f64)) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Confidence = ptr.Float32(float32(f64)) - - default: - return fmt.Errorf("expected Percent to be a JSON Number, got %T instead", value) - - } - } - - case "Geometry": - if err := awsAwsjson11_deserializeDocumentGeometry(&sv.Geometry, value); err != nil { - return err - } - - case "Text": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Text = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseDocument(v **types.ExpenseDocument, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ExpenseDocument - if *v == nil { - sv = &types.ExpenseDocument{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Blocks": - if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil { - return err - } - - case "ExpenseIndex": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.ExpenseIndex = ptr.Int32(int32(i64)) - } - - case "LineItemGroups": - if err := awsAwsjson11_deserializeDocumentLineItemGroupList(&sv.LineItemGroups, value); err != nil { - return err - } - - case "SummaryFields": - if err := awsAwsjson11_deserializeDocumentExpenseFieldList(&sv.SummaryFields, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseDocumentList(v *[]types.ExpenseDocument, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.ExpenseDocument - if *v == nil { - cv = []types.ExpenseDocument{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.ExpenseDocument - destAddr := &col - if err := awsAwsjson11_deserializeDocumentExpenseDocument(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseField(v **types.ExpenseField, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ExpenseField - if *v == nil { - sv = &types.ExpenseField{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Currency": - if err := awsAwsjson11_deserializeDocumentExpenseCurrency(&sv.Currency, value); err != nil { - return err - } - - case "GroupProperties": - if err := awsAwsjson11_deserializeDocumentExpenseGroupPropertyList(&sv.GroupProperties, value); err != nil { - return err - } - - case "LabelDetection": - if err := awsAwsjson11_deserializeDocumentExpenseDetection(&sv.LabelDetection, value); err != nil { - return err - } - - case "PageNumber": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.PageNumber = ptr.Int32(int32(i64)) - } - - case "Type": - if err := awsAwsjson11_deserializeDocumentExpenseType(&sv.Type, value); err != nil { - return err - } - - case "ValueDetection": - if err := awsAwsjson11_deserializeDocumentExpenseDetection(&sv.ValueDetection, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseFieldList(v *[]types.ExpenseField, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.ExpenseField - if *v == nil { - cv = []types.ExpenseField{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.ExpenseField - destAddr := &col - if err := awsAwsjson11_deserializeDocumentExpenseField(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseGroupProperty(v **types.ExpenseGroupProperty, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ExpenseGroupProperty - if *v == nil { - sv = &types.ExpenseGroupProperty{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Id": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Id = ptr.String(jtv) - } - - case "Types": - if err := awsAwsjson11_deserializeDocumentStringList(&sv.Types, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseGroupPropertyList(v *[]types.ExpenseGroupProperty, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.ExpenseGroupProperty - if *v == nil { - cv = []types.ExpenseGroupProperty{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.ExpenseGroupProperty - destAddr := &col - if err := awsAwsjson11_deserializeDocumentExpenseGroupProperty(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentExpenseType(v **types.ExpenseType, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ExpenseType - if *v == nil { - sv = &types.ExpenseType{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Confidence": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Confidence = ptr.Float32(float32(f64)) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Confidence = ptr.Float32(float32(f64)) - - default: - return fmt.Errorf("expected Percent to be a JSON Number, got %T instead", value) - - } - } - - case "Text": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Text = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentExtraction(v **types.Extraction, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.Extraction - if *v == nil { - sv = &types.Extraction{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "ExpenseDocument": - if err := awsAwsjson11_deserializeDocumentExpenseDocument(&sv.ExpenseDocument, value); err != nil { - return err - } - - case "IdentityDocument": - if err := awsAwsjson11_deserializeDocumentIdentityDocument(&sv.IdentityDocument, value); err != nil { - return err - } - - case "LendingDocument": - if err := awsAwsjson11_deserializeDocumentLendingDocument(&sv.LendingDocument, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentExtractionList(v *[]types.Extraction, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.Extraction - if *v == nil { - cv = []types.Extraction{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.Extraction - destAddr := &col - if err := awsAwsjson11_deserializeDocumentExtraction(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentFeatureTypes(v *[]types.FeatureType, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.FeatureType - if *v == nil { - cv = []types.FeatureType{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.FeatureType - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected FeatureType to be of type string, got %T instead", value) - } - col = types.FeatureType(jtv) - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentGeometry(v **types.Geometry, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.Geometry - if *v == nil { - sv = &types.Geometry{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "BoundingBox": - if err := awsAwsjson11_deserializeDocumentBoundingBox(&sv.BoundingBox, value); err != nil { - return err - } - - case "Polygon": - if err := awsAwsjson11_deserializeDocumentPolygon(&sv.Polygon, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentHumanLoopActivationOutput(v **types.HumanLoopActivationOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.HumanLoopActivationOutput - if *v == nil { - sv = &types.HumanLoopActivationOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "HumanLoopActivationConditionsEvaluationResults": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected SynthesizedJsonHumanLoopActivationConditionsEvaluationResults to be of type string, got %T instead", value) - } - sv.HumanLoopActivationConditionsEvaluationResults = ptr.String(jtv) - } - - case "HumanLoopActivationReasons": - if err := awsAwsjson11_deserializeDocumentHumanLoopActivationReasons(&sv.HumanLoopActivationReasons, value); err != nil { - return err - } - - case "HumanLoopArn": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HumanLoopArn to be of type string, got %T instead", value) - } - sv.HumanLoopArn = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentHumanLoopActivationReasons(v *[]string, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []string - if *v == nil { - cv = []string{} - } else { - cv = *v - } - - for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected HumanLoopActivationReason to be of type string, got %T instead", value) - } - col = jtv - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentHumanLoopQuotaExceededException(v **types.HumanLoopQuotaExceededException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.HumanLoopQuotaExceededException - if *v == nil { - sv = &types.HumanLoopQuotaExceededException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - case "QuotaCode": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.QuotaCode = ptr.String(jtv) - } - - case "ResourceType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.ResourceType = ptr.String(jtv) - } - - case "ServiceCode": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.ServiceCode = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentIdempotentParameterMismatchException(v **types.IdempotentParameterMismatchException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.IdempotentParameterMismatchException - if *v == nil { - sv = &types.IdempotentParameterMismatchException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentIdentityDocument(v **types.IdentityDocument, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.IdentityDocument - if *v == nil { - sv = &types.IdentityDocument{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Blocks": - if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil { - return err - } - - case "DocumentIndex": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.DocumentIndex = ptr.Int32(int32(i64)) - } - - case "IdentityDocumentFields": - if err := awsAwsjson11_deserializeDocumentIdentityDocumentFieldList(&sv.IdentityDocumentFields, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentIdentityDocumentField(v **types.IdentityDocumentField, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.IdentityDocumentField - if *v == nil { - sv = &types.IdentityDocumentField{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Type": - if err := awsAwsjson11_deserializeDocumentAnalyzeIDDetections(&sv.Type, value); err != nil { - return err - } - - case "ValueDetection": - if err := awsAwsjson11_deserializeDocumentAnalyzeIDDetections(&sv.ValueDetection, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentIdentityDocumentFieldList(v *[]types.IdentityDocumentField, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.IdentityDocumentField - if *v == nil { - cv = []types.IdentityDocumentField{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.IdentityDocumentField - destAddr := &col - if err := awsAwsjson11_deserializeDocumentIdentityDocumentField(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentIdentityDocumentList(v *[]types.IdentityDocument, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.IdentityDocument - if *v == nil { - cv = []types.IdentityDocument{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.IdentityDocument - destAddr := &col - if err := awsAwsjson11_deserializeDocumentIdentityDocument(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentIdList(v *[]string, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []string - if *v == nil { - cv = []string{} - } else { - cv = *v - } - - for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) - } - col = jtv - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentInternalServerError(v **types.InternalServerError, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.InternalServerError - if *v == nil { - sv = &types.InternalServerError{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentInvalidJobIdException(v **types.InvalidJobIdException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.InvalidJobIdException - if *v == nil { - sv = &types.InvalidJobIdException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentInvalidKMSKeyException(v **types.InvalidKMSKeyException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.InvalidKMSKeyException - if *v == nil { - sv = &types.InvalidKMSKeyException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentInvalidParameterException(v **types.InvalidParameterException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.InvalidParameterException - if *v == nil { - sv = &types.InvalidParameterException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentInvalidS3ObjectException(v **types.InvalidS3ObjectException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.InvalidS3ObjectException - if *v == nil { - sv = &types.InvalidS3ObjectException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLendingDetection(v **types.LendingDetection, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.LendingDetection - if *v == nil { - sv = &types.LendingDetection{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Confidence": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Confidence = ptr.Float32(float32(f64)) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Confidence = ptr.Float32(float32(f64)) - - default: - return fmt.Errorf("expected Percent to be a JSON Number, got %T instead", value) - - } - } - - case "Geometry": - if err := awsAwsjson11_deserializeDocumentGeometry(&sv.Geometry, value); err != nil { - return err - } - - case "SelectionStatus": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected SelectionStatus to be of type string, got %T instead", value) - } - sv.SelectionStatus = types.SelectionStatus(jtv) - } - - case "Text": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Text = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLendingDetectionList(v *[]types.LendingDetection, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.LendingDetection - if *v == nil { - cv = []types.LendingDetection{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.LendingDetection - destAddr := &col - if err := awsAwsjson11_deserializeDocumentLendingDetection(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentLendingDocument(v **types.LendingDocument, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.LendingDocument - if *v == nil { - sv = &types.LendingDocument{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "LendingFields": - if err := awsAwsjson11_deserializeDocumentLendingFieldList(&sv.LendingFields, value); err != nil { - return err - } - - case "SignatureDetections": - if err := awsAwsjson11_deserializeDocumentSignatureDetectionList(&sv.SignatureDetections, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLendingField(v **types.LendingField, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.LendingField - if *v == nil { - sv = &types.LendingField{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "KeyDetection": - if err := awsAwsjson11_deserializeDocumentLendingDetection(&sv.KeyDetection, value); err != nil { - return err - } - - case "Type": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Type = ptr.String(jtv) - } - - case "ValueDetections": - if err := awsAwsjson11_deserializeDocumentLendingDetectionList(&sv.ValueDetections, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLendingFieldList(v *[]types.LendingField, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.LendingField - if *v == nil { - cv = []types.LendingField{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.LendingField - destAddr := &col - if err := awsAwsjson11_deserializeDocumentLendingField(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentLendingResult(v **types.LendingResult, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.LendingResult - if *v == nil { - sv = &types.LendingResult{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Extractions": - if err := awsAwsjson11_deserializeDocumentExtractionList(&sv.Extractions, value); err != nil { - return err - } - - case "Page": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.Page = ptr.Int32(int32(i64)) - } - - case "PageClassification": - if err := awsAwsjson11_deserializeDocumentPageClassification(&sv.PageClassification, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLendingResultList(v *[]types.LendingResult, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.LendingResult - if *v == nil { - cv = []types.LendingResult{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.LendingResult - destAddr := &col - if err := awsAwsjson11_deserializeDocumentLendingResult(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentLendingSummary(v **types.LendingSummary, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.LendingSummary - if *v == nil { - sv = &types.LendingSummary{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "DocumentGroups": - if err := awsAwsjson11_deserializeDocumentDocumentGroupList(&sv.DocumentGroups, value); err != nil { - return err - } - - case "UndetectedDocumentTypes": - if err := awsAwsjson11_deserializeDocumentUndetectedDocumentTypeList(&sv.UndetectedDocumentTypes, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLimitExceededException(v **types.LimitExceededException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.LimitExceededException - if *v == nil { - sv = &types.LimitExceededException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLineItemFields(v **types.LineItemFields, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.LineItemFields - if *v == nil { - sv = &types.LineItemFields{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "LineItemExpenseFields": - if err := awsAwsjson11_deserializeDocumentExpenseFieldList(&sv.LineItemExpenseFields, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLineItemGroup(v **types.LineItemGroup, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.LineItemGroup - if *v == nil { - sv = &types.LineItemGroup{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "LineItemGroupIndex": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.LineItemGroupIndex = ptr.Int32(int32(i64)) - } - - case "LineItems": - if err := awsAwsjson11_deserializeDocumentLineItemList(&sv.LineItems, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentLineItemGroupList(v *[]types.LineItemGroup, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.LineItemGroup - if *v == nil { - cv = []types.LineItemGroup{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.LineItemGroup - destAddr := &col - if err := awsAwsjson11_deserializeDocumentLineItemGroup(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentLineItemList(v *[]types.LineItemFields, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.LineItemFields - if *v == nil { - cv = []types.LineItemFields{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.LineItemFields - destAddr := &col - if err := awsAwsjson11_deserializeDocumentLineItemFields(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentNormalizedValue(v **types.NormalizedValue, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.NormalizedValue - if *v == nil { - sv = &types.NormalizedValue{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Value": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Value = ptr.String(jtv) - } - - case "ValueType": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ValueType to be of type string, got %T instead", value) - } - sv.ValueType = types.ValueType(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentOutputConfig(v **types.OutputConfig, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.OutputConfig - if *v == nil { - sv = &types.OutputConfig{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "S3Bucket": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected S3Bucket to be of type string, got %T instead", value) - } - sv.S3Bucket = ptr.String(jtv) - } - - case "S3Prefix": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected S3ObjectName to be of type string, got %T instead", value) - } - sv.S3Prefix = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentPageClassification(v **types.PageClassification, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.PageClassification - if *v == nil { - sv = &types.PageClassification{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "PageNumber": - if err := awsAwsjson11_deserializeDocumentPredictionList(&sv.PageNumber, value); err != nil { - return err - } - - case "PageType": - if err := awsAwsjson11_deserializeDocumentPredictionList(&sv.PageType, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentPageList(v *[]int32, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []int32 - if *v == nil { - cv = []int32{} - } else { - cv = *v - } - - for _, value := range shape { - var col int32 - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - col = int32(i64) - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentPages(v *[]int32, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []int32 - if *v == nil { - cv = []int32{} - } else { - cv = *v - } - - for _, value := range shape { - var col int32 - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - col = int32(i64) - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentPoint(v **types.Point, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.Point - if *v == nil { - sv = &types.Point{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "X": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.X = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.X = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - case "Y": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Y = float32(f64) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Y = float32(f64) - - default: - return fmt.Errorf("expected Float to be a JSON Number, got %T instead", value) - - } - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentPolygon(v *[]types.Point, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.Point - if *v == nil { - cv = []types.Point{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.Point - destAddr := &col - if err := awsAwsjson11_deserializeDocumentPoint(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentPrediction(v **types.Prediction, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.Prediction - if *v == nil { - sv = &types.Prediction{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Confidence": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Confidence = ptr.Float32(float32(f64)) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Confidence = ptr.Float32(float32(f64)) - - default: - return fmt.Errorf("expected Percent to be a JSON Number, got %T instead", value) - - } - } - - case "Value": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) - } - sv.Value = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentPredictionList(v *[]types.Prediction, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.Prediction - if *v == nil { - cv = []types.Prediction{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.Prediction - destAddr := &col - if err := awsAwsjson11_deserializeDocumentPrediction(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentProvisionedThroughputExceededException(v **types.ProvisionedThroughputExceededException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ProvisionedThroughputExceededException - if *v == nil { - sv = &types.ProvisionedThroughputExceededException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentQuery(v **types.Query, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.Query - if *v == nil { - sv = &types.Query{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Alias": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueryInput to be of type string, got %T instead", value) - } - sv.Alias = ptr.String(jtv) - } - - case "Pages": - if err := awsAwsjson11_deserializeDocumentQueryPages(&sv.Pages, value); err != nil { - return err - } - - case "Text": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueryInput to be of type string, got %T instead", value) - } - sv.Text = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentQueryPages(v *[]string, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []string - if *v == nil { - cv = []string{} - } else { - cv = *v - } - - for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected QueryPage to be of type string, got %T instead", value) - } - col = jtv - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentRelationship(v **types.Relationship, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.Relationship - if *v == nil { - sv = &types.Relationship{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Ids": - if err := awsAwsjson11_deserializeDocumentIdList(&sv.Ids, value); err != nil { - return err - } - - case "Type": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected RelationshipType to be of type string, got %T instead", value) - } - sv.Type = types.RelationshipType(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentRelationshipList(v *[]types.Relationship, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.Relationship - if *v == nil { - cv = []types.Relationship{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.Relationship - destAddr := &col - if err := awsAwsjson11_deserializeDocumentRelationship(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentResourceNotFoundException(v **types.ResourceNotFoundException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ResourceNotFoundException - if *v == nil { - sv = &types.ResourceNotFoundException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentS3Object(v **types.S3Object, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.S3Object - if *v == nil { - sv = &types.S3Object{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Bucket": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected S3Bucket to be of type string, got %T instead", value) - } - sv.Bucket = ptr.String(jtv) - } - - case "Name": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected S3ObjectName to be of type string, got %T instead", value) - } - sv.Name = ptr.String(jtv) - } - - case "Version": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected S3ObjectVersion to be of type string, got %T instead", value) - } - sv.Version = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentServiceQuotaExceededException(v **types.ServiceQuotaExceededException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ServiceQuotaExceededException - if *v == nil { - sv = &types.ServiceQuotaExceededException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentSignatureDetection(v **types.SignatureDetection, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.SignatureDetection - if *v == nil { - sv = &types.SignatureDetection{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Confidence": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.Confidence = ptr.Float32(float32(f64)) - - case string: - var f64 float64 - switch { - case strings.EqualFold(jtv, "NaN"): - f64 = math.NaN() - - case strings.EqualFold(jtv, "Infinity"): - f64 = math.Inf(1) - - case strings.EqualFold(jtv, "-Infinity"): - f64 = math.Inf(-1) - - default: - return fmt.Errorf("unknown JSON number value: %s", jtv) - - } - sv.Confidence = ptr.Float32(float32(f64)) - - default: - return fmt.Errorf("expected Percent to be a JSON Number, got %T instead", value) - - } - } - - case "Geometry": - if err := awsAwsjson11_deserializeDocumentGeometry(&sv.Geometry, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentSignatureDetectionList(v *[]types.SignatureDetection, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.SignatureDetection - if *v == nil { - cv = []types.SignatureDetection{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.SignatureDetection - destAddr := &col - if err := awsAwsjson11_deserializeDocumentSignatureDetection(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentSplitDocument(v **types.SplitDocument, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.SplitDocument - if *v == nil { - sv = &types.SplitDocument{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Index": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.Index = ptr.Int32(int32(i64)) - } - - case "Pages": - if err := awsAwsjson11_deserializeDocumentPageList(&sv.Pages, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentSplitDocumentList(v *[]types.SplitDocument, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.SplitDocument - if *v == nil { - cv = []types.SplitDocument{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.SplitDocument - destAddr := &col - if err := awsAwsjson11_deserializeDocumentSplitDocument(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentStringList(v *[]string, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []string - if *v == nil { - cv = []string{} - } else { - cv = *v - } - - for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - col = jtv - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentTagMap(v *map[string]string, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var mv map[string]string - if *v == nil { - mv = map[string]string{} - } else { - mv = *v - } - - for key, value := range shape { - var parsedVal string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected TagValue to be of type string, got %T instead", value) - } - parsedVal = jtv - } - mv[key] = parsedVal - - } - *v = mv - return nil -} - -func awsAwsjson11_deserializeDocumentThrottlingException(v **types.ThrottlingException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ThrottlingException - if *v == nil { - sv = &types.ThrottlingException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentUndetectedDocumentTypeList(v *[]string, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []string - if *v == nil { - cv = []string{} - } else { - cv = *v - } - - for _, value := range shape { - var col string - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected NonEmptyString to be of type string, got %T instead", value) - } - col = jtv - } - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentUndetectedSignature(v **types.UndetectedSignature, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.UndetectedSignature - if *v == nil { - sv = &types.UndetectedSignature{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Page": - if value != nil { - jtv, ok := value.(json.Number) - if !ok { - return fmt.Errorf("expected UInteger to be json.Number, got %T instead", value) - } - i64, err := jtv.Int64() - if err != nil { - return err - } - sv.Page = ptr.Int32(int32(i64)) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentUndetectedSignatureList(v *[]types.UndetectedSignature, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.UndetectedSignature - if *v == nil { - cv = []types.UndetectedSignature{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.UndetectedSignature - destAddr := &col - if err := awsAwsjson11_deserializeDocumentUndetectedSignature(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeDocumentUnsupportedDocumentException(v **types.UnsupportedDocumentException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.UnsupportedDocumentException - if *v == nil { - sv = &types.UnsupportedDocumentException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentValidationException(v **types.ValidationException, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.ValidationException - if *v == nil { - sv = &types.ValidationException{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Code": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Code = ptr.String(jtv) - } - - case "message", "Message": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.Message = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentWarning(v **types.Warning, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *types.Warning - if *v == nil { - sv = &types.Warning{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "ErrorCode": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected ErrorCode to be of type string, got %T instead", value) - } - sv.ErrorCode = ptr.String(jtv) - } - - case "Pages": - if err := awsAwsjson11_deserializeDocumentPages(&sv.Pages, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeDocumentWarnings(v *[]types.Warning, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.([]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var cv []types.Warning - if *v == nil { - cv = []types.Warning{} - } else { - cv = *v - } - - for _, value := range shape { - var col types.Warning - destAddr := &col - if err := awsAwsjson11_deserializeDocumentWarning(&destAddr, value); err != nil { - return err - } - col = *destAddr - cv = append(cv, col) - - } - *v = cv - return nil -} - -func awsAwsjson11_deserializeOpDocumentAnalyzeDocumentOutput(v **AnalyzeDocumentOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *AnalyzeDocumentOutput - if *v == nil { - sv = &AnalyzeDocumentOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AnalyzeDocumentModelVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.AnalyzeDocumentModelVersion = ptr.String(jtv) - } - - case "Blocks": - if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil { - return err - } - - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - case "HumanLoopActivationOutput": - if err := awsAwsjson11_deserializeDocumentHumanLoopActivationOutput(&sv.HumanLoopActivationOutput, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentAnalyzeExpenseOutput(v **AnalyzeExpenseOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *AnalyzeExpenseOutput - if *v == nil { - sv = &AnalyzeExpenseOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - case "ExpenseDocuments": - if err := awsAwsjson11_deserializeDocumentExpenseDocumentList(&sv.ExpenseDocuments, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentAnalyzeIDOutput(v **AnalyzeIDOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *AnalyzeIDOutput - if *v == nil { - sv = &AnalyzeIDOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AnalyzeIDModelVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.AnalyzeIDModelVersion = ptr.String(jtv) - } - - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - case "IdentityDocuments": - if err := awsAwsjson11_deserializeDocumentIdentityDocumentList(&sv.IdentityDocuments, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentCreateAdapterOutput(v **CreateAdapterOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *CreateAdapterOutput - if *v == nil { - sv = &CreateAdapterOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterId to be of type string, got %T instead", value) - } - sv.AdapterId = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentCreateAdapterVersionOutput(v **CreateAdapterVersionOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *CreateAdapterVersionOutput - if *v == nil { - sv = &CreateAdapterVersionOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterId to be of type string, got %T instead", value) - } - sv.AdapterId = ptr.String(jtv) - } - - case "AdapterVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterVersion to be of type string, got %T instead", value) - } - sv.AdapterVersion = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentDeleteAdapterOutput(v **DeleteAdapterOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *DeleteAdapterOutput - if *v == nil { - sv = &DeleteAdapterOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentDeleteAdapterVersionOutput(v **DeleteAdapterVersionOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *DeleteAdapterVersionOutput - if *v == nil { - sv = &DeleteAdapterVersionOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentDetectDocumentTextOutput(v **DetectDocumentTextOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *DetectDocumentTextOutput - if *v == nil { - sv = &DetectDocumentTextOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Blocks": - if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil { - return err - } - - case "DetectDocumentTextModelVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.DetectDocumentTextModelVersion = ptr.String(jtv) - } - - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentGetAdapterOutput(v **GetAdapterOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *GetAdapterOutput - if *v == nil { - sv = &GetAdapterOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterId to be of type string, got %T instead", value) - } - sv.AdapterId = ptr.String(jtv) - } - - case "AdapterName": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterName to be of type string, got %T instead", value) - } - sv.AdapterName = ptr.String(jtv) - } - - case "AutoUpdate": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AutoUpdate to be of type string, got %T instead", value) - } - sv.AutoUpdate = types.AutoUpdate(jtv) - } - - case "CreationTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value) - - } - } - - case "Description": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterDescription to be of type string, got %T instead", value) - } - sv.Description = ptr.String(jtv) - } - - case "FeatureTypes": - if err := awsAwsjson11_deserializeDocumentFeatureTypes(&sv.FeatureTypes, value); err != nil { - return err - } - - case "Tags": - if err := awsAwsjson11_deserializeDocumentTagMap(&sv.Tags, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentGetAdapterVersionOutput(v **GetAdapterVersionOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *GetAdapterVersionOutput - if *v == nil { - sv = &GetAdapterVersionOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterId to be of type string, got %T instead", value) - } - sv.AdapterId = ptr.String(jtv) - } - - case "AdapterVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterVersion to be of type string, got %T instead", value) - } - sv.AdapterVersion = ptr.String(jtv) - } - - case "CreationTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value) - - } - } - - case "DatasetConfig": - if err := awsAwsjson11_deserializeDocumentAdapterVersionDatasetConfig(&sv.DatasetConfig, value); err != nil { - return err - } - - case "EvaluationMetrics": - if err := awsAwsjson11_deserializeDocumentAdapterVersionEvaluationMetrics(&sv.EvaluationMetrics, value); err != nil { - return err - } - - case "FeatureTypes": - if err := awsAwsjson11_deserializeDocumentFeatureTypes(&sv.FeatureTypes, value); err != nil { - return err - } - - case "KMSKeyId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected KMSKeyId to be of type string, got %T instead", value) - } - sv.KMSKeyId = ptr.String(jtv) - } - - case "OutputConfig": - if err := awsAwsjson11_deserializeDocumentOutputConfig(&sv.OutputConfig, value); err != nil { - return err - } - - case "Status": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterVersionStatus to be of type string, got %T instead", value) - } - sv.Status = types.AdapterVersionStatus(jtv) - } - - case "StatusMessage": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterVersionStatusMessage to be of type string, got %T instead", value) - } - sv.StatusMessage = ptr.String(jtv) - } - - case "Tags": - if err := awsAwsjson11_deserializeDocumentTagMap(&sv.Tags, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentGetDocumentAnalysisOutput(v **GetDocumentAnalysisOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *GetDocumentAnalysisOutput - if *v == nil { - sv = &GetDocumentAnalysisOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AnalyzeDocumentModelVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.AnalyzeDocumentModelVersion = ptr.String(jtv) - } - - case "Blocks": - if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil { - return err - } - - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - case "JobStatus": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) - } - sv.JobStatus = types.JobStatus(jtv) - } - - case "NextToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) - } - sv.NextToken = ptr.String(jtv) - } - - case "StatusMessage": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected StatusMessage to be of type string, got %T instead", value) - } - sv.StatusMessage = ptr.String(jtv) - } - - case "Warnings": - if err := awsAwsjson11_deserializeDocumentWarnings(&sv.Warnings, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentGetDocumentTextDetectionOutput(v **GetDocumentTextDetectionOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *GetDocumentTextDetectionOutput - if *v == nil { - sv = &GetDocumentTextDetectionOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Blocks": - if err := awsAwsjson11_deserializeDocumentBlockList(&sv.Blocks, value); err != nil { - return err - } - - case "DetectDocumentTextModelVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.DetectDocumentTextModelVersion = ptr.String(jtv) - } - - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - case "JobStatus": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) - } - sv.JobStatus = types.JobStatus(jtv) - } - - case "NextToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) - } - sv.NextToken = ptr.String(jtv) - } - - case "StatusMessage": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected StatusMessage to be of type string, got %T instead", value) - } - sv.StatusMessage = ptr.String(jtv) - } - - case "Warnings": - if err := awsAwsjson11_deserializeDocumentWarnings(&sv.Warnings, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentGetExpenseAnalysisOutput(v **GetExpenseAnalysisOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *GetExpenseAnalysisOutput - if *v == nil { - sv = &GetExpenseAnalysisOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AnalyzeExpenseModelVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.AnalyzeExpenseModelVersion = ptr.String(jtv) - } - - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - case "ExpenseDocuments": - if err := awsAwsjson11_deserializeDocumentExpenseDocumentList(&sv.ExpenseDocuments, value); err != nil { - return err - } - - case "JobStatus": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) - } - sv.JobStatus = types.JobStatus(jtv) - } - - case "NextToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) - } - sv.NextToken = ptr.String(jtv) - } - - case "StatusMessage": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected StatusMessage to be of type string, got %T instead", value) - } - sv.StatusMessage = ptr.String(jtv) - } - - case "Warnings": - if err := awsAwsjson11_deserializeDocumentWarnings(&sv.Warnings, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentGetLendingAnalysisOutput(v **GetLendingAnalysisOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *GetLendingAnalysisOutput - if *v == nil { - sv = &GetLendingAnalysisOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AnalyzeLendingModelVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.AnalyzeLendingModelVersion = ptr.String(jtv) - } - - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - case "JobStatus": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) - } - sv.JobStatus = types.JobStatus(jtv) - } - - case "NextToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) - } - sv.NextToken = ptr.String(jtv) - } - - case "Results": - if err := awsAwsjson11_deserializeDocumentLendingResultList(&sv.Results, value); err != nil { - return err - } - - case "StatusMessage": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected StatusMessage to be of type string, got %T instead", value) - } - sv.StatusMessage = ptr.String(jtv) - } - - case "Warnings": - if err := awsAwsjson11_deserializeDocumentWarnings(&sv.Warnings, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentGetLendingAnalysisSummaryOutput(v **GetLendingAnalysisSummaryOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *GetLendingAnalysisSummaryOutput - if *v == nil { - sv = &GetLendingAnalysisSummaryOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AnalyzeLendingModelVersion": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected String to be of type string, got %T instead", value) - } - sv.AnalyzeLendingModelVersion = ptr.String(jtv) - } - - case "DocumentMetadata": - if err := awsAwsjson11_deserializeDocumentDocumentMetadata(&sv.DocumentMetadata, value); err != nil { - return err - } - - case "JobStatus": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobStatus to be of type string, got %T instead", value) - } - sv.JobStatus = types.JobStatus(jtv) - } - - case "StatusMessage": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected StatusMessage to be of type string, got %T instead", value) - } - sv.StatusMessage = ptr.String(jtv) - } - - case "Summary": - if err := awsAwsjson11_deserializeDocumentLendingSummary(&sv.Summary, value); err != nil { - return err - } - - case "Warnings": - if err := awsAwsjson11_deserializeDocumentWarnings(&sv.Warnings, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentListAdaptersOutput(v **ListAdaptersOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *ListAdaptersOutput - if *v == nil { - sv = &ListAdaptersOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Adapters": - if err := awsAwsjson11_deserializeDocumentAdapterList(&sv.Adapters, value); err != nil { - return err - } - - case "NextToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) - } - sv.NextToken = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentListAdapterVersionsOutput(v **ListAdapterVersionsOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *ListAdapterVersionsOutput - if *v == nil { - sv = &ListAdapterVersionsOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterVersions": - if err := awsAwsjson11_deserializeDocumentAdapterVersionList(&sv.AdapterVersions, value); err != nil { - return err - } - - case "NextToken": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected PaginationToken to be of type string, got %T instead", value) - } - sv.NextToken = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentListTagsForResourceOutput(v **ListTagsForResourceOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *ListTagsForResourceOutput - if *v == nil { - sv = &ListTagsForResourceOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "Tags": - if err := awsAwsjson11_deserializeDocumentTagMap(&sv.Tags, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentStartDocumentAnalysisOutput(v **StartDocumentAnalysisOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *StartDocumentAnalysisOutput - if *v == nil { - sv = &StartDocumentAnalysisOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "JobId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobId to be of type string, got %T instead", value) - } - sv.JobId = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentStartDocumentTextDetectionOutput(v **StartDocumentTextDetectionOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *StartDocumentTextDetectionOutput - if *v == nil { - sv = &StartDocumentTextDetectionOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "JobId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobId to be of type string, got %T instead", value) - } - sv.JobId = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentStartExpenseAnalysisOutput(v **StartExpenseAnalysisOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *StartExpenseAnalysisOutput - if *v == nil { - sv = &StartExpenseAnalysisOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "JobId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobId to be of type string, got %T instead", value) - } - sv.JobId = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentStartLendingAnalysisOutput(v **StartLendingAnalysisOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *StartLendingAnalysisOutput - if *v == nil { - sv = &StartLendingAnalysisOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "JobId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected JobId to be of type string, got %T instead", value) - } - sv.JobId = ptr.String(jtv) - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentTagResourceOutput(v **TagResourceOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *TagResourceOutput - if *v == nil { - sv = &TagResourceOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentUntagResourceOutput(v **UntagResourceOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *UntagResourceOutput - if *v == nil { - sv = &UntagResourceOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -func awsAwsjson11_deserializeOpDocumentUpdateAdapterOutput(v **UpdateAdapterOutput, value interface{}) error { - if v == nil { - return fmt.Errorf("unexpected nil of type %T", v) - } - if value == nil { - return nil - } - - shape, ok := value.(map[string]interface{}) - if !ok { - return fmt.Errorf("unexpected JSON type %v", value) - } - - var sv *UpdateAdapterOutput - if *v == nil { - sv = &UpdateAdapterOutput{} - } else { - sv = *v - } - - for key, value := range shape { - switch key { - case "AdapterId": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterId to be of type string, got %T instead", value) - } - sv.AdapterId = ptr.String(jtv) - } - - case "AdapterName": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterName to be of type string, got %T instead", value) - } - sv.AdapterName = ptr.String(jtv) - } - - case "AutoUpdate": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AutoUpdate to be of type string, got %T instead", value) - } - sv.AutoUpdate = types.AutoUpdate(jtv) - } - - case "CreationTime": - if value != nil { - switch jtv := value.(type) { - case json.Number: - f64, err := jtv.Float64() - if err != nil { - return err - } - sv.CreationTime = ptr.Time(smithytime.ParseEpochSeconds(f64)) - - default: - return fmt.Errorf("expected DateTime to be a JSON Number, got %T instead", value) - - } - } - - case "Description": - if value != nil { - jtv, ok := value.(string) - if !ok { - return fmt.Errorf("expected AdapterDescription to be of type string, got %T instead", value) - } - sv.Description = ptr.String(jtv) - } - - case "FeatureTypes": - if err := awsAwsjson11_deserializeDocumentFeatureTypes(&sv.FeatureTypes, value); err != nil { - return err - } - - default: - _, _ = key, value - - } - } - *v = sv - return nil -} - -type protocolErrorInfo struct { - Type string `json:"__type"` - Message string - Code any // nonstandard for awsjson but some services do present the type here -} - -func getProtocolErrorInfo(decoder *json.Decoder) (protocolErrorInfo, error) { - var errInfo protocolErrorInfo - if err := decoder.Decode(&errInfo); err != nil { - if err == io.EOF { - return errInfo, nil - } - return errInfo, err - } - - return errInfo, nil -} - -func resolveProtocolErrorType(headerType string, bodyInfo protocolErrorInfo) (string, bool) { - if len(headerType) != 0 { - return headerType, true - } else if len(bodyInfo.Type) != 0 { - return bodyInfo.Type, true - } else if code, ok := bodyInfo.Code.(string); ok && len(code) != 0 { - return code, true - } - return "", false -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/doc.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/doc.go deleted file mode 100644 index c550456f..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/doc.go +++ /dev/null @@ -1,9 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -// Package textract provides the API client, operations, and parameter types for -// Amazon Textract. -// -// Amazon Textract detects and analyzes text in documents and converts it into -// machine-readable text. This is the API reference documentation for Amazon -// Textract. -package textract diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/endpoints.go deleted file mode 100644 index 024c2952..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/endpoints.go +++ /dev/null @@ -1,537 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "errors" - "fmt" - "github.com/aws/aws-sdk-go-v2/aws" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - internalConfig "github.com/aws/aws-sdk-go-v2/internal/configsources" - "github.com/aws/aws-sdk-go-v2/internal/endpoints" - "github.com/aws/aws-sdk-go-v2/internal/endpoints/awsrulesfn" - internalendpoints "github.com/aws/aws-sdk-go-v2/service/textract/internal/endpoints" - smithyauth "github.com/aws/smithy-go/auth" - smithyendpoints "github.com/aws/smithy-go/endpoints" - "github.com/aws/smithy-go/middleware" - "github.com/aws/smithy-go/ptr" - "github.com/aws/smithy-go/tracing" - smithyhttp "github.com/aws/smithy-go/transport/http" - "net/http" - "net/url" - "os" - "strings" -) - -// EndpointResolverOptions is the service endpoint resolver options -type EndpointResolverOptions = internalendpoints.Options - -// EndpointResolver interface for resolving service endpoints. -type EndpointResolver interface { - ResolveEndpoint(region string, options EndpointResolverOptions) (aws.Endpoint, error) -} - -var _ EndpointResolver = &internalendpoints.Resolver{} - -// NewDefaultEndpointResolver constructs a new service endpoint resolver -func NewDefaultEndpointResolver() *internalendpoints.Resolver { - return internalendpoints.New() -} - -// EndpointResolverFunc is a helper utility that wraps a function so it satisfies -// the EndpointResolver interface. This is useful when you want to add additional -// endpoint resolving logic, or stub out specific endpoints with custom values. -type EndpointResolverFunc func(region string, options EndpointResolverOptions) (aws.Endpoint, error) - -func (fn EndpointResolverFunc) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { - return fn(region, options) -} - -// EndpointResolverFromURL returns an EndpointResolver configured using the -// provided endpoint url. By default, the resolved endpoint resolver uses the -// client region as signing region, and the endpoint source is set to -// EndpointSourceCustom.You can provide functional options to configure endpoint -// values for the resolved endpoint. -func EndpointResolverFromURL(url string, optFns ...func(*aws.Endpoint)) EndpointResolver { - e := aws.Endpoint{URL: url, Source: aws.EndpointSourceCustom} - for _, fn := range optFns { - fn(&e) - } - - return EndpointResolverFunc( - func(region string, options EndpointResolverOptions) (aws.Endpoint, error) { - if len(e.SigningRegion) == 0 { - e.SigningRegion = region - } - return e, nil - }, - ) -} - -type ResolveEndpoint struct { - Resolver EndpointResolver - Options EndpointResolverOptions -} - -func (*ResolveEndpoint) ID() string { - return "ResolveEndpoint" -} - -func (m *ResolveEndpoint) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - if !awsmiddleware.GetRequiresLegacyEndpoints(ctx) { - return next.HandleSerialize(ctx, in) - } - - req, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) - } - - if m.Resolver == nil { - return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") - } - - eo := m.Options - eo.Logger = middleware.GetLogger(ctx) - - var endpoint aws.Endpoint - endpoint, err = m.Resolver.ResolveEndpoint(awsmiddleware.GetRegion(ctx), eo) - if err != nil { - nf := (&aws.EndpointNotFoundError{}) - if errors.As(err, &nf) { - ctx = awsmiddleware.SetRequiresLegacyEndpoints(ctx, false) - return next.HandleSerialize(ctx, in) - } - return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) - } - - req.URL, err = url.Parse(endpoint.URL) - if err != nil { - return out, metadata, fmt.Errorf("failed to parse endpoint URL: %w", err) - } - - if len(awsmiddleware.GetSigningName(ctx)) == 0 { - signingName := endpoint.SigningName - if len(signingName) == 0 { - signingName = "textract" - } - ctx = awsmiddleware.SetSigningName(ctx, signingName) - } - ctx = awsmiddleware.SetEndpointSource(ctx, endpoint.Source) - ctx = smithyhttp.SetHostnameImmutable(ctx, endpoint.HostnameImmutable) - ctx = awsmiddleware.SetSigningRegion(ctx, endpoint.SigningRegion) - ctx = awsmiddleware.SetPartitionID(ctx, endpoint.PartitionID) - return next.HandleSerialize(ctx, in) -} -func addResolveEndpointMiddleware(stack *middleware.Stack, o Options) error { - return stack.Serialize.Insert(&ResolveEndpoint{ - Resolver: o.EndpointResolver, - Options: o.EndpointOptions, - }, "OperationSerializer", middleware.Before) -} - -func removeResolveEndpointMiddleware(stack *middleware.Stack) error { - _, err := stack.Serialize.Remove((&ResolveEndpoint{}).ID()) - return err -} - -type wrappedEndpointResolver struct { - awsResolver aws.EndpointResolverWithOptions -} - -func (w *wrappedEndpointResolver) ResolveEndpoint(region string, options EndpointResolverOptions) (endpoint aws.Endpoint, err error) { - return w.awsResolver.ResolveEndpoint(ServiceID, region, options) -} - -type awsEndpointResolverAdaptor func(service, region string) (aws.Endpoint, error) - -func (a awsEndpointResolverAdaptor) ResolveEndpoint(service, region string, options ...interface{}) (aws.Endpoint, error) { - return a(service, region) -} - -var _ aws.EndpointResolverWithOptions = awsEndpointResolverAdaptor(nil) - -// withEndpointResolver returns an aws.EndpointResolverWithOptions that first delegates endpoint resolution to the awsResolver. -// If awsResolver returns aws.EndpointNotFoundError error, the v1 resolver middleware will swallow the error, -// and set an appropriate context flag such that fallback will occur when EndpointResolverV2 is invoked -// via its middleware. -// -// If another error (besides aws.EndpointNotFoundError) is returned, then that error will be propagated. -func withEndpointResolver(awsResolver aws.EndpointResolver, awsResolverWithOptions aws.EndpointResolverWithOptions) EndpointResolver { - var resolver aws.EndpointResolverWithOptions - - if awsResolverWithOptions != nil { - resolver = awsResolverWithOptions - } else if awsResolver != nil { - resolver = awsEndpointResolverAdaptor(awsResolver.ResolveEndpoint) - } - - return &wrappedEndpointResolver{ - awsResolver: resolver, - } -} - -func finalizeClientEndpointResolverOptions(options *Options) { - options.EndpointOptions.LogDeprecated = options.ClientLogMode.IsDeprecatedUsage() - - if len(options.EndpointOptions.ResolvedRegion) == 0 { - const fipsInfix = "-fips-" - const fipsPrefix = "fips-" - const fipsSuffix = "-fips" - - if strings.Contains(options.Region, fipsInfix) || - strings.Contains(options.Region, fipsPrefix) || - strings.Contains(options.Region, fipsSuffix) { - options.EndpointOptions.ResolvedRegion = strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll( - options.Region, fipsInfix, "-"), fipsPrefix, ""), fipsSuffix, "") - options.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateEnabled - } - } - -} - -func resolveEndpointResolverV2(options *Options) { - if options.EndpointResolverV2 == nil { - options.EndpointResolverV2 = NewDefaultEndpointResolverV2() - } -} - -func resolveBaseEndpoint(cfg aws.Config, o *Options) { - if cfg.BaseEndpoint != nil { - o.BaseEndpoint = cfg.BaseEndpoint - } - - _, g := os.LookupEnv("AWS_ENDPOINT_URL") - _, s := os.LookupEnv("AWS_ENDPOINT_URL_TEXTRACT") - - if g && !s { - return - } - - value, found, err := internalConfig.ResolveServiceBaseEndpoint(context.Background(), "Textract", cfg.ConfigSources) - if found && err == nil { - o.BaseEndpoint = &value - } -} - -func bindRegion(region string) *string { - if region == "" { - return nil - } - return aws.String(endpoints.MapFIPSRegion(region)) -} - -// EndpointParameters provides the parameters that influence how endpoints are -// resolved. -type EndpointParameters struct { - // The AWS region used to dispatch the request. - // - // Parameter is - // required. - // - // AWS::Region - Region *string - - // When true, use the dual-stack endpoint. If the configured endpoint does not - // support dual-stack, dispatching the request MAY return an error. - // - // Defaults to - // false if no value is provided. - // - // AWS::UseDualStack - UseDualStack *bool - - // When true, send this request to the FIPS-compliant regional endpoint. If the - // configured endpoint does not have a FIPS compliant endpoint, dispatching the - // request will return an error. - // - // Defaults to false if no value is - // provided. - // - // AWS::UseFIPS - UseFIPS *bool - - // Override the endpoint used to send this request - // - // Parameter is - // required. - // - // SDK::Endpoint - Endpoint *string -} - -// ValidateRequired validates required parameters are set. -func (p EndpointParameters) ValidateRequired() error { - if p.UseDualStack == nil { - return fmt.Errorf("parameter UseDualStack is required") - } - - if p.UseFIPS == nil { - return fmt.Errorf("parameter UseFIPS is required") - } - - return nil -} - -// WithDefaults returns a shallow copy of EndpointParameterswith default values -// applied to members where applicable. -func (p EndpointParameters) WithDefaults() EndpointParameters { - if p.UseDualStack == nil { - p.UseDualStack = ptr.Bool(false) - } - - if p.UseFIPS == nil { - p.UseFIPS = ptr.Bool(false) - } - return p -} - -type stringSlice []string - -func (s stringSlice) Get(i int) *string { - if i < 0 || i >= len(s) { - return nil - } - - v := s[i] - return &v -} - -// EndpointResolverV2 provides the interface for resolving service endpoints. -type EndpointResolverV2 interface { - // ResolveEndpoint attempts to resolve the endpoint with the provided options, - // returning the endpoint if found. Otherwise an error is returned. - ResolveEndpoint(ctx context.Context, params EndpointParameters) ( - smithyendpoints.Endpoint, error, - ) -} - -// resolver provides the implementation for resolving endpoints. -type resolver struct{} - -func NewDefaultEndpointResolverV2() EndpointResolverV2 { - return &resolver{} -} - -// ResolveEndpoint attempts to resolve the endpoint with the provided options, -// returning the endpoint if found. Otherwise an error is returned. -func (r *resolver) ResolveEndpoint( - ctx context.Context, params EndpointParameters, -) ( - endpoint smithyendpoints.Endpoint, err error, -) { - params = params.WithDefaults() - if err = params.ValidateRequired(); err != nil { - return endpoint, fmt.Errorf("endpoint parameters are not valid, %w", err) - } - _UseDualStack := *params.UseDualStack - _UseFIPS := *params.UseFIPS - - if exprVal := params.Endpoint; exprVal != nil { - _Endpoint := *exprVal - _ = _Endpoint - if _UseFIPS == true { - return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: FIPS and custom endpoint are not supported") - } - if _UseDualStack == true { - return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Dualstack and custom endpoint are not supported") - } - uriString := _Endpoint - - uri, err := url.Parse(uriString) - if err != nil { - return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) - } - - return smithyendpoints.Endpoint{ - URI: *uri, - Headers: http.Header{}, - }, nil - } - if exprVal := params.Region; exprVal != nil { - _Region := *exprVal - _ = _Region - if exprVal := awsrulesfn.GetPartition(_Region); exprVal != nil { - _PartitionResult := *exprVal - _ = _PartitionResult - if _UseFIPS == true { - if _UseDualStack == true { - if true == _PartitionResult.SupportsFIPS { - if true == _PartitionResult.SupportsDualStack { - uriString := func() string { - var out strings.Builder - out.WriteString("https://textract-fips.") - out.WriteString(_Region) - out.WriteString(".") - out.WriteString(_PartitionResult.DualStackDnsSuffix) - return out.String() - }() - - uri, err := url.Parse(uriString) - if err != nil { - return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) - } - - return smithyendpoints.Endpoint{ - URI: *uri, - Headers: http.Header{}, - }, nil - } - } - return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS and DualStack are enabled, but this partition does not support one or both") - } - } - if _UseFIPS == true { - if true == _PartitionResult.SupportsFIPS { - uriString := func() string { - var out strings.Builder - out.WriteString("https://textract-fips.") - out.WriteString(_Region) - out.WriteString(".") - out.WriteString(_PartitionResult.DnsSuffix) - return out.String() - }() - - uri, err := url.Parse(uriString) - if err != nil { - return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) - } - - return smithyendpoints.Endpoint{ - URI: *uri, - Headers: http.Header{}, - }, nil - } - return endpoint, fmt.Errorf("endpoint rule error, %s", "FIPS is enabled but this partition does not support FIPS") - } - if _UseDualStack == true { - if true == _PartitionResult.SupportsDualStack { - uriString := func() string { - var out strings.Builder - out.WriteString("https://textract.") - out.WriteString(_Region) - out.WriteString(".") - out.WriteString(_PartitionResult.DualStackDnsSuffix) - return out.String() - }() - - uri, err := url.Parse(uriString) - if err != nil { - return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) - } - - return smithyendpoints.Endpoint{ - URI: *uri, - Headers: http.Header{}, - }, nil - } - return endpoint, fmt.Errorf("endpoint rule error, %s", "DualStack is enabled but this partition does not support DualStack") - } - uriString := func() string { - var out strings.Builder - out.WriteString("https://textract.") - out.WriteString(_Region) - out.WriteString(".") - out.WriteString(_PartitionResult.DnsSuffix) - return out.String() - }() - - uri, err := url.Parse(uriString) - if err != nil { - return endpoint, fmt.Errorf("Failed to parse uri: %s", uriString) - } - - return smithyendpoints.Endpoint{ - URI: *uri, - Headers: http.Header{}, - }, nil - } - return endpoint, fmt.Errorf("Endpoint resolution failed. Invalid operation or environment input.") - } - return endpoint, fmt.Errorf("endpoint rule error, %s", "Invalid Configuration: Missing Region") -} - -type endpointParamsBinder interface { - bindEndpointParams(*EndpointParameters) -} - -func bindEndpointParams(ctx context.Context, input interface{}, options Options) *EndpointParameters { - params := &EndpointParameters{} - - params.Region = bindRegion(options.Region) - params.UseDualStack = aws.Bool(options.EndpointOptions.UseDualStackEndpoint == aws.DualStackEndpointStateEnabled) - params.UseFIPS = aws.Bool(options.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled) - params.Endpoint = options.BaseEndpoint - - if b, ok := input.(endpointParamsBinder); ok { - b.bindEndpointParams(params) - } - - return params -} - -type resolveEndpointV2Middleware struct { - options Options -} - -func (*resolveEndpointV2Middleware) ID() string { - return "ResolveEndpointV2" -} - -func (m *resolveEndpointV2Middleware) HandleFinalize(ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler) ( - out middleware.FinalizeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "ResolveEndpoint") - defer span.End() - - if awsmiddleware.GetRequiresLegacyEndpoints(ctx) { - return next.HandleFinalize(ctx, in) - } - - req, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, fmt.Errorf("unknown transport type %T", in.Request) - } - - if m.options.EndpointResolverV2 == nil { - return out, metadata, fmt.Errorf("expected endpoint resolver to not be nil") - } - - params := bindEndpointParams(ctx, getOperationInput(ctx), m.options) - endpt, err := timeOperationMetric(ctx, "client.call.resolve_endpoint_duration", - func() (smithyendpoints.Endpoint, error) { - return m.options.EndpointResolverV2.ResolveEndpoint(ctx, *params) - }) - if err != nil { - return out, metadata, fmt.Errorf("failed to resolve service endpoint, %w", err) - } - - span.SetProperty("client.call.resolved_endpoint", endpt.URI.String()) - - if endpt.URI.RawPath == "" && req.URL.RawPath != "" { - endpt.URI.RawPath = endpt.URI.Path - } - req.URL.Scheme = endpt.URI.Scheme - req.URL.Host = endpt.URI.Host - req.URL.Path = smithyhttp.JoinPath(endpt.URI.Path, req.URL.Path) - req.URL.RawPath = smithyhttp.JoinPath(endpt.URI.RawPath, req.URL.RawPath) - for k := range endpt.Headers { - req.Header.Set(k, endpt.Headers.Get(k)) - } - - rscheme := getResolvedAuthScheme(ctx) - if rscheme == nil { - return out, metadata, fmt.Errorf("no resolved auth scheme") - } - - opts, _ := smithyauth.GetAuthOptions(&endpt.Properties) - for _, o := range opts { - rscheme.SignerProperties.SetAll(&o.SignerProperties) - } - - span.End() - return next.HandleFinalize(ctx, in) -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/generated.json b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/generated.json deleted file mode 100644 index 71a7a082..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/generated.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "dependencies": { - "github.com/aws/aws-sdk-go-v2": "v1.4.0", - "github.com/aws/aws-sdk-go-v2/internal/configsources": "v0.0.0-00010101000000-000000000000", - "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2": "v2.0.0-00010101000000-000000000000", - "github.com/aws/smithy-go": "v1.4.0" - }, - "files": [ - "api_client.go", - "api_client_test.go", - "api_op_AnalyzeDocument.go", - "api_op_AnalyzeExpense.go", - "api_op_AnalyzeID.go", - "api_op_CreateAdapter.go", - "api_op_CreateAdapterVersion.go", - "api_op_DeleteAdapter.go", - "api_op_DeleteAdapterVersion.go", - "api_op_DetectDocumentText.go", - "api_op_GetAdapter.go", - "api_op_GetAdapterVersion.go", - "api_op_GetDocumentAnalysis.go", - "api_op_GetDocumentTextDetection.go", - "api_op_GetExpenseAnalysis.go", - "api_op_GetLendingAnalysis.go", - "api_op_GetLendingAnalysisSummary.go", - "api_op_ListAdapterVersions.go", - "api_op_ListAdapters.go", - "api_op_ListTagsForResource.go", - "api_op_StartDocumentAnalysis.go", - "api_op_StartDocumentTextDetection.go", - "api_op_StartExpenseAnalysis.go", - "api_op_StartLendingAnalysis.go", - "api_op_TagResource.go", - "api_op_UntagResource.go", - "api_op_UpdateAdapter.go", - "auth.go", - "deserializers.go", - "doc.go", - "endpoints.go", - "endpoints_config_test.go", - "endpoints_test.go", - "generated.json", - "internal/endpoints/endpoints.go", - "internal/endpoints/endpoints_test.go", - "options.go", - "protocol_test.go", - "serializers.go", - "snapshot_test.go", - "sra_operation_order_test.go", - "types/enums.go", - "types/errors.go", - "types/types.go", - "validators.go" - ], - "go": "1.22", - "module": "github.com/aws/aws-sdk-go-v2/service/textract", - "unstable": false -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/go_module_metadata.go deleted file mode 100644 index 2d3d2ebf..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/go_module_metadata.go +++ /dev/null @@ -1,6 +0,0 @@ -// Code generated by internal/repotools/cmd/updatemodulemeta DO NOT EDIT. - -package textract - -// goModuleVersion is the tagged release for this module -const goModuleVersion = "1.35.1" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/internal/endpoints/endpoints.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/internal/endpoints/endpoints.go deleted file mode 100644 index e2526571..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/internal/endpoints/endpoints.go +++ /dev/null @@ -1,604 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package endpoints - -import ( - "github.com/aws/aws-sdk-go-v2/aws" - endpoints "github.com/aws/aws-sdk-go-v2/internal/endpoints/v2" - "github.com/aws/smithy-go/logging" - "regexp" -) - -// Options is the endpoint resolver configuration options -type Options struct { - // Logger is a logging implementation that log events should be sent to. - Logger logging.Logger - - // LogDeprecated indicates that deprecated endpoints should be logged to the - // provided logger. - LogDeprecated bool - - // ResolvedRegion is used to override the region to be resolved, rather then the - // using the value passed to the ResolveEndpoint method. This value is used by the - // SDK to translate regions like fips-us-east-1 or us-east-1-fips to an alternative - // name. You must not set this value directly in your application. - ResolvedRegion string - - // DisableHTTPS informs the resolver to return an endpoint that does not use the - // HTTPS scheme. - DisableHTTPS bool - - // UseDualStackEndpoint specifies the resolver must resolve a dual-stack endpoint. - UseDualStackEndpoint aws.DualStackEndpointState - - // UseFIPSEndpoint specifies the resolver must resolve a FIPS endpoint. - UseFIPSEndpoint aws.FIPSEndpointState -} - -func (o Options) GetResolvedRegion() string { - return o.ResolvedRegion -} - -func (o Options) GetDisableHTTPS() bool { - return o.DisableHTTPS -} - -func (o Options) GetUseDualStackEndpoint() aws.DualStackEndpointState { - return o.UseDualStackEndpoint -} - -func (o Options) GetUseFIPSEndpoint() aws.FIPSEndpointState { - return o.UseFIPSEndpoint -} - -func transformToSharedOptions(options Options) endpoints.Options { - return endpoints.Options{ - Logger: options.Logger, - LogDeprecated: options.LogDeprecated, - ResolvedRegion: options.ResolvedRegion, - DisableHTTPS: options.DisableHTTPS, - UseDualStackEndpoint: options.UseDualStackEndpoint, - UseFIPSEndpoint: options.UseFIPSEndpoint, - } -} - -// Resolver Textract endpoint resolver -type Resolver struct { - partitions endpoints.Partitions -} - -// ResolveEndpoint resolves the service endpoint for the given region and options -func (r *Resolver) ResolveEndpoint(region string, options Options) (endpoint aws.Endpoint, err error) { - if len(region) == 0 { - return endpoint, &aws.MissingRegionError{} - } - - opt := transformToSharedOptions(options) - return r.partitions.ResolveEndpoint(region, opt) -} - -// New returns a new Resolver -func New() *Resolver { - return &Resolver{ - partitions: defaultPartitions, - } -} - -var partitionRegexp = struct { - Aws *regexp.Regexp - AwsCn *regexp.Regexp - AwsIso *regexp.Regexp - AwsIsoB *regexp.Regexp - AwsIsoE *regexp.Regexp - AwsIsoF *regexp.Regexp - AwsUsGov *regexp.Regexp -}{ - - Aws: regexp.MustCompile("^(us|eu|ap|sa|ca|me|af|il|mx)\\-\\w+\\-\\d+$"), - AwsCn: regexp.MustCompile("^cn\\-\\w+\\-\\d+$"), - AwsIso: regexp.MustCompile("^us\\-iso\\-\\w+\\-\\d+$"), - AwsIsoB: regexp.MustCompile("^us\\-isob\\-\\w+\\-\\d+$"), - AwsIsoE: regexp.MustCompile("^eu\\-isoe\\-\\w+\\-\\d+$"), - AwsIsoF: regexp.MustCompile("^us\\-isof\\-\\w+\\-\\d+$"), - AwsUsGov: regexp.MustCompile("^us\\-gov\\-\\w+\\-\\d+$"), -} - -var defaultPartitions = endpoints.Partitions{ - { - ID: "aws", - Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ - { - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.{region}.api.aws", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.{region}.amazonaws.com", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.{region}.api.aws", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: 0, - }: { - Hostname: "textract.{region}.amazonaws.com", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - }, - RegionRegex: partitionRegexp.Aws, - IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - endpoints.EndpointKey{ - Region: "ap-northeast-2", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "ap-northeast-2", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.ap-northeast-2.api.aws", - }, - endpoints.EndpointKey{ - Region: "ap-south-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "ap-south-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.ap-south-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "ap-southeast-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "ap-southeast-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.ap-southeast-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "ap-southeast-2", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "ap-southeast-2", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.ap-southeast-2.api.aws", - }, - endpoints.EndpointKey{ - Region: "ca-central-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "ca-central-1", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.ca-central-1.amazonaws.com", - }, - endpoints.EndpointKey{ - Region: "ca-central-1", - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.ca-central-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "ca-central-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.ca-central-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "eu-central-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "eu-central-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.eu-central-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "eu-south-2", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "eu-south-2", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.eu-south-2.api.aws", - }, - endpoints.EndpointKey{ - Region: "eu-west-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "eu-west-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.eu-west-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "eu-west-2", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "eu-west-2", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.eu-west-2.api.aws", - }, - endpoints.EndpointKey{ - Region: "eu-west-3", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "eu-west-3", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.eu-west-3.api.aws", - }, - endpoints.EndpointKey{ - Region: "fips-ca-central-1", - }: endpoints.Endpoint{ - Hostname: "textract-fips.ca-central-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "ca-central-1", - }, - Deprecated: aws.TrueTernary, - }, - endpoints.EndpointKey{ - Region: "fips-us-east-1", - }: endpoints.Endpoint{ - Hostname: "textract-fips.us-east-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-1", - }, - Deprecated: aws.TrueTernary, - }, - endpoints.EndpointKey{ - Region: "fips-us-east-2", - }: endpoints.Endpoint{ - Hostname: "textract-fips.us-east-2.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-east-2", - }, - Deprecated: aws.TrueTernary, - }, - endpoints.EndpointKey{ - Region: "fips-us-west-1", - }: endpoints.Endpoint{ - Hostname: "textract-fips.us-west-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-west-1", - }, - Deprecated: aws.TrueTernary, - }, - endpoints.EndpointKey{ - Region: "fips-us-west-2", - }: endpoints.Endpoint{ - Hostname: "textract-fips.us-west-2.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-west-2", - }, - Deprecated: aws.TrueTernary, - }, - endpoints.EndpointKey{ - Region: "us-east-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-east-1", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.us-east-1.amazonaws.com", - }, - endpoints.EndpointKey{ - Region: "us-east-1", - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.us-east-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-east-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.us-east-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-east-2", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-east-2", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.us-east-2.amazonaws.com", - }, - endpoints.EndpointKey{ - Region: "us-east-2", - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.us-east-2.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-east-2", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.us-east-2.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-west-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-west-1", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.us-west-1.amazonaws.com", - }, - endpoints.EndpointKey{ - Region: "us-west-1", - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.us-west-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-west-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.us-west-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-west-2", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-west-2", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.us-west-2.amazonaws.com", - }, - endpoints.EndpointKey{ - Region: "us-west-2", - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.us-west-2.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-west-2", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.us-west-2.api.aws", - }, - }, - }, - { - ID: "aws-cn", - Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ - { - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.{region}.api.amazonwebservices.com.cn", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.{region}.amazonaws.com.cn", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.{region}.api.amazonwebservices.com.cn", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: 0, - }: { - Hostname: "textract.{region}.amazonaws.com.cn", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - }, - RegionRegex: partitionRegexp.AwsCn, - IsRegionalized: true, - }, - { - ID: "aws-iso", - Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ - { - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.{region}.c2s.ic.gov", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: 0, - }: { - Hostname: "textract.{region}.c2s.ic.gov", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - }, - RegionRegex: partitionRegexp.AwsIso, - IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - endpoints.EndpointKey{ - Region: "us-iso-east-1", - }: endpoints.Endpoint{}, - }, - }, - { - ID: "aws-iso-b", - Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ - { - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.{region}.sc2s.sgov.gov", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: 0, - }: { - Hostname: "textract.{region}.sc2s.sgov.gov", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - }, - RegionRegex: partitionRegexp.AwsIsoB, - IsRegionalized: true, - }, - { - ID: "aws-iso-e", - Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ - { - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.{region}.cloud.adc-e.uk", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: 0, - }: { - Hostname: "textract.{region}.cloud.adc-e.uk", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - }, - RegionRegex: partitionRegexp.AwsIsoE, - IsRegionalized: true, - }, - { - ID: "aws-iso-f", - Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ - { - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.{region}.csp.hci.ic.gov", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: 0, - }: { - Hostname: "textract.{region}.csp.hci.ic.gov", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - }, - RegionRegex: partitionRegexp.AwsIsoF, - IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - endpoints.EndpointKey{ - Region: "us-isof-east-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-isof-south-1", - }: endpoints.Endpoint{}, - }, - }, - { - ID: "aws-us-gov", - Defaults: map[endpoints.DefaultKey]endpoints.Endpoint{ - { - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.{region}.api.aws", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.{region}.amazonaws.com", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.{region}.api.aws", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - { - Variant: 0, - }: { - Hostname: "textract.{region}.amazonaws.com", - Protocols: []string{"https"}, - SignatureVersions: []string{"v4"}, - }, - }, - RegionRegex: partitionRegexp.AwsUsGov, - IsRegionalized: true, - Endpoints: endpoints.Endpoints{ - endpoints.EndpointKey{ - Region: "fips-us-gov-east-1", - }: endpoints.Endpoint{ - Hostname: "textract-fips.us-gov-east-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-east-1", - }, - Deprecated: aws.TrueTernary, - }, - endpoints.EndpointKey{ - Region: "fips-us-gov-west-1", - }: endpoints.Endpoint{ - Hostname: "textract-fips.us-gov-west-1.amazonaws.com", - CredentialScope: endpoints.CredentialScope{ - Region: "us-gov-west-1", - }, - Deprecated: aws.TrueTernary, - }, - endpoints.EndpointKey{ - Region: "us-gov-east-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-gov-east-1", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.us-gov-east-1.amazonaws.com", - }, - endpoints.EndpointKey{ - Region: "us-gov-east-1", - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.us-gov-east-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-gov-east-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.us-gov-east-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-gov-west-1", - }: endpoints.Endpoint{}, - endpoints.EndpointKey{ - Region: "us-gov-west-1", - Variant: endpoints.FIPSVariant, - }: { - Hostname: "textract-fips.us-gov-west-1.amazonaws.com", - }, - endpoints.EndpointKey{ - Region: "us-gov-west-1", - Variant: endpoints.FIPSVariant | endpoints.DualStackVariant, - }: { - Hostname: "textract-fips.us-gov-west-1.api.aws", - }, - endpoints.EndpointKey{ - Region: "us-gov-west-1", - Variant: endpoints.DualStackVariant, - }: { - Hostname: "textract.us-gov-west-1.api.aws", - }, - }, - }, -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/options.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/options.go deleted file mode 100644 index 4eacab04..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/options.go +++ /dev/null @@ -1,236 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "github.com/aws/aws-sdk-go-v2/aws" - awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" - internalauthsmithy "github.com/aws/aws-sdk-go-v2/internal/auth/smithy" - smithyauth "github.com/aws/smithy-go/auth" - "github.com/aws/smithy-go/logging" - "github.com/aws/smithy-go/metrics" - "github.com/aws/smithy-go/middleware" - "github.com/aws/smithy-go/tracing" - smithyhttp "github.com/aws/smithy-go/transport/http" - "net/http" -) - -type HTTPClient interface { - Do(*http.Request) (*http.Response, error) -} - -type Options struct { - // Set of options to modify how an operation is invoked. These apply to all - // operations invoked for this client. Use functional options on operation call to - // modify this list for per operation behavior. - APIOptions []func(*middleware.Stack) error - - // The optional application specific identifier appended to the User-Agent header. - AppID string - - // This endpoint will be given as input to an EndpointResolverV2. It is used for - // providing a custom base endpoint that is subject to modifications by the - // processing EndpointResolverV2. - BaseEndpoint *string - - // Configures the events that will be sent to the configured logger. - ClientLogMode aws.ClientLogMode - - // The credentials object to use when signing requests. - Credentials aws.CredentialsProvider - - // The configuration DefaultsMode that the SDK should use when constructing the - // clients initial default settings. - DefaultsMode aws.DefaultsMode - - // The endpoint options to be used when attempting to resolve an endpoint. - EndpointOptions EndpointResolverOptions - - // The service endpoint resolver. - // - // Deprecated: Deprecated: EndpointResolver and WithEndpointResolver. Providing a - // value for this field will likely prevent you from using any endpoint-related - // service features released after the introduction of EndpointResolverV2 and - // BaseEndpoint. - // - // To migrate an EndpointResolver implementation that uses a custom endpoint, set - // the client option BaseEndpoint instead. - EndpointResolver EndpointResolver - - // Resolves the endpoint used for a particular service operation. This should be - // used over the deprecated EndpointResolver. - EndpointResolverV2 EndpointResolverV2 - - // Signature Version 4 (SigV4) Signer - HTTPSignerV4 HTTPSignerV4 - - // Provides idempotency tokens values that will be automatically populated into - // idempotent API operations. - IdempotencyTokenProvider IdempotencyTokenProvider - - // The logger writer interface to write logging messages to. - Logger logging.Logger - - // The client meter provider. - MeterProvider metrics.MeterProvider - - // The region to send requests to. (Required) - Region string - - // RetryMaxAttempts specifies the maximum number attempts an API client will call - // an operation that fails with a retryable error. A value of 0 is ignored, and - // will not be used to configure the API client created default retryer, or modify - // per operation call's retry max attempts. - // - // If specified in an operation call's functional options with a value that is - // different than the constructed client's Options, the Client's Retryer will be - // wrapped to use the operation's specific RetryMaxAttempts value. - RetryMaxAttempts int - - // RetryMode specifies the retry mode the API client will be created with, if - // Retryer option is not also specified. - // - // When creating a new API Clients this member will only be used if the Retryer - // Options member is nil. This value will be ignored if Retryer is not nil. - // - // Currently does not support per operation call overrides, may in the future. - RetryMode aws.RetryMode - - // Retryer guides how HTTP requests should be retried in case of recoverable - // failures. When nil the API client will use a default retryer. The kind of - // default retry created by the API client can be changed with the RetryMode - // option. - Retryer aws.Retryer - - // The RuntimeEnvironment configuration, only populated if the DefaultsMode is set - // to DefaultsModeAuto and is initialized using config.LoadDefaultConfig . You - // should not populate this structure programmatically, or rely on the values here - // within your applications. - RuntimeEnvironment aws.RuntimeEnvironment - - // The client tracer provider. - TracerProvider tracing.TracerProvider - - // The initial DefaultsMode used when the client options were constructed. If the - // DefaultsMode was set to aws.DefaultsModeAuto this will store what the resolved - // value was at that point in time. - // - // Currently does not support per operation call overrides, may in the future. - resolvedDefaultsMode aws.DefaultsMode - - // The HTTP client to invoke API calls with. Defaults to client's default HTTP - // implementation if nil. - HTTPClient HTTPClient - - // The auth scheme resolver which determines how to authenticate for each - // operation. - AuthSchemeResolver AuthSchemeResolver - - // The list of auth schemes supported by the client. - AuthSchemes []smithyhttp.AuthScheme -} - -// Copy creates a clone where the APIOptions list is deep copied. -func (o Options) Copy() Options { - to := o - to.APIOptions = make([]func(*middleware.Stack) error, len(o.APIOptions)) - copy(to.APIOptions, o.APIOptions) - - return to -} - -func (o Options) GetIdentityResolver(schemeID string) smithyauth.IdentityResolver { - if schemeID == "aws.auth#sigv4" { - return getSigV4IdentityResolver(o) - } - if schemeID == "smithy.api#noAuth" { - return &smithyauth.AnonymousIdentityResolver{} - } - return nil -} - -// WithAPIOptions returns a functional option for setting the Client's APIOptions -// option. -func WithAPIOptions(optFns ...func(*middleware.Stack) error) func(*Options) { - return func(o *Options) { - o.APIOptions = append(o.APIOptions, optFns...) - } -} - -// Deprecated: EndpointResolver and WithEndpointResolver. Providing a value for -// this field will likely prevent you from using any endpoint-related service -// features released after the introduction of EndpointResolverV2 and BaseEndpoint. -// -// To migrate an EndpointResolver implementation that uses a custom endpoint, set -// the client option BaseEndpoint instead. -func WithEndpointResolver(v EndpointResolver) func(*Options) { - return func(o *Options) { - o.EndpointResolver = v - } -} - -// WithEndpointResolverV2 returns a functional option for setting the Client's -// EndpointResolverV2 option. -func WithEndpointResolverV2(v EndpointResolverV2) func(*Options) { - return func(o *Options) { - o.EndpointResolverV2 = v - } -} - -func getSigV4IdentityResolver(o Options) smithyauth.IdentityResolver { - if o.Credentials != nil { - return &internalauthsmithy.CredentialsProviderAdapter{Provider: o.Credentials} - } - return nil -} - -// WithSigV4SigningName applies an override to the authentication workflow to -// use the given signing name for SigV4-authenticated operations. -// -// This is an advanced setting. The value here is FINAL, taking precedence over -// the resolved signing name from both auth scheme resolution and endpoint -// resolution. -func WithSigV4SigningName(name string) func(*Options) { - fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, - ) { - return next.HandleInitialize(awsmiddleware.SetSigningName(ctx, name), in) - } - return func(o *Options) { - o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { - return s.Initialize.Add( - middleware.InitializeMiddlewareFunc("withSigV4SigningName", fn), - middleware.Before, - ) - }) - } -} - -// WithSigV4SigningRegion applies an override to the authentication workflow to -// use the given signing region for SigV4-authenticated operations. -// -// This is an advanced setting. The value here is FINAL, taking precedence over -// the resolved signing region from both auth scheme resolution and endpoint -// resolution. -func WithSigV4SigningRegion(region string) func(*Options) { - fn := func(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, - ) { - return next.HandleInitialize(awsmiddleware.SetSigningRegion(ctx, region), in) - } - return func(o *Options) { - o.APIOptions = append(o.APIOptions, func(s *middleware.Stack) error { - return s.Initialize.Add( - middleware.InitializeMiddlewareFunc("withSigV4SigningRegion", fn), - middleware.Before, - ) - }) - } -} - -func ignoreAnonymousAuth(options *Options) { - if aws.IsCredentialsProvider(options.Credentials, (*aws.AnonymousCredentials)(nil)) { - options.Credentials = nil - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/serializers.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/serializers.go deleted file mode 100644 index 6f416d89..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/serializers.go +++ /dev/null @@ -1,2519 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "bytes" - "context" - "fmt" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - smithy "github.com/aws/smithy-go" - "github.com/aws/smithy-go/encoding/httpbinding" - smithyjson "github.com/aws/smithy-go/encoding/json" - "github.com/aws/smithy-go/middleware" - smithytime "github.com/aws/smithy-go/time" - "github.com/aws/smithy-go/tracing" - smithyhttp "github.com/aws/smithy-go/transport/http" - "path" -) - -type awsAwsjson11_serializeOpAnalyzeDocument struct { -} - -func (*awsAwsjson11_serializeOpAnalyzeDocument) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpAnalyzeDocument) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*AnalyzeDocumentInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.AnalyzeDocument") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentAnalyzeDocumentInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpAnalyzeExpense struct { -} - -func (*awsAwsjson11_serializeOpAnalyzeExpense) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpAnalyzeExpense) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*AnalyzeExpenseInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.AnalyzeExpense") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentAnalyzeExpenseInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpAnalyzeID struct { -} - -func (*awsAwsjson11_serializeOpAnalyzeID) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpAnalyzeID) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*AnalyzeIDInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.AnalyzeID") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentAnalyzeIDInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpCreateAdapter struct { -} - -func (*awsAwsjson11_serializeOpCreateAdapter) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpCreateAdapter) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*CreateAdapterInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.CreateAdapter") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentCreateAdapterInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpCreateAdapterVersion struct { -} - -func (*awsAwsjson11_serializeOpCreateAdapterVersion) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpCreateAdapterVersion) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*CreateAdapterVersionInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.CreateAdapterVersion") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentCreateAdapterVersionInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpDeleteAdapter struct { -} - -func (*awsAwsjson11_serializeOpDeleteAdapter) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpDeleteAdapter) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*DeleteAdapterInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.DeleteAdapter") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentDeleteAdapterInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpDeleteAdapterVersion struct { -} - -func (*awsAwsjson11_serializeOpDeleteAdapterVersion) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpDeleteAdapterVersion) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*DeleteAdapterVersionInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.DeleteAdapterVersion") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentDeleteAdapterVersionInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpDetectDocumentText struct { -} - -func (*awsAwsjson11_serializeOpDetectDocumentText) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpDetectDocumentText) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*DetectDocumentTextInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.DetectDocumentText") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentDetectDocumentTextInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpGetAdapter struct { -} - -func (*awsAwsjson11_serializeOpGetAdapter) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpGetAdapter) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*GetAdapterInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.GetAdapter") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentGetAdapterInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpGetAdapterVersion struct { -} - -func (*awsAwsjson11_serializeOpGetAdapterVersion) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpGetAdapterVersion) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*GetAdapterVersionInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.GetAdapterVersion") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentGetAdapterVersionInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpGetDocumentAnalysis struct { -} - -func (*awsAwsjson11_serializeOpGetDocumentAnalysis) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpGetDocumentAnalysis) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*GetDocumentAnalysisInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.GetDocumentAnalysis") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentGetDocumentAnalysisInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpGetDocumentTextDetection struct { -} - -func (*awsAwsjson11_serializeOpGetDocumentTextDetection) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpGetDocumentTextDetection) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*GetDocumentTextDetectionInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.GetDocumentTextDetection") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentGetDocumentTextDetectionInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpGetExpenseAnalysis struct { -} - -func (*awsAwsjson11_serializeOpGetExpenseAnalysis) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpGetExpenseAnalysis) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*GetExpenseAnalysisInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.GetExpenseAnalysis") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentGetExpenseAnalysisInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpGetLendingAnalysis struct { -} - -func (*awsAwsjson11_serializeOpGetLendingAnalysis) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpGetLendingAnalysis) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*GetLendingAnalysisInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.GetLendingAnalysis") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentGetLendingAnalysisInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpGetLendingAnalysisSummary struct { -} - -func (*awsAwsjson11_serializeOpGetLendingAnalysisSummary) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpGetLendingAnalysisSummary) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*GetLendingAnalysisSummaryInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.GetLendingAnalysisSummary") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentGetLendingAnalysisSummaryInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpListAdapters struct { -} - -func (*awsAwsjson11_serializeOpListAdapters) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpListAdapters) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*ListAdaptersInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.ListAdapters") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentListAdaptersInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpListAdapterVersions struct { -} - -func (*awsAwsjson11_serializeOpListAdapterVersions) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpListAdapterVersions) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*ListAdapterVersionsInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.ListAdapterVersions") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentListAdapterVersionsInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpListTagsForResource struct { -} - -func (*awsAwsjson11_serializeOpListTagsForResource) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpListTagsForResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*ListTagsForResourceInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.ListTagsForResource") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentListTagsForResourceInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpStartDocumentAnalysis struct { -} - -func (*awsAwsjson11_serializeOpStartDocumentAnalysis) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpStartDocumentAnalysis) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*StartDocumentAnalysisInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.StartDocumentAnalysis") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentStartDocumentAnalysisInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpStartDocumentTextDetection struct { -} - -func (*awsAwsjson11_serializeOpStartDocumentTextDetection) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpStartDocumentTextDetection) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*StartDocumentTextDetectionInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.StartDocumentTextDetection") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentStartDocumentTextDetectionInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpStartExpenseAnalysis struct { -} - -func (*awsAwsjson11_serializeOpStartExpenseAnalysis) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpStartExpenseAnalysis) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*StartExpenseAnalysisInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.StartExpenseAnalysis") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentStartExpenseAnalysisInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpStartLendingAnalysis struct { -} - -func (*awsAwsjson11_serializeOpStartLendingAnalysis) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpStartLendingAnalysis) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*StartLendingAnalysisInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.StartLendingAnalysis") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentStartLendingAnalysisInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpTagResource struct { -} - -func (*awsAwsjson11_serializeOpTagResource) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpTagResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*TagResourceInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.TagResource") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentTagResourceInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpUntagResource struct { -} - -func (*awsAwsjson11_serializeOpUntagResource) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpUntagResource) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*UntagResourceInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.UntagResource") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentUntagResourceInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} - -type awsAwsjson11_serializeOpUpdateAdapter struct { -} - -func (*awsAwsjson11_serializeOpUpdateAdapter) ID() string { - return "OperationSerializer" -} - -func (m *awsAwsjson11_serializeOpUpdateAdapter) HandleSerialize(ctx context.Context, in middleware.SerializeInput, next middleware.SerializeHandler) ( - out middleware.SerializeOutput, metadata middleware.Metadata, err error, -) { - _, span := tracing.StartSpan(ctx, "OperationSerializer") - endTimer := startMetricTimer(ctx, "client.call.serialization_duration") - defer endTimer() - defer span.End() - request, ok := in.Request.(*smithyhttp.Request) - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown transport type %T", in.Request)} - } - - input, ok := in.Parameters.(*UpdateAdapterInput) - _ = input - if !ok { - return out, metadata, &smithy.SerializationError{Err: fmt.Errorf("unknown input parameters type %T", in.Parameters)} - } - - operationPath := "/" - if len(request.Request.URL.Path) == 0 { - request.Request.URL.Path = operationPath - } else { - request.Request.URL.Path = path.Join(request.Request.URL.Path, operationPath) - if request.Request.URL.Path != "/" && operationPath[len(operationPath)-1] == '/' { - request.Request.URL.Path += "/" - } - } - request.Request.Method = "POST" - httpBindingEncoder, err := httpbinding.NewEncoder(request.URL.Path, request.URL.RawQuery, request.Header) - if err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - httpBindingEncoder.SetHeader("Content-Type").String("application/x-amz-json-1.1") - httpBindingEncoder.SetHeader("X-Amz-Target").String("Textract.UpdateAdapter") - - jsonEncoder := smithyjson.NewEncoder() - if err := awsAwsjson11_serializeOpDocumentUpdateAdapterInput(input, jsonEncoder.Value); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request, err = request.SetStream(bytes.NewReader(jsonEncoder.Bytes())); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - - if request.Request, err = httpBindingEncoder.Encode(request.Request); err != nil { - return out, metadata, &smithy.SerializationError{Err: err} - } - in.Request = request - - endTimer() - span.End() - return next.HandleSerialize(ctx, in) -} -func awsAwsjson11_serializeDocumentAdapter(v *types.Adapter, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterId != nil { - ok := object.Key("AdapterId") - ok.String(*v.AdapterId) - } - - if v.Pages != nil { - ok := object.Key("Pages") - if err := awsAwsjson11_serializeDocumentAdapterPages(v.Pages, ok); err != nil { - return err - } - } - - if v.Version != nil { - ok := object.Key("Version") - ok.String(*v.Version) - } - - return nil -} - -func awsAwsjson11_serializeDocumentAdapterPages(v []string, value smithyjson.Value) error { - array := value.Array() - defer array.Close() - - for i := range v { - av := array.Value() - av.String(v[i]) - } - return nil -} - -func awsAwsjson11_serializeDocumentAdapters(v []types.Adapter, value smithyjson.Value) error { - array := value.Array() - defer array.Close() - - for i := range v { - av := array.Value() - if err := awsAwsjson11_serializeDocumentAdapter(&v[i], av); err != nil { - return err - } - } - return nil -} - -func awsAwsjson11_serializeDocumentAdaptersConfig(v *types.AdaptersConfig, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.Adapters != nil { - ok := object.Key("Adapters") - if err := awsAwsjson11_serializeDocumentAdapters(v.Adapters, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeDocumentAdapterVersionDatasetConfig(v *types.AdapterVersionDatasetConfig, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.ManifestS3Object != nil { - ok := object.Key("ManifestS3Object") - if err := awsAwsjson11_serializeDocumentS3Object(v.ManifestS3Object, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeDocumentContentClassifiers(v []types.ContentClassifier, value smithyjson.Value) error { - array := value.Array() - defer array.Close() - - for i := range v { - av := array.Value() - av.String(string(v[i])) - } - return nil -} - -func awsAwsjson11_serializeDocumentDocument(v *types.Document, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.Bytes != nil { - ok := object.Key("Bytes") - ok.Base64EncodeBytes(v.Bytes) - } - - if v.S3Object != nil { - ok := object.Key("S3Object") - if err := awsAwsjson11_serializeDocumentS3Object(v.S3Object, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeDocumentDocumentLocation(v *types.DocumentLocation, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.S3Object != nil { - ok := object.Key("S3Object") - if err := awsAwsjson11_serializeDocumentS3Object(v.S3Object, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeDocumentDocumentPages(v []types.Document, value smithyjson.Value) error { - array := value.Array() - defer array.Close() - - for i := range v { - av := array.Value() - if err := awsAwsjson11_serializeDocumentDocument(&v[i], av); err != nil { - return err - } - } - return nil -} - -func awsAwsjson11_serializeDocumentFeatureTypes(v []types.FeatureType, value smithyjson.Value) error { - array := value.Array() - defer array.Close() - - for i := range v { - av := array.Value() - av.String(string(v[i])) - } - return nil -} - -func awsAwsjson11_serializeDocumentHumanLoopConfig(v *types.HumanLoopConfig, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.DataAttributes != nil { - ok := object.Key("DataAttributes") - if err := awsAwsjson11_serializeDocumentHumanLoopDataAttributes(v.DataAttributes, ok); err != nil { - return err - } - } - - if v.FlowDefinitionArn != nil { - ok := object.Key("FlowDefinitionArn") - ok.String(*v.FlowDefinitionArn) - } - - if v.HumanLoopName != nil { - ok := object.Key("HumanLoopName") - ok.String(*v.HumanLoopName) - } - - return nil -} - -func awsAwsjson11_serializeDocumentHumanLoopDataAttributes(v *types.HumanLoopDataAttributes, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.ContentClassifiers != nil { - ok := object.Key("ContentClassifiers") - if err := awsAwsjson11_serializeDocumentContentClassifiers(v.ContentClassifiers, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeDocumentNotificationChannel(v *types.NotificationChannel, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.RoleArn != nil { - ok := object.Key("RoleArn") - ok.String(*v.RoleArn) - } - - if v.SNSTopicArn != nil { - ok := object.Key("SNSTopicArn") - ok.String(*v.SNSTopicArn) - } - - return nil -} - -func awsAwsjson11_serializeDocumentOutputConfig(v *types.OutputConfig, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.S3Bucket != nil { - ok := object.Key("S3Bucket") - ok.String(*v.S3Bucket) - } - - if v.S3Prefix != nil { - ok := object.Key("S3Prefix") - ok.String(*v.S3Prefix) - } - - return nil -} - -func awsAwsjson11_serializeDocumentQueries(v []types.Query, value smithyjson.Value) error { - array := value.Array() - defer array.Close() - - for i := range v { - av := array.Value() - if err := awsAwsjson11_serializeDocumentQuery(&v[i], av); err != nil { - return err - } - } - return nil -} - -func awsAwsjson11_serializeDocumentQueriesConfig(v *types.QueriesConfig, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.Queries != nil { - ok := object.Key("Queries") - if err := awsAwsjson11_serializeDocumentQueries(v.Queries, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeDocumentQuery(v *types.Query, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.Alias != nil { - ok := object.Key("Alias") - ok.String(*v.Alias) - } - - if v.Pages != nil { - ok := object.Key("Pages") - if err := awsAwsjson11_serializeDocumentQueryPages(v.Pages, ok); err != nil { - return err - } - } - - if v.Text != nil { - ok := object.Key("Text") - ok.String(*v.Text) - } - - return nil -} - -func awsAwsjson11_serializeDocumentQueryPages(v []string, value smithyjson.Value) error { - array := value.Array() - defer array.Close() - - for i := range v { - av := array.Value() - av.String(v[i]) - } - return nil -} - -func awsAwsjson11_serializeDocumentS3Object(v *types.S3Object, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.Bucket != nil { - ok := object.Key("Bucket") - ok.String(*v.Bucket) - } - - if v.Name != nil { - ok := object.Key("Name") - ok.String(*v.Name) - } - - if v.Version != nil { - ok := object.Key("Version") - ok.String(*v.Version) - } - - return nil -} - -func awsAwsjson11_serializeDocumentTagKeyList(v []string, value smithyjson.Value) error { - array := value.Array() - defer array.Close() - - for i := range v { - av := array.Value() - av.String(v[i]) - } - return nil -} - -func awsAwsjson11_serializeDocumentTagMap(v map[string]string, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - for key := range v { - om := object.Key(key) - om.String(v[key]) - } - return nil -} - -func awsAwsjson11_serializeOpDocumentAnalyzeDocumentInput(v *AnalyzeDocumentInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdaptersConfig != nil { - ok := object.Key("AdaptersConfig") - if err := awsAwsjson11_serializeDocumentAdaptersConfig(v.AdaptersConfig, ok); err != nil { - return err - } - } - - if v.Document != nil { - ok := object.Key("Document") - if err := awsAwsjson11_serializeDocumentDocument(v.Document, ok); err != nil { - return err - } - } - - if v.FeatureTypes != nil { - ok := object.Key("FeatureTypes") - if err := awsAwsjson11_serializeDocumentFeatureTypes(v.FeatureTypes, ok); err != nil { - return err - } - } - - if v.HumanLoopConfig != nil { - ok := object.Key("HumanLoopConfig") - if err := awsAwsjson11_serializeDocumentHumanLoopConfig(v.HumanLoopConfig, ok); err != nil { - return err - } - } - - if v.QueriesConfig != nil { - ok := object.Key("QueriesConfig") - if err := awsAwsjson11_serializeDocumentQueriesConfig(v.QueriesConfig, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentAnalyzeExpenseInput(v *AnalyzeExpenseInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.Document != nil { - ok := object.Key("Document") - if err := awsAwsjson11_serializeDocumentDocument(v.Document, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentAnalyzeIDInput(v *AnalyzeIDInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.DocumentPages != nil { - ok := object.Key("DocumentPages") - if err := awsAwsjson11_serializeDocumentDocumentPages(v.DocumentPages, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentCreateAdapterInput(v *CreateAdapterInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterName != nil { - ok := object.Key("AdapterName") - ok.String(*v.AdapterName) - } - - if len(v.AutoUpdate) > 0 { - ok := object.Key("AutoUpdate") - ok.String(string(v.AutoUpdate)) - } - - if v.ClientRequestToken != nil { - ok := object.Key("ClientRequestToken") - ok.String(*v.ClientRequestToken) - } - - if v.Description != nil { - ok := object.Key("Description") - ok.String(*v.Description) - } - - if v.FeatureTypes != nil { - ok := object.Key("FeatureTypes") - if err := awsAwsjson11_serializeDocumentFeatureTypes(v.FeatureTypes, ok); err != nil { - return err - } - } - - if v.Tags != nil { - ok := object.Key("Tags") - if err := awsAwsjson11_serializeDocumentTagMap(v.Tags, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentCreateAdapterVersionInput(v *CreateAdapterVersionInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterId != nil { - ok := object.Key("AdapterId") - ok.String(*v.AdapterId) - } - - if v.ClientRequestToken != nil { - ok := object.Key("ClientRequestToken") - ok.String(*v.ClientRequestToken) - } - - if v.DatasetConfig != nil { - ok := object.Key("DatasetConfig") - if err := awsAwsjson11_serializeDocumentAdapterVersionDatasetConfig(v.DatasetConfig, ok); err != nil { - return err - } - } - - if v.KMSKeyId != nil { - ok := object.Key("KMSKeyId") - ok.String(*v.KMSKeyId) - } - - if v.OutputConfig != nil { - ok := object.Key("OutputConfig") - if err := awsAwsjson11_serializeDocumentOutputConfig(v.OutputConfig, ok); err != nil { - return err - } - } - - if v.Tags != nil { - ok := object.Key("Tags") - if err := awsAwsjson11_serializeDocumentTagMap(v.Tags, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentDeleteAdapterInput(v *DeleteAdapterInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterId != nil { - ok := object.Key("AdapterId") - ok.String(*v.AdapterId) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentDeleteAdapterVersionInput(v *DeleteAdapterVersionInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterId != nil { - ok := object.Key("AdapterId") - ok.String(*v.AdapterId) - } - - if v.AdapterVersion != nil { - ok := object.Key("AdapterVersion") - ok.String(*v.AdapterVersion) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentDetectDocumentTextInput(v *DetectDocumentTextInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.Document != nil { - ok := object.Key("Document") - if err := awsAwsjson11_serializeDocumentDocument(v.Document, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentGetAdapterInput(v *GetAdapterInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterId != nil { - ok := object.Key("AdapterId") - ok.String(*v.AdapterId) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentGetAdapterVersionInput(v *GetAdapterVersionInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterId != nil { - ok := object.Key("AdapterId") - ok.String(*v.AdapterId) - } - - if v.AdapterVersion != nil { - ok := object.Key("AdapterVersion") - ok.String(*v.AdapterVersion) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentGetDocumentAnalysisInput(v *GetDocumentAnalysisInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.JobId != nil { - ok := object.Key("JobId") - ok.String(*v.JobId) - } - - if v.MaxResults != nil { - ok := object.Key("MaxResults") - ok.Integer(*v.MaxResults) - } - - if v.NextToken != nil { - ok := object.Key("NextToken") - ok.String(*v.NextToken) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentGetDocumentTextDetectionInput(v *GetDocumentTextDetectionInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.JobId != nil { - ok := object.Key("JobId") - ok.String(*v.JobId) - } - - if v.MaxResults != nil { - ok := object.Key("MaxResults") - ok.Integer(*v.MaxResults) - } - - if v.NextToken != nil { - ok := object.Key("NextToken") - ok.String(*v.NextToken) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentGetExpenseAnalysisInput(v *GetExpenseAnalysisInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.JobId != nil { - ok := object.Key("JobId") - ok.String(*v.JobId) - } - - if v.MaxResults != nil { - ok := object.Key("MaxResults") - ok.Integer(*v.MaxResults) - } - - if v.NextToken != nil { - ok := object.Key("NextToken") - ok.String(*v.NextToken) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentGetLendingAnalysisInput(v *GetLendingAnalysisInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.JobId != nil { - ok := object.Key("JobId") - ok.String(*v.JobId) - } - - if v.MaxResults != nil { - ok := object.Key("MaxResults") - ok.Integer(*v.MaxResults) - } - - if v.NextToken != nil { - ok := object.Key("NextToken") - ok.String(*v.NextToken) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentGetLendingAnalysisSummaryInput(v *GetLendingAnalysisSummaryInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.JobId != nil { - ok := object.Key("JobId") - ok.String(*v.JobId) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentListAdaptersInput(v *ListAdaptersInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AfterCreationTime != nil { - ok := object.Key("AfterCreationTime") - ok.Double(smithytime.FormatEpochSeconds(*v.AfterCreationTime)) - } - - if v.BeforeCreationTime != nil { - ok := object.Key("BeforeCreationTime") - ok.Double(smithytime.FormatEpochSeconds(*v.BeforeCreationTime)) - } - - if v.MaxResults != nil { - ok := object.Key("MaxResults") - ok.Integer(*v.MaxResults) - } - - if v.NextToken != nil { - ok := object.Key("NextToken") - ok.String(*v.NextToken) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentListAdapterVersionsInput(v *ListAdapterVersionsInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterId != nil { - ok := object.Key("AdapterId") - ok.String(*v.AdapterId) - } - - if v.AfterCreationTime != nil { - ok := object.Key("AfterCreationTime") - ok.Double(smithytime.FormatEpochSeconds(*v.AfterCreationTime)) - } - - if v.BeforeCreationTime != nil { - ok := object.Key("BeforeCreationTime") - ok.Double(smithytime.FormatEpochSeconds(*v.BeforeCreationTime)) - } - - if v.MaxResults != nil { - ok := object.Key("MaxResults") - ok.Integer(*v.MaxResults) - } - - if v.NextToken != nil { - ok := object.Key("NextToken") - ok.String(*v.NextToken) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentListTagsForResourceInput(v *ListTagsForResourceInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.ResourceARN != nil { - ok := object.Key("ResourceARN") - ok.String(*v.ResourceARN) - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentStartDocumentAnalysisInput(v *StartDocumentAnalysisInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdaptersConfig != nil { - ok := object.Key("AdaptersConfig") - if err := awsAwsjson11_serializeDocumentAdaptersConfig(v.AdaptersConfig, ok); err != nil { - return err - } - } - - if v.ClientRequestToken != nil { - ok := object.Key("ClientRequestToken") - ok.String(*v.ClientRequestToken) - } - - if v.DocumentLocation != nil { - ok := object.Key("DocumentLocation") - if err := awsAwsjson11_serializeDocumentDocumentLocation(v.DocumentLocation, ok); err != nil { - return err - } - } - - if v.FeatureTypes != nil { - ok := object.Key("FeatureTypes") - if err := awsAwsjson11_serializeDocumentFeatureTypes(v.FeatureTypes, ok); err != nil { - return err - } - } - - if v.JobTag != nil { - ok := object.Key("JobTag") - ok.String(*v.JobTag) - } - - if v.KMSKeyId != nil { - ok := object.Key("KMSKeyId") - ok.String(*v.KMSKeyId) - } - - if v.NotificationChannel != nil { - ok := object.Key("NotificationChannel") - if err := awsAwsjson11_serializeDocumentNotificationChannel(v.NotificationChannel, ok); err != nil { - return err - } - } - - if v.OutputConfig != nil { - ok := object.Key("OutputConfig") - if err := awsAwsjson11_serializeDocumentOutputConfig(v.OutputConfig, ok); err != nil { - return err - } - } - - if v.QueriesConfig != nil { - ok := object.Key("QueriesConfig") - if err := awsAwsjson11_serializeDocumentQueriesConfig(v.QueriesConfig, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentStartDocumentTextDetectionInput(v *StartDocumentTextDetectionInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.ClientRequestToken != nil { - ok := object.Key("ClientRequestToken") - ok.String(*v.ClientRequestToken) - } - - if v.DocumentLocation != nil { - ok := object.Key("DocumentLocation") - if err := awsAwsjson11_serializeDocumentDocumentLocation(v.DocumentLocation, ok); err != nil { - return err - } - } - - if v.JobTag != nil { - ok := object.Key("JobTag") - ok.String(*v.JobTag) - } - - if v.KMSKeyId != nil { - ok := object.Key("KMSKeyId") - ok.String(*v.KMSKeyId) - } - - if v.NotificationChannel != nil { - ok := object.Key("NotificationChannel") - if err := awsAwsjson11_serializeDocumentNotificationChannel(v.NotificationChannel, ok); err != nil { - return err - } - } - - if v.OutputConfig != nil { - ok := object.Key("OutputConfig") - if err := awsAwsjson11_serializeDocumentOutputConfig(v.OutputConfig, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentStartExpenseAnalysisInput(v *StartExpenseAnalysisInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.ClientRequestToken != nil { - ok := object.Key("ClientRequestToken") - ok.String(*v.ClientRequestToken) - } - - if v.DocumentLocation != nil { - ok := object.Key("DocumentLocation") - if err := awsAwsjson11_serializeDocumentDocumentLocation(v.DocumentLocation, ok); err != nil { - return err - } - } - - if v.JobTag != nil { - ok := object.Key("JobTag") - ok.String(*v.JobTag) - } - - if v.KMSKeyId != nil { - ok := object.Key("KMSKeyId") - ok.String(*v.KMSKeyId) - } - - if v.NotificationChannel != nil { - ok := object.Key("NotificationChannel") - if err := awsAwsjson11_serializeDocumentNotificationChannel(v.NotificationChannel, ok); err != nil { - return err - } - } - - if v.OutputConfig != nil { - ok := object.Key("OutputConfig") - if err := awsAwsjson11_serializeDocumentOutputConfig(v.OutputConfig, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentStartLendingAnalysisInput(v *StartLendingAnalysisInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.ClientRequestToken != nil { - ok := object.Key("ClientRequestToken") - ok.String(*v.ClientRequestToken) - } - - if v.DocumentLocation != nil { - ok := object.Key("DocumentLocation") - if err := awsAwsjson11_serializeDocumentDocumentLocation(v.DocumentLocation, ok); err != nil { - return err - } - } - - if v.JobTag != nil { - ok := object.Key("JobTag") - ok.String(*v.JobTag) - } - - if v.KMSKeyId != nil { - ok := object.Key("KMSKeyId") - ok.String(*v.KMSKeyId) - } - - if v.NotificationChannel != nil { - ok := object.Key("NotificationChannel") - if err := awsAwsjson11_serializeDocumentNotificationChannel(v.NotificationChannel, ok); err != nil { - return err - } - } - - if v.OutputConfig != nil { - ok := object.Key("OutputConfig") - if err := awsAwsjson11_serializeDocumentOutputConfig(v.OutputConfig, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentTagResourceInput(v *TagResourceInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.ResourceARN != nil { - ok := object.Key("ResourceARN") - ok.String(*v.ResourceARN) - } - - if v.Tags != nil { - ok := object.Key("Tags") - if err := awsAwsjson11_serializeDocumentTagMap(v.Tags, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentUntagResourceInput(v *UntagResourceInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.ResourceARN != nil { - ok := object.Key("ResourceARN") - ok.String(*v.ResourceARN) - } - - if v.TagKeys != nil { - ok := object.Key("TagKeys") - if err := awsAwsjson11_serializeDocumentTagKeyList(v.TagKeys, ok); err != nil { - return err - } - } - - return nil -} - -func awsAwsjson11_serializeOpDocumentUpdateAdapterInput(v *UpdateAdapterInput, value smithyjson.Value) error { - object := value.Object() - defer object.Close() - - if v.AdapterId != nil { - ok := object.Key("AdapterId") - ok.String(*v.AdapterId) - } - - if v.AdapterName != nil { - ok := object.Key("AdapterName") - ok.String(*v.AdapterName) - } - - if len(v.AutoUpdate) > 0 { - ok := object.Key("AutoUpdate") - ok.String(string(v.AutoUpdate)) - } - - if v.Description != nil { - ok := object.Key("Description") - ok.String(*v.Description) - } - - return nil -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/enums.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/enums.go deleted file mode 100644 index cc7b3090..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/enums.go +++ /dev/null @@ -1,298 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package types - -type AdapterVersionStatus string - -// Enum values for AdapterVersionStatus -const ( - AdapterVersionStatusActive AdapterVersionStatus = "ACTIVE" - AdapterVersionStatusAtRisk AdapterVersionStatus = "AT_RISK" - AdapterVersionStatusDeprecated AdapterVersionStatus = "DEPRECATED" - AdapterVersionStatusCreationError AdapterVersionStatus = "CREATION_ERROR" - AdapterVersionStatusCreationInProgress AdapterVersionStatus = "CREATION_IN_PROGRESS" -) - -// Values returns all known values for AdapterVersionStatus. Note that this can be -// expanded in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (AdapterVersionStatus) Values() []AdapterVersionStatus { - return []AdapterVersionStatus{ - "ACTIVE", - "AT_RISK", - "DEPRECATED", - "CREATION_ERROR", - "CREATION_IN_PROGRESS", - } -} - -type AutoUpdate string - -// Enum values for AutoUpdate -const ( - AutoUpdateEnabled AutoUpdate = "ENABLED" - AutoUpdateDisabled AutoUpdate = "DISABLED" -) - -// Values returns all known values for AutoUpdate. Note that this can be expanded -// in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (AutoUpdate) Values() []AutoUpdate { - return []AutoUpdate{ - "ENABLED", - "DISABLED", - } -} - -type BlockType string - -// Enum values for BlockType -const ( - BlockTypeKeyValueSet BlockType = "KEY_VALUE_SET" - BlockTypePage BlockType = "PAGE" - BlockTypeLine BlockType = "LINE" - BlockTypeWord BlockType = "WORD" - BlockTypeTable BlockType = "TABLE" - BlockTypeCell BlockType = "CELL" - BlockTypeSelectionElement BlockType = "SELECTION_ELEMENT" - BlockTypeMergedCell BlockType = "MERGED_CELL" - BlockTypeTitle BlockType = "TITLE" - BlockTypeQuery BlockType = "QUERY" - BlockTypeQueryResult BlockType = "QUERY_RESULT" - BlockTypeSignature BlockType = "SIGNATURE" - BlockTypeTableTitle BlockType = "TABLE_TITLE" - BlockTypeTableFooter BlockType = "TABLE_FOOTER" - BlockTypeLayoutText BlockType = "LAYOUT_TEXT" - BlockTypeLayoutTitle BlockType = "LAYOUT_TITLE" - BlockTypeLayoutHeader BlockType = "LAYOUT_HEADER" - BlockTypeLayoutFooter BlockType = "LAYOUT_FOOTER" - BlockTypeLayoutSectionHeader BlockType = "LAYOUT_SECTION_HEADER" - BlockTypeLayoutPageNumber BlockType = "LAYOUT_PAGE_NUMBER" - BlockTypeLayoutList BlockType = "LAYOUT_LIST" - BlockTypeLayoutFigure BlockType = "LAYOUT_FIGURE" - BlockTypeLayoutTable BlockType = "LAYOUT_TABLE" - BlockTypeLayoutKeyValue BlockType = "LAYOUT_KEY_VALUE" -) - -// Values returns all known values for BlockType. Note that this can be expanded -// in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (BlockType) Values() []BlockType { - return []BlockType{ - "KEY_VALUE_SET", - "PAGE", - "LINE", - "WORD", - "TABLE", - "CELL", - "SELECTION_ELEMENT", - "MERGED_CELL", - "TITLE", - "QUERY", - "QUERY_RESULT", - "SIGNATURE", - "TABLE_TITLE", - "TABLE_FOOTER", - "LAYOUT_TEXT", - "LAYOUT_TITLE", - "LAYOUT_HEADER", - "LAYOUT_FOOTER", - "LAYOUT_SECTION_HEADER", - "LAYOUT_PAGE_NUMBER", - "LAYOUT_LIST", - "LAYOUT_FIGURE", - "LAYOUT_TABLE", - "LAYOUT_KEY_VALUE", - } -} - -type ContentClassifier string - -// Enum values for ContentClassifier -const ( - ContentClassifierFreeOfPersonallyIdentifiableInformation ContentClassifier = "FreeOfPersonallyIdentifiableInformation" - ContentClassifierFreeOfAdultContent ContentClassifier = "FreeOfAdultContent" -) - -// Values returns all known values for ContentClassifier. Note that this can be -// expanded in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (ContentClassifier) Values() []ContentClassifier { - return []ContentClassifier{ - "FreeOfPersonallyIdentifiableInformation", - "FreeOfAdultContent", - } -} - -type EntityType string - -// Enum values for EntityType -const ( - EntityTypeKey EntityType = "KEY" - EntityTypeValue EntityType = "VALUE" - EntityTypeColumnHeader EntityType = "COLUMN_HEADER" - EntityTypeTableTitle EntityType = "TABLE_TITLE" - EntityTypeTableFooter EntityType = "TABLE_FOOTER" - EntityTypeTableSectionTitle EntityType = "TABLE_SECTION_TITLE" - EntityTypeTableSummary EntityType = "TABLE_SUMMARY" - EntityTypeStructuredTable EntityType = "STRUCTURED_TABLE" - EntityTypeSemiStructuredTable EntityType = "SEMI_STRUCTURED_TABLE" -) - -// Values returns all known values for EntityType. Note that this can be expanded -// in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (EntityType) Values() []EntityType { - return []EntityType{ - "KEY", - "VALUE", - "COLUMN_HEADER", - "TABLE_TITLE", - "TABLE_FOOTER", - "TABLE_SECTION_TITLE", - "TABLE_SUMMARY", - "STRUCTURED_TABLE", - "SEMI_STRUCTURED_TABLE", - } -} - -type FeatureType string - -// Enum values for FeatureType -const ( - FeatureTypeTables FeatureType = "TABLES" - FeatureTypeForms FeatureType = "FORMS" - FeatureTypeQueries FeatureType = "QUERIES" - FeatureTypeSignatures FeatureType = "SIGNATURES" - FeatureTypeLayout FeatureType = "LAYOUT" -) - -// Values returns all known values for FeatureType. Note that this can be expanded -// in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (FeatureType) Values() []FeatureType { - return []FeatureType{ - "TABLES", - "FORMS", - "QUERIES", - "SIGNATURES", - "LAYOUT", - } -} - -type JobStatus string - -// Enum values for JobStatus -const ( - JobStatusInProgress JobStatus = "IN_PROGRESS" - JobStatusSucceeded JobStatus = "SUCCEEDED" - JobStatusFailed JobStatus = "FAILED" - JobStatusPartialSuccess JobStatus = "PARTIAL_SUCCESS" -) - -// Values returns all known values for JobStatus. Note that this can be expanded -// in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (JobStatus) Values() []JobStatus { - return []JobStatus{ - "IN_PROGRESS", - "SUCCEEDED", - "FAILED", - "PARTIAL_SUCCESS", - } -} - -type RelationshipType string - -// Enum values for RelationshipType -const ( - RelationshipTypeValue RelationshipType = "VALUE" - RelationshipTypeChild RelationshipType = "CHILD" - RelationshipTypeComplexFeatures RelationshipType = "COMPLEX_FEATURES" - RelationshipTypeMergedCell RelationshipType = "MERGED_CELL" - RelationshipTypeTitle RelationshipType = "TITLE" - RelationshipTypeAnswer RelationshipType = "ANSWER" - RelationshipTypeTable RelationshipType = "TABLE" - RelationshipTypeTableTitle RelationshipType = "TABLE_TITLE" - RelationshipTypeTableFooter RelationshipType = "TABLE_FOOTER" -) - -// Values returns all known values for RelationshipType. Note that this can be -// expanded in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (RelationshipType) Values() []RelationshipType { - return []RelationshipType{ - "VALUE", - "CHILD", - "COMPLEX_FEATURES", - "MERGED_CELL", - "TITLE", - "ANSWER", - "TABLE", - "TABLE_TITLE", - "TABLE_FOOTER", - } -} - -type SelectionStatus string - -// Enum values for SelectionStatus -const ( - SelectionStatusSelected SelectionStatus = "SELECTED" - SelectionStatusNotSelected SelectionStatus = "NOT_SELECTED" -) - -// Values returns all known values for SelectionStatus. Note that this can be -// expanded in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (SelectionStatus) Values() []SelectionStatus { - return []SelectionStatus{ - "SELECTED", - "NOT_SELECTED", - } -} - -type TextType string - -// Enum values for TextType -const ( - TextTypeHandwriting TextType = "HANDWRITING" - TextTypePrinted TextType = "PRINTED" -) - -// Values returns all known values for TextType. Note that this can be expanded in -// the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (TextType) Values() []TextType { - return []TextType{ - "HANDWRITING", - "PRINTED", - } -} - -type ValueType string - -// Enum values for ValueType -const ( - ValueTypeDate ValueType = "DATE" -) - -// Values returns all known values for ValueType. Note that this can be expanded -// in the future, and so it is only as up to date as the client. -// -// The ordering of this slice is not guaranteed to be stable across updates. -func (ValueType) Values() []ValueType { - return []ValueType{ - "DATE", - } -} diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/errors.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/errors.go deleted file mode 100644 index 96c16b53..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/errors.go +++ /dev/null @@ -1,543 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package types - -import ( - "fmt" - smithy "github.com/aws/smithy-go" -) - -// You aren't authorized to perform the action. Use the Amazon Resource Name (ARN) -// of an authorized user or IAM role to perform the operation. -type AccessDeniedException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *AccessDeniedException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *AccessDeniedException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *AccessDeniedException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "AccessDeniedException" - } - return *e.ErrorCodeOverride -} -func (e *AccessDeniedException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// Amazon Textract isn't able to read the document. For more information on the -// document limits in Amazon Textract, see limits. -type BadDocumentException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *BadDocumentException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *BadDocumentException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *BadDocumentException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "BadDocumentException" - } - return *e.ErrorCodeOverride -} -func (e *BadDocumentException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// Updating or deleting a resource can cause an inconsistent state. -type ConflictException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *ConflictException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *ConflictException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *ConflictException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "ConflictException" - } - return *e.ErrorCodeOverride -} -func (e *ConflictException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// The document can't be processed because it's too large. The maximum document -// size for synchronous operations 10 MB. The maximum document size for -// asynchronous operations is 500 MB for PDF files. -type DocumentTooLargeException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *DocumentTooLargeException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *DocumentTooLargeException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *DocumentTooLargeException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "DocumentTooLargeException" - } - return *e.ErrorCodeOverride -} -func (e *DocumentTooLargeException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// Indicates you have exceeded the maximum number of active human in the loop -// workflows available -type HumanLoopQuotaExceededException struct { - Message *string - - ErrorCodeOverride *string - - ResourceType *string - QuotaCode *string - ServiceCode *string - Code *string - - noSmithyDocumentSerde -} - -func (e *HumanLoopQuotaExceededException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *HumanLoopQuotaExceededException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *HumanLoopQuotaExceededException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "HumanLoopQuotaExceededException" - } - return *e.ErrorCodeOverride -} -func (e *HumanLoopQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// A ClientRequestToken input parameter was reused with an operation, but at least -// one of the other input parameters is different from the previous call to the -// operation. -type IdempotentParameterMismatchException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *IdempotentParameterMismatchException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *IdempotentParameterMismatchException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *IdempotentParameterMismatchException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "IdempotentParameterMismatchException" - } - return *e.ErrorCodeOverride -} -func (e *IdempotentParameterMismatchException) ErrorFault() smithy.ErrorFault { - return smithy.FaultClient -} - -// Amazon Textract experienced a service issue. Try your call again. -type InternalServerError struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *InternalServerError) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *InternalServerError) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *InternalServerError) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "InternalServerError" - } - return *e.ErrorCodeOverride -} -func (e *InternalServerError) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } - -// An invalid job identifier was passed to an asynchronous analysis operation. -type InvalidJobIdException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *InvalidJobIdException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *InvalidJobIdException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *InvalidJobIdException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "InvalidJobIdException" - } - return *e.ErrorCodeOverride -} -func (e *InvalidJobIdException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// Indicates you do not have decrypt permissions with the KMS key entered, or the -// -// KMS key was entered incorrectly. -type InvalidKMSKeyException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *InvalidKMSKeyException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *InvalidKMSKeyException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *InvalidKMSKeyException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "InvalidKMSKeyException" - } - return *e.ErrorCodeOverride -} -func (e *InvalidKMSKeyException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// An input parameter violated a constraint. For example, in synchronous -// operations, an InvalidParameterException exception occurs when neither of the -// S3Object or Bytes values are supplied in the Document request parameter. -// Validate your parameter before calling the API operation again. -type InvalidParameterException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *InvalidParameterException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *InvalidParameterException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *InvalidParameterException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "InvalidParameterException" - } - return *e.ErrorCodeOverride -} -func (e *InvalidParameterException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// Amazon Textract is unable to access the S3 object that's specified in the -// request. for more information, [Configure Access to Amazon S3]For troubleshooting information, see [Troubleshooting Amazon S3] -// -// [Troubleshooting Amazon S3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/troubleshooting.html -// [Configure Access to Amazon S3]: https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html -type InvalidS3ObjectException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *InvalidS3ObjectException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *InvalidS3ObjectException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *InvalidS3ObjectException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "InvalidS3ObjectException" - } - return *e.ErrorCodeOverride -} -func (e *InvalidS3ObjectException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// An Amazon Textract service limit was exceeded. For example, if you start too -// many asynchronous jobs concurrently, calls to start operations ( -// StartDocumentTextDetection , for example) raise a LimitExceededException -// exception (HTTP status code: 400) until the number of concurrently running jobs -// is below the Amazon Textract service limit. -type LimitExceededException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *LimitExceededException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *LimitExceededException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *LimitExceededException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "LimitExceededException" - } - return *e.ErrorCodeOverride -} -func (e *LimitExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// The number of requests exceeded your throughput limit. If you want to increase -// this limit, contact Amazon Textract. -type ProvisionedThroughputExceededException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *ProvisionedThroughputExceededException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *ProvisionedThroughputExceededException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *ProvisionedThroughputExceededException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "ProvisionedThroughputExceededException" - } - return *e.ErrorCodeOverride -} -func (e *ProvisionedThroughputExceededException) ErrorFault() smithy.ErrorFault { - return smithy.FaultClient -} - -// Returned when an operation tried to access a nonexistent resource. -type ResourceNotFoundException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *ResourceNotFoundException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *ResourceNotFoundException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *ResourceNotFoundException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "ResourceNotFoundException" - } - return *e.ErrorCodeOverride -} -func (e *ResourceNotFoundException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// Returned when a request cannot be completed as it would exceed a maximum -// service quota. -type ServiceQuotaExceededException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *ServiceQuotaExceededException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *ServiceQuotaExceededException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *ServiceQuotaExceededException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "ServiceQuotaExceededException" - } - return *e.ErrorCodeOverride -} -func (e *ServiceQuotaExceededException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// Amazon Textract is temporarily unable to process the request. Try your call -// again. -type ThrottlingException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *ThrottlingException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *ThrottlingException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *ThrottlingException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "ThrottlingException" - } - return *e.ErrorCodeOverride -} -func (e *ThrottlingException) ErrorFault() smithy.ErrorFault { return smithy.FaultServer } - -// The format of the input document isn't supported. Documents for operations can -// be in PNG, JPEG, PDF, or TIFF format. -type UnsupportedDocumentException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *UnsupportedDocumentException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *UnsupportedDocumentException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *UnsupportedDocumentException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "UnsupportedDocumentException" - } - return *e.ErrorCodeOverride -} -func (e *UnsupportedDocumentException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } - -// Indicates that a request was not valid. Check request for proper formatting. -type ValidationException struct { - Message *string - - ErrorCodeOverride *string - - Code *string - - noSmithyDocumentSerde -} - -func (e *ValidationException) Error() string { - return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) -} -func (e *ValidationException) ErrorMessage() string { - if e.Message == nil { - return "" - } - return *e.Message -} -func (e *ValidationException) ErrorCode() string { - if e == nil || e.ErrorCodeOverride == nil { - return "ValidationException" - } - return *e.ErrorCodeOverride -} -func (e *ValidationException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/types.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/types.go deleted file mode 100644 index 1b77c5a6..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/types/types.go +++ /dev/null @@ -1,1103 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package types - -import ( - smithydocument "github.com/aws/smithy-go/document" - "time" -) - -// An adapter selected for use when analyzing documents. Contains an adapter ID -// and a version number. Contains information on pages selected for analysis when -// analyzing documents asychronously. -type Adapter struct { - - // A unique identifier for the adapter resource. - // - // This member is required. - AdapterId *string - - // A string that identifies the version of the adapter. - // - // This member is required. - Version *string - - // Pages is a parameter that the user inputs to specify which pages to apply an - // adapter to. The following is a list of rules for using this parameter. - // - // - If a page is not specified, it is set to ["1"] by default. - // - // - The following characters are allowed in the parameter's string: 0 1 2 3 4 5 - // 6 7 8 9 - * . No whitespace is allowed. - // - // - When using * to indicate all pages, it must be the only element in the list. - // - // - You can use page intervals, such as ["1-3", "1-1", "4-*"] . Where * - // indicates last page of document. - // - // - Specified pages must be greater than 0 and less than or equal to the number - // of pages in the document. - Pages []string - - noSmithyDocumentSerde -} - -// Contains information on the adapter, including the adapter ID, Name, Creation -// time, and feature types. -type AdapterOverview struct { - - // A unique identifier for the adapter resource. - AdapterId *string - - // A string naming the adapter resource. - AdapterName *string - - // The date and time that the adapter was created. - CreationTime *time.Time - - // The feature types that the adapter is operating on. - FeatureTypes []FeatureType - - noSmithyDocumentSerde -} - -// Contains information about adapters used when analyzing a document, with each -// adapter specified using an AdapterId and version -type AdaptersConfig struct { - - // A list of adapters to be used when analyzing the specified document. - // - // This member is required. - Adapters []Adapter - - noSmithyDocumentSerde -} - -// The dataset configuration options for a given version of an adapter. Can -// include an Amazon S3 bucket if specified. -type AdapterVersionDatasetConfig struct { - - // The S3 bucket name and file name that identifies the document. - // - // The AWS Region for the S3 bucket that contains the document must match the - // Region that you use for Amazon Textract operations. - // - // For Amazon Textract to process a file in an S3 bucket, the user must have - // permission to access the S3 bucket and file. - ManifestS3Object *S3Object - - noSmithyDocumentSerde -} - -// Contains information on the metrics used to evalute the peformance of a given -// adapter version. Includes data for baseline model performance and individual -// adapter version perfromance. -type AdapterVersionEvaluationMetric struct { - - // The F1 score, precision, and recall metrics for the baseline model. - AdapterVersion *EvaluationMetric - - // The F1 score, precision, and recall metrics for the baseline model. - Baseline *EvaluationMetric - - // Indicates the feature type being analyzed by a given adapter version. - FeatureType FeatureType - - noSmithyDocumentSerde -} - -// Summary info for an adapter version. Contains information on the AdapterId, -// AdapterVersion, CreationTime, FeatureTypes, and Status. -type AdapterVersionOverview struct { - - // A unique identifier for the adapter associated with a given adapter version. - AdapterId *string - - // An identified for a given adapter version. - AdapterVersion *string - - // The date and time that a given adapter version was created. - CreationTime *time.Time - - // The feature types that the adapter version is operating on. - FeatureTypes []FeatureType - - // Contains information on the status of a given adapter version. - Status AdapterVersionStatus - - // A message explaining the status of a given adapter vesion. - StatusMessage *string - - noSmithyDocumentSerde -} - -// Used to contain the information detected by an AnalyzeID operation. -type AnalyzeIDDetections struct { - - // Text of either the normalized field or value associated with it. - // - // This member is required. - Text *string - - // The confidence score of the detected text. - Confidence *float32 - - // Only returned for dates, returns the type of value detected and the date - // written in a more machine readable way. - NormalizedValue *NormalizedValue - - noSmithyDocumentSerde -} - -// A Block represents items that are recognized in a document within a group of -// pixels close to each other. The information returned in a Block object depends -// on the type of operation. In text detection for documents (for example DetectDocumentText), you -// get information about the detected words and lines of text. In text analysis -// (for example AnalyzeDocument), you can also get information about the fields, tables, and -// selection elements that are detected in the document. -// -// An array of Block objects is returned by both synchronous and asynchronous -// operations. In synchronous operations, such as DetectDocumentText, the array of Block objects is -// the entire set of results. In asynchronous operations, such as GetDocumentAnalysis, the array is -// returned over one or more responses. -// -// For more information, see [How Amazon Textract Works]. -// -// [How Amazon Textract Works]: https://docs.aws.amazon.com/textract/latest/dg/how-it-works.html -type Block struct { - - // The type of text item that's recognized. In operations for text detection, the - // following types are returned: - // - // - PAGE - Contains a list of the LINE Block objects that are detected on a - // document page. - // - // - WORD - A word detected on a document page. A word is one or more ISO basic - // Latin script characters that aren't separated by spaces. - // - // - LINE - A string of tab-delimited, contiguous words that are detected on a - // document page. - // - // In text analysis operations, the following types are returned: - // - // - PAGE - Contains a list of child Block objects that are detected on a - // document page. - // - // - KEY_VALUE_SET - Stores the KEY and VALUE Block objects for linked text - // that's detected on a document page. Use the EntityType field to determine if a - // KEY_VALUE_SET object is a KEY Block object or a VALUE Block object. - // - // - WORD - A word that's detected on a document page. A word is one or more ISO - // basic Latin script characters that aren't separated by spaces. - // - // - LINE - A string of tab-delimited, contiguous words that are detected on a - // document page. - // - // - TABLE - A table that's detected on a document page. A table is grid-based - // information with two or more rows or columns, with a cell span of one row and - // one column each. - // - // - TABLE_TITLE - The title of a table. A title is typically a line of text - // above or below a table, or embedded as the first row of a table. - // - // - TABLE_FOOTER - The footer associated with a table. A footer is typically a - // line or lines of text below a table or embedded as the last row of a table. - // - // - CELL - A cell within a detected table. The cell is the parent of the block - // that contains the text in the cell. - // - // - MERGED_CELL - A cell in a table whose content spans more than one row or - // column. The Relationships array for this cell contain data from individual - // cells. - // - // - SELECTION_ELEMENT - A selection element such as an option button (radio - // button) or a check box that's detected on a document page. Use the value of - // SelectionStatus to determine the status of the selection element. - // - // - SIGNATURE - The location and confidence score of a signature detected on a - // document page. Can be returned as part of a Key-Value pair or a detected cell. - // - // - QUERY - A question asked during the call of AnalyzeDocument. Contains an - // alias and an ID that attaches it to its answer. - // - // - QUERY_RESULT - A response to a question asked during the call of analyze - // document. Comes with an alias and ID for ease of locating in a response. Also - // contains location and confidence score. - // - // The following BlockTypes are only returned for Amazon Textract Layout. - // - // - LAYOUT_TITLE - The main title of the document. - // - // - LAYOUT_HEADER - Text located in the top margin of the document. - // - // - LAYOUT_FOOTER - Text located in the bottom margin of the document. - // - // - LAYOUT_SECTION_HEADER - The titles of sections within a document. - // - // - LAYOUT_PAGE_NUMBER - The page number of the documents. - // - // - LAYOUT_LIST - Any information grouped together in list form. - // - // - LAYOUT_FIGURE - Indicates the location of an image in a document. - // - // - LAYOUT_TABLE - Indicates the location of a table in the document. - // - // - LAYOUT_KEY_VALUE - Indicates the location of form key-values in a document. - // - // - LAYOUT_TEXT - Text that is present typically as a part of paragraphs in - // documents. - BlockType BlockType - - // The column in which a table cell appears. The first column position is 1. - // ColumnIndex isn't returned by DetectDocumentText and GetDocumentTextDetection . - ColumnIndex *int32 - - // The number of columns that a table cell spans. ColumnSpan isn't returned by - // DetectDocumentText and GetDocumentTextDetection . - ColumnSpan *int32 - - // The confidence score that Amazon Textract has in the accuracy of the recognized - // text and the accuracy of the geometry points around the recognized text. - Confidence *float32 - - // The type of entity. - // - // The following entity types can be returned by FORMS analysis: - // - // - KEY - An identifier for a field on the document. - // - // - VALUE - The field text. - // - // The following entity types can be returned by TABLES analysis: - // - // - COLUMN_HEADER - Identifies a cell that is a header of a column. - // - // - TABLE_TITLE - Identifies a cell that is a title within the table. - // - // - TABLE_SECTION_TITLE - Identifies a cell that is a title of a section within - // a table. A section title is a cell that typically spans an entire row above a - // section. - // - // - TABLE_FOOTER - Identifies a cell that is a footer of a table. - // - // - TABLE_SUMMARY - Identifies a summary cell of a table. A summary cell can be - // a row of a table or an additional, smaller table that contains summary - // information for another table. - // - // - STRUCTURED_TABLE - Identifies a table with column headers where the content - // of each row corresponds to the headers. - // - // - SEMI_STRUCTURED_TABLE - Identifies a non-structured table. - // - // EntityTypes isn't returned by DetectDocumentText and GetDocumentTextDetection . - EntityTypes []EntityType - - // The location of the recognized text on the image. It includes an axis-aligned, - // coarse bounding box that surrounds the text, and a finer-grain polygon for more - // accurate spatial information. - Geometry *Geometry - - // The identifier for the recognized text. The identifier is only unique for a - // single operation. - Id *string - - // The page on which a block was detected. Page is returned by synchronous and - // asynchronous operations. Page values greater than 1 are only returned for - // multipage documents that are in PDF or TIFF format. A scanned image (JPEG/PNG) - // provided to an asynchronous operation, even if it contains multiple document - // pages, is considered a single-page document. This means that for scanned images - // the value of Page is always 1. - Page *int32 - - // - Query *Query - - // A list of relationship objects that describe how blocks are related to each - // other. For example, a LINE block object contains a CHILD relationship type with - // the WORD blocks that make up the line of text. There aren't Relationship objects - // in the list for relationships that don't exist, such as when the current block - // has no child blocks. - Relationships []Relationship - - // The row in which a table cell is located. The first row position is 1. RowIndex - // isn't returned by DetectDocumentText and GetDocumentTextDetection . - RowIndex *int32 - - // The number of rows that a table cell spans. RowSpan isn't returned by - // DetectDocumentText and GetDocumentTextDetection . - RowSpan *int32 - - // The selection status of a selection element, such as an option button or check - // box. - SelectionStatus SelectionStatus - - // The word or line of text that's recognized by Amazon Textract. - Text *string - - // The kind of text that Amazon Textract has detected. Can check for handwritten - // text and printed text. - TextType TextType - - noSmithyDocumentSerde -} - -// The bounding box around the detected page, text, key-value pair, table, table -// cell, or selection element on a document page. The left (x-coordinate) and top -// (y-coordinate) are coordinates that represent the top and left sides of the -// bounding box. Note that the upper-left corner of the image is the origin (0,0). -// -// The top and left values returned are ratios of the overall document page size. -// For example, if the input image is 700 x 200 pixels, and the top-left coordinate -// of the bounding box is 350 x 50 pixels, the API returns a left value of 0.5 -// (350/700) and a top value of 0.25 (50/200). -// -// The width and height values represent the dimensions of the bounding box as a -// ratio of the overall document page dimension. For example, if the document page -// size is 700 x 200 pixels, and the bounding box width is 70 pixels, the width -// returned is 0.1. -type BoundingBox struct { - - // The height of the bounding box as a ratio of the overall document page height. - Height float32 - - // The left coordinate of the bounding box as a ratio of overall document page - // width. - Left float32 - - // The top coordinate of the bounding box as a ratio of overall document page - // height. - Top float32 - - // The width of the bounding box as a ratio of the overall document page width. - Width float32 - - noSmithyDocumentSerde -} - -// A structure that holds information regarding a detected signature on a page. -type DetectedSignature struct { - - // The page a detected signature was found on. - Page *int32 - - noSmithyDocumentSerde -} - -// The input document, either as bytes or as an S3 object. -// -// You pass image bytes to an Amazon Textract API operation by using the Bytes -// property. For example, you would use the Bytes property to pass a document -// loaded from a local file system. Image bytes passed by using the Bytes property -// must be base64 encoded. Your code might not need to encode document file bytes -// if you're using an AWS SDK to call Amazon Textract API operations. -// -// You pass images stored in an S3 bucket to an Amazon Textract API operation by -// using the S3Object property. Documents stored in an S3 bucket don't need to be -// base64 encoded. -// -// The AWS Region for the S3 bucket that contains the S3 object must match the AWS -// Region that you use for Amazon Textract operations. -// -// If you use the AWS CLI to call Amazon Textract operations, passing image bytes -// using the Bytes property isn't supported. You must first upload the document to -// an Amazon S3 bucket, and then call the operation using the S3Object property. -// -// For Amazon Textract to process an S3 object, the user must have permission to -// access the S3 object. -type Document struct { - - // A blob of base64-encoded document bytes. The maximum size of a document that's - // provided in a blob of bytes is 5 MB. The document bytes must be in PNG or JPEG - // format. - // - // If you're using an AWS SDK to call Amazon Textract, you might not need to - // base64-encode image bytes passed using the Bytes field. - Bytes []byte - - // Identifies an S3 object as the document source. The maximum size of a document - // that's stored in an S3 bucket is 5 MB. - S3Object *S3Object - - noSmithyDocumentSerde -} - -// Summary information about documents grouped by the same document type. -type DocumentGroup struct { - - // A list of the detected signatures found in a document group. - DetectedSignatures []DetectedSignature - - // An array that contains information about the pages of a document, defined by - // logical boundary. - SplitDocuments []SplitDocument - - // The type of document that Amazon Textract has detected. See [Analyze Lending Response Objects] for a list of all - // types returned by Textract. - // - // [Analyze Lending Response Objects]: https://docs.aws.amazon.com/textract/latest/dg/lending-response-objects.html - Type *string - - // A list of any expected signatures not found in a document group. - UndetectedSignatures []UndetectedSignature - - noSmithyDocumentSerde -} - -// The Amazon S3 bucket that contains the document to be processed. It's used by -// asynchronous operations. -// -// The input document can be an image file in JPEG or PNG format. It can also be a -// file in PDF format. -type DocumentLocation struct { - - // The Amazon S3 bucket that contains the input document. - S3Object *S3Object - - noSmithyDocumentSerde -} - -// Information about the input document. -type DocumentMetadata struct { - - // The number of pages that are detected in the document. - Pages *int32 - - noSmithyDocumentSerde -} - -// The evaluation metrics (F1 score, Precision, and Recall) for an adapter version. -type EvaluationMetric struct { - - // The F1 score for an adapter version. - F1Score float32 - - // The Precision score for an adapter version. - Precision float32 - - // The Recall score for an adapter version. - Recall float32 - - noSmithyDocumentSerde -} - -// Returns the kind of currency detected. -type ExpenseCurrency struct { - - // Currency code for detected currency. the current supported codes are: - // - // - USD - // - // - EUR - // - // - GBP - // - // - CAD - // - // - INR - // - // - JPY - // - // - CHF - // - // - AUD - // - // - CNY - // - // - BZR - // - // - SEK - // - // - HKD - Code *string - - // Percentage confideence in the detected currency. - Confidence *float32 - - noSmithyDocumentSerde -} - -// An object used to store information about the Value or Label detected by Amazon -// Textract. -type ExpenseDetection struct { - - // The confidence in detection, as a percentage - Confidence *float32 - - // Information about where the following items are located on a document page: - // detected page, text, key-value pairs, tables, table cells, and selection - // elements. - Geometry *Geometry - - // The word or line of text recognized by Amazon Textract - Text *string - - noSmithyDocumentSerde -} - -// The structure holding all the information returned by AnalyzeExpense -type ExpenseDocument struct { - - // This is a block object, the same as reported when DetectDocumentText is run on - // a document. It provides word level recognition of text. - Blocks []Block - - // Denotes which invoice or receipt in the document the information is coming - // from. First document will be 1, the second 2, and so on. - ExpenseIndex *int32 - - // Information detected on each table of a document, seperated into LineItems . - LineItemGroups []LineItemGroup - - // Any information found outside of a table by Amazon Textract. - SummaryFields []ExpenseField - - noSmithyDocumentSerde -} - -// Breakdown of detected information, seperated into the catagories Type, -// LabelDetection, and ValueDetection -type ExpenseField struct { - - // Shows the kind of currency, both the code and confidence associated with any - // monatary value detected. - Currency *ExpenseCurrency - - // Shows which group a response object belongs to, such as whether an address line - // belongs to the vendor's address or the recipent's address. - GroupProperties []ExpenseGroupProperty - - // The explicitly stated label of a detected element. - LabelDetection *ExpenseDetection - - // The page number the value was detected on. - PageNumber *int32 - - // The implied label of a detected element. Present alongside LabelDetection for - // explicit elements. - Type *ExpenseType - - // The value of a detected element. Present in explicit and implicit elements. - ValueDetection *ExpenseDetection - - noSmithyDocumentSerde -} - -// Shows the group that a certain key belongs to. This helps differentiate between -// names and addresses for different organizations, that can be hard to determine -// via JSON response. -type ExpenseGroupProperty struct { - - // Provides a group Id number, which will be the same for each in the group. - Id *string - - // Informs you on whether the expense group is a name or an address. - Types []string - - noSmithyDocumentSerde -} - -// An object used to store information about the Type detected by Amazon Textract. -type ExpenseType struct { - - // The confidence of accuracy, as a percentage. - Confidence *float32 - - // The word or line of text detected by Amazon Textract. - Text *string - - noSmithyDocumentSerde -} - -// Contains information extracted by an analysis operation after using -// StartLendingAnalysis. -type Extraction struct { - - // The structure holding all the information returned by AnalyzeExpense - ExpenseDocument *ExpenseDocument - - // The structure that lists each document processed in an AnalyzeID operation. - IdentityDocument *IdentityDocument - - // Holds the structured data returned by AnalyzeDocument for lending documents. - LendingDocument *LendingDocument - - noSmithyDocumentSerde -} - -// Information about where the following items are located on a document page: -// detected page, text, key-value pairs, tables, table cells, and selection -// elements. -type Geometry struct { - - // An axis-aligned coarse representation of the location of the recognized item on - // the document page. - BoundingBox *BoundingBox - - // Within the bounding box, a fine-grained polygon around the recognized item. - Polygon []Point - - noSmithyDocumentSerde -} - -// Shows the results of the human in the loop evaluation. If there is no -// HumanLoopArn, the input did not trigger human review. -type HumanLoopActivationOutput struct { - - // Shows the result of condition evaluations, including those conditions which - // activated a human review. - // - // This value conforms to the media type: application/json - HumanLoopActivationConditionsEvaluationResults *string - - // Shows if and why human review was needed. - HumanLoopActivationReasons []string - - // The Amazon Resource Name (ARN) of the HumanLoop created. - HumanLoopArn *string - - noSmithyDocumentSerde -} - -// Sets up the human review workflow the document will be sent to if one of the -// conditions is met. You can also set certain attributes of the image before -// review. -type HumanLoopConfig struct { - - // The Amazon Resource Name (ARN) of the flow definition. - // - // This member is required. - FlowDefinitionArn *string - - // The name of the human workflow used for this image. This should be kept unique - // within a region. - // - // This member is required. - HumanLoopName *string - - // Sets attributes of the input data. - DataAttributes *HumanLoopDataAttributes - - noSmithyDocumentSerde -} - -// Allows you to set attributes of the image. Currently, you can declare an image -// as free of personally identifiable information and adult content. -type HumanLoopDataAttributes struct { - - // Sets whether the input image is free of personally identifiable information or - // adult content. - ContentClassifiers []ContentClassifier - - noSmithyDocumentSerde -} - -// The structure that lists each document processed in an AnalyzeID operation. -type IdentityDocument struct { - - // Individual word recognition, as returned by document detection. - Blocks []Block - - // Denotes the placement of a document in the IdentityDocument list. The first - // document is marked 1, the second 2 and so on. - DocumentIndex *int32 - - // The structure used to record information extracted from identity documents. - // Contains both normalized field and value of the extracted text. - IdentityDocumentFields []IdentityDocumentField - - noSmithyDocumentSerde -} - -// Structure containing both the normalized type of the extracted information and -// the text associated with it. These are extracted as Type and Value respectively. -type IdentityDocumentField struct { - - // Used to contain the information detected by an AnalyzeID operation. - Type *AnalyzeIDDetections - - // Used to contain the information detected by an AnalyzeID operation. - ValueDetection *AnalyzeIDDetections - - noSmithyDocumentSerde -} - -// The results extracted for a lending document. -type LendingDetection struct { - - // The confidence level for the text of a detected value in a lending document. - Confidence *float32 - - // Information about where the following items are located on a document page: - // detected page, text, key-value pairs, tables, table cells, and selection - // elements. - Geometry *Geometry - - // The selection status of a selection element, such as an option button or check - // box. - SelectionStatus SelectionStatus - - // The text extracted for a detected value in a lending document. - Text *string - - noSmithyDocumentSerde -} - -// Holds the structured data returned by AnalyzeDocument for lending documents. -type LendingDocument struct { - - // An array of LendingField objects. - LendingFields []LendingField - - // A list of signatures detected in a lending document. - SignatureDetections []SignatureDetection - - noSmithyDocumentSerde -} - -// Holds the normalized key-value pairs returned by AnalyzeDocument, including the -// document type, detected text, and geometry. -type LendingField struct { - - // The results extracted for a lending document. - KeyDetection *LendingDetection - - // The type of the lending document. - Type *string - - // An array of LendingDetection objects. - ValueDetections []LendingDetection - - noSmithyDocumentSerde -} - -// Contains the detections for each page analyzed through the Analyze Lending API. -type LendingResult struct { - - // An array of Extraction to hold structured data. e.g. normalized key value pairs - // instead of raw OCR detections . - Extractions []Extraction - - // The page number for a page, with regard to whole submission. - Page *int32 - - // The classifier result for a given page. - PageClassification *PageClassification - - noSmithyDocumentSerde -} - -// Contains information regarding DocumentGroups and UndetectedDocumentTypes. -type LendingSummary struct { - - // Contains an array of all DocumentGroup objects. - DocumentGroups []DocumentGroup - - // UndetectedDocumentTypes. - UndetectedDocumentTypes []string - - noSmithyDocumentSerde -} - -// A structure that holds information about the different lines found in a -// document's tables. -type LineItemFields struct { - - // ExpenseFields used to show information from detected lines on a table. - LineItemExpenseFields []ExpenseField - - noSmithyDocumentSerde -} - -// A grouping of tables which contain LineItems, with each table identified by the -// table's LineItemGroupIndex . -type LineItemGroup struct { - - // The number used to identify a specific table in a document. The first table - // encountered will have a LineItemGroupIndex of 1, the second 2, etc. - LineItemGroupIndex *int32 - - // The breakdown of information on a particular line of a table. - LineItems []LineItemFields - - noSmithyDocumentSerde -} - -// Contains information relating to dates in a document, including the type of -// value, and the value. -type NormalizedValue struct { - - // The value of the date, written as Year-Month-DayTHour:Minute:Second. - Value *string - - // The normalized type of the value detected. In this case, DATE. - ValueType ValueType - - noSmithyDocumentSerde -} - -// The Amazon Simple Notification Service (Amazon SNS) topic to which Amazon -// Textract publishes the completion status of an asynchronous document operation. -type NotificationChannel struct { - - // The Amazon Resource Name (ARN) of an IAM role that gives Amazon Textract - // publishing permissions to the Amazon SNS topic. - // - // This member is required. - RoleArn *string - - // The Amazon SNS topic that Amazon Textract posts the completion status to. - // - // This member is required. - SNSTopicArn *string - - noSmithyDocumentSerde -} - -// Sets whether or not your output will go to a user created bucket. Used to set -// the name of the bucket, and the prefix on the output file. -// -// OutputConfig is an optional parameter which lets you adjust where your output -// will be placed. By default, Amazon Textract will store the results internally -// and can only be accessed by the Get API operations. With OutputConfig enabled, -// you can set the name of the bucket the output will be sent to the file prefix of -// the results where you can download your results. Additionally, you can set the -// KMSKeyID parameter to a customer master key (CMK) to encrypt your output. -// Without this parameter set Amazon Textract will encrypt server-side using the -// AWS managed CMK for Amazon S3. -// -// Decryption of Customer Content is necessary for processing of the documents by -// Amazon Textract. If your account is opted out under an AI services opt out -// policy then all unencrypted Customer Content is immediately and permanently -// deleted after the Customer Content has been processed by the service. No copy of -// of the output is retained by Amazon Textract. For information about how to opt -// out, see [Managing AI services opt-out policy.] -// -// For more information on data privacy, see the [Data Privacy FAQ]. -// -// [Managing AI services opt-out policy.]: https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_ai-opt-out.html -// [Data Privacy FAQ]: https://aws.amazon.com/compliance/data-privacy-faq/ -type OutputConfig struct { - - // The name of the bucket your output will go to. - // - // This member is required. - S3Bucket *string - - // The prefix of the object key that the output will be saved to. When not - // enabled, the prefix will be “textract_output". - S3Prefix *string - - noSmithyDocumentSerde -} - -// The class assigned to a Page object detected in an input document. Contains -// information regarding the predicted type/class of a document's page and the page -// number that the Page object was detected on. -type PageClassification struct { - - // The page number the value was detected on, relative to Amazon Textract's - // starting position. - // - // This member is required. - PageNumber []Prediction - - // The class, or document type, assigned to a detected Page object. The class, or - // document type, assigned to a detected Page object. - // - // This member is required. - PageType []Prediction - - noSmithyDocumentSerde -} - -// The X and Y coordinates of a point on a document page. The X and Y values that -// are returned are ratios of the overall document page size. For example, if the -// input document is 700 x 200 and the operation returns X=0.5 and Y=0.25, then the -// point is at the (350,50) pixel coordinate on the document page. -// -// An array of Point objects, Polygon , is returned by DetectDocumentText. Polygon represents a -// fine-grained polygon around detected text. For more information, see Geometry in -// the Amazon Textract Developer Guide. -type Point struct { - - // The value of the X coordinate for a point on a Polygon . - X float32 - - // The value of the Y coordinate for a point on a Polygon . - Y float32 - - noSmithyDocumentSerde -} - -// Contains information regarding predicted values returned by Amazon Textract -// operations, including the predicted value and the confidence in the predicted -// value. -type Prediction struct { - - // Amazon Textract's confidence in its predicted value. - Confidence *float32 - - // The predicted value of a detected object. - Value *string - - noSmithyDocumentSerde -} - -type QueriesConfig struct { - - // - // - // This member is required. - Queries []Query - - noSmithyDocumentSerde -} - -// Each query contains the question you want to ask in the Text and the alias you -// want to associate. -type Query struct { - - // Question that Amazon Textract will apply to the document. An example would be - // "What is the customer's SSN?" - // - // This member is required. - Text *string - - // Alias attached to the query, for ease of location. - Alias *string - - // Pages is a parameter that the user inputs to specify which pages to apply a - // query to. The following is a list of rules for using this parameter. - // - // - If a page is not specified, it is set to ["1"] by default. - // - // - The following characters are allowed in the parameter's string: 0 1 2 3 4 5 - // 6 7 8 9 - * . No whitespace is allowed. - // - // - When using * to indicate all pages, it must be the only element in the list. - // - // - You can use page intervals, such as [“1-3”, “1-1”, “4-*”] . Where * - // indicates last page of document. - // - // - Specified pages must be greater than 0 and less than or equal to the number - // of pages in the document. - Pages []string - - noSmithyDocumentSerde -} - -// Information about how blocks are related to each other. A Block object contains -// 0 or more Relation objects in a list, Relationships . For more information, see Block -// . -// -// The Type element provides the type of the relationship for all blocks in the IDs -// array. -type Relationship struct { - - // An array of IDs for related blocks. You can get the type of the relationship - // from the Type element. - Ids []string - - // The type of relationship between the blocks in the IDs array and the current - // block. The following list describes the relationship types that can be returned. - // - // - VALUE - A list that contains the ID of the VALUE block that's associated - // with the KEY of a key-value pair. - // - // - CHILD - A list of IDs that identify blocks found within the current block - // object. For example, WORD blocks have a CHILD relationship to the LINE block - // type. - // - // - MERGED_CELL - A list of IDs that identify each of the MERGED_CELL block - // types in a table. - // - // - ANSWER - A list that contains the ID of the QUERY_RESULT block that’s - // associated with the corresponding QUERY block. - // - // - TABLE - A list of IDs that identify associated TABLE block types. - // - // - TABLE_TITLE - A list that contains the ID for the TABLE_TITLE block type in - // a table. - // - // - TABLE_FOOTER - A list of IDs that identify the TABLE_FOOTER block types in - // a table. - Type RelationshipType - - noSmithyDocumentSerde -} - -// The S3 bucket name and file name that identifies the document. -// -// The AWS Region for the S3 bucket that contains the document must match the -// Region that you use for Amazon Textract operations. -// -// For Amazon Textract to process a file in an S3 bucket, the user must have -// permission to access the S3 bucket and file. -type S3Object struct { - - // The name of the S3 bucket. Note that the # character is not valid in the file - // name. - Bucket *string - - // The file name of the input document. Synchronous operations can use image files - // that are in JPEG or PNG format. Asynchronous operations also support PDF and - // TIFF format files. - Name *string - - // If the bucket has versioning enabled, you can specify the object version. - Version *string - - noSmithyDocumentSerde -} - -// Information regarding a detected signature on a page. -type SignatureDetection struct { - - // The confidence, from 0 to 100, in the predicted values for a detected signature. - Confidence *float32 - - // Information about where the following items are located on a document page: - // detected page, text, key-value pairs, tables, table cells, and selection - // elements. - Geometry *Geometry - - noSmithyDocumentSerde -} - -// Contains information about the pages of a document, defined by logical boundary. -type SplitDocument struct { - - // The index for a given document in a DocumentGroup of a specific Type. - Index *int32 - - // An array of page numbers for a for a given document, ordered by logical - // boundary. - Pages []int32 - - noSmithyDocumentSerde -} - -// A structure containing information about an undetected signature on a page -// where it was expected but not found. -type UndetectedSignature struct { - - // The page where a signature was expected but not found. - Page *int32 - - noSmithyDocumentSerde -} - -// A warning about an issue that occurred during asynchronous text analysis (StartDocumentAnalysis ) or -// asynchronous document text detection (StartDocumentTextDetection ). -type Warning struct { - - // The error code for the warning. - ErrorCode *string - - // A list of the pages that the warning applies to. - Pages []int32 - - noSmithyDocumentSerde -} - -type noSmithyDocumentSerde = smithydocument.NoSerde diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/validators.go b/vendor/github.com/aws/aws-sdk-go-v2/service/textract/validators.go deleted file mode 100644 index 0e67ffcb..00000000 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/textract/validators.go +++ /dev/null @@ -1,1160 +0,0 @@ -// Code generated by smithy-go-codegen DO NOT EDIT. - -package textract - -import ( - "context" - "fmt" - "github.com/aws/aws-sdk-go-v2/service/textract/types" - smithy "github.com/aws/smithy-go" - "github.com/aws/smithy-go/middleware" -) - -type validateOpAnalyzeDocument struct { -} - -func (*validateOpAnalyzeDocument) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpAnalyzeDocument) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*AnalyzeDocumentInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpAnalyzeDocumentInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpAnalyzeExpense struct { -} - -func (*validateOpAnalyzeExpense) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpAnalyzeExpense) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*AnalyzeExpenseInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpAnalyzeExpenseInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpAnalyzeID struct { -} - -func (*validateOpAnalyzeID) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpAnalyzeID) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*AnalyzeIDInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpAnalyzeIDInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpCreateAdapter struct { -} - -func (*validateOpCreateAdapter) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpCreateAdapter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*CreateAdapterInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpCreateAdapterInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpCreateAdapterVersion struct { -} - -func (*validateOpCreateAdapterVersion) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpCreateAdapterVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*CreateAdapterVersionInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpCreateAdapterVersionInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpDeleteAdapter struct { -} - -func (*validateOpDeleteAdapter) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpDeleteAdapter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*DeleteAdapterInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpDeleteAdapterInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpDeleteAdapterVersion struct { -} - -func (*validateOpDeleteAdapterVersion) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpDeleteAdapterVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*DeleteAdapterVersionInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpDeleteAdapterVersionInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpDetectDocumentText struct { -} - -func (*validateOpDetectDocumentText) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpDetectDocumentText) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*DetectDocumentTextInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpDetectDocumentTextInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpGetAdapter struct { -} - -func (*validateOpGetAdapter) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpGetAdapter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*GetAdapterInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpGetAdapterInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpGetAdapterVersion struct { -} - -func (*validateOpGetAdapterVersion) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpGetAdapterVersion) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*GetAdapterVersionInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpGetAdapterVersionInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpGetDocumentAnalysis struct { -} - -func (*validateOpGetDocumentAnalysis) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpGetDocumentAnalysis) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*GetDocumentAnalysisInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpGetDocumentAnalysisInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpGetDocumentTextDetection struct { -} - -func (*validateOpGetDocumentTextDetection) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpGetDocumentTextDetection) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*GetDocumentTextDetectionInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpGetDocumentTextDetectionInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpGetExpenseAnalysis struct { -} - -func (*validateOpGetExpenseAnalysis) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpGetExpenseAnalysis) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*GetExpenseAnalysisInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpGetExpenseAnalysisInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpGetLendingAnalysis struct { -} - -func (*validateOpGetLendingAnalysis) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpGetLendingAnalysis) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*GetLendingAnalysisInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpGetLendingAnalysisInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpGetLendingAnalysisSummary struct { -} - -func (*validateOpGetLendingAnalysisSummary) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpGetLendingAnalysisSummary) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*GetLendingAnalysisSummaryInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpGetLendingAnalysisSummaryInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpListTagsForResource struct { -} - -func (*validateOpListTagsForResource) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpListTagsForResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*ListTagsForResourceInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpListTagsForResourceInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpStartDocumentAnalysis struct { -} - -func (*validateOpStartDocumentAnalysis) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpStartDocumentAnalysis) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*StartDocumentAnalysisInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpStartDocumentAnalysisInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpStartDocumentTextDetection struct { -} - -func (*validateOpStartDocumentTextDetection) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpStartDocumentTextDetection) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*StartDocumentTextDetectionInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpStartDocumentTextDetectionInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpStartExpenseAnalysis struct { -} - -func (*validateOpStartExpenseAnalysis) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpStartExpenseAnalysis) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*StartExpenseAnalysisInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpStartExpenseAnalysisInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpStartLendingAnalysis struct { -} - -func (*validateOpStartLendingAnalysis) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpStartLendingAnalysis) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*StartLendingAnalysisInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpStartLendingAnalysisInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpTagResource struct { -} - -func (*validateOpTagResource) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpTagResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*TagResourceInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpTagResourceInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpUntagResource struct { -} - -func (*validateOpUntagResource) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpUntagResource) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*UntagResourceInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpUntagResourceInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -type validateOpUpdateAdapter struct { -} - -func (*validateOpUpdateAdapter) ID() string { - return "OperationInputValidation" -} - -func (m *validateOpUpdateAdapter) HandleInitialize(ctx context.Context, in middleware.InitializeInput, next middleware.InitializeHandler) ( - out middleware.InitializeOutput, metadata middleware.Metadata, err error, -) { - input, ok := in.Parameters.(*UpdateAdapterInput) - if !ok { - return out, metadata, fmt.Errorf("unknown input parameters type %T", in.Parameters) - } - if err := validateOpUpdateAdapterInput(input); err != nil { - return out, metadata, err - } - return next.HandleInitialize(ctx, in) -} - -func addOpAnalyzeDocumentValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpAnalyzeDocument{}, middleware.After) -} - -func addOpAnalyzeExpenseValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpAnalyzeExpense{}, middleware.After) -} - -func addOpAnalyzeIDValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpAnalyzeID{}, middleware.After) -} - -func addOpCreateAdapterValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpCreateAdapter{}, middleware.After) -} - -func addOpCreateAdapterVersionValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpCreateAdapterVersion{}, middleware.After) -} - -func addOpDeleteAdapterValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpDeleteAdapter{}, middleware.After) -} - -func addOpDeleteAdapterVersionValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpDeleteAdapterVersion{}, middleware.After) -} - -func addOpDetectDocumentTextValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpDetectDocumentText{}, middleware.After) -} - -func addOpGetAdapterValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpGetAdapter{}, middleware.After) -} - -func addOpGetAdapterVersionValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpGetAdapterVersion{}, middleware.After) -} - -func addOpGetDocumentAnalysisValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpGetDocumentAnalysis{}, middleware.After) -} - -func addOpGetDocumentTextDetectionValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpGetDocumentTextDetection{}, middleware.After) -} - -func addOpGetExpenseAnalysisValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpGetExpenseAnalysis{}, middleware.After) -} - -func addOpGetLendingAnalysisValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpGetLendingAnalysis{}, middleware.After) -} - -func addOpGetLendingAnalysisSummaryValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpGetLendingAnalysisSummary{}, middleware.After) -} - -func addOpListTagsForResourceValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpListTagsForResource{}, middleware.After) -} - -func addOpStartDocumentAnalysisValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpStartDocumentAnalysis{}, middleware.After) -} - -func addOpStartDocumentTextDetectionValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpStartDocumentTextDetection{}, middleware.After) -} - -func addOpStartExpenseAnalysisValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpStartExpenseAnalysis{}, middleware.After) -} - -func addOpStartLendingAnalysisValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpStartLendingAnalysis{}, middleware.After) -} - -func addOpTagResourceValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpTagResource{}, middleware.After) -} - -func addOpUntagResourceValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpUntagResource{}, middleware.After) -} - -func addOpUpdateAdapterValidationMiddleware(stack *middleware.Stack) error { - return stack.Initialize.Add(&validateOpUpdateAdapter{}, middleware.After) -} - -func validateAdapter(v *types.Adapter) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "Adapter"} - if v.AdapterId == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterId")) - } - if v.Version == nil { - invalidParams.Add(smithy.NewErrParamRequired("Version")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateAdapters(v []types.Adapter) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "Adapters"} - for i := range v { - if err := validateAdapter(&v[i]); err != nil { - invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateAdaptersConfig(v *types.AdaptersConfig) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "AdaptersConfig"} - if v.Adapters == nil { - invalidParams.Add(smithy.NewErrParamRequired("Adapters")) - } else if v.Adapters != nil { - if err := validateAdapters(v.Adapters); err != nil { - invalidParams.AddNested("Adapters", err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateHumanLoopConfig(v *types.HumanLoopConfig) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "HumanLoopConfig"} - if v.HumanLoopName == nil { - invalidParams.Add(smithy.NewErrParamRequired("HumanLoopName")) - } - if v.FlowDefinitionArn == nil { - invalidParams.Add(smithy.NewErrParamRequired("FlowDefinitionArn")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateNotificationChannel(v *types.NotificationChannel) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "NotificationChannel"} - if v.SNSTopicArn == nil { - invalidParams.Add(smithy.NewErrParamRequired("SNSTopicArn")) - } - if v.RoleArn == nil { - invalidParams.Add(smithy.NewErrParamRequired("RoleArn")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOutputConfig(v *types.OutputConfig) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "OutputConfig"} - if v.S3Bucket == nil { - invalidParams.Add(smithy.NewErrParamRequired("S3Bucket")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateQueries(v []types.Query) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "Queries"} - for i := range v { - if err := validateQuery(&v[i]); err != nil { - invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateQueriesConfig(v *types.QueriesConfig) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "QueriesConfig"} - if v.Queries == nil { - invalidParams.Add(smithy.NewErrParamRequired("Queries")) - } else if v.Queries != nil { - if err := validateQueries(v.Queries); err != nil { - invalidParams.AddNested("Queries", err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateQuery(v *types.Query) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "Query"} - if v.Text == nil { - invalidParams.Add(smithy.NewErrParamRequired("Text")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpAnalyzeDocumentInput(v *AnalyzeDocumentInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "AnalyzeDocumentInput"} - if v.Document == nil { - invalidParams.Add(smithy.NewErrParamRequired("Document")) - } - if v.FeatureTypes == nil { - invalidParams.Add(smithy.NewErrParamRequired("FeatureTypes")) - } - if v.HumanLoopConfig != nil { - if err := validateHumanLoopConfig(v.HumanLoopConfig); err != nil { - invalidParams.AddNested("HumanLoopConfig", err.(smithy.InvalidParamsError)) - } - } - if v.QueriesConfig != nil { - if err := validateQueriesConfig(v.QueriesConfig); err != nil { - invalidParams.AddNested("QueriesConfig", err.(smithy.InvalidParamsError)) - } - } - if v.AdaptersConfig != nil { - if err := validateAdaptersConfig(v.AdaptersConfig); err != nil { - invalidParams.AddNested("AdaptersConfig", err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpAnalyzeExpenseInput(v *AnalyzeExpenseInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "AnalyzeExpenseInput"} - if v.Document == nil { - invalidParams.Add(smithy.NewErrParamRequired("Document")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpAnalyzeIDInput(v *AnalyzeIDInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "AnalyzeIDInput"} - if v.DocumentPages == nil { - invalidParams.Add(smithy.NewErrParamRequired("DocumentPages")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpCreateAdapterInput(v *CreateAdapterInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "CreateAdapterInput"} - if v.AdapterName == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterName")) - } - if v.FeatureTypes == nil { - invalidParams.Add(smithy.NewErrParamRequired("FeatureTypes")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpCreateAdapterVersionInput(v *CreateAdapterVersionInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "CreateAdapterVersionInput"} - if v.AdapterId == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterId")) - } - if v.DatasetConfig == nil { - invalidParams.Add(smithy.NewErrParamRequired("DatasetConfig")) - } - if v.OutputConfig == nil { - invalidParams.Add(smithy.NewErrParamRequired("OutputConfig")) - } else if v.OutputConfig != nil { - if err := validateOutputConfig(v.OutputConfig); err != nil { - invalidParams.AddNested("OutputConfig", err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpDeleteAdapterInput(v *DeleteAdapterInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "DeleteAdapterInput"} - if v.AdapterId == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterId")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpDeleteAdapterVersionInput(v *DeleteAdapterVersionInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "DeleteAdapterVersionInput"} - if v.AdapterId == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterId")) - } - if v.AdapterVersion == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterVersion")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpDetectDocumentTextInput(v *DetectDocumentTextInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "DetectDocumentTextInput"} - if v.Document == nil { - invalidParams.Add(smithy.NewErrParamRequired("Document")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpGetAdapterInput(v *GetAdapterInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "GetAdapterInput"} - if v.AdapterId == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterId")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpGetAdapterVersionInput(v *GetAdapterVersionInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "GetAdapterVersionInput"} - if v.AdapterId == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterId")) - } - if v.AdapterVersion == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterVersion")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpGetDocumentAnalysisInput(v *GetDocumentAnalysisInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "GetDocumentAnalysisInput"} - if v.JobId == nil { - invalidParams.Add(smithy.NewErrParamRequired("JobId")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpGetDocumentTextDetectionInput(v *GetDocumentTextDetectionInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "GetDocumentTextDetectionInput"} - if v.JobId == nil { - invalidParams.Add(smithy.NewErrParamRequired("JobId")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpGetExpenseAnalysisInput(v *GetExpenseAnalysisInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "GetExpenseAnalysisInput"} - if v.JobId == nil { - invalidParams.Add(smithy.NewErrParamRequired("JobId")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpGetLendingAnalysisInput(v *GetLendingAnalysisInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "GetLendingAnalysisInput"} - if v.JobId == nil { - invalidParams.Add(smithy.NewErrParamRequired("JobId")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpGetLendingAnalysisSummaryInput(v *GetLendingAnalysisSummaryInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "GetLendingAnalysisSummaryInput"} - if v.JobId == nil { - invalidParams.Add(smithy.NewErrParamRequired("JobId")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpListTagsForResourceInput(v *ListTagsForResourceInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "ListTagsForResourceInput"} - if v.ResourceARN == nil { - invalidParams.Add(smithy.NewErrParamRequired("ResourceARN")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpStartDocumentAnalysisInput(v *StartDocumentAnalysisInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "StartDocumentAnalysisInput"} - if v.DocumentLocation == nil { - invalidParams.Add(smithy.NewErrParamRequired("DocumentLocation")) - } - if v.FeatureTypes == nil { - invalidParams.Add(smithy.NewErrParamRequired("FeatureTypes")) - } - if v.NotificationChannel != nil { - if err := validateNotificationChannel(v.NotificationChannel); err != nil { - invalidParams.AddNested("NotificationChannel", err.(smithy.InvalidParamsError)) - } - } - if v.OutputConfig != nil { - if err := validateOutputConfig(v.OutputConfig); err != nil { - invalidParams.AddNested("OutputConfig", err.(smithy.InvalidParamsError)) - } - } - if v.QueriesConfig != nil { - if err := validateQueriesConfig(v.QueriesConfig); err != nil { - invalidParams.AddNested("QueriesConfig", err.(smithy.InvalidParamsError)) - } - } - if v.AdaptersConfig != nil { - if err := validateAdaptersConfig(v.AdaptersConfig); err != nil { - invalidParams.AddNested("AdaptersConfig", err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpStartDocumentTextDetectionInput(v *StartDocumentTextDetectionInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "StartDocumentTextDetectionInput"} - if v.DocumentLocation == nil { - invalidParams.Add(smithy.NewErrParamRequired("DocumentLocation")) - } - if v.NotificationChannel != nil { - if err := validateNotificationChannel(v.NotificationChannel); err != nil { - invalidParams.AddNested("NotificationChannel", err.(smithy.InvalidParamsError)) - } - } - if v.OutputConfig != nil { - if err := validateOutputConfig(v.OutputConfig); err != nil { - invalidParams.AddNested("OutputConfig", err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpStartExpenseAnalysisInput(v *StartExpenseAnalysisInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "StartExpenseAnalysisInput"} - if v.DocumentLocation == nil { - invalidParams.Add(smithy.NewErrParamRequired("DocumentLocation")) - } - if v.NotificationChannel != nil { - if err := validateNotificationChannel(v.NotificationChannel); err != nil { - invalidParams.AddNested("NotificationChannel", err.(smithy.InvalidParamsError)) - } - } - if v.OutputConfig != nil { - if err := validateOutputConfig(v.OutputConfig); err != nil { - invalidParams.AddNested("OutputConfig", err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpStartLendingAnalysisInput(v *StartLendingAnalysisInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "StartLendingAnalysisInput"} - if v.DocumentLocation == nil { - invalidParams.Add(smithy.NewErrParamRequired("DocumentLocation")) - } - if v.NotificationChannel != nil { - if err := validateNotificationChannel(v.NotificationChannel); err != nil { - invalidParams.AddNested("NotificationChannel", err.(smithy.InvalidParamsError)) - } - } - if v.OutputConfig != nil { - if err := validateOutputConfig(v.OutputConfig); err != nil { - invalidParams.AddNested("OutputConfig", err.(smithy.InvalidParamsError)) - } - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpTagResourceInput(v *TagResourceInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "TagResourceInput"} - if v.ResourceARN == nil { - invalidParams.Add(smithy.NewErrParamRequired("ResourceARN")) - } - if v.Tags == nil { - invalidParams.Add(smithy.NewErrParamRequired("Tags")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpUntagResourceInput(v *UntagResourceInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "UntagResourceInput"} - if v.ResourceARN == nil { - invalidParams.Add(smithy.NewErrParamRequired("ResourceARN")) - } - if v.TagKeys == nil { - invalidParams.Add(smithy.NewErrParamRequired("TagKeys")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} - -func validateOpUpdateAdapterInput(v *UpdateAdapterInput) error { - if v == nil { - return nil - } - invalidParams := smithy.InvalidParamsError{Context: "UpdateAdapterInput"} - if v.AdapterId == nil { - invalidParams.Add(smithy.NewErrParamRequired("AdapterId")) - } - if invalidParams.Len() > 0 { - return invalidParams - } else { - return nil - } -} diff --git a/vendor/github.com/stretchr/objx/.codeclimate.yml b/vendor/github.com/stretchr/objx/.codeclimate.yml deleted file mode 100644 index 559fa399..00000000 --- a/vendor/github.com/stretchr/objx/.codeclimate.yml +++ /dev/null @@ -1,21 +0,0 @@ -engines: - gofmt: - enabled: true - golint: - enabled: true - govet: - enabled: true - -exclude_patterns: -- ".github/" -- "vendor/" -- "codegen/" -- "*.yml" -- ".*.yml" -- "*.md" -- "Gopkg.*" -- "doc.go" -- "type_specific_codegen_test.go" -- "type_specific_codegen.go" -- ".gitignore" -- "LICENSE" diff --git a/vendor/github.com/stretchr/objx/.gitignore b/vendor/github.com/stretchr/objx/.gitignore deleted file mode 100644 index ea58090b..00000000 --- a/vendor/github.com/stretchr/objx/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -# Binaries for programs and plugins -*.exe -*.dll -*.so -*.dylib - -# Test binary, build with `go test -c` -*.test - -# Output of the go coverage tool, specifically when used with LiteIDE -*.out diff --git a/vendor/github.com/stretchr/objx/LICENSE b/vendor/github.com/stretchr/objx/LICENSE deleted file mode 100644 index 44d4d9d5..00000000 --- a/vendor/github.com/stretchr/objx/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License - -Copyright (c) 2014 Stretchr, Inc. -Copyright (c) 2017-2018 objx contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/vendor/github.com/stretchr/objx/README.md b/vendor/github.com/stretchr/objx/README.md deleted file mode 100644 index 78dc1f8b..00000000 --- a/vendor/github.com/stretchr/objx/README.md +++ /dev/null @@ -1,80 +0,0 @@ -# Objx -[![Build Status](https://travis-ci.org/stretchr/objx.svg?branch=master)](https://travis-ci.org/stretchr/objx) -[![Go Report Card](https://goreportcard.com/badge/github.com/stretchr/objx)](https://goreportcard.com/report/github.com/stretchr/objx) -[![Maintainability](https://api.codeclimate.com/v1/badges/1d64bc6c8474c2074f2b/maintainability)](https://codeclimate.com/github/stretchr/objx/maintainability) -[![Test Coverage](https://api.codeclimate.com/v1/badges/1d64bc6c8474c2074f2b/test_coverage)](https://codeclimate.com/github/stretchr/objx/test_coverage) -[![Sourcegraph](https://sourcegraph.com/github.com/stretchr/objx/-/badge.svg)](https://sourcegraph.com/github.com/stretchr/objx) -[![GoDoc](https://pkg.go.dev/badge/github.com/stretchr/objx?utm_source=godoc)](https://pkg.go.dev/github.com/stretchr/objx) - -Objx - Go package for dealing with maps, slices, JSON and other data. - -Get started: - -- Install Objx with [one line of code](#installation), or [update it with another](#staying-up-to-date) -- Check out the API Documentation http://pkg.go.dev/github.com/stretchr/objx - -## Overview -Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes a powerful `Get` method (among others) that allows you to easily and quickly get access to data within the map, without having to worry too much about type assertions, missing data, default values etc. - -### Pattern -Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy. Call one of the `objx.` functions to create your `objx.Map` to get going: - - m, err := objx.FromJSON(json) - -NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, the rest will be optimistic and try to figure things out without panicking. - -Use `Get` to access the value you're interested in. You can use dot and array -notation too: - - m.Get("places[0].latlng") - -Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type. - - if m.Get("code").IsStr() { // Your code... } - -Or you can just assume the type, and use one of the strong type methods to extract the real value: - - m.Get("code").Int() - -If there's no value there (or if it's the wrong type) then a default value will be returned, or you can be explicit about the default value. - - Get("code").Int(-1) - -If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, manipulating and selecting that data. You can find out more by exploring the index below. - -### Reading data -A simple example of how to use Objx: - - // Use MustFromJSON to make an objx.Map from some JSON - m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) - - // Get the details - name := m.Get("name").Str() - age := m.Get("age").Int() - - // Get their nickname (or use their name if they don't have one) - nickname := m.Get("nickname").Str(name) - -### Ranging -Since `objx.Map` is a `map[string]interface{}` you can treat it as such. For example, to `range` the data, do what you would expect: - - m := objx.MustFromJSON(json) - for key, value := range m { - // Your code... - } - -## Installation -To install Objx, use go get: - - go get github.com/stretchr/objx - -### Staying up to date -To update Objx to the latest version, run: - - go get -u github.com/stretchr/objx - -### Supported go versions -We currently support the three recent major Go versions. - -## Contributing -Please feel free to submit issues, fork the repository and send pull requests! diff --git a/vendor/github.com/stretchr/objx/Taskfile.yml b/vendor/github.com/stretchr/objx/Taskfile.yml deleted file mode 100644 index 8a79e8d6..00000000 --- a/vendor/github.com/stretchr/objx/Taskfile.yml +++ /dev/null @@ -1,27 +0,0 @@ -version: '3' - -tasks: - default: - deps: [test] - - lint: - desc: Checks code style - cmds: - - gofmt -d -s *.go - - go vet ./... - silent: true - - lint-fix: - desc: Fixes code style - cmds: - - gofmt -w -s *.go - - test: - desc: Runs go tests - cmds: - - go test -race ./... - - test-coverage: - desc: Runs go tests and calculates test coverage - cmds: - - go test -race -coverprofile=c.out ./... diff --git a/vendor/github.com/stretchr/objx/accessors.go b/vendor/github.com/stretchr/objx/accessors.go deleted file mode 100644 index 72f1d1c1..00000000 --- a/vendor/github.com/stretchr/objx/accessors.go +++ /dev/null @@ -1,197 +0,0 @@ -package objx - -import ( - "reflect" - "regexp" - "strconv" - "strings" -) - -const ( - // PathSeparator is the character used to separate the elements - // of the keypath. - // - // For example, `location.address.city` - PathSeparator string = "." - - // arrayAccessRegexString is the regex used to extract the array number - // from the access path - arrayAccessRegexString = `^(.+)\[([0-9]+)\]$` - - // mapAccessRegexString is the regex used to extract the map key - // from the access path - mapAccessRegexString = `^([^\[]*)\[([^\]]+)\](.*)$` -) - -// arrayAccessRegex is the compiled arrayAccessRegexString -var arrayAccessRegex = regexp.MustCompile(arrayAccessRegexString) - -// mapAccessRegex is the compiled mapAccessRegexString -var mapAccessRegex = regexp.MustCompile(mapAccessRegexString) - -// Get gets the value using the specified selector and -// returns it inside a new Obj object. -// -// If it cannot find the value, Get will return a nil -// value inside an instance of Obj. -// -// Get can only operate directly on map[string]interface{} and []interface. -// -// # Example -// -// To access the title of the third chapter of the second book, do: -// -// o.Get("books[1].chapters[2].title") -func (m Map) Get(selector string) *Value { - rawObj := access(m, selector, nil, false) - return &Value{data: rawObj} -} - -// Set sets the value using the specified selector and -// returns the object on which Set was called. -// -// Set can only operate directly on map[string]interface{} and []interface -// -// # Example -// -// To set the title of the third chapter of the second book, do: -// -// o.Set("books[1].chapters[2].title","Time to Go") -func (m Map) Set(selector string, value interface{}) Map { - access(m, selector, value, true) - return m -} - -// getIndex returns the index, which is hold in s by two branches. -// It also returns s without the index part, e.g. name[1] will return (1, name). -// If no index is found, -1 is returned -func getIndex(s string) (int, string) { - arrayMatches := arrayAccessRegex.FindStringSubmatch(s) - if len(arrayMatches) > 0 { - // Get the key into the map - selector := arrayMatches[1] - // Get the index into the array at the key - // We know this can't fail because arrayMatches[2] is an int for sure - index, _ := strconv.Atoi(arrayMatches[2]) - return index, selector - } - return -1, s -} - -// getKey returns the key which is held in s by two brackets. -// It also returns the next selector. -func getKey(s string) (string, string) { - selSegs := strings.SplitN(s, PathSeparator, 2) - thisSel := selSegs[0] - nextSel := "" - - if len(selSegs) > 1 { - nextSel = selSegs[1] - } - - mapMatches := mapAccessRegex.FindStringSubmatch(s) - if len(mapMatches) > 0 { - if _, err := strconv.Atoi(mapMatches[2]); err != nil { - thisSel = mapMatches[1] - nextSel = "[" + mapMatches[2] + "]" + mapMatches[3] - - if thisSel == "" { - thisSel = mapMatches[2] - nextSel = mapMatches[3] - } - - if nextSel == "" { - selSegs = []string{"", ""} - } else if nextSel[0] == '.' { - nextSel = nextSel[1:] - } - } - } - - return thisSel, nextSel -} - -// access accesses the object using the selector and performs the -// appropriate action. -func access(current interface{}, selector string, value interface{}, isSet bool) interface{} { - thisSel, nextSel := getKey(selector) - - indexes := []int{} - for strings.Contains(thisSel, "[") { - prevSel := thisSel - index := -1 - index, thisSel = getIndex(thisSel) - indexes = append(indexes, index) - if prevSel == thisSel { - break - } - } - - if curMap, ok := current.(Map); ok { - current = map[string]interface{}(curMap) - } - // get the object in question - switch current.(type) { - case map[string]interface{}: - curMSI := current.(map[string]interface{}) - if nextSel == "" && isSet { - curMSI[thisSel] = value - return nil - } - - _, ok := curMSI[thisSel].(map[string]interface{}) - if !ok { - _, ok = curMSI[thisSel].(Map) - } - - if (curMSI[thisSel] == nil || !ok) && len(indexes) == 0 && isSet { - curMSI[thisSel] = map[string]interface{}{} - } - - current = curMSI[thisSel] - default: - current = nil - } - - // do we need to access the item of an array? - if len(indexes) > 0 { - num := len(indexes) - for num > 0 { - num-- - index := indexes[num] - indexes = indexes[:num] - if array, ok := interSlice(current); ok { - if index < len(array) { - current = array[index] - } else { - current = nil - break - } - } - } - } - - if nextSel != "" { - current = access(current, nextSel, value, isSet) - } - return current -} - -func interSlice(slice interface{}) ([]interface{}, bool) { - if array, ok := slice.([]interface{}); ok { - return array, ok - } - - s := reflect.ValueOf(slice) - if s.Kind() != reflect.Slice { - return nil, false - } - - ret := make([]interface{}, s.Len()) - - for i := 0; i < s.Len(); i++ { - ret[i] = s.Index(i).Interface() - } - - return ret, true -} diff --git a/vendor/github.com/stretchr/objx/conversions.go b/vendor/github.com/stretchr/objx/conversions.go deleted file mode 100644 index 01c63d7d..00000000 --- a/vendor/github.com/stretchr/objx/conversions.go +++ /dev/null @@ -1,280 +0,0 @@ -package objx - -import ( - "bytes" - "encoding/base64" - "encoding/json" - "errors" - "fmt" - "net/url" - "strconv" -) - -// SignatureSeparator is the character that is used to -// separate the Base64 string from the security signature. -const SignatureSeparator = "_" - -// URLValuesSliceKeySuffix is the character that is used to -// specify a suffix for slices parsed by URLValues. -// If the suffix is set to "[i]", then the index of the slice -// is used in place of i -// Ex: Suffix "[]" would have the form a[]=b&a[]=c -// OR Suffix "[i]" would have the form a[0]=b&a[1]=c -// OR Suffix "" would have the form a=b&a=c -var urlValuesSliceKeySuffix = "[]" - -const ( - URLValuesSliceKeySuffixEmpty = "" - URLValuesSliceKeySuffixArray = "[]" - URLValuesSliceKeySuffixIndex = "[i]" -) - -// SetURLValuesSliceKeySuffix sets the character that is used to -// specify a suffix for slices parsed by URLValues. -// If the suffix is set to "[i]", then the index of the slice -// is used in place of i -// Ex: Suffix "[]" would have the form a[]=b&a[]=c -// OR Suffix "[i]" would have the form a[0]=b&a[1]=c -// OR Suffix "" would have the form a=b&a=c -func SetURLValuesSliceKeySuffix(s string) error { - if s == URLValuesSliceKeySuffixEmpty || s == URLValuesSliceKeySuffixArray || s == URLValuesSliceKeySuffixIndex { - urlValuesSliceKeySuffix = s - return nil - } - - return errors.New("objx: Invalid URLValuesSliceKeySuffix provided.") -} - -// JSON converts the contained object to a JSON string -// representation -func (m Map) JSON() (string, error) { - for k, v := range m { - m[k] = cleanUp(v) - } - - result, err := json.Marshal(m) - if err != nil { - err = errors.New("objx: JSON encode failed with: " + err.Error()) - } - return string(result), err -} - -func cleanUpInterfaceArray(in []interface{}) []interface{} { - result := make([]interface{}, len(in)) - for i, v := range in { - result[i] = cleanUp(v) - } - return result -} - -func cleanUpInterfaceMap(in map[interface{}]interface{}) Map { - result := Map{} - for k, v := range in { - result[fmt.Sprintf("%v", k)] = cleanUp(v) - } - return result -} - -func cleanUpStringMap(in map[string]interface{}) Map { - result := Map{} - for k, v := range in { - result[k] = cleanUp(v) - } - return result -} - -func cleanUpMSIArray(in []map[string]interface{}) []Map { - result := make([]Map, len(in)) - for i, v := range in { - result[i] = cleanUpStringMap(v) - } - return result -} - -func cleanUpMapArray(in []Map) []Map { - result := make([]Map, len(in)) - for i, v := range in { - result[i] = cleanUpStringMap(v) - } - return result -} - -func cleanUp(v interface{}) interface{} { - switch v := v.(type) { - case []interface{}: - return cleanUpInterfaceArray(v) - case []map[string]interface{}: - return cleanUpMSIArray(v) - case map[interface{}]interface{}: - return cleanUpInterfaceMap(v) - case Map: - return cleanUpStringMap(v) - case []Map: - return cleanUpMapArray(v) - default: - return v - } -} - -// MustJSON converts the contained object to a JSON string -// representation and panics if there is an error -func (m Map) MustJSON() string { - result, err := m.JSON() - if err != nil { - panic(err.Error()) - } - return result -} - -// Base64 converts the contained object to a Base64 string -// representation of the JSON string representation -func (m Map) Base64() (string, error) { - var buf bytes.Buffer - - jsonData, err := m.JSON() - if err != nil { - return "", err - } - - encoder := base64.NewEncoder(base64.StdEncoding, &buf) - _, _ = encoder.Write([]byte(jsonData)) - _ = encoder.Close() - - return buf.String(), nil -} - -// MustBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and panics -// if there is an error -func (m Map) MustBase64() string { - result, err := m.Base64() - if err != nil { - panic(err.Error()) - } - return result -} - -// SignedBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and signs it -// using the provided key. -func (m Map) SignedBase64(key string) (string, error) { - base64, err := m.Base64() - if err != nil { - return "", err - } - - sig := HashWithKey(base64, key) - return base64 + SignatureSeparator + sig, nil -} - -// MustSignedBase64 converts the contained object to a Base64 string -// representation of the JSON string representation and signs it -// using the provided key and panics if there is an error -func (m Map) MustSignedBase64(key string) string { - result, err := m.SignedBase64(key) - if err != nil { - panic(err.Error()) - } - return result -} - -/* - URL Query - ------------------------------------------------ -*/ - -// URLValues creates a url.Values object from an Obj. This -// function requires that the wrapped object be a map[string]interface{} -func (m Map) URLValues() url.Values { - vals := make(url.Values) - - m.parseURLValues(m, vals, "") - - return vals -} - -func (m Map) parseURLValues(queryMap Map, vals url.Values, key string) { - useSliceIndex := false - if urlValuesSliceKeySuffix == "[i]" { - useSliceIndex = true - } - - for k, v := range queryMap { - val := &Value{data: v} - switch { - case val.IsObjxMap(): - if key == "" { - m.parseURLValues(val.ObjxMap(), vals, k) - } else { - m.parseURLValues(val.ObjxMap(), vals, key+"["+k+"]") - } - case val.IsObjxMapSlice(): - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.MustObjxMapSlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - m.parseURLValues(sv, vals, sk) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - for _, sv := range val.MustObjxMapSlice() { - m.parseURLValues(sv, vals, sliceKey) - } - } - case val.IsMSISlice(): - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.MustMSISlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - m.parseURLValues(New(sv), vals, sk) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - for _, sv := range val.MustMSISlice() { - m.parseURLValues(New(sv), vals, sliceKey) - } - } - case val.IsStrSlice(), val.IsBoolSlice(), - val.IsFloat32Slice(), val.IsFloat64Slice(), - val.IsIntSlice(), val.IsInt8Slice(), val.IsInt16Slice(), val.IsInt32Slice(), val.IsInt64Slice(), - val.IsUintSlice(), val.IsUint8Slice(), val.IsUint16Slice(), val.IsUint32Slice(), val.IsUint64Slice(): - - sliceKey := k - if key != "" { - sliceKey = key + "[" + k + "]" - } - - if useSliceIndex { - for i, sv := range val.StringSlice() { - sk := sliceKey + "[" + strconv.FormatInt(int64(i), 10) + "]" - vals.Set(sk, sv) - } - } else { - sliceKey = sliceKey + urlValuesSliceKeySuffix - vals[sliceKey] = val.StringSlice() - } - - default: - if key == "" { - vals.Set(k, val.String()) - } else { - vals.Set(key+"["+k+"]", val.String()) - } - } - } -} - -// URLQuery gets an encoded URL query representing the given -// Obj. This function requires that the wrapped object be a -// map[string]interface{} -func (m Map) URLQuery() (string, error) { - return m.URLValues().Encode(), nil -} diff --git a/vendor/github.com/stretchr/objx/doc.go b/vendor/github.com/stretchr/objx/doc.go deleted file mode 100644 index b170af74..00000000 --- a/vendor/github.com/stretchr/objx/doc.go +++ /dev/null @@ -1,66 +0,0 @@ -/* -Package objx provides utilities for dealing with maps, slices, JSON and other data. - -# Overview - -Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes -a powerful `Get` method (among others) that allows you to easily and quickly get -access to data within the map, without having to worry too much about type assertions, -missing data, default values etc. - -# Pattern - -Objx uses a predictable pattern to make access data from within `map[string]interface{}` easy. -Call one of the `objx.` functions to create your `objx.Map` to get going: - - m, err := objx.FromJSON(json) - -NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, -the rest will be optimistic and try to figure things out without panicking. - -Use `Get` to access the value you're interested in. You can use dot and array -notation too: - - m.Get("places[0].latlng") - -Once you have sought the `Value` you're interested in, you can use the `Is*` methods to determine its type. - - if m.Get("code").IsStr() { // Your code... } - -Or you can just assume the type, and use one of the strong type methods to extract the real value: - - m.Get("code").Int() - -If there's no value there (or if it's the wrong type) then a default value will be returned, -or you can be explicit about the default value. - - Get("code").Int(-1) - -If you're dealing with a slice of data as a value, Objx provides many useful methods for iterating, -manipulating and selecting that data. You can find out more by exploring the index below. - -# Reading data - -A simple example of how to use Objx: - - // Use MustFromJSON to make an objx.Map from some JSON - m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) - - // Get the details - name := m.Get("name").Str() - age := m.Get("age").Int() - - // Get their nickname (or use their name if they don't have one) - nickname := m.Get("nickname").Str(name) - -# Ranging - -Since `objx.Map` is a `map[string]interface{}` you can treat it as such. -For example, to `range` the data, do what you would expect: - - m := objx.MustFromJSON(json) - for key, value := range m { - // Your code... - } -*/ -package objx diff --git a/vendor/github.com/stretchr/objx/map.go b/vendor/github.com/stretchr/objx/map.go deleted file mode 100644 index ab9f9ae6..00000000 --- a/vendor/github.com/stretchr/objx/map.go +++ /dev/null @@ -1,214 +0,0 @@ -package objx - -import ( - "encoding/base64" - "encoding/json" - "errors" - "io/ioutil" - "net/url" - "strings" -) - -// MSIConvertable is an interface that defines methods for converting your -// custom types to a map[string]interface{} representation. -type MSIConvertable interface { - // MSI gets a map[string]interface{} (msi) representing the - // object. - MSI() map[string]interface{} -} - -// Map provides extended functionality for working with -// untyped data, in particular map[string]interface (msi). -type Map map[string]interface{} - -// Value returns the internal value instance -func (m Map) Value() *Value { - return &Value{data: m} -} - -// Nil represents a nil Map. -var Nil = New(nil) - -// New creates a new Map containing the map[string]interface{} in the data argument. -// If the data argument is not a map[string]interface, New attempts to call the -// MSI() method on the MSIConvertable interface to create one. -func New(data interface{}) Map { - if _, ok := data.(map[string]interface{}); !ok { - if converter, ok := data.(MSIConvertable); ok { - data = converter.MSI() - } else { - return nil - } - } - return Map(data.(map[string]interface{})) -} - -// MSI creates a map[string]interface{} and puts it inside a new Map. -// -// The arguments follow a key, value pattern. -// -// Returns nil if any key argument is non-string or if there are an odd number of arguments. -// -// # Example -// -// To easily create Maps: -// -// m := objx.MSI("name", "Mat", "age", 29, "subobj", objx.MSI("active", true)) -// -// // creates an Map equivalent to -// m := objx.Map{"name": "Mat", "age": 29, "subobj": objx.Map{"active": true}} -func MSI(keyAndValuePairs ...interface{}) Map { - newMap := Map{} - keyAndValuePairsLen := len(keyAndValuePairs) - if keyAndValuePairsLen%2 != 0 { - return nil - } - for i := 0; i < keyAndValuePairsLen; i = i + 2 { - key := keyAndValuePairs[i] - value := keyAndValuePairs[i+1] - - // make sure the key is a string - keyString, keyStringOK := key.(string) - if !keyStringOK { - return nil - } - newMap[keyString] = value - } - return newMap -} - -// ****** Conversion Constructors - -// MustFromJSON creates a new Map containing the data specified in the -// jsonString. -// -// Panics if the JSON is invalid. -func MustFromJSON(jsonString string) Map { - o, err := FromJSON(jsonString) - if err != nil { - panic("objx: MustFromJSON failed with error: " + err.Error()) - } - return o -} - -// MustFromJSONSlice creates a new slice of Map containing the data specified in the -// jsonString. Works with jsons with a top level array -// -// Panics if the JSON is invalid. -func MustFromJSONSlice(jsonString string) []Map { - slice, err := FromJSONSlice(jsonString) - if err != nil { - panic("objx: MustFromJSONSlice failed with error: " + err.Error()) - } - return slice -} - -// FromJSON creates a new Map containing the data specified in the -// jsonString. -// -// Returns an error if the JSON is invalid. -func FromJSON(jsonString string) (Map, error) { - var m Map - err := json.Unmarshal([]byte(jsonString), &m) - if err != nil { - return Nil, err - } - return m, nil -} - -// FromJSONSlice creates a new slice of Map containing the data specified in the -// jsonString. Works with jsons with a top level array -// -// Returns an error if the JSON is invalid. -func FromJSONSlice(jsonString string) ([]Map, error) { - var slice []Map - err := json.Unmarshal([]byte(jsonString), &slice) - if err != nil { - return nil, err - } - return slice, nil -} - -// FromBase64 creates a new Obj containing the data specified -// in the Base64 string. -// -// The string is an encoded JSON string returned by Base64 -func FromBase64(base64String string) (Map, error) { - decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(base64String)) - decoded, err := ioutil.ReadAll(decoder) - if err != nil { - return nil, err - } - return FromJSON(string(decoded)) -} - -// MustFromBase64 creates a new Obj containing the data specified -// in the Base64 string and panics if there is an error. -// -// The string is an encoded JSON string returned by Base64 -func MustFromBase64(base64String string) Map { - result, err := FromBase64(base64String) - if err != nil { - panic("objx: MustFromBase64 failed with error: " + err.Error()) - } - return result -} - -// FromSignedBase64 creates a new Obj containing the data specified -// in the Base64 string. -// -// The string is an encoded JSON string returned by SignedBase64 -func FromSignedBase64(base64String, key string) (Map, error) { - parts := strings.Split(base64String, SignatureSeparator) - if len(parts) != 2 { - return nil, errors.New("objx: Signed base64 string is malformed") - } - - sig := HashWithKey(parts[0], key) - if parts[1] != sig { - return nil, errors.New("objx: Signature for base64 data does not match") - } - return FromBase64(parts[0]) -} - -// MustFromSignedBase64 creates a new Obj containing the data specified -// in the Base64 string and panics if there is an error. -// -// The string is an encoded JSON string returned by Base64 -func MustFromSignedBase64(base64String, key string) Map { - result, err := FromSignedBase64(base64String, key) - if err != nil { - panic("objx: MustFromSignedBase64 failed with error: " + err.Error()) - } - return result -} - -// FromURLQuery generates a new Obj by parsing the specified -// query. -// -// For queries with multiple values, the first value is selected. -func FromURLQuery(query string) (Map, error) { - vals, err := url.ParseQuery(query) - if err != nil { - return nil, err - } - m := Map{} - for k, vals := range vals { - m[k] = vals[0] - } - return m, nil -} - -// MustFromURLQuery generates a new Obj by parsing the specified -// query. -// -// For queries with multiple values, the first value is selected. -// -// Panics if it encounters an error -func MustFromURLQuery(query string) Map { - o, err := FromURLQuery(query) - if err != nil { - panic("objx: MustFromURLQuery failed with error: " + err.Error()) - } - return o -} diff --git a/vendor/github.com/stretchr/objx/mutations.go b/vendor/github.com/stretchr/objx/mutations.go deleted file mode 100644 index c3400a3f..00000000 --- a/vendor/github.com/stretchr/objx/mutations.go +++ /dev/null @@ -1,77 +0,0 @@ -package objx - -// Exclude returns a new Map with the keys in the specified []string -// excluded. -func (m Map) Exclude(exclude []string) Map { - excluded := make(Map) - for k, v := range m { - if !contains(exclude, k) { - excluded[k] = v - } - } - return excluded -} - -// Copy creates a shallow copy of the Obj. -func (m Map) Copy() Map { - copied := Map{} - for k, v := range m { - copied[k] = v - } - return copied -} - -// Merge blends the specified map with a copy of this map and returns the result. -// -// Keys that appear in both will be selected from the specified map. -// This method requires that the wrapped object be a map[string]interface{} -func (m Map) Merge(merge Map) Map { - return m.Copy().MergeHere(merge) -} - -// MergeHere blends the specified map with this map and returns the current map. -// -// Keys that appear in both will be selected from the specified map. The original map -// will be modified. This method requires that -// the wrapped object be a map[string]interface{} -func (m Map) MergeHere(merge Map) Map { - for k, v := range merge { - m[k] = v - } - return m -} - -// Transform builds a new Obj giving the transformer a chance -// to change the keys and values as it goes. This method requires that -// the wrapped object be a map[string]interface{} -func (m Map) Transform(transformer func(key string, value interface{}) (string, interface{})) Map { - newMap := Map{} - for k, v := range m { - modifiedKey, modifiedVal := transformer(k, v) - newMap[modifiedKey] = modifiedVal - } - return newMap -} - -// TransformKeys builds a new map using the specified key mapping. -// -// Unspecified keys will be unaltered. -// This method requires that the wrapped object be a map[string]interface{} -func (m Map) TransformKeys(mapping map[string]string) Map { - return m.Transform(func(key string, value interface{}) (string, interface{}) { - if newKey, ok := mapping[key]; ok { - return newKey, value - } - return key, value - }) -} - -// Checks if a string slice contains a string -func contains(s []string, e string) bool { - for _, a := range s { - if a == e { - return true - } - } - return false -} diff --git a/vendor/github.com/stretchr/objx/security.go b/vendor/github.com/stretchr/objx/security.go deleted file mode 100644 index 692be8e2..00000000 --- a/vendor/github.com/stretchr/objx/security.go +++ /dev/null @@ -1,12 +0,0 @@ -package objx - -import ( - "crypto/sha1" - "encoding/hex" -) - -// HashWithKey hashes the specified string using the security key -func HashWithKey(data, key string) string { - d := sha1.Sum([]byte(data + ":" + key)) - return hex.EncodeToString(d[:]) -} diff --git a/vendor/github.com/stretchr/objx/tests.go b/vendor/github.com/stretchr/objx/tests.go deleted file mode 100644 index d9e0b479..00000000 --- a/vendor/github.com/stretchr/objx/tests.go +++ /dev/null @@ -1,17 +0,0 @@ -package objx - -// Has gets whether there is something at the specified selector -// or not. -// -// If m is nil, Has will always return false. -func (m Map) Has(selector string) bool { - if m == nil { - return false - } - return !m.Get(selector).IsNil() -} - -// IsNil gets whether the data is nil or not. -func (v *Value) IsNil() bool { - return v == nil || v.data == nil -} diff --git a/vendor/github.com/stretchr/objx/type_specific.go b/vendor/github.com/stretchr/objx/type_specific.go deleted file mode 100644 index 80f88d9f..00000000 --- a/vendor/github.com/stretchr/objx/type_specific.go +++ /dev/null @@ -1,346 +0,0 @@ -package objx - -/* - MSI (map[string]interface{} and []map[string]interface{}) -*/ - -// MSI gets the value as a map[string]interface{}, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} { - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - if s, ok := v.data.(Map); ok { - return map[string]interface{}(s) - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustMSI gets the value as a map[string]interface{}. -// -// Panics if the object is not a map[string]interface{}. -func (v *Value) MustMSI() map[string]interface{} { - if s, ok := v.data.(Map); ok { - return map[string]interface{}(s) - } - return v.data.(map[string]interface{}) -} - -// MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault -// value or nil if the value is not a []map[string]interface{}. -func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} { - if s, ok := v.data.([]map[string]interface{}); ok { - return s - } - - s := v.ObjxMapSlice() - if s == nil { - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil - } - - result := make([]map[string]interface{}, len(s)) - for i := range s { - result[i] = s[i].Value().MSI() - } - return result -} - -// MustMSISlice gets the value as a []map[string]interface{}. -// -// Panics if the object is not a []map[string]interface{}. -func (v *Value) MustMSISlice() []map[string]interface{} { - if s := v.MSISlice(); s != nil { - return s - } - - return v.data.([]map[string]interface{}) -} - -// IsMSI gets whether the object contained is a map[string]interface{} or not. -func (v *Value) IsMSI() bool { - _, ok := v.data.(map[string]interface{}) - if !ok { - _, ok = v.data.(Map) - } - return ok -} - -// IsMSISlice gets whether the object contained is a []map[string]interface{} or not. -func (v *Value) IsMSISlice() bool { - _, ok := v.data.([]map[string]interface{}) - if !ok { - _, ok = v.data.([]Map) - if !ok { - s, ok := v.data.([]interface{}) - if ok { - for i := range s { - switch s[i].(type) { - case Map: - case map[string]interface{}: - default: - return false - } - } - return true - } - } - } - return ok -} - -// EachMSI calls the specified callback for each object -// in the []map[string]interface{}. -// -// Panics if the object is the wrong type. -func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value { - for index, val := range v.MustMSISlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereMSI uses the specified decider function to select items -// from the []map[string]interface{}. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value { - var selected []map[string]interface{} - v.EachMSI(func(index int, val map[string]interface{}) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupMSI uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]map[string]interface{}. -func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value { - groups := make(map[string][]map[string]interface{}) - v.EachMSI(func(index int, val map[string]interface{}) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]map[string]interface{}, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceMSI uses the specified function to replace each map[string]interface{}s -// by iterating each item. The data in the returned result will be a -// []map[string]interface{} containing the replaced items. -func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value { - arr := v.MustMSISlice() - replaced := make([]map[string]interface{}, len(arr)) - v.EachMSI(func(index int, val map[string]interface{}) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectMSI uses the specified collector function to collect a value -// for each of the map[string]interface{}s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value { - arr := v.MustMSISlice() - collected := make([]interface{}, len(arr)) - v.EachMSI(func(index int, val map[string]interface{}) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - ObjxMap ((Map) and [](Map)) -*/ - -// ObjxMap gets the value as a (Map), returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) ObjxMap(optionalDefault ...(Map)) Map { - if s, ok := v.data.((Map)); ok { - return s - } - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return New(nil) -} - -// MustObjxMap gets the value as a (Map). -// -// Panics if the object is not a (Map). -func (v *Value) MustObjxMap() Map { - if s, ok := v.data.(map[string]interface{}); ok { - return s - } - return v.data.((Map)) -} - -// ObjxMapSlice gets the value as a [](Map), returns the optionalDefault -// value or nil if the value is not a [](Map). -func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) { - if s, ok := v.data.([]Map); ok { - return s - } - - if s, ok := v.data.([]map[string]interface{}); ok { - result := make([]Map, len(s)) - for i := range s { - result[i] = s[i] - } - return result - } - - s, ok := v.data.([]interface{}) - if !ok { - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil - } - - result := make([]Map, len(s)) - for i := range s { - switch s[i].(type) { - case Map: - result[i] = s[i].(Map) - case map[string]interface{}: - result[i] = New(s[i]) - default: - return nil - } - } - return result -} - -// MustObjxMapSlice gets the value as a [](Map). -// -// Panics if the object is not a [](Map). -func (v *Value) MustObjxMapSlice() [](Map) { - if s := v.ObjxMapSlice(); s != nil { - return s - } - return v.data.([](Map)) -} - -// IsObjxMap gets whether the object contained is a (Map) or not. -func (v *Value) IsObjxMap() bool { - _, ok := v.data.((Map)) - if !ok { - _, ok = v.data.(map[string]interface{}) - } - return ok -} - -// IsObjxMapSlice gets whether the object contained is a [](Map) or not. -func (v *Value) IsObjxMapSlice() bool { - _, ok := v.data.([](Map)) - if !ok { - _, ok = v.data.([]map[string]interface{}) - if !ok { - s, ok := v.data.([]interface{}) - if ok { - for i := range s { - switch s[i].(type) { - case Map: - case map[string]interface{}: - default: - return false - } - } - return true - } - } - } - - return ok -} - -// EachObjxMap calls the specified callback for each object -// in the [](Map). -// -// Panics if the object is the wrong type. -func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value { - for index, val := range v.MustObjxMapSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereObjxMap uses the specified decider function to select items -// from the [](Map). The object contained in the result will contain -// only the selected items. -func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value { - var selected [](Map) - v.EachObjxMap(func(index int, val Map) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupObjxMap uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][](Map). -func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value { - groups := make(map[string][](Map)) - v.EachObjxMap(func(index int, val Map) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([](Map), 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceObjxMap uses the specified function to replace each (Map)s -// by iterating each item. The data in the returned result will be a -// [](Map) containing the replaced items. -func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value { - arr := v.MustObjxMapSlice() - replaced := make([](Map), len(arr)) - v.EachObjxMap(func(index int, val Map) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectObjxMap uses the specified collector function to collect a value -// for each of the (Map)s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value { - arr := v.MustObjxMapSlice() - collected := make([]interface{}, len(arr)) - v.EachObjxMap(func(index int, val Map) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} diff --git a/vendor/github.com/stretchr/objx/type_specific_codegen.go b/vendor/github.com/stretchr/objx/type_specific_codegen.go deleted file mode 100644 index 45850456..00000000 --- a/vendor/github.com/stretchr/objx/type_specific_codegen.go +++ /dev/null @@ -1,2261 +0,0 @@ -package objx - -/* - Inter (interface{} and []interface{}) -*/ - -// Inter gets the value as a interface{}, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Inter(optionalDefault ...interface{}) interface{} { - if s, ok := v.data.(interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInter gets the value as a interface{}. -// -// Panics if the object is not a interface{}. -func (v *Value) MustInter() interface{} { - return v.data.(interface{}) -} - -// InterSlice gets the value as a []interface{}, returns the optionalDefault -// value or nil if the value is not a []interface{}. -func (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface{} { - if s, ok := v.data.([]interface{}); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInterSlice gets the value as a []interface{}. -// -// Panics if the object is not a []interface{}. -func (v *Value) MustInterSlice() []interface{} { - return v.data.([]interface{}) -} - -// IsInter gets whether the object contained is a interface{} or not. -func (v *Value) IsInter() bool { - _, ok := v.data.(interface{}) - return ok -} - -// IsInterSlice gets whether the object contained is a []interface{} or not. -func (v *Value) IsInterSlice() bool { - _, ok := v.data.([]interface{}) - return ok -} - -// EachInter calls the specified callback for each object -// in the []interface{}. -// -// Panics if the object is the wrong type. -func (v *Value) EachInter(callback func(int, interface{}) bool) *Value { - for index, val := range v.MustInterSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInter uses the specified decider function to select items -// from the []interface{}. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInter(decider func(int, interface{}) bool) *Value { - var selected []interface{} - v.EachInter(func(index int, val interface{}) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInter uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]interface{}. -func (v *Value) GroupInter(grouper func(int, interface{}) string) *Value { - groups := make(map[string][]interface{}) - v.EachInter(func(index int, val interface{}) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]interface{}, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInter uses the specified function to replace each interface{}s -// by iterating each item. The data in the returned result will be a -// []interface{} containing the replaced items. -func (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}) *Value { - arr := v.MustInterSlice() - replaced := make([]interface{}, len(arr)) - v.EachInter(func(index int, val interface{}) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInter uses the specified collector function to collect a value -// for each of the interface{}s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Value { - arr := v.MustInterSlice() - collected := make([]interface{}, len(arr)) - v.EachInter(func(index int, val interface{}) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Bool (bool and []bool) -*/ - -// Bool gets the value as a bool, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Bool(optionalDefault ...bool) bool { - if s, ok := v.data.(bool); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return false -} - -// MustBool gets the value as a bool. -// -// Panics if the object is not a bool. -func (v *Value) MustBool() bool { - return v.data.(bool) -} - -// BoolSlice gets the value as a []bool, returns the optionalDefault -// value or nil if the value is not a []bool. -func (v *Value) BoolSlice(optionalDefault ...[]bool) []bool { - if s, ok := v.data.([]bool); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustBoolSlice gets the value as a []bool. -// -// Panics if the object is not a []bool. -func (v *Value) MustBoolSlice() []bool { - return v.data.([]bool) -} - -// IsBool gets whether the object contained is a bool or not. -func (v *Value) IsBool() bool { - _, ok := v.data.(bool) - return ok -} - -// IsBoolSlice gets whether the object contained is a []bool or not. -func (v *Value) IsBoolSlice() bool { - _, ok := v.data.([]bool) - return ok -} - -// EachBool calls the specified callback for each object -// in the []bool. -// -// Panics if the object is the wrong type. -func (v *Value) EachBool(callback func(int, bool) bool) *Value { - for index, val := range v.MustBoolSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereBool uses the specified decider function to select items -// from the []bool. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereBool(decider func(int, bool) bool) *Value { - var selected []bool - v.EachBool(func(index int, val bool) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupBool uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]bool. -func (v *Value) GroupBool(grouper func(int, bool) string) *Value { - groups := make(map[string][]bool) - v.EachBool(func(index int, val bool) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]bool, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceBool uses the specified function to replace each bools -// by iterating each item. The data in the returned result will be a -// []bool containing the replaced items. -func (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value { - arr := v.MustBoolSlice() - replaced := make([]bool, len(arr)) - v.EachBool(func(index int, val bool) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectBool uses the specified collector function to collect a value -// for each of the bools in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value { - arr := v.MustBoolSlice() - collected := make([]interface{}, len(arr)) - v.EachBool(func(index int, val bool) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Str (string and []string) -*/ - -// Str gets the value as a string, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Str(optionalDefault ...string) string { - if s, ok := v.data.(string); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return "" -} - -// MustStr gets the value as a string. -// -// Panics if the object is not a string. -func (v *Value) MustStr() string { - return v.data.(string) -} - -// StrSlice gets the value as a []string, returns the optionalDefault -// value or nil if the value is not a []string. -func (v *Value) StrSlice(optionalDefault ...[]string) []string { - if s, ok := v.data.([]string); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustStrSlice gets the value as a []string. -// -// Panics if the object is not a []string. -func (v *Value) MustStrSlice() []string { - return v.data.([]string) -} - -// IsStr gets whether the object contained is a string or not. -func (v *Value) IsStr() bool { - _, ok := v.data.(string) - return ok -} - -// IsStrSlice gets whether the object contained is a []string or not. -func (v *Value) IsStrSlice() bool { - _, ok := v.data.([]string) - return ok -} - -// EachStr calls the specified callback for each object -// in the []string. -// -// Panics if the object is the wrong type. -func (v *Value) EachStr(callback func(int, string) bool) *Value { - for index, val := range v.MustStrSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereStr uses the specified decider function to select items -// from the []string. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereStr(decider func(int, string) bool) *Value { - var selected []string - v.EachStr(func(index int, val string) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupStr uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]string. -func (v *Value) GroupStr(grouper func(int, string) string) *Value { - groups := make(map[string][]string) - v.EachStr(func(index int, val string) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]string, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceStr uses the specified function to replace each strings -// by iterating each item. The data in the returned result will be a -// []string containing the replaced items. -func (v *Value) ReplaceStr(replacer func(int, string) string) *Value { - arr := v.MustStrSlice() - replaced := make([]string, len(arr)) - v.EachStr(func(index int, val string) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectStr uses the specified collector function to collect a value -// for each of the strings in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectStr(collector func(int, string) interface{}) *Value { - arr := v.MustStrSlice() - collected := make([]interface{}, len(arr)) - v.EachStr(func(index int, val string) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int (int and []int) -*/ - -// Int gets the value as a int, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int(optionalDefault ...int) int { - if s, ok := v.data.(int); ok { - return s - } - if s, ok := v.data.(float64); ok { - if float64(int(s)) == s { - return int(s) - } - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt gets the value as a int. -// -// Panics if the object is not a int. -func (v *Value) MustInt() int { - if s, ok := v.data.(float64); ok { - if float64(int(s)) == s { - return int(s) - } - } - return v.data.(int) -} - -// IntSlice gets the value as a []int, returns the optionalDefault -// value or nil if the value is not a []int. -func (v *Value) IntSlice(optionalDefault ...[]int) []int { - if s, ok := v.data.([]int); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustIntSlice gets the value as a []int. -// -// Panics if the object is not a []int. -func (v *Value) MustIntSlice() []int { - return v.data.([]int) -} - -// IsInt gets whether the object contained is a int or not. -func (v *Value) IsInt() bool { - _, ok := v.data.(int) - return ok -} - -// IsIntSlice gets whether the object contained is a []int or not. -func (v *Value) IsIntSlice() bool { - _, ok := v.data.([]int) - return ok -} - -// EachInt calls the specified callback for each object -// in the []int. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt(callback func(int, int) bool) *Value { - for index, val := range v.MustIntSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt uses the specified decider function to select items -// from the []int. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt(decider func(int, int) bool) *Value { - var selected []int - v.EachInt(func(index int, val int) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int. -func (v *Value) GroupInt(grouper func(int, int) string) *Value { - groups := make(map[string][]int) - v.EachInt(func(index int, val int) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt uses the specified function to replace each ints -// by iterating each item. The data in the returned result will be a -// []int containing the replaced items. -func (v *Value) ReplaceInt(replacer func(int, int) int) *Value { - arr := v.MustIntSlice() - replaced := make([]int, len(arr)) - v.EachInt(func(index int, val int) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt uses the specified collector function to collect a value -// for each of the ints in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt(collector func(int, int) interface{}) *Value { - arr := v.MustIntSlice() - collected := make([]interface{}, len(arr)) - v.EachInt(func(index int, val int) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int8 (int8 and []int8) -*/ - -// Int8 gets the value as a int8, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int8(optionalDefault ...int8) int8 { - if s, ok := v.data.(int8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt8 gets the value as a int8. -// -// Panics if the object is not a int8. -func (v *Value) MustInt8() int8 { - return v.data.(int8) -} - -// Int8Slice gets the value as a []int8, returns the optionalDefault -// value or nil if the value is not a []int8. -func (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 { - if s, ok := v.data.([]int8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt8Slice gets the value as a []int8. -// -// Panics if the object is not a []int8. -func (v *Value) MustInt8Slice() []int8 { - return v.data.([]int8) -} - -// IsInt8 gets whether the object contained is a int8 or not. -func (v *Value) IsInt8() bool { - _, ok := v.data.(int8) - return ok -} - -// IsInt8Slice gets whether the object contained is a []int8 or not. -func (v *Value) IsInt8Slice() bool { - _, ok := v.data.([]int8) - return ok -} - -// EachInt8 calls the specified callback for each object -// in the []int8. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt8(callback func(int, int8) bool) *Value { - for index, val := range v.MustInt8Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt8 uses the specified decider function to select items -// from the []int8. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt8(decider func(int, int8) bool) *Value { - var selected []int8 - v.EachInt8(func(index int, val int8) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt8 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int8. -func (v *Value) GroupInt8(grouper func(int, int8) string) *Value { - groups := make(map[string][]int8) - v.EachInt8(func(index int, val int8) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int8, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt8 uses the specified function to replace each int8s -// by iterating each item. The data in the returned result will be a -// []int8 containing the replaced items. -func (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value { - arr := v.MustInt8Slice() - replaced := make([]int8, len(arr)) - v.EachInt8(func(index int, val int8) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt8 uses the specified collector function to collect a value -// for each of the int8s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value { - arr := v.MustInt8Slice() - collected := make([]interface{}, len(arr)) - v.EachInt8(func(index int, val int8) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int16 (int16 and []int16) -*/ - -// Int16 gets the value as a int16, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int16(optionalDefault ...int16) int16 { - if s, ok := v.data.(int16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt16 gets the value as a int16. -// -// Panics if the object is not a int16. -func (v *Value) MustInt16() int16 { - return v.data.(int16) -} - -// Int16Slice gets the value as a []int16, returns the optionalDefault -// value or nil if the value is not a []int16. -func (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 { - if s, ok := v.data.([]int16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt16Slice gets the value as a []int16. -// -// Panics if the object is not a []int16. -func (v *Value) MustInt16Slice() []int16 { - return v.data.([]int16) -} - -// IsInt16 gets whether the object contained is a int16 or not. -func (v *Value) IsInt16() bool { - _, ok := v.data.(int16) - return ok -} - -// IsInt16Slice gets whether the object contained is a []int16 or not. -func (v *Value) IsInt16Slice() bool { - _, ok := v.data.([]int16) - return ok -} - -// EachInt16 calls the specified callback for each object -// in the []int16. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt16(callback func(int, int16) bool) *Value { - for index, val := range v.MustInt16Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt16 uses the specified decider function to select items -// from the []int16. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt16(decider func(int, int16) bool) *Value { - var selected []int16 - v.EachInt16(func(index int, val int16) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt16 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int16. -func (v *Value) GroupInt16(grouper func(int, int16) string) *Value { - groups := make(map[string][]int16) - v.EachInt16(func(index int, val int16) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int16, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt16 uses the specified function to replace each int16s -// by iterating each item. The data in the returned result will be a -// []int16 containing the replaced items. -func (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value { - arr := v.MustInt16Slice() - replaced := make([]int16, len(arr)) - v.EachInt16(func(index int, val int16) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt16 uses the specified collector function to collect a value -// for each of the int16s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value { - arr := v.MustInt16Slice() - collected := make([]interface{}, len(arr)) - v.EachInt16(func(index int, val int16) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int32 (int32 and []int32) -*/ - -// Int32 gets the value as a int32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int32(optionalDefault ...int32) int32 { - if s, ok := v.data.(int32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt32 gets the value as a int32. -// -// Panics if the object is not a int32. -func (v *Value) MustInt32() int32 { - return v.data.(int32) -} - -// Int32Slice gets the value as a []int32, returns the optionalDefault -// value or nil if the value is not a []int32. -func (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 { - if s, ok := v.data.([]int32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt32Slice gets the value as a []int32. -// -// Panics if the object is not a []int32. -func (v *Value) MustInt32Slice() []int32 { - return v.data.([]int32) -} - -// IsInt32 gets whether the object contained is a int32 or not. -func (v *Value) IsInt32() bool { - _, ok := v.data.(int32) - return ok -} - -// IsInt32Slice gets whether the object contained is a []int32 or not. -func (v *Value) IsInt32Slice() bool { - _, ok := v.data.([]int32) - return ok -} - -// EachInt32 calls the specified callback for each object -// in the []int32. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt32(callback func(int, int32) bool) *Value { - for index, val := range v.MustInt32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt32 uses the specified decider function to select items -// from the []int32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt32(decider func(int, int32) bool) *Value { - var selected []int32 - v.EachInt32(func(index int, val int32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int32. -func (v *Value) GroupInt32(grouper func(int, int32) string) *Value { - groups := make(map[string][]int32) - v.EachInt32(func(index int, val int32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt32 uses the specified function to replace each int32s -// by iterating each item. The data in the returned result will be a -// []int32 containing the replaced items. -func (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value { - arr := v.MustInt32Slice() - replaced := make([]int32, len(arr)) - v.EachInt32(func(index int, val int32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt32 uses the specified collector function to collect a value -// for each of the int32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value { - arr := v.MustInt32Slice() - collected := make([]interface{}, len(arr)) - v.EachInt32(func(index int, val int32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Int64 (int64 and []int64) -*/ - -// Int64 gets the value as a int64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Int64(optionalDefault ...int64) int64 { - if s, ok := v.data.(int64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustInt64 gets the value as a int64. -// -// Panics if the object is not a int64. -func (v *Value) MustInt64() int64 { - return v.data.(int64) -} - -// Int64Slice gets the value as a []int64, returns the optionalDefault -// value or nil if the value is not a []int64. -func (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 { - if s, ok := v.data.([]int64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustInt64Slice gets the value as a []int64. -// -// Panics if the object is not a []int64. -func (v *Value) MustInt64Slice() []int64 { - return v.data.([]int64) -} - -// IsInt64 gets whether the object contained is a int64 or not. -func (v *Value) IsInt64() bool { - _, ok := v.data.(int64) - return ok -} - -// IsInt64Slice gets whether the object contained is a []int64 or not. -func (v *Value) IsInt64Slice() bool { - _, ok := v.data.([]int64) - return ok -} - -// EachInt64 calls the specified callback for each object -// in the []int64. -// -// Panics if the object is the wrong type. -func (v *Value) EachInt64(callback func(int, int64) bool) *Value { - for index, val := range v.MustInt64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereInt64 uses the specified decider function to select items -// from the []int64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereInt64(decider func(int, int64) bool) *Value { - var selected []int64 - v.EachInt64(func(index int, val int64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupInt64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]int64. -func (v *Value) GroupInt64(grouper func(int, int64) string) *Value { - groups := make(map[string][]int64) - v.EachInt64(func(index int, val int64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]int64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceInt64 uses the specified function to replace each int64s -// by iterating each item. The data in the returned result will be a -// []int64 containing the replaced items. -func (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value { - arr := v.MustInt64Slice() - replaced := make([]int64, len(arr)) - v.EachInt64(func(index int, val int64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectInt64 uses the specified collector function to collect a value -// for each of the int64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value { - arr := v.MustInt64Slice() - collected := make([]interface{}, len(arr)) - v.EachInt64(func(index int, val int64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint (uint and []uint) -*/ - -// Uint gets the value as a uint, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint(optionalDefault ...uint) uint { - if s, ok := v.data.(uint); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint gets the value as a uint. -// -// Panics if the object is not a uint. -func (v *Value) MustUint() uint { - return v.data.(uint) -} - -// UintSlice gets the value as a []uint, returns the optionalDefault -// value or nil if the value is not a []uint. -func (v *Value) UintSlice(optionalDefault ...[]uint) []uint { - if s, ok := v.data.([]uint); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUintSlice gets the value as a []uint. -// -// Panics if the object is not a []uint. -func (v *Value) MustUintSlice() []uint { - return v.data.([]uint) -} - -// IsUint gets whether the object contained is a uint or not. -func (v *Value) IsUint() bool { - _, ok := v.data.(uint) - return ok -} - -// IsUintSlice gets whether the object contained is a []uint or not. -func (v *Value) IsUintSlice() bool { - _, ok := v.data.([]uint) - return ok -} - -// EachUint calls the specified callback for each object -// in the []uint. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint(callback func(int, uint) bool) *Value { - for index, val := range v.MustUintSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint uses the specified decider function to select items -// from the []uint. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint(decider func(int, uint) bool) *Value { - var selected []uint - v.EachUint(func(index int, val uint) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint. -func (v *Value) GroupUint(grouper func(int, uint) string) *Value { - groups := make(map[string][]uint) - v.EachUint(func(index int, val uint) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint uses the specified function to replace each uints -// by iterating each item. The data in the returned result will be a -// []uint containing the replaced items. -func (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value { - arr := v.MustUintSlice() - replaced := make([]uint, len(arr)) - v.EachUint(func(index int, val uint) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint uses the specified collector function to collect a value -// for each of the uints in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value { - arr := v.MustUintSlice() - collected := make([]interface{}, len(arr)) - v.EachUint(func(index int, val uint) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint8 (uint8 and []uint8) -*/ - -// Uint8 gets the value as a uint8, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint8(optionalDefault ...uint8) uint8 { - if s, ok := v.data.(uint8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint8 gets the value as a uint8. -// -// Panics if the object is not a uint8. -func (v *Value) MustUint8() uint8 { - return v.data.(uint8) -} - -// Uint8Slice gets the value as a []uint8, returns the optionalDefault -// value or nil if the value is not a []uint8. -func (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 { - if s, ok := v.data.([]uint8); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint8Slice gets the value as a []uint8. -// -// Panics if the object is not a []uint8. -func (v *Value) MustUint8Slice() []uint8 { - return v.data.([]uint8) -} - -// IsUint8 gets whether the object contained is a uint8 or not. -func (v *Value) IsUint8() bool { - _, ok := v.data.(uint8) - return ok -} - -// IsUint8Slice gets whether the object contained is a []uint8 or not. -func (v *Value) IsUint8Slice() bool { - _, ok := v.data.([]uint8) - return ok -} - -// EachUint8 calls the specified callback for each object -// in the []uint8. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint8(callback func(int, uint8) bool) *Value { - for index, val := range v.MustUint8Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint8 uses the specified decider function to select items -// from the []uint8. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint8(decider func(int, uint8) bool) *Value { - var selected []uint8 - v.EachUint8(func(index int, val uint8) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint8 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint8. -func (v *Value) GroupUint8(grouper func(int, uint8) string) *Value { - groups := make(map[string][]uint8) - v.EachUint8(func(index int, val uint8) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint8, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint8 uses the specified function to replace each uint8s -// by iterating each item. The data in the returned result will be a -// []uint8 containing the replaced items. -func (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value { - arr := v.MustUint8Slice() - replaced := make([]uint8, len(arr)) - v.EachUint8(func(index int, val uint8) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint8 uses the specified collector function to collect a value -// for each of the uint8s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value { - arr := v.MustUint8Slice() - collected := make([]interface{}, len(arr)) - v.EachUint8(func(index int, val uint8) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint16 (uint16 and []uint16) -*/ - -// Uint16 gets the value as a uint16, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint16(optionalDefault ...uint16) uint16 { - if s, ok := v.data.(uint16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint16 gets the value as a uint16. -// -// Panics if the object is not a uint16. -func (v *Value) MustUint16() uint16 { - return v.data.(uint16) -} - -// Uint16Slice gets the value as a []uint16, returns the optionalDefault -// value or nil if the value is not a []uint16. -func (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 { - if s, ok := v.data.([]uint16); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint16Slice gets the value as a []uint16. -// -// Panics if the object is not a []uint16. -func (v *Value) MustUint16Slice() []uint16 { - return v.data.([]uint16) -} - -// IsUint16 gets whether the object contained is a uint16 or not. -func (v *Value) IsUint16() bool { - _, ok := v.data.(uint16) - return ok -} - -// IsUint16Slice gets whether the object contained is a []uint16 or not. -func (v *Value) IsUint16Slice() bool { - _, ok := v.data.([]uint16) - return ok -} - -// EachUint16 calls the specified callback for each object -// in the []uint16. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint16(callback func(int, uint16) bool) *Value { - for index, val := range v.MustUint16Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint16 uses the specified decider function to select items -// from the []uint16. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint16(decider func(int, uint16) bool) *Value { - var selected []uint16 - v.EachUint16(func(index int, val uint16) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint16 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint16. -func (v *Value) GroupUint16(grouper func(int, uint16) string) *Value { - groups := make(map[string][]uint16) - v.EachUint16(func(index int, val uint16) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint16, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint16 uses the specified function to replace each uint16s -// by iterating each item. The data in the returned result will be a -// []uint16 containing the replaced items. -func (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value { - arr := v.MustUint16Slice() - replaced := make([]uint16, len(arr)) - v.EachUint16(func(index int, val uint16) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint16 uses the specified collector function to collect a value -// for each of the uint16s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value { - arr := v.MustUint16Slice() - collected := make([]interface{}, len(arr)) - v.EachUint16(func(index int, val uint16) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint32 (uint32 and []uint32) -*/ - -// Uint32 gets the value as a uint32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint32(optionalDefault ...uint32) uint32 { - if s, ok := v.data.(uint32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint32 gets the value as a uint32. -// -// Panics if the object is not a uint32. -func (v *Value) MustUint32() uint32 { - return v.data.(uint32) -} - -// Uint32Slice gets the value as a []uint32, returns the optionalDefault -// value or nil if the value is not a []uint32. -func (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 { - if s, ok := v.data.([]uint32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint32Slice gets the value as a []uint32. -// -// Panics if the object is not a []uint32. -func (v *Value) MustUint32Slice() []uint32 { - return v.data.([]uint32) -} - -// IsUint32 gets whether the object contained is a uint32 or not. -func (v *Value) IsUint32() bool { - _, ok := v.data.(uint32) - return ok -} - -// IsUint32Slice gets whether the object contained is a []uint32 or not. -func (v *Value) IsUint32Slice() bool { - _, ok := v.data.([]uint32) - return ok -} - -// EachUint32 calls the specified callback for each object -// in the []uint32. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint32(callback func(int, uint32) bool) *Value { - for index, val := range v.MustUint32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint32 uses the specified decider function to select items -// from the []uint32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint32(decider func(int, uint32) bool) *Value { - var selected []uint32 - v.EachUint32(func(index int, val uint32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint32. -func (v *Value) GroupUint32(grouper func(int, uint32) string) *Value { - groups := make(map[string][]uint32) - v.EachUint32(func(index int, val uint32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint32 uses the specified function to replace each uint32s -// by iterating each item. The data in the returned result will be a -// []uint32 containing the replaced items. -func (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value { - arr := v.MustUint32Slice() - replaced := make([]uint32, len(arr)) - v.EachUint32(func(index int, val uint32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint32 uses the specified collector function to collect a value -// for each of the uint32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value { - arr := v.MustUint32Slice() - collected := make([]interface{}, len(arr)) - v.EachUint32(func(index int, val uint32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uint64 (uint64 and []uint64) -*/ - -// Uint64 gets the value as a uint64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uint64(optionalDefault ...uint64) uint64 { - if s, ok := v.data.(uint64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUint64 gets the value as a uint64. -// -// Panics if the object is not a uint64. -func (v *Value) MustUint64() uint64 { - return v.data.(uint64) -} - -// Uint64Slice gets the value as a []uint64, returns the optionalDefault -// value or nil if the value is not a []uint64. -func (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 { - if s, ok := v.data.([]uint64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUint64Slice gets the value as a []uint64. -// -// Panics if the object is not a []uint64. -func (v *Value) MustUint64Slice() []uint64 { - return v.data.([]uint64) -} - -// IsUint64 gets whether the object contained is a uint64 or not. -func (v *Value) IsUint64() bool { - _, ok := v.data.(uint64) - return ok -} - -// IsUint64Slice gets whether the object contained is a []uint64 or not. -func (v *Value) IsUint64Slice() bool { - _, ok := v.data.([]uint64) - return ok -} - -// EachUint64 calls the specified callback for each object -// in the []uint64. -// -// Panics if the object is the wrong type. -func (v *Value) EachUint64(callback func(int, uint64) bool) *Value { - for index, val := range v.MustUint64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUint64 uses the specified decider function to select items -// from the []uint64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUint64(decider func(int, uint64) bool) *Value { - var selected []uint64 - v.EachUint64(func(index int, val uint64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUint64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uint64. -func (v *Value) GroupUint64(grouper func(int, uint64) string) *Value { - groups := make(map[string][]uint64) - v.EachUint64(func(index int, val uint64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uint64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUint64 uses the specified function to replace each uint64s -// by iterating each item. The data in the returned result will be a -// []uint64 containing the replaced items. -func (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value { - arr := v.MustUint64Slice() - replaced := make([]uint64, len(arr)) - v.EachUint64(func(index int, val uint64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUint64 uses the specified collector function to collect a value -// for each of the uint64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value { - arr := v.MustUint64Slice() - collected := make([]interface{}, len(arr)) - v.EachUint64(func(index int, val uint64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Uintptr (uintptr and []uintptr) -*/ - -// Uintptr gets the value as a uintptr, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Uintptr(optionalDefault ...uintptr) uintptr { - if s, ok := v.data.(uintptr); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustUintptr gets the value as a uintptr. -// -// Panics if the object is not a uintptr. -func (v *Value) MustUintptr() uintptr { - return v.data.(uintptr) -} - -// UintptrSlice gets the value as a []uintptr, returns the optionalDefault -// value or nil if the value is not a []uintptr. -func (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr { - if s, ok := v.data.([]uintptr); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustUintptrSlice gets the value as a []uintptr. -// -// Panics if the object is not a []uintptr. -func (v *Value) MustUintptrSlice() []uintptr { - return v.data.([]uintptr) -} - -// IsUintptr gets whether the object contained is a uintptr or not. -func (v *Value) IsUintptr() bool { - _, ok := v.data.(uintptr) - return ok -} - -// IsUintptrSlice gets whether the object contained is a []uintptr or not. -func (v *Value) IsUintptrSlice() bool { - _, ok := v.data.([]uintptr) - return ok -} - -// EachUintptr calls the specified callback for each object -// in the []uintptr. -// -// Panics if the object is the wrong type. -func (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value { - for index, val := range v.MustUintptrSlice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereUintptr uses the specified decider function to select items -// from the []uintptr. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value { - var selected []uintptr - v.EachUintptr(func(index int, val uintptr) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupUintptr uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]uintptr. -func (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value { - groups := make(map[string][]uintptr) - v.EachUintptr(func(index int, val uintptr) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]uintptr, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceUintptr uses the specified function to replace each uintptrs -// by iterating each item. The data in the returned result will be a -// []uintptr containing the replaced items. -func (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Value { - arr := v.MustUintptrSlice() - replaced := make([]uintptr, len(arr)) - v.EachUintptr(func(index int, val uintptr) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectUintptr uses the specified collector function to collect a value -// for each of the uintptrs in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value { - arr := v.MustUintptrSlice() - collected := make([]interface{}, len(arr)) - v.EachUintptr(func(index int, val uintptr) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Float32 (float32 and []float32) -*/ - -// Float32 gets the value as a float32, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Float32(optionalDefault ...float32) float32 { - if s, ok := v.data.(float32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustFloat32 gets the value as a float32. -// -// Panics if the object is not a float32. -func (v *Value) MustFloat32() float32 { - return v.data.(float32) -} - -// Float32Slice gets the value as a []float32, returns the optionalDefault -// value or nil if the value is not a []float32. -func (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 { - if s, ok := v.data.([]float32); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustFloat32Slice gets the value as a []float32. -// -// Panics if the object is not a []float32. -func (v *Value) MustFloat32Slice() []float32 { - return v.data.([]float32) -} - -// IsFloat32 gets whether the object contained is a float32 or not. -func (v *Value) IsFloat32() bool { - _, ok := v.data.(float32) - return ok -} - -// IsFloat32Slice gets whether the object contained is a []float32 or not. -func (v *Value) IsFloat32Slice() bool { - _, ok := v.data.([]float32) - return ok -} - -// EachFloat32 calls the specified callback for each object -// in the []float32. -// -// Panics if the object is the wrong type. -func (v *Value) EachFloat32(callback func(int, float32) bool) *Value { - for index, val := range v.MustFloat32Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereFloat32 uses the specified decider function to select items -// from the []float32. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereFloat32(decider func(int, float32) bool) *Value { - var selected []float32 - v.EachFloat32(func(index int, val float32) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupFloat32 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]float32. -func (v *Value) GroupFloat32(grouper func(int, float32) string) *Value { - groups := make(map[string][]float32) - v.EachFloat32(func(index int, val float32) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]float32, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceFloat32 uses the specified function to replace each float32s -// by iterating each item. The data in the returned result will be a -// []float32 containing the replaced items. -func (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Value { - arr := v.MustFloat32Slice() - replaced := make([]float32, len(arr)) - v.EachFloat32(func(index int, val float32) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectFloat32 uses the specified collector function to collect a value -// for each of the float32s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value { - arr := v.MustFloat32Slice() - collected := make([]interface{}, len(arr)) - v.EachFloat32(func(index int, val float32) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Float64 (float64 and []float64) -*/ - -// Float64 gets the value as a float64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Float64(optionalDefault ...float64) float64 { - if s, ok := v.data.(float64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustFloat64 gets the value as a float64. -// -// Panics if the object is not a float64. -func (v *Value) MustFloat64() float64 { - return v.data.(float64) -} - -// Float64Slice gets the value as a []float64, returns the optionalDefault -// value or nil if the value is not a []float64. -func (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 { - if s, ok := v.data.([]float64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustFloat64Slice gets the value as a []float64. -// -// Panics if the object is not a []float64. -func (v *Value) MustFloat64Slice() []float64 { - return v.data.([]float64) -} - -// IsFloat64 gets whether the object contained is a float64 or not. -func (v *Value) IsFloat64() bool { - _, ok := v.data.(float64) - return ok -} - -// IsFloat64Slice gets whether the object contained is a []float64 or not. -func (v *Value) IsFloat64Slice() bool { - _, ok := v.data.([]float64) - return ok -} - -// EachFloat64 calls the specified callback for each object -// in the []float64. -// -// Panics if the object is the wrong type. -func (v *Value) EachFloat64(callback func(int, float64) bool) *Value { - for index, val := range v.MustFloat64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereFloat64 uses the specified decider function to select items -// from the []float64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereFloat64(decider func(int, float64) bool) *Value { - var selected []float64 - v.EachFloat64(func(index int, val float64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupFloat64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]float64. -func (v *Value) GroupFloat64(grouper func(int, float64) string) *Value { - groups := make(map[string][]float64) - v.EachFloat64(func(index int, val float64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]float64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceFloat64 uses the specified function to replace each float64s -// by iterating each item. The data in the returned result will be a -// []float64 containing the replaced items. -func (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Value { - arr := v.MustFloat64Slice() - replaced := make([]float64, len(arr)) - v.EachFloat64(func(index int, val float64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectFloat64 uses the specified collector function to collect a value -// for each of the float64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value { - arr := v.MustFloat64Slice() - collected := make([]interface{}, len(arr)) - v.EachFloat64(func(index int, val float64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Complex64 (complex64 and []complex64) -*/ - -// Complex64 gets the value as a complex64, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Complex64(optionalDefault ...complex64) complex64 { - if s, ok := v.data.(complex64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustComplex64 gets the value as a complex64. -// -// Panics if the object is not a complex64. -func (v *Value) MustComplex64() complex64 { - return v.data.(complex64) -} - -// Complex64Slice gets the value as a []complex64, returns the optionalDefault -// value or nil if the value is not a []complex64. -func (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex64 { - if s, ok := v.data.([]complex64); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustComplex64Slice gets the value as a []complex64. -// -// Panics if the object is not a []complex64. -func (v *Value) MustComplex64Slice() []complex64 { - return v.data.([]complex64) -} - -// IsComplex64 gets whether the object contained is a complex64 or not. -func (v *Value) IsComplex64() bool { - _, ok := v.data.(complex64) - return ok -} - -// IsComplex64Slice gets whether the object contained is a []complex64 or not. -func (v *Value) IsComplex64Slice() bool { - _, ok := v.data.([]complex64) - return ok -} - -// EachComplex64 calls the specified callback for each object -// in the []complex64. -// -// Panics if the object is the wrong type. -func (v *Value) EachComplex64(callback func(int, complex64) bool) *Value { - for index, val := range v.MustComplex64Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereComplex64 uses the specified decider function to select items -// from the []complex64. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value { - var selected []complex64 - v.EachComplex64(func(index int, val complex64) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupComplex64 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]complex64. -func (v *Value) GroupComplex64(grouper func(int, complex64) string) *Value { - groups := make(map[string][]complex64) - v.EachComplex64(func(index int, val complex64) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]complex64, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceComplex64 uses the specified function to replace each complex64s -// by iterating each item. The data in the returned result will be a -// []complex64 containing the replaced items. -func (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64) *Value { - arr := v.MustComplex64Slice() - replaced := make([]complex64, len(arr)) - v.EachComplex64(func(index int, val complex64) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectComplex64 uses the specified collector function to collect a value -// for each of the complex64s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Value { - arr := v.MustComplex64Slice() - collected := make([]interface{}, len(arr)) - v.EachComplex64(func(index int, val complex64) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} - -/* - Complex128 (complex128 and []complex128) -*/ - -// Complex128 gets the value as a complex128, returns the optionalDefault -// value or a system default object if the value is the wrong type. -func (v *Value) Complex128(optionalDefault ...complex128) complex128 { - if s, ok := v.data.(complex128); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return 0 -} - -// MustComplex128 gets the value as a complex128. -// -// Panics if the object is not a complex128. -func (v *Value) MustComplex128() complex128 { - return v.data.(complex128) -} - -// Complex128Slice gets the value as a []complex128, returns the optionalDefault -// value or nil if the value is not a []complex128. -func (v *Value) Complex128Slice(optionalDefault ...[]complex128) []complex128 { - if s, ok := v.data.([]complex128); ok { - return s - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - return nil -} - -// MustComplex128Slice gets the value as a []complex128. -// -// Panics if the object is not a []complex128. -func (v *Value) MustComplex128Slice() []complex128 { - return v.data.([]complex128) -} - -// IsComplex128 gets whether the object contained is a complex128 or not. -func (v *Value) IsComplex128() bool { - _, ok := v.data.(complex128) - return ok -} - -// IsComplex128Slice gets whether the object contained is a []complex128 or not. -func (v *Value) IsComplex128Slice() bool { - _, ok := v.data.([]complex128) - return ok -} - -// EachComplex128 calls the specified callback for each object -// in the []complex128. -// -// Panics if the object is the wrong type. -func (v *Value) EachComplex128(callback func(int, complex128) bool) *Value { - for index, val := range v.MustComplex128Slice() { - carryon := callback(index, val) - if !carryon { - break - } - } - return v -} - -// WhereComplex128 uses the specified decider function to select items -// from the []complex128. The object contained in the result will contain -// only the selected items. -func (v *Value) WhereComplex128(decider func(int, complex128) bool) *Value { - var selected []complex128 - v.EachComplex128(func(index int, val complex128) bool { - shouldSelect := decider(index, val) - if !shouldSelect { - selected = append(selected, val) - } - return true - }) - return &Value{data: selected} -} - -// GroupComplex128 uses the specified grouper function to group the items -// keyed by the return of the grouper. The object contained in the -// result will contain a map[string][]complex128. -func (v *Value) GroupComplex128(grouper func(int, complex128) string) *Value { - groups := make(map[string][]complex128) - v.EachComplex128(func(index int, val complex128) bool { - group := grouper(index, val) - if _, ok := groups[group]; !ok { - groups[group] = make([]complex128, 0) - } - groups[group] = append(groups[group], val) - return true - }) - return &Value{data: groups} -} - -// ReplaceComplex128 uses the specified function to replace each complex128s -// by iterating each item. The data in the returned result will be a -// []complex128 containing the replaced items. -func (v *Value) ReplaceComplex128(replacer func(int, complex128) complex128) *Value { - arr := v.MustComplex128Slice() - replaced := make([]complex128, len(arr)) - v.EachComplex128(func(index int, val complex128) bool { - replaced[index] = replacer(index, val) - return true - }) - return &Value{data: replaced} -} - -// CollectComplex128 uses the specified collector function to collect a value -// for each of the complex128s in the slice. The data returned will be a -// []interface{}. -func (v *Value) CollectComplex128(collector func(int, complex128) interface{}) *Value { - arr := v.MustComplex128Slice() - collected := make([]interface{}, len(arr)) - v.EachComplex128(func(index int, val complex128) bool { - collected[index] = collector(index, val) - return true - }) - return &Value{data: collected} -} diff --git a/vendor/github.com/stretchr/objx/value.go b/vendor/github.com/stretchr/objx/value.go deleted file mode 100644 index 4e5f9b77..00000000 --- a/vendor/github.com/stretchr/objx/value.go +++ /dev/null @@ -1,159 +0,0 @@ -package objx - -import ( - "fmt" - "strconv" -) - -// Value provides methods for extracting interface{} data in various -// types. -type Value struct { - // data contains the raw data being managed by this Value - data interface{} -} - -// Data returns the raw data contained by this Value -func (v *Value) Data() interface{} { - return v.data -} - -// String returns the value always as a string -func (v *Value) String() string { - switch { - case v.IsNil(): - return "" - case v.IsStr(): - return v.Str() - case v.IsBool(): - return strconv.FormatBool(v.Bool()) - case v.IsFloat32(): - return strconv.FormatFloat(float64(v.Float32()), 'f', -1, 32) - case v.IsFloat64(): - return strconv.FormatFloat(v.Float64(), 'f', -1, 64) - case v.IsInt(): - return strconv.FormatInt(int64(v.Int()), 10) - case v.IsInt8(): - return strconv.FormatInt(int64(v.Int8()), 10) - case v.IsInt16(): - return strconv.FormatInt(int64(v.Int16()), 10) - case v.IsInt32(): - return strconv.FormatInt(int64(v.Int32()), 10) - case v.IsInt64(): - return strconv.FormatInt(v.Int64(), 10) - case v.IsUint(): - return strconv.FormatUint(uint64(v.Uint()), 10) - case v.IsUint8(): - return strconv.FormatUint(uint64(v.Uint8()), 10) - case v.IsUint16(): - return strconv.FormatUint(uint64(v.Uint16()), 10) - case v.IsUint32(): - return strconv.FormatUint(uint64(v.Uint32()), 10) - case v.IsUint64(): - return strconv.FormatUint(v.Uint64(), 10) - } - return fmt.Sprintf("%#v", v.Data()) -} - -// StringSlice returns the value always as a []string -func (v *Value) StringSlice(optionalDefault ...[]string) []string { - switch { - case v.IsStrSlice(): - return v.MustStrSlice() - case v.IsBoolSlice(): - slice := v.MustBoolSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatBool(iv) - } - return vals - case v.IsFloat32Slice(): - slice := v.MustFloat32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatFloat(float64(iv), 'f', -1, 32) - } - return vals - case v.IsFloat64Slice(): - slice := v.MustFloat64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatFloat(iv, 'f', -1, 64) - } - return vals - case v.IsIntSlice(): - slice := v.MustIntSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt8Slice(): - slice := v.MustInt8Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt16Slice(): - slice := v.MustInt16Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt32Slice(): - slice := v.MustInt32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(int64(iv), 10) - } - return vals - case v.IsInt64Slice(): - slice := v.MustInt64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatInt(iv, 10) - } - return vals - case v.IsUintSlice(): - slice := v.MustUintSlice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint8Slice(): - slice := v.MustUint8Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint16Slice(): - slice := v.MustUint16Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint32Slice(): - slice := v.MustUint32Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(uint64(iv), 10) - } - return vals - case v.IsUint64Slice(): - slice := v.MustUint64Slice() - vals := make([]string, len(slice)) - for i, iv := range slice { - vals[i] = strconv.FormatUint(iv, 10) - } - return vals - } - if len(optionalDefault) == 1 { - return optionalDefault[0] - } - - return []string{} -} diff --git a/vendor/github.com/stretchr/testify/mock/doc.go b/vendor/github.com/stretchr/testify/mock/doc.go deleted file mode 100644 index d6b3c844..00000000 --- a/vendor/github.com/stretchr/testify/mock/doc.go +++ /dev/null @@ -1,44 +0,0 @@ -// Package mock provides a system by which it is possible to mock your objects -// and verify calls are happening as expected. -// -// # Example Usage -// -// The mock package provides an object, Mock, that tracks activity on another object. It is usually -// embedded into a test object as shown below: -// -// type MyTestObject struct { -// // add a Mock object instance -// mock.Mock -// -// // other fields go here as normal -// } -// -// When implementing the methods of an interface, you wire your functions up -// to call the Mock.Called(args...) method, and return the appropriate values. -// -// For example, to mock a method that saves the name and age of a person and returns -// the year of their birth or an error, you might write this: -// -// func (o *MyTestObject) SavePersonDetails(firstname, lastname string, age int) (int, error) { -// args := o.Called(firstname, lastname, age) -// return args.Int(0), args.Error(1) -// } -// -// The Int, Error and Bool methods are examples of strongly typed getters that take the argument -// index position. Given this argument list: -// -// (12, true, "Something") -// -// You could read them out strongly typed like this: -// -// args.Int(0) -// args.Bool(1) -// args.String(2) -// -// For objects of your own type, use the generic Arguments.Get(index) method and make a type assertion: -// -// return args.Get(0).(*MyObject), args.Get(1).(*AnotherObjectOfMine) -// -// This may cause a panic if the object you are getting is nil (the type assertion will fail), in those -// cases you should check for nil first. -package mock diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go deleted file mode 100644 index eb5682df..00000000 --- a/vendor/github.com/stretchr/testify/mock/mock.go +++ /dev/null @@ -1,1288 +0,0 @@ -package mock - -import ( - "errors" - "fmt" - "path" - "reflect" - "regexp" - "runtime" - "strings" - "sync" - "time" - - "github.com/davecgh/go-spew/spew" - "github.com/pmezard/go-difflib/difflib" - "github.com/stretchr/objx" - - "github.com/stretchr/testify/assert" -) - -// regex for GCCGO functions -var gccgoRE = regexp.MustCompile(`\.pN\d+_`) - -// TestingT is an interface wrapper around *testing.T -type TestingT interface { - Logf(format string, args ...interface{}) - Errorf(format string, args ...interface{}) - FailNow() -} - -/* - Call -*/ - -// Call represents a method call and is used for setting expectations, -// as well as recording activity. -type Call struct { - Parent *Mock - - // The name of the method that was or will be called. - Method string - - // Holds the arguments of the method. - Arguments Arguments - - // Holds the arguments that should be returned when - // this method is called. - ReturnArguments Arguments - - // Holds the caller info for the On() call - callerInfo []string - - // The number of times to return the return arguments when setting - // expectations. 0 means to always return the value. - Repeatability int - - // Amount of times this call has been called - totalCalls int - - // Call to this method can be optional - optional bool - - // Holds a channel that will be used to block the Return until it either - // receives a message or is closed. nil means it returns immediately. - WaitFor <-chan time.Time - - waitTime time.Duration - - // Holds a handler used to manipulate arguments content that are passed by - // reference. It's useful when mocking methods such as unmarshalers or - // decoders. - RunFn func(Arguments) - - // PanicMsg holds msg to be used to mock panic on the function call - // if the PanicMsg is set to a non nil string the function call will panic - // irrespective of other settings - PanicMsg *string - - // Calls which must be satisfied before this call can be - requires []*Call -} - -func newCall(parent *Mock, methodName string, callerInfo []string, methodArguments Arguments, returnArguments Arguments) *Call { - return &Call{ - Parent: parent, - Method: methodName, - Arguments: methodArguments, - ReturnArguments: returnArguments, - callerInfo: callerInfo, - Repeatability: 0, - WaitFor: nil, - RunFn: nil, - PanicMsg: nil, - } -} - -func (c *Call) lock() { - c.Parent.mutex.Lock() -} - -func (c *Call) unlock() { - c.Parent.mutex.Unlock() -} - -// Return specifies the return arguments for the expectation. -// -// Mock.On("DoSomething").Return(errors.New("failed")) -func (c *Call) Return(returnArguments ...interface{}) *Call { - c.lock() - defer c.unlock() - - c.ReturnArguments = returnArguments - - return c -} - -// Panic specifies if the function call should fail and the panic message -// -// Mock.On("DoSomething").Panic("test panic") -func (c *Call) Panic(msg string) *Call { - c.lock() - defer c.unlock() - - c.PanicMsg = &msg - - return c -} - -// Once indicates that the mock should only return the value once. -// -// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Once() -func (c *Call) Once() *Call { - return c.Times(1) -} - -// Twice indicates that the mock should only return the value twice. -// -// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Twice() -func (c *Call) Twice() *Call { - return c.Times(2) -} - -// Times indicates that the mock should only return the indicated number -// of times. -// -// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times(5) -func (c *Call) Times(i int) *Call { - c.lock() - defer c.unlock() - c.Repeatability = i - return c -} - -// WaitUntil sets the channel that will block the mock's return until its closed -// or a message is received. -// -// Mock.On("MyMethod", arg1, arg2).WaitUntil(time.After(time.Second)) -func (c *Call) WaitUntil(w <-chan time.Time) *Call { - c.lock() - defer c.unlock() - c.WaitFor = w - return c -} - -// After sets how long to block until the call returns -// -// Mock.On("MyMethod", arg1, arg2).After(time.Second) -func (c *Call) After(d time.Duration) *Call { - c.lock() - defer c.unlock() - c.waitTime = d - return c -} - -// Run sets a handler to be called before returning. It can be used when -// mocking a method (such as an unmarshaler) that takes a pointer to a struct and -// sets properties in such struct -// -// Mock.On("Unmarshal", AnythingOfType("*map[string]interface{}")).Return().Run(func(args Arguments) { -// arg := args.Get(0).(*map[string]interface{}) -// arg["foo"] = "bar" -// }) -func (c *Call) Run(fn func(args Arguments)) *Call { - c.lock() - defer c.unlock() - c.RunFn = fn - return c -} - -// Maybe allows the method call to be optional. Not calling an optional method -// will not cause an error while asserting expectations -func (c *Call) Maybe() *Call { - c.lock() - defer c.unlock() - c.optional = true - return c -} - -// On chains a new expectation description onto the mocked interface. This -// allows syntax like. -// -// Mock. -// On("MyMethod", 1).Return(nil). -// On("MyOtherMethod", 'a', 'b', 'c').Return(errors.New("Some Error")) -// -//go:noinline -func (c *Call) On(methodName string, arguments ...interface{}) *Call { - return c.Parent.On(methodName, arguments...) -} - -// Unset removes a mock handler from being called. -// -// test.On("func", mock.Anything).Unset() -func (c *Call) Unset() *Call { - var unlockOnce sync.Once - - for _, arg := range c.Arguments { - if v := reflect.ValueOf(arg); v.Kind() == reflect.Func { - panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg)) - } - } - - c.lock() - defer unlockOnce.Do(c.unlock) - - foundMatchingCall := false - - // in-place filter slice for calls to be removed - iterate from 0'th to last skipping unnecessary ones - var index int // write index - for _, call := range c.Parent.ExpectedCalls { - if call.Method == c.Method { - _, diffCount := call.Arguments.Diff(c.Arguments) - if diffCount == 0 { - foundMatchingCall = true - // Remove from ExpectedCalls - just skip it - continue - } - } - c.Parent.ExpectedCalls[index] = call - index++ - } - // trim slice up to last copied index - c.Parent.ExpectedCalls = c.Parent.ExpectedCalls[:index] - - if !foundMatchingCall { - unlockOnce.Do(c.unlock) - c.Parent.fail("\n\nmock: Could not find expected call\n-----------------------------\n\n%s\n\n", - callString(c.Method, c.Arguments, true), - ) - } - - return c -} - -// NotBefore indicates that the mock should only be called after the referenced -// calls have been called as expected. The referenced calls may be from the -// same mock instance and/or other mock instances. -// -// Mock.On("Do").Return(nil).NotBefore( -// Mock.On("Init").Return(nil) -// ) -func (c *Call) NotBefore(calls ...*Call) *Call { - c.lock() - defer c.unlock() - - for _, call := range calls { - if call.Parent == nil { - panic("not before calls must be created with Mock.On()") - } - } - - c.requires = append(c.requires, calls...) - return c -} - -// InOrder defines the order in which the calls should be made -// -// For example: -// -// InOrder( -// Mock.On("init").Return(nil), -// Mock.On("Do").Return(nil), -// ) -func InOrder(calls ...*Call) { - for i := 1; i < len(calls); i++ { - calls[i].NotBefore(calls[i-1]) - } -} - -// Mock is the workhorse used to track activity on another object. -// For an example of its usage, refer to the "Example Usage" section at the top -// of this document. -type Mock struct { - // Represents the calls that are expected of - // an object. - ExpectedCalls []*Call - - // Holds the calls that were made to this mocked object. - Calls []Call - - // test is An optional variable that holds the test struct, to be used when an - // invalid mock call was made. - test TestingT - - // TestData holds any data that might be useful for testing. Testify ignores - // this data completely allowing you to do whatever you like with it. - testData objx.Map - - mutex sync.Mutex -} - -// String provides a %v format string for Mock. -// Note: this is used implicitly by Arguments.Diff if a Mock is passed. -// It exists because go's default %v formatting traverses the struct -// without acquiring the mutex, which is detected by go test -race. -func (m *Mock) String() string { - return fmt.Sprintf("%[1]T<%[1]p>", m) -} - -// TestData holds any data that might be useful for testing. Testify ignores -// this data completely allowing you to do whatever you like with it. -func (m *Mock) TestData() objx.Map { - if m.testData == nil { - m.testData = make(objx.Map) - } - - return m.testData -} - -/* - Setting expectations -*/ - -// Test sets the test struct variable of the mock object -func (m *Mock) Test(t TestingT) { - m.mutex.Lock() - defer m.mutex.Unlock() - m.test = t -} - -// fail fails the current test with the given formatted format and args. -// In case that a test was defined, it uses the test APIs for failing a test, -// otherwise it uses panic. -func (m *Mock) fail(format string, args ...interface{}) { - m.mutex.Lock() - defer m.mutex.Unlock() - - if m.test == nil { - panic(fmt.Sprintf(format, args...)) - } - m.test.Errorf(format, args...) - m.test.FailNow() -} - -// On starts a description of an expectation of the specified method -// being called. -// -// Mock.On("MyMethod", arg1, arg2) -func (m *Mock) On(methodName string, arguments ...interface{}) *Call { - for _, arg := range arguments { - if v := reflect.ValueOf(arg); v.Kind() == reflect.Func { - panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg)) - } - } - - m.mutex.Lock() - defer m.mutex.Unlock() - - c := newCall(m, methodName, assert.CallerInfo(), arguments, make([]interface{}, 0)) - m.ExpectedCalls = append(m.ExpectedCalls, c) - return c -} - -// /* -// Recording and responding to activity -// */ - -func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) { - var expectedCall *Call - - for i, call := range m.ExpectedCalls { - if call.Method == method { - _, diffCount := call.Arguments.Diff(arguments) - if diffCount == 0 { - expectedCall = call - if call.Repeatability > -1 { - return i, call - } - } - } - } - - return -1, expectedCall -} - -type matchCandidate struct { - call *Call - mismatch string - diffCount int -} - -func (c matchCandidate) isBetterMatchThan(other matchCandidate) bool { - if c.call == nil { - return false - } - if other.call == nil { - return true - } - - if c.diffCount > other.diffCount { - return false - } - if c.diffCount < other.diffCount { - return true - } - - if c.call.Repeatability > 0 && other.call.Repeatability <= 0 { - return true - } - return false -} - -func (m *Mock) findClosestCall(method string, arguments ...interface{}) (*Call, string) { - var bestMatch matchCandidate - - for _, call := range m.expectedCalls() { - if call.Method == method { - - errInfo, tempDiffCount := call.Arguments.Diff(arguments) - tempCandidate := matchCandidate{ - call: call, - mismatch: errInfo, - diffCount: tempDiffCount, - } - if tempCandidate.isBetterMatchThan(bestMatch) { - bestMatch = tempCandidate - } - } - } - - return bestMatch.call, bestMatch.mismatch -} - -func callString(method string, arguments Arguments, includeArgumentValues bool) string { - var argValsString string - if includeArgumentValues { - var argVals []string - for argIndex, arg := range arguments { - if _, ok := arg.(*FunctionalOptionsArgument); ok { - argVals = append(argVals, fmt.Sprintf("%d: %s", argIndex, arg)) - continue - } - argVals = append(argVals, fmt.Sprintf("%d: %#v", argIndex, arg)) - } - argValsString = fmt.Sprintf("\n\t\t%s", strings.Join(argVals, "\n\t\t")) - } - - return fmt.Sprintf("%s(%s)%s", method, arguments.String(), argValsString) -} - -// Called tells the mock object that a method has been called, and gets an array -// of arguments to return. Panics if the call is unexpected (i.e. not preceded by -// appropriate .On .Return() calls) -// If Call.WaitFor is set, blocks until the channel is closed or receives a message. -func (m *Mock) Called(arguments ...interface{}) Arguments { - // get the calling function's name - pc, _, _, ok := runtime.Caller(1) - if !ok { - panic("Couldn't get the caller information") - } - functionPath := runtime.FuncForPC(pc).Name() - // Next four lines are required to use GCCGO function naming conventions. - // For Ex: github_com_docker_libkv_store_mock.WatchTree.pN39_github_com_docker_libkv_store_mock.Mock - // uses interface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree - // With GCCGO we need to remove interface information starting from pN
. - if gccgoRE.MatchString(functionPath) { - functionPath = gccgoRE.Split(functionPath, -1)[0] - } - parts := strings.Split(functionPath, ".") - functionName := parts[len(parts)-1] - return m.MethodCalled(functionName, arguments...) -} - -// MethodCalled tells the mock object that the given method has been called, and gets -// an array of arguments to return. Panics if the call is unexpected (i.e. not preceded -// by appropriate .On .Return() calls) -// If Call.WaitFor is set, blocks until the channel is closed or receives a message. -func (m *Mock) MethodCalled(methodName string, arguments ...interface{}) Arguments { - m.mutex.Lock() - // TODO: could combine expected and closes in single loop - found, call := m.findExpectedCall(methodName, arguments...) - - if found < 0 { - // expected call found, but it has already been called with repeatable times - if call != nil { - m.mutex.Unlock() - m.fail("\nassert: mock: The method has been called over %d times.\n\tEither do one more Mock.On(\"%s\").Return(...), or remove extra call.\n\tThis call was unexpected:\n\t\t%s\n\tat: %s", call.totalCalls, methodName, callString(methodName, arguments, true), assert.CallerInfo()) - } - // we have to fail here - because we don't know what to do - // as the return arguments. This is because: - // - // a) this is a totally unexpected call to this method, - // b) the arguments are not what was expected, or - // c) the developer has forgotten to add an accompanying On...Return pair. - closestCall, mismatch := m.findClosestCall(methodName, arguments...) - m.mutex.Unlock() - - if closestCall != nil { - m.fail("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\nDiff: %s\nat: %s\n", - callString(methodName, arguments, true), - callString(methodName, closestCall.Arguments, true), - diffArguments(closestCall.Arguments, arguments), - strings.TrimSpace(mismatch), - assert.CallerInfo(), - ) - } else { - m.fail("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(\"%s\").Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", methodName, methodName, callString(methodName, arguments, true), assert.CallerInfo()) - } - } - - for _, requirement := range call.requires { - if satisfied, _ := requirement.Parent.checkExpectation(requirement); !satisfied { - m.mutex.Unlock() - m.fail("mock: Unexpected Method Call\n-----------------------------\n\n%s\n\nMust not be called before%s:\n\n%s", - callString(call.Method, call.Arguments, true), - func() (s string) { - if requirement.totalCalls > 0 { - s = " another call of" - } - if call.Parent != requirement.Parent { - s += " method from another mock instance" - } - return - }(), - callString(requirement.Method, requirement.Arguments, true), - ) - } - } - - if call.Repeatability == 1 { - call.Repeatability = -1 - } else if call.Repeatability > 1 { - call.Repeatability-- - } - call.totalCalls++ - - // add the call - m.Calls = append(m.Calls, *newCall(m, methodName, assert.CallerInfo(), arguments, call.ReturnArguments)) - m.mutex.Unlock() - - // block if specified - if call.WaitFor != nil { - <-call.WaitFor - } else { - time.Sleep(call.waitTime) - } - - m.mutex.Lock() - panicMsg := call.PanicMsg - m.mutex.Unlock() - if panicMsg != nil { - panic(*panicMsg) - } - - m.mutex.Lock() - runFn := call.RunFn - m.mutex.Unlock() - - if runFn != nil { - runFn(arguments) - } - - m.mutex.Lock() - returnArgs := call.ReturnArguments - m.mutex.Unlock() - - return returnArgs -} - -/* - Assertions -*/ - -type assertExpectationiser interface { - AssertExpectations(TestingT) bool -} - -// AssertExpectationsForObjects asserts that everything specified with On and Return -// of the specified objects was in fact called as expected. -// -// Calls may have occurred in any order. -func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - for _, obj := range testObjects { - if m, ok := obj.(*Mock); ok { - t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)") - obj = m - } - m := obj.(assertExpectationiser) - if !m.AssertExpectations(t) { - t.Logf("Expectations didn't match for Mock: %+v", reflect.TypeOf(m)) - return false - } - } - return true -} - -// AssertExpectations asserts that everything specified with On and Return was -// in fact called as expected. Calls may have occurred in any order. -func (m *Mock) AssertExpectations(t TestingT) bool { - if s, ok := t.(interface{ Skipped() bool }); ok && s.Skipped() { - return true - } - if h, ok := t.(tHelper); ok { - h.Helper() - } - - m.mutex.Lock() - defer m.mutex.Unlock() - var failedExpectations int - - // iterate through each expectation - expectedCalls := m.expectedCalls() - for _, expectedCall := range expectedCalls { - satisfied, reason := m.checkExpectation(expectedCall) - if !satisfied { - failedExpectations++ - t.Logf(reason) - } - } - - if failedExpectations != 0 { - t.Errorf("FAIL: %d out of %d expectation(s) were met.\n\tThe code you are testing needs to make %d more call(s).\n\tat: %s", len(expectedCalls)-failedExpectations, len(expectedCalls), failedExpectations, assert.CallerInfo()) - } - - return failedExpectations == 0 -} - -func (m *Mock) checkExpectation(call *Call) (bool, string) { - if !call.optional && !m.methodWasCalled(call.Method, call.Arguments) && call.totalCalls == 0 { - return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo) - } - if call.Repeatability > 0 { - return false, fmt.Sprintf("FAIL:\t%s(%s)\n\t\tat: %s", call.Method, call.Arguments.String(), call.callerInfo) - } - return true, fmt.Sprintf("PASS:\t%s(%s)", call.Method, call.Arguments.String()) -} - -// AssertNumberOfCalls asserts that the method was called expectedCalls times. -func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - var actualCalls int - for _, call := range m.calls() { - if call.Method == methodName { - actualCalls++ - } - } - return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) does not match the actual number of calls (%d).", expectedCalls, actualCalls)) -} - -// AssertCalled asserts that the method was called. -// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. -func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - if !m.methodWasCalled(methodName, arguments) { - var calledWithArgs []string - for _, call := range m.calls() { - calledWithArgs = append(calledWithArgs, fmt.Sprintf("%v", call.Arguments)) - } - if len(calledWithArgs) == 0 { - return assert.Fail(t, "Should have called with given arguments", - fmt.Sprintf("Expected %q to have been called with:\n%v\nbut no actual calls happened", methodName, arguments)) - } - return assert.Fail(t, "Should have called with given arguments", - fmt.Sprintf("Expected %q to have been called with:\n%v\nbut actual calls were:\n %v", methodName, arguments, strings.Join(calledWithArgs, "\n"))) - } - return true -} - -// AssertNotCalled asserts that the method was not called. -// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. -func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - if m.methodWasCalled(methodName, arguments) { - return assert.Fail(t, "Should not have called with given arguments", - fmt.Sprintf("Expected %q to not have been called with:\n%v\nbut actually it was.", methodName, arguments)) - } - return true -} - -// IsMethodCallable checking that the method can be called -// If the method was called more than `Repeatability` return false -func (m *Mock) IsMethodCallable(t TestingT, methodName string, arguments ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - m.mutex.Lock() - defer m.mutex.Unlock() - - for _, v := range m.ExpectedCalls { - if v.Method != methodName { - continue - } - if len(arguments) != len(v.Arguments) { - continue - } - if v.Repeatability < v.totalCalls { - continue - } - if isArgsEqual(v.Arguments, arguments) { - return true - } - } - return false -} - -// isArgsEqual compares arguments -func isArgsEqual(expected Arguments, args []interface{}) bool { - if len(expected) != len(args) { - return false - } - for i, v := range args { - if !reflect.DeepEqual(expected[i], v) { - return false - } - } - return true -} - -func (m *Mock) methodWasCalled(methodName string, expected []interface{}) bool { - for _, call := range m.calls() { - if call.Method == methodName { - - _, differences := Arguments(expected).Diff(call.Arguments) - - if differences == 0 { - // found the expected call - return true - } - - } - } - // we didn't find the expected call - return false -} - -func (m *Mock) expectedCalls() []*Call { - return append([]*Call{}, m.ExpectedCalls...) -} - -func (m *Mock) calls() []Call { - return append([]Call{}, m.Calls...) -} - -/* - Arguments -*/ - -// Arguments holds an array of method arguments or return values. -type Arguments []interface{} - -const ( - // Anything is used in Diff and Assert when the argument being tested - // shouldn't be taken into consideration. - Anything = "mock.Anything" -) - -// AnythingOfTypeArgument contains the type of an argument -// for use when type checking. Used in [Arguments.Diff] and [Arguments.Assert]. -// -// Deprecated: this is an implementation detail that must not be used. Use the [AnythingOfType] constructor instead, example: -// -// m.On("Do", mock.AnythingOfType("string")) -// -// All explicit type declarations can be replaced with interface{} as is expected by [Mock.On], example: -// -// func anyString interface{} { -// return mock.AnythingOfType("string") -// } -type AnythingOfTypeArgument = anythingOfTypeArgument - -// anythingOfTypeArgument is a string that contains the type of an argument -// for use when type checking. Used in Diff and Assert. -type anythingOfTypeArgument string - -// AnythingOfType returns a special value containing the -// name of the type to check for. The type name will be matched against the type name returned by [reflect.Type.String]. -// -// Used in Diff and Assert. -// -// For example: -// -// args.Assert(t, AnythingOfType("string"), AnythingOfType("int")) -func AnythingOfType(t string) AnythingOfTypeArgument { - return anythingOfTypeArgument(t) -} - -// IsTypeArgument is a struct that contains the type of an argument -// for use when type checking. This is an alternative to [AnythingOfType]. -// Used in [Arguments.Diff] and [Arguments.Assert]. -type IsTypeArgument struct { - t reflect.Type -} - -// IsType returns an IsTypeArgument object containing the type to check for. -// You can provide a zero-value of the type to check. This is an -// alternative to [AnythingOfType]. Used in [Arguments.Diff] and [Arguments.Assert]. -// -// For example: -// -// args.Assert(t, IsType(""), IsType(0)) -func IsType(t interface{}) *IsTypeArgument { - return &IsTypeArgument{t: reflect.TypeOf(t)} -} - -// FunctionalOptionsArgument contains a list of functional options arguments -// expected for use when matching a list of arguments. -type FunctionalOptionsArgument struct { - values []interface{} -} - -// String returns the string representation of FunctionalOptionsArgument -func (f *FunctionalOptionsArgument) String() string { - var name string - if len(f.values) > 0 { - name = "[]" + reflect.TypeOf(f.values[0]).String() - } - - return strings.Replace(fmt.Sprintf("%#v", f.values), "[]interface {}", name, 1) -} - -// FunctionalOptions returns an [FunctionalOptionsArgument] object containing -// the expected functional-options to check for. -// -// For example: -// -// args.Assert(t, FunctionalOptions(foo.Opt1("strValue"), foo.Opt2(613))) -func FunctionalOptions(values ...interface{}) *FunctionalOptionsArgument { - return &FunctionalOptionsArgument{ - values: values, - } -} - -// argumentMatcher performs custom argument matching, returning whether or -// not the argument is matched by the expectation fixture function. -type argumentMatcher struct { - // fn is a function which accepts one argument, and returns a bool. - fn reflect.Value -} - -func (f argumentMatcher) Matches(argument interface{}) bool { - expectType := f.fn.Type().In(0) - expectTypeNilSupported := false - switch expectType.Kind() { - case reflect.Interface, reflect.Chan, reflect.Func, reflect.Map, reflect.Slice, reflect.Ptr: - expectTypeNilSupported = true - } - - argType := reflect.TypeOf(argument) - var arg reflect.Value - if argType == nil { - arg = reflect.New(expectType).Elem() - } else { - arg = reflect.ValueOf(argument) - } - - if argType == nil && !expectTypeNilSupported { - panic(errors.New("attempting to call matcher with nil for non-nil expected type")) - } - if argType == nil || argType.AssignableTo(expectType) { - result := f.fn.Call([]reflect.Value{arg}) - return result[0].Bool() - } - return false -} - -func (f argumentMatcher) String() string { - return fmt.Sprintf("func(%s) bool", f.fn.Type().In(0).String()) -} - -// MatchedBy can be used to match a mock call based on only certain properties -// from a complex struct or some calculation. It takes a function that will be -// evaluated with the called argument and will return true when there's a match -// and false otherwise. -// -// Example: -// -// m.On("Do", MatchedBy(func(req *http.Request) bool { return req.Host == "example.com" })) -// -// fn must be a function accepting a single argument (of the expected type) -// which returns a bool. If fn doesn't match the required signature, -// MatchedBy() panics. -func MatchedBy(fn interface{}) argumentMatcher { - fnType := reflect.TypeOf(fn) - - if fnType.Kind() != reflect.Func { - panic(fmt.Sprintf("assert: arguments: %s is not a func", fn)) - } - if fnType.NumIn() != 1 { - panic(fmt.Sprintf("assert: arguments: %s does not take exactly one argument", fn)) - } - if fnType.NumOut() != 1 || fnType.Out(0).Kind() != reflect.Bool { - panic(fmt.Sprintf("assert: arguments: %s does not return a bool", fn)) - } - - return argumentMatcher{fn: reflect.ValueOf(fn)} -} - -// Get Returns the argument at the specified index. -func (args Arguments) Get(index int) interface{} { - if index+1 > len(args) { - panic(fmt.Sprintf("assert: arguments: Cannot call Get(%d) because there are %d argument(s).", index, len(args))) - } - return args[index] -} - -// Is gets whether the objects match the arguments specified. -func (args Arguments) Is(objects ...interface{}) bool { - for i, obj := range args { - if obj != objects[i] { - return false - } - } - return true -} - -// Diff gets a string describing the differences between the arguments -// and the specified objects. -// -// Returns the diff string and number of differences found. -func (args Arguments) Diff(objects []interface{}) (string, int) { - // TODO: could return string as error and nil for No difference - - output := "\n" - var differences int - - maxArgCount := len(args) - if len(objects) > maxArgCount { - maxArgCount = len(objects) - } - - for i := 0; i < maxArgCount; i++ { - var actual, expected interface{} - var actualFmt, expectedFmt string - - if len(objects) <= i { - actual = "(Missing)" - actualFmt = "(Missing)" - } else { - actual = objects[i] - actualFmt = fmt.Sprintf("(%[1]T=%[1]v)", actual) - } - - if len(args) <= i { - expected = "(Missing)" - expectedFmt = "(Missing)" - } else { - expected = args[i] - expectedFmt = fmt.Sprintf("(%[1]T=%[1]v)", expected) - } - - if matcher, ok := expected.(argumentMatcher); ok { - var matches bool - func() { - defer func() { - if r := recover(); r != nil { - actualFmt = fmt.Sprintf("panic in argument matcher: %v", r) - } - }() - matches = matcher.Matches(actual) - }() - if matches { - output = fmt.Sprintf("%s\t%d: PASS: %s matched by %s\n", output, i, actualFmt, matcher) - } else { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s not matched by %s\n", output, i, actualFmt, matcher) - } - } else { - switch expected := expected.(type) { - case anythingOfTypeArgument: - // type checking - if reflect.TypeOf(actual).Name() != string(expected) && reflect.TypeOf(actual).String() != string(expected) { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actualFmt) - } - case *IsTypeArgument: - actualT := reflect.TypeOf(actual) - if actualT != expected.t { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, expected.t.Name(), actualT.Name(), actualFmt) - } - case *FunctionalOptionsArgument: - var name string - if len(expected.values) > 0 { - name = "[]" + reflect.TypeOf(expected.values[0]).String() - } - - const tName = "[]interface{}" - if name != reflect.TypeOf(actual).String() && len(expected.values) != 0 { - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: type %s != type %s - %s\n", output, i, tName, reflect.TypeOf(actual).Name(), actualFmt) - } else { - if ef, af := assertOpts(expected.values, actual); ef == "" && af == "" { - // match - output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, tName, tName) - } else { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, af, ef) - } - } - - default: - if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) { - // match - output = fmt.Sprintf("%s\t%d: PASS: %s == %s\n", output, i, actualFmt, expectedFmt) - } else { - // not match - differences++ - output = fmt.Sprintf("%s\t%d: FAIL: %s != %s\n", output, i, actualFmt, expectedFmt) - } - } - } - - } - - if differences == 0 { - return "No differences.", differences - } - - return output, differences -} - -// Assert compares the arguments with the specified objects and fails if -// they do not exactly match. -func (args Arguments) Assert(t TestingT, objects ...interface{}) bool { - if h, ok := t.(tHelper); ok { - h.Helper() - } - - // get the differences - diff, diffCount := args.Diff(objects) - - if diffCount == 0 { - return true - } - - // there are differences... report them... - t.Logf(diff) - t.Errorf("%sArguments do not match.", assert.CallerInfo()) - - return false -} - -// String gets the argument at the specified index. Panics if there is no argument, or -// if the argument is of the wrong type. -// -// If no index is provided, String() returns a complete string representation -// of the arguments. -func (args Arguments) String(indexOrNil ...int) string { - if len(indexOrNil) == 0 { - // normal String() method - return a string representation of the args - var argsStr []string - for _, arg := range args { - argsStr = append(argsStr, fmt.Sprintf("%T", arg)) // handles nil nicely - } - return strings.Join(argsStr, ",") - } else if len(indexOrNil) == 1 { - // Index has been specified - get the argument at that index - index := indexOrNil[0] - var s string - var ok bool - if s, ok = args.Get(index).(string); !ok { - panic(fmt.Sprintf("assert: arguments: String(%d) failed because object wasn't correct type: %s", index, args.Get(index))) - } - return s - } - - panic(fmt.Sprintf("assert: arguments: Wrong number of arguments passed to String. Must be 0 or 1, not %d", len(indexOrNil))) -} - -// Int gets the argument at the specified index. Panics if there is no argument, or -// if the argument is of the wrong type. -func (args Arguments) Int(index int) int { - var s int - var ok bool - if s, ok = args.Get(index).(int); !ok { - panic(fmt.Sprintf("assert: arguments: Int(%d) failed because object wasn't correct type: %v", index, args.Get(index))) - } - return s -} - -// Error gets the argument at the specified index. Panics if there is no argument, or -// if the argument is of the wrong type. -func (args Arguments) Error(index int) error { - obj := args.Get(index) - var s error - var ok bool - if obj == nil { - return nil - } - if s, ok = obj.(error); !ok { - panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, obj)) - } - return s -} - -// Bool gets the argument at the specified index. Panics if there is no argument, or -// if the argument is of the wrong type. -func (args Arguments) Bool(index int) bool { - var s bool - var ok bool - if s, ok = args.Get(index).(bool); !ok { - panic(fmt.Sprintf("assert: arguments: Bool(%d) failed because object wasn't correct type: %v", index, args.Get(index))) - } - return s -} - -func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { - t := reflect.TypeOf(v) - k := t.Kind() - - if k == reflect.Ptr { - t = t.Elem() - k = t.Kind() - } - return t, k -} - -func diffArguments(expected Arguments, actual Arguments) string { - if len(expected) != len(actual) { - return fmt.Sprintf("Provided %v arguments, mocked for %v arguments", len(expected), len(actual)) - } - - for x := range expected { - if diffString := diff(expected[x], actual[x]); diffString != "" { - return fmt.Sprintf("Difference found in argument %v:\n\n%s", x, diffString) - } - } - - return "" -} - -// diff returns a diff of both values as long as both are of the same type and -// are a struct, map, slice or array. Otherwise it returns an empty string. -func diff(expected interface{}, actual interface{}) string { - if expected == nil || actual == nil { - return "" - } - - et, ek := typeAndKind(expected) - at, _ := typeAndKind(actual) - - if et != at { - return "" - } - - if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array { - return "" - } - - e := spewConfig.Sdump(expected) - a := spewConfig.Sdump(actual) - - diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ - A: difflib.SplitLines(e), - B: difflib.SplitLines(a), - FromFile: "Expected", - FromDate: "", - ToFile: "Actual", - ToDate: "", - Context: 1, - }) - - return diff -} - -var spewConfig = spew.ConfigState{ - Indent: " ", - DisablePointerAddresses: true, - DisableCapacities: true, - SortKeys: true, -} - -type tHelper interface { - Helper() -} - -func assertOpts(expected, actual interface{}) (expectedFmt, actualFmt string) { - expectedOpts := reflect.ValueOf(expected) - actualOpts := reflect.ValueOf(actual) - - var expectedFuncs []*runtime.Func - var expectedNames []string - for i := 0; i < expectedOpts.Len(); i++ { - f := runtimeFunc(expectedOpts.Index(i).Interface()) - expectedFuncs = append(expectedFuncs, f) - expectedNames = append(expectedNames, funcName(f)) - } - var actualFuncs []*runtime.Func - var actualNames []string - for i := 0; i < actualOpts.Len(); i++ { - f := runtimeFunc(actualOpts.Index(i).Interface()) - actualFuncs = append(actualFuncs, f) - actualNames = append(actualNames, funcName(f)) - } - - if expectedOpts.Len() != actualOpts.Len() { - expectedFmt = fmt.Sprintf("%v", expectedNames) - actualFmt = fmt.Sprintf("%v", actualNames) - return - } - - for i := 0; i < expectedOpts.Len(); i++ { - if !isFuncSame(expectedFuncs[i], actualFuncs[i]) { - expectedFmt = expectedNames[i] - actualFmt = actualNames[i] - return - } - - expectedOpt := expectedOpts.Index(i).Interface() - actualOpt := actualOpts.Index(i).Interface() - - ot := reflect.TypeOf(expectedOpt) - var expectedValues []reflect.Value - var actualValues []reflect.Value - if ot.NumIn() == 0 { - return - } - - for i := 0; i < ot.NumIn(); i++ { - vt := ot.In(i).Elem() - expectedValues = append(expectedValues, reflect.New(vt)) - actualValues = append(actualValues, reflect.New(vt)) - } - - reflect.ValueOf(expectedOpt).Call(expectedValues) - reflect.ValueOf(actualOpt).Call(actualValues) - - for i := 0; i < ot.NumIn(); i++ { - if expectedArg, actualArg := expectedValues[i].Interface(), actualValues[i].Interface(); !assert.ObjectsAreEqual(expectedArg, actualArg) { - expectedFmt = fmt.Sprintf("%s(%T) -> %#v", expectedNames[i], expectedArg, expectedArg) - actualFmt = fmt.Sprintf("%s(%T) -> %#v", expectedNames[i], actualArg, actualArg) - return - } - } - } - - return "", "" -} - -func runtimeFunc(opt interface{}) *runtime.Func { - return runtime.FuncForPC(reflect.ValueOf(opt).Pointer()) -} - -func funcName(f *runtime.Func) string { - name := f.Name() - trimmed := strings.TrimSuffix(path.Base(name), path.Ext(name)) - splitted := strings.Split(trimmed, ".") - - if len(splitted) == 0 { - return trimmed - } - - return splitted[len(splitted)-1] -} - -func isFuncSame(f1, f2 *runtime.Func) bool { - f1File, f1Loc := f1.FileLine(f1.Entry()) - f2File, f2Loc := f2.FileLine(f2.Entry()) - - return f1File == f2File && f1Loc == f2Loc -} diff --git a/vendor/modules.txt b/vendor/modules.txt index 7d83c30b..34f34d40 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -134,11 +134,6 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc/types github.com/aws/aws-sdk-go-v2/service/sts github.com/aws/aws-sdk-go-v2/service/sts/internal/endpoints github.com/aws/aws-sdk-go-v2/service/sts/types -# github.com/aws/aws-sdk-go-v2/service/textract v1.35.1 -## explicit; go 1.22 -github.com/aws/aws-sdk-go-v2/service/textract -github.com/aws/aws-sdk-go-v2/service/textract/internal/endpoints -github.com/aws/aws-sdk-go-v2/service/textract/types # github.com/aws/smithy-go v1.22.3 ## explicit; go 1.22 github.com/aws/smithy-go @@ -695,14 +690,10 @@ github.com/spf13/viper/internal/encoding/json github.com/spf13/viper/internal/encoding/toml github.com/spf13/viper/internal/encoding/yaml github.com/spf13/viper/internal/features -# github.com/stretchr/objx v0.5.2 -## explicit; go 1.20 -github.com/stretchr/objx # github.com/stretchr/testify v1.10.0 ## explicit; go 1.17 github.com/stretchr/testify/assert github.com/stretchr/testify/assert/yaml -github.com/stretchr/testify/mock github.com/stretchr/testify/require github.com/stretchr/testify/suite # github.com/subosito/gotenv v1.6.0