swagger part 1
This commit is contained in:
+760
-3
@@ -14,6 +14,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/oapi-codegen/nullable"
|
||||
"github.com/oapi-codegen/runtime"
|
||||
openapi_types "github.com/oapi-codegen/runtime/types"
|
||||
)
|
||||
@@ -23,6 +24,14 @@ const (
|
||||
JwtAuthScopes = "jwtAuth.Scopes"
|
||||
)
|
||||
|
||||
// Defines values for BatchStatus.
|
||||
const (
|
||||
BatchStatusCancelled BatchStatus = "cancelled"
|
||||
BatchStatusCompleted BatchStatus = "completed"
|
||||
BatchStatusFailed BatchStatus = "failed"
|
||||
BatchStatusProcessing BatchStatus = "processing"
|
||||
)
|
||||
|
||||
// Defines values for ClientStatus.
|
||||
const (
|
||||
INSYNC ClientStatus = "IN_SYNC"
|
||||
@@ -32,9 +41,9 @@ const (
|
||||
|
||||
// Defines values for ExportStatus.
|
||||
const (
|
||||
Completed ExportStatus = "completed"
|
||||
Failed ExportStatus = "failed"
|
||||
InProgress ExportStatus = "in_progress"
|
||||
ExportStatusCompleted ExportStatus = "completed"
|
||||
ExportStatusFailed ExportStatus = "failed"
|
||||
ExportStatusInProgress ExportStatus = "in_progress"
|
||||
)
|
||||
|
||||
// Defines values for FieldFilterCondition.
|
||||
@@ -55,6 +64,107 @@ const (
|
||||
JSONEXTRACTOR QueryType = "JSON_EXTRACTOR"
|
||||
)
|
||||
|
||||
// BatchID The batch upload id.
|
||||
type BatchID = openapi_types.UUID
|
||||
|
||||
// BatchStatus The status of a batch upload
|
||||
type BatchStatus string
|
||||
|
||||
// BatchUploadDetails defines model for BatchUploadDetails.
|
||||
type BatchUploadDetails struct {
|
||||
// BatchId The batch upload id.
|
||||
BatchId BatchID `json:"batch_id"`
|
||||
|
||||
// ClientId The client external id
|
||||
ClientId ClientID `json:"client_id"`
|
||||
|
||||
// CompletedAt When the batch upload completed processing
|
||||
CompletedAt nullable.Nullable[time.Time] `json:"completed_at,omitempty"`
|
||||
|
||||
// CreatedAt When the batch upload was created
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
// FailedDocuments Number of documents that failed processing
|
||||
FailedDocuments int32 `json:"failed_documents"`
|
||||
|
||||
// FailedFilenames List of filenames that failed processing
|
||||
FailedFilenames *[]string `json:"failed_filenames,omitempty"`
|
||||
|
||||
// InvalidTypeDocuments Number of non-PDF files found in archive
|
||||
InvalidTypeDocuments int32 `json:"invalid_type_documents"`
|
||||
|
||||
// OriginalFilename Original filename of the uploaded ZIP archive
|
||||
OriginalFilename string `json:"original_filename"`
|
||||
|
||||
// ProcessedDocuments Number of documents processed so far
|
||||
ProcessedDocuments int32 `json:"processed_documents"`
|
||||
|
||||
// ProgressPercent Processing progress percentage
|
||||
ProgressPercent int32 `json:"progress_percent"`
|
||||
|
||||
// Status The status of a batch upload
|
||||
Status BatchStatus `json:"status"`
|
||||
|
||||
// TotalDocuments Total number of documents in the batch
|
||||
TotalDocuments int32 `json:"total_documents"`
|
||||
}
|
||||
|
||||
// BatchUploadList List of batch uploads for a client
|
||||
type BatchUploadList struct {
|
||||
Batches []BatchUploadSummary `json:"batches"`
|
||||
|
||||
// TotalCount Total number of batches for this client
|
||||
TotalCount int32 `json:"total_count"`
|
||||
}
|
||||
|
||||
// BatchUploadResponse Response returned when a batch upload is accepted for processing
|
||||
type BatchUploadResponse struct {
|
||||
// BatchId The batch upload id.
|
||||
BatchId BatchID `json:"batch_id"`
|
||||
|
||||
// Status The status of a batch upload
|
||||
Status BatchStatus `json:"status"`
|
||||
|
||||
// StatusUrl URL to check batch status
|
||||
StatusUrl string `json:"status_url"`
|
||||
}
|
||||
|
||||
// BatchUploadSummary Summary information about a batch upload
|
||||
type BatchUploadSummary struct {
|
||||
// BatchId The batch upload id.
|
||||
BatchId BatchID `json:"batch_id"`
|
||||
|
||||
// ClientId The client external id
|
||||
ClientId ClientID `json:"client_id"`
|
||||
|
||||
// CompletedAt When the batch upload completed processing
|
||||
CompletedAt nullable.Nullable[time.Time] `json:"completed_at,omitempty"`
|
||||
|
||||
// CreatedAt When the batch upload was created
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
|
||||
// FailedDocuments Number of documents that failed processing
|
||||
FailedDocuments int32 `json:"failed_documents"`
|
||||
|
||||
// InvalidTypeDocuments Number of non-PDF files found in archive
|
||||
InvalidTypeDocuments int32 `json:"invalid_type_documents"`
|
||||
|
||||
// OriginalFilename Original filename of the uploaded ZIP archive
|
||||
OriginalFilename string `json:"original_filename"`
|
||||
|
||||
// ProcessedDocuments Number of documents processed so far
|
||||
ProcessedDocuments int32 `json:"processed_documents"`
|
||||
|
||||
// ProgressPercent Processing progress percentage
|
||||
ProgressPercent int32 `json:"progress_percent"`
|
||||
|
||||
// Status The status of a batch upload
|
||||
Status BatchStatus `json:"status"`
|
||||
|
||||
// TotalDocuments Total number of documents in the batch
|
||||
TotalDocuments int32 `json:"total_documents"`
|
||||
}
|
||||
|
||||
// ClientCanSync If the client is allowing active syncs
|
||||
type ClientCanSync = bool
|
||||
|
||||
@@ -343,6 +453,9 @@ type InternalError = ErrorMessage
|
||||
// InvalidRequest Description of error
|
||||
type InvalidRequest = ErrorMessage
|
||||
|
||||
// NotFound Description of error
|
||||
type NotFound = ErrorMessage
|
||||
|
||||
// TooManyRequests Description of error
|
||||
type TooManyRequests = ErrorMessage
|
||||
|
||||
@@ -358,6 +471,21 @@ type UploadDocumentMultipartBody struct {
|
||||
Filename *string `json:"filename,omitempty"`
|
||||
}
|
||||
|
||||
// ListDocumentBatchesParams defines parameters for ListDocumentBatches.
|
||||
type ListDocumentBatchesParams struct {
|
||||
// Limit Maximum number of items to return
|
||||
Limit *int32 `form:"limit,omitempty" json:"limit,omitempty"`
|
||||
|
||||
// Offset Number of items to skip
|
||||
Offset *int32 `form:"offset,omitempty" json:"offset,omitempty"`
|
||||
}
|
||||
|
||||
// UploadDocumentBatchMultipartBody defines parameters for UploadDocumentBatch.
|
||||
type UploadDocumentBatchMultipartBody struct {
|
||||
// Archive The file to be uploaded as a ZIP archive
|
||||
Archive openapi_types.File `json:"archive"`
|
||||
}
|
||||
|
||||
// LoginCallbackParams defines parameters for LoginCallback.
|
||||
type LoginCallbackParams struct {
|
||||
// Code Authorization code from Cognito
|
||||
@@ -379,6 +507,9 @@ type SetCollectorByClientIdJSONRequestBody = CollectorSet
|
||||
// UploadDocumentMultipartRequestBody defines body for UploadDocument for multipart/form-data ContentType.
|
||||
type UploadDocumentMultipartRequestBody UploadDocumentMultipartBody
|
||||
|
||||
// UploadDocumentBatchMultipartRequestBody defines body for UploadDocumentBatch for multipart/form-data ContentType.
|
||||
type UploadDocumentBatchMultipartRequestBody UploadDocumentBatchMultipartBody
|
||||
|
||||
// TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType.
|
||||
type TriggerExportJSONRequestBody = ExportTrigger
|
||||
|
||||
@@ -491,6 +622,18 @@ type ClientInterface interface {
|
||||
// UploadDocumentWithBody request with any body
|
||||
UploadDocumentWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// ListDocumentBatches request
|
||||
ListDocumentBatches(ctx context.Context, id ClientID, params *ListDocumentBatchesParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// UploadDocumentBatchWithBody request with any body
|
||||
UploadDocumentBatchWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// CancelDocumentBatch request
|
||||
CancelDocumentBatch(ctx context.Context, id ClientID, batchId BatchID, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// GetDocumentBatch request
|
||||
GetDocumentBatch(ctx context.Context, id ClientID, batchId BatchID, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// TriggerExportWithBody request with any body
|
||||
TriggerExportWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
@@ -659,6 +802,54 @@ func (c *Client) UploadDocumentWithBody(ctx context.Context, id ClientID, conten
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) ListDocumentBatches(ctx context.Context, id ClientID, params *ListDocumentBatchesParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewListDocumentBatchesRequest(c.Server, id, params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req = req.WithContext(ctx)
|
||||
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) UploadDocumentBatchWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewUploadDocumentBatchRequestWithBody(c.Server, id, contentType, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req = req.WithContext(ctx)
|
||||
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) CancelDocumentBatch(ctx context.Context, id ClientID, batchId BatchID, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewCancelDocumentBatchRequest(c.Server, id, batchId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req = req.WithContext(ctx)
|
||||
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) GetDocumentBatch(ctx context.Context, id ClientID, batchId BatchID, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewGetDocumentBatchRequest(c.Server, id, batchId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req = req.WithContext(ctx)
|
||||
if err := c.applyEditors(ctx, req, reqEditors); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) TriggerExportWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewTriggerExportRequestWithBody(c.Server, id, contentType, body)
|
||||
if err != nil {
|
||||
@@ -1135,6 +1326,196 @@ func NewUploadDocumentRequestWithBody(server string, id ClientID, contentType st
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewListDocumentBatchesRequest generates requests for ListDocumentBatches
|
||||
func NewListDocumentBatchesRequest(server string, id ClientID, params *ListDocumentBatchesParams) (*http.Request, error) {
|
||||
var err error
|
||||
|
||||
var pathParam0 string
|
||||
|
||||
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
serverURL, err := url.Parse(server)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
operationPath := fmt.Sprintf("/client/%s/document/batch", pathParam0)
|
||||
if operationPath[0] == '/' {
|
||||
operationPath = "." + operationPath
|
||||
}
|
||||
|
||||
queryURL, err := serverURL.Parse(operationPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if params != nil {
|
||||
queryValues := queryURL.Query()
|
||||
|
||||
if params.Limit != nil {
|
||||
|
||||
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "limit", runtime.ParamLocationQuery, *params.Limit); err != nil {
|
||||
return nil, err
|
||||
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
for k, v := range parsed {
|
||||
for _, v2 := range v {
|
||||
queryValues.Add(k, v2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if params.Offset != nil {
|
||||
|
||||
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "offset", runtime.ParamLocationQuery, *params.Offset); err != nil {
|
||||
return nil, err
|
||||
} else if parsed, err := url.ParseQuery(queryFrag); err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
for k, v := range parsed {
|
||||
for _, v2 := range v {
|
||||
queryValues.Add(k, v2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
queryURL.RawQuery = queryValues.Encode()
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewUploadDocumentBatchRequestWithBody generates requests for UploadDocumentBatch with any type of body
|
||||
func NewUploadDocumentBatchRequestWithBody(server string, id ClientID, contentType string, body io.Reader) (*http.Request, error) {
|
||||
var err error
|
||||
|
||||
var pathParam0 string
|
||||
|
||||
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
serverURL, err := url.Parse(server)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
operationPath := fmt.Sprintf("/client/%s/document/batch", pathParam0)
|
||||
if operationPath[0] == '/' {
|
||||
operationPath = "." + operationPath
|
||||
}
|
||||
|
||||
queryURL, err := serverURL.Parse(operationPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("POST", queryURL.String(), body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req.Header.Add("Content-Type", contentType)
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewCancelDocumentBatchRequest generates requests for CancelDocumentBatch
|
||||
func NewCancelDocumentBatchRequest(server string, id ClientID, batchId BatchID) (*http.Request, error) {
|
||||
var err error
|
||||
|
||||
var pathParam0 string
|
||||
|
||||
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var pathParam1 string
|
||||
|
||||
pathParam1, err = runtime.StyleParamWithLocation("simple", false, "batch_id", runtime.ParamLocationPath, batchId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
serverURL, err := url.Parse(server)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
operationPath := fmt.Sprintf("/client/%s/document/batch/%s", pathParam0, pathParam1)
|
||||
if operationPath[0] == '/' {
|
||||
operationPath = "." + operationPath
|
||||
}
|
||||
|
||||
queryURL, err := serverURL.Parse(operationPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("DELETE", queryURL.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewGetDocumentBatchRequest generates requests for GetDocumentBatch
|
||||
func NewGetDocumentBatchRequest(server string, id ClientID, batchId BatchID) (*http.Request, error) {
|
||||
var err error
|
||||
|
||||
var pathParam0 string
|
||||
|
||||
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "id", runtime.ParamLocationPath, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var pathParam1 string
|
||||
|
||||
pathParam1, err = runtime.StyleParamWithLocation("simple", false, "batch_id", runtime.ParamLocationPath, batchId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
serverURL, err := url.Parse(server)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
operationPath := fmt.Sprintf("/client/%s/document/batch/%s", pathParam0, pathParam1)
|
||||
if operationPath[0] == '/' {
|
||||
operationPath = "." + operationPath
|
||||
}
|
||||
|
||||
queryURL, err := serverURL.Parse(operationPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("GET", queryURL.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewTriggerExportRequest calls the generic TriggerExport builder with application/json body
|
||||
func NewTriggerExportRequest(server string, id ClientID, body TriggerExportJSONRequestBody) (*http.Request, error) {
|
||||
var bodyReader io.Reader
|
||||
@@ -1687,6 +2068,18 @@ type ClientWithResponsesInterface interface {
|
||||
// UploadDocumentWithBodyWithResponse request with any body
|
||||
UploadDocumentWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadDocumentResponse, error)
|
||||
|
||||
// ListDocumentBatchesWithResponse request
|
||||
ListDocumentBatchesWithResponse(ctx context.Context, id ClientID, params *ListDocumentBatchesParams, reqEditors ...RequestEditorFn) (*ListDocumentBatchesResponse, error)
|
||||
|
||||
// UploadDocumentBatchWithBodyWithResponse request with any body
|
||||
UploadDocumentBatchWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadDocumentBatchResponse, error)
|
||||
|
||||
// CancelDocumentBatchWithResponse request
|
||||
CancelDocumentBatchWithResponse(ctx context.Context, id ClientID, batchId BatchID, reqEditors ...RequestEditorFn) (*CancelDocumentBatchResponse, error)
|
||||
|
||||
// GetDocumentBatchWithResponse request
|
||||
GetDocumentBatchWithResponse(ctx context.Context, id ClientID, batchId BatchID, reqEditors ...RequestEditorFn) (*GetDocumentBatchResponse, error)
|
||||
|
||||
// TriggerExportWithBodyWithResponse request with any body
|
||||
TriggerExportWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error)
|
||||
|
||||
@@ -1914,6 +2307,111 @@ func (r UploadDocumentResponse) StatusCode() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
type ListDocumentBatchesResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
JSON200 *BatchUploadList
|
||||
JSON400 *InvalidRequest
|
||||
JSON401 *Unauthorized
|
||||
JSON429 *TooManyRequests
|
||||
JSON500 *InternalError
|
||||
}
|
||||
|
||||
// Status returns HTTPResponse.Status
|
||||
func (r ListDocumentBatchesResponse) Status() string {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.Status
|
||||
}
|
||||
return http.StatusText(0)
|
||||
}
|
||||
|
||||
// StatusCode returns HTTPResponse.StatusCode
|
||||
func (r ListDocumentBatchesResponse) StatusCode() int {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.StatusCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type UploadDocumentBatchResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
JSON202 *BatchUploadResponse
|
||||
JSON400 *InvalidRequest
|
||||
JSON401 *Unauthorized
|
||||
JSON429 *TooManyRequests
|
||||
JSON500 *InternalError
|
||||
}
|
||||
|
||||
// Status returns HTTPResponse.Status
|
||||
func (r UploadDocumentBatchResponse) Status() string {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.Status
|
||||
}
|
||||
return http.StatusText(0)
|
||||
}
|
||||
|
||||
// StatusCode returns HTTPResponse.StatusCode
|
||||
func (r UploadDocumentBatchResponse) StatusCode() int {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.StatusCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type CancelDocumentBatchResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
JSON400 *InvalidRequest
|
||||
JSON401 *Unauthorized
|
||||
JSON404 *NotFound
|
||||
JSON429 *TooManyRequests
|
||||
JSON500 *InternalError
|
||||
}
|
||||
|
||||
// Status returns HTTPResponse.Status
|
||||
func (r CancelDocumentBatchResponse) Status() string {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.Status
|
||||
}
|
||||
return http.StatusText(0)
|
||||
}
|
||||
|
||||
// StatusCode returns HTTPResponse.StatusCode
|
||||
func (r CancelDocumentBatchResponse) StatusCode() int {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.StatusCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetDocumentBatchResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
JSON200 *BatchUploadDetails
|
||||
JSON400 *InvalidRequest
|
||||
JSON401 *Unauthorized
|
||||
JSON404 *NotFound
|
||||
JSON429 *TooManyRequests
|
||||
JSON500 *InternalError
|
||||
}
|
||||
|
||||
// Status returns HTTPResponse.Status
|
||||
func (r GetDocumentBatchResponse) Status() string {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.Status
|
||||
}
|
||||
return http.StatusText(0)
|
||||
}
|
||||
|
||||
// StatusCode returns HTTPResponse.StatusCode
|
||||
func (r GetDocumentBatchResponse) StatusCode() int {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.StatusCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type TriggerExportResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
@@ -2334,6 +2832,42 @@ func (c *ClientWithResponses) UploadDocumentWithBodyWithResponse(ctx context.Con
|
||||
return ParseUploadDocumentResponse(rsp)
|
||||
}
|
||||
|
||||
// ListDocumentBatchesWithResponse request returning *ListDocumentBatchesResponse
|
||||
func (c *ClientWithResponses) ListDocumentBatchesWithResponse(ctx context.Context, id ClientID, params *ListDocumentBatchesParams, reqEditors ...RequestEditorFn) (*ListDocumentBatchesResponse, error) {
|
||||
rsp, err := c.ListDocumentBatches(ctx, id, params, reqEditors...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseListDocumentBatchesResponse(rsp)
|
||||
}
|
||||
|
||||
// UploadDocumentBatchWithBodyWithResponse request with arbitrary body returning *UploadDocumentBatchResponse
|
||||
func (c *ClientWithResponses) UploadDocumentBatchWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadDocumentBatchResponse, error) {
|
||||
rsp, err := c.UploadDocumentBatchWithBody(ctx, id, contentType, body, reqEditors...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseUploadDocumentBatchResponse(rsp)
|
||||
}
|
||||
|
||||
// CancelDocumentBatchWithResponse request returning *CancelDocumentBatchResponse
|
||||
func (c *ClientWithResponses) CancelDocumentBatchWithResponse(ctx context.Context, id ClientID, batchId BatchID, reqEditors ...RequestEditorFn) (*CancelDocumentBatchResponse, error) {
|
||||
rsp, err := c.CancelDocumentBatch(ctx, id, batchId, reqEditors...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseCancelDocumentBatchResponse(rsp)
|
||||
}
|
||||
|
||||
// GetDocumentBatchWithResponse request returning *GetDocumentBatchResponse
|
||||
func (c *ClientWithResponses) GetDocumentBatchWithResponse(ctx context.Context, id ClientID, batchId BatchID, reqEditors ...RequestEditorFn) (*GetDocumentBatchResponse, error) {
|
||||
rsp, err := c.GetDocumentBatch(ctx, id, batchId, reqEditors...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseGetDocumentBatchResponse(rsp)
|
||||
}
|
||||
|
||||
// TriggerExportWithBodyWithResponse request with arbitrary body returning *TriggerExportResponse
|
||||
func (c *ClientWithResponses) TriggerExportWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) {
|
||||
rsp, err := c.TriggerExportWithBody(ctx, id, contentType, body, reqEditors...)
|
||||
@@ -2840,6 +3374,229 @@ func ParseUploadDocumentResponse(rsp *http.Response) (*UploadDocumentResponse, e
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ParseListDocumentBatchesResponse parses an HTTP response from a ListDocumentBatchesWithResponse call
|
||||
func ParseListDocumentBatchesResponse(rsp *http.Response) (*ListDocumentBatchesResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
defer func() { _ = rsp.Body.Close() }()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := &ListDocumentBatchesResponse{
|
||||
Body: bodyBytes,
|
||||
HTTPResponse: rsp,
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
||||
var dest BatchUploadList
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON200 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
|
||||
var dest InvalidRequest
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON400 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
|
||||
var dest Unauthorized
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON401 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429:
|
||||
var dest TooManyRequests
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON429 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
|
||||
var dest InternalError
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON500 = &dest
|
||||
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ParseUploadDocumentBatchResponse parses an HTTP response from a UploadDocumentBatchWithResponse call
|
||||
func ParseUploadDocumentBatchResponse(rsp *http.Response) (*UploadDocumentBatchResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
defer func() { _ = rsp.Body.Close() }()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := &UploadDocumentBatchResponse{
|
||||
Body: bodyBytes,
|
||||
HTTPResponse: rsp,
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 202:
|
||||
var dest BatchUploadResponse
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON202 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
|
||||
var dest InvalidRequest
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON400 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
|
||||
var dest Unauthorized
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON401 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429:
|
||||
var dest TooManyRequests
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON429 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
|
||||
var dest InternalError
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON500 = &dest
|
||||
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ParseCancelDocumentBatchResponse parses an HTTP response from a CancelDocumentBatchWithResponse call
|
||||
func ParseCancelDocumentBatchResponse(rsp *http.Response) (*CancelDocumentBatchResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
defer func() { _ = rsp.Body.Close() }()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := &CancelDocumentBatchResponse{
|
||||
Body: bodyBytes,
|
||||
HTTPResponse: rsp,
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
|
||||
var dest InvalidRequest
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON400 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
|
||||
var dest Unauthorized
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON401 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
|
||||
var dest NotFound
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON404 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429:
|
||||
var dest TooManyRequests
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON429 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
|
||||
var dest InternalError
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON500 = &dest
|
||||
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ParseGetDocumentBatchResponse parses an HTTP response from a GetDocumentBatchWithResponse call
|
||||
func ParseGetDocumentBatchResponse(rsp *http.Response) (*GetDocumentBatchResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
defer func() { _ = rsp.Body.Close() }()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := &GetDocumentBatchResponse{
|
||||
Body: bodyBytes,
|
||||
HTTPResponse: rsp,
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
||||
var dest BatchUploadDetails
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON200 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400:
|
||||
var dest InvalidRequest
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON400 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401:
|
||||
var dest Unauthorized
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON401 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404:
|
||||
var dest NotFound
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON404 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 429:
|
||||
var dest TooManyRequests
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON429 = &dest
|
||||
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500:
|
||||
var dest InternalError
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON500 = &dest
|
||||
|
||||
}
|
||||
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ParseTriggerExportResponse parses an HTTP response from a TriggerExportWithResponse call
|
||||
func ParseTriggerExportResponse(rsp *http.Response) (*TriggerExportResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
|
||||
Reference in New Issue
Block a user