Merged in feature/import (pull request #157)

Feature/import

* importstart

* pp

* tests

* importtests

* 100GB

* lint

* passtests

* utc

* awsprofile

* doublequotes

* host
This commit is contained in:
Michael McGuinness
2025-05-27 15:28:46 +00:00
parent 46882da5f5
commit cc2278086f
74 changed files with 992 additions and 4753 deletions
+148 -1
View File
@@ -349,6 +349,15 @@ type TooManyRequests = ErrorMessage
// Unauthorized Description of error
type Unauthorized = ErrorMessage
// UploadDocumentMultipartBody defines parameters for UploadDocument.
type UploadDocumentMultipartBody struct {
// File The file to upload
File openapi_types.File `json:"file"`
// Filename Optional custom filename
Filename *string `json:"filename,omitempty"`
}
// LoginCallbackParams defines parameters for LoginCallback.
type LoginCallbackParams struct {
// Code Authorization code from Cognito
@@ -367,6 +376,9 @@ type UpdateClientJSONRequestBody = ClientUpdate
// SetCollectorByClientIdJSONRequestBody defines body for SetCollectorByClientId for application/json ContentType.
type SetCollectorByClientIdJSONRequestBody = CollectorSet
// UploadDocumentMultipartRequestBody defines body for UploadDocument for multipart/form-data ContentType.
type UploadDocumentMultipartRequestBody UploadDocumentMultipartBody
// TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType.
type TriggerExportJSONRequestBody = ExportTrigger
@@ -476,6 +488,9 @@ type ClientInterface interface {
// ListDocumentsByClientId request
ListDocumentsByClientId(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error)
// UploadDocumentWithBody request with any body
UploadDocumentWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, 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)
@@ -632,6 +647,18 @@ func (c *Client) ListDocumentsByClientId(ctx context.Context, id ClientID, reqEd
return c.Client.Do(req)
}
func (c *Client) UploadDocumentWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
req, err := NewUploadDocumentRequestWithBody(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) 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 {
@@ -1054,7 +1081,7 @@ func NewListDocumentsByClientIdRequest(server string, id ClientID) (*http.Reques
return nil, err
}
operationPath := fmt.Sprintf("/client/%s/documents", pathParam0)
operationPath := fmt.Sprintf("/client/%s/document", pathParam0)
if operationPath[0] == '/' {
operationPath = "." + operationPath
}
@@ -1072,6 +1099,42 @@ func NewListDocumentsByClientIdRequest(server string, id ClientID) (*http.Reques
return req, nil
}
// NewUploadDocumentRequestWithBody generates requests for UploadDocument with any type of body
func NewUploadDocumentRequestWithBody(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", 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
}
// 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
@@ -1621,6 +1684,9 @@ type ClientWithResponsesInterface interface {
// ListDocumentsByClientIdWithResponse request
ListDocumentsByClientIdWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*ListDocumentsByClientIdResponse, error)
// UploadDocumentWithBodyWithResponse request with any body
UploadDocumentWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadDocumentResponse, error)
// TriggerExportWithBodyWithResponse request with any body
TriggerExportWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error)
@@ -1823,6 +1889,31 @@ func (r ListDocumentsByClientIdResponse) StatusCode() int {
return 0
}
type UploadDocumentResponse struct {
Body []byte
HTTPResponse *http.Response
JSON400 *InvalidRequest
JSON401 *Unauthorized
JSON429 *TooManyRequests
JSON500 *InternalError
}
// Status returns HTTPResponse.Status
func (r UploadDocumentResponse) Status() string {
if r.HTTPResponse != nil {
return r.HTTPResponse.Status
}
return http.StatusText(0)
}
// StatusCode returns HTTPResponse.StatusCode
func (r UploadDocumentResponse) StatusCode() int {
if r.HTTPResponse != nil {
return r.HTTPResponse.StatusCode
}
return 0
}
type TriggerExportResponse struct {
Body []byte
HTTPResponse *http.Response
@@ -2234,6 +2325,15 @@ func (c *ClientWithResponses) ListDocumentsByClientIdWithResponse(ctx context.Co
return ParseListDocumentsByClientIdResponse(rsp)
}
// UploadDocumentWithBodyWithResponse request with arbitrary body returning *UploadDocumentResponse
func (c *ClientWithResponses) UploadDocumentWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadDocumentResponse, error) {
rsp, err := c.UploadDocumentWithBody(ctx, id, contentType, body, reqEditors...)
if err != nil {
return nil, err
}
return ParseUploadDocumentResponse(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...)
@@ -2693,6 +2793,53 @@ func ParseListDocumentsByClientIdResponse(rsp *http.Response) (*ListDocumentsByC
return response, nil
}
// ParseUploadDocumentResponse parses an HTTP response from a UploadDocumentWithResponse call
func ParseUploadDocumentResponse(rsp *http.Response) (*UploadDocumentResponse, error) {
bodyBytes, err := io.ReadAll(rsp.Body)
defer func() { _ = rsp.Body.Close() }()
if err != nil {
return nil, err
}
response := &UploadDocumentResponse{
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 == 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)