Merged in feature/add-deletes (pull request #214)
support delete for client, document and folder * support delete for client, document and folder * remove batch cancel conflict not used Approved-by: Jacob Mathison
This commit is contained in:
+585
-148
@@ -532,6 +532,18 @@ type CollectorSet struct {
|
||||
MinimumCleanerVersion *CodeVersion `json:"minimum_cleaner_version,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteResponse Response for hard-delete operations when verbose=true
|
||||
type DeleteResponse struct {
|
||||
// DeletedDocuments S3 paths of orphaned source documents (only populated when verbose=true)
|
||||
DeletedDocuments []struct {
|
||||
// DocumentId ID of the deleted document
|
||||
DocumentId openapi_types.UUID `json:"documentId"`
|
||||
|
||||
// S3Path Full S3 path (s3://bucket/key) of the orphaned source file
|
||||
S3Path string `json:"s3Path"`
|
||||
} `json:"deletedDocuments"`
|
||||
}
|
||||
|
||||
// DocClient The properties of a client.
|
||||
type DocClient struct {
|
||||
// CanSync If the client is allowing active syncs
|
||||
@@ -1291,6 +1303,15 @@ type DeleteAdminUserParams struct {
|
||||
Confirm bool `form:"confirm" json:"confirm"`
|
||||
}
|
||||
|
||||
// DeleteClientParams defines parameters for DeleteClient.
|
||||
type DeleteClientParams struct {
|
||||
// Confirm Must be set to true to confirm deletion
|
||||
Confirm bool `form:"confirm" json:"confirm"`
|
||||
|
||||
// Verbose When true, returns S3 paths of orphaned source documents in the response body
|
||||
Verbose *bool `form:"verbose,omitempty" json:"verbose,omitempty"`
|
||||
}
|
||||
|
||||
// UploadDocumentMultipartBody defines parameters for UploadDocument.
|
||||
type UploadDocumentMultipartBody struct {
|
||||
// File The file to upload
|
||||
@@ -1322,6 +1343,12 @@ type ListClientFoldersParams struct {
|
||||
Metrics *bool `form:"metrics,omitempty" json:"metrics,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteDocumentParams defines parameters for DeleteDocument.
|
||||
type DeleteDocumentParams struct {
|
||||
// Verbose When true, returns S3 paths of orphaned source documents in the response body
|
||||
Verbose *bool `form:"verbose,omitempty" json:"verbose,omitempty"`
|
||||
}
|
||||
|
||||
// GetDocumentParams defines parameters for GetDocument.
|
||||
type GetDocumentParams struct {
|
||||
// TextRecord When true, includes the full text extraction record in the response
|
||||
@@ -1349,6 +1376,15 @@ type GetFieldExtractionByVersionParams struct {
|
||||
Version int64 `form:"version" json:"version"`
|
||||
}
|
||||
|
||||
// DeleteFolderParams defines parameters for DeleteFolder.
|
||||
type DeleteFolderParams struct {
|
||||
// IncludeDocuments When true, also deletes all documents in the folder tree
|
||||
IncludeDocuments *bool `form:"include_documents,omitempty" json:"include_documents,omitempty"`
|
||||
|
||||
// Verbose When true, returns S3 paths of orphaned source documents in the response body
|
||||
Verbose *bool `form:"verbose,omitempty" json:"verbose,omitempty"`
|
||||
}
|
||||
|
||||
// GetFolderDocumentsParams defines parameters for GetFolderDocuments.
|
||||
type GetFolderDocumentsParams struct {
|
||||
// TextRecord When true, includes the full text extraction record for each document
|
||||
@@ -1543,6 +1579,9 @@ type ClientInterface interface {
|
||||
|
||||
CreateClient(ctx context.Context, body CreateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// DeleteClient request
|
||||
DeleteClient(ctx context.Context, id ClientID, params *DeleteClientParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// GetClient request
|
||||
GetClient(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
@@ -1571,9 +1610,6 @@ type ClientInterface interface {
|
||||
// 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)
|
||||
|
||||
@@ -1591,6 +1627,9 @@ type ClientInterface interface {
|
||||
// ListClients request
|
||||
ListClients(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// DeleteDocument request
|
||||
DeleteDocument(ctx context.Context, id DocumentID, params *DeleteDocumentParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// GetDocument request
|
||||
GetDocument(ctx context.Context, id DocumentID, params *GetDocumentParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
@@ -1633,6 +1672,9 @@ type ClientInterface interface {
|
||||
|
||||
CreateFolder(ctx context.Context, body CreateFolderJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// DeleteFolder request
|
||||
DeleteFolder(ctx context.Context, folderId openapi_types.UUID, params *DeleteFolderParams, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
// RenameFolderWithBody request with any body
|
||||
RenameFolderWithBody(ctx context.Context, folderId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||||
|
||||
@@ -1915,6 +1957,18 @@ func (c *Client) CreateClient(ctx context.Context, body CreateClientJSONRequestB
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) DeleteClient(ctx context.Context, id ClientID, params *DeleteClientParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewDeleteClientRequest(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) GetClient(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewGetClientRequest(c.Server, id)
|
||||
if err != nil {
|
||||
@@ -2035,18 +2089,6 @@ func (c *Client) UploadDocumentBatchWithBody(ctx context.Context, id ClientID, c
|
||||
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 {
|
||||
@@ -2119,6 +2161,18 @@ func (c *Client) ListClients(ctx context.Context, reqEditors ...RequestEditorFn)
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) DeleteDocument(ctx context.Context, id DocumentID, params *DeleteDocumentParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewDeleteDocumentRequest(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) GetDocument(ctx context.Context, id DocumentID, params *GetDocumentParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewGetDocumentRequest(c.Server, id, params)
|
||||
if err != nil {
|
||||
@@ -2299,6 +2353,18 @@ func (c *Client) CreateFolder(ctx context.Context, body CreateFolderJSONRequestB
|
||||
return c.Client.Do(req)
|
||||
}
|
||||
|
||||
func (c *Client) DeleteFolder(ctx context.Context, folderId openapi_types.UUID, params *DeleteFolderParams, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewDeleteFolderRequest(c.Server, folderId, 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) RenameFolderWithBody(ctx context.Context, folderId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||||
req, err := NewRenameFolderRequestWithBody(c.Server, folderId, contentType, body)
|
||||
if err != nil {
|
||||
@@ -3277,6 +3343,74 @@ func NewCreateClientRequestWithBody(server string, contentType string, body io.R
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewDeleteClientRequest generates requests for DeleteClient
|
||||
func NewDeleteClientRequest(server string, id ClientID, params *DeleteClientParams) (*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", pathParam0)
|
||||
if operationPath[0] == '/' {
|
||||
operationPath = "." + operationPath
|
||||
}
|
||||
|
||||
queryURL, err := serverURL.Parse(operationPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if params != nil {
|
||||
queryValues := queryURL.Query()
|
||||
|
||||
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "confirm", runtime.ParamLocationQuery, params.Confirm); 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.Verbose != nil {
|
||||
|
||||
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "verbose", runtime.ParamLocationQuery, *params.Verbose); 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("DELETE", queryURL.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewGetClientRequest generates requests for GetClient
|
||||
func NewGetClientRequest(server string, id ClientID) (*http.Request, error) {
|
||||
var err error
|
||||
@@ -3617,47 +3751,6 @@ func NewUploadDocumentBatchRequestWithBody(server string, id ClientID, contentTy
|
||||
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
|
||||
@@ -3863,6 +3956,62 @@ func NewListClientsRequest(server string) (*http.Request, error) {
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewDeleteDocumentRequest generates requests for DeleteDocument
|
||||
func NewDeleteDocumentRequest(server string, id DocumentID, params *DeleteDocumentParams) (*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("/document/%s", 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.Verbose != nil {
|
||||
|
||||
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "verbose", runtime.ParamLocationQuery, *params.Verbose); 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("DELETE", queryURL.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewGetDocumentRequest generates requests for GetDocument
|
||||
func NewGetDocumentRequest(server string, id DocumentID, params *GetDocumentParams) (*http.Request, error) {
|
||||
var err error
|
||||
@@ -4342,6 +4491,78 @@ func NewCreateFolderRequestWithBody(server string, contentType string, body io.R
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewDeleteFolderRequest generates requests for DeleteFolder
|
||||
func NewDeleteFolderRequest(server string, folderId openapi_types.UUID, params *DeleteFolderParams) (*http.Request, error) {
|
||||
var err error
|
||||
|
||||
var pathParam0 string
|
||||
|
||||
pathParam0, err = runtime.StyleParamWithLocation("simple", false, "folderId", runtime.ParamLocationPath, folderId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
serverURL, err := url.Parse(server)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
operationPath := fmt.Sprintf("/folders/%s", 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.IncludeDocuments != nil {
|
||||
|
||||
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "include_documents", runtime.ParamLocationQuery, *params.IncludeDocuments); 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.Verbose != nil {
|
||||
|
||||
if queryFrag, err := runtime.StyleParamWithLocation("form", true, "verbose", runtime.ParamLocationQuery, *params.Verbose); 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("DELETE", queryURL.String(), nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return req, nil
|
||||
}
|
||||
|
||||
// NewRenameFolderRequest calls the generic RenameFolder builder with application/json body
|
||||
func NewRenameFolderRequest(server string, folderId openapi_types.UUID, body RenameFolderJSONRequestBody) (*http.Request, error) {
|
||||
var bodyReader io.Reader
|
||||
@@ -4797,6 +5018,9 @@ type ClientWithResponsesInterface interface {
|
||||
|
||||
CreateClientWithResponse(ctx context.Context, body CreateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateClientResponse, error)
|
||||
|
||||
// DeleteClientWithResponse request
|
||||
DeleteClientWithResponse(ctx context.Context, id ClientID, params *DeleteClientParams, reqEditors ...RequestEditorFn) (*DeleteClientResponse, error)
|
||||
|
||||
// GetClientWithResponse request
|
||||
GetClientWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*GetClientResponse, error)
|
||||
|
||||
@@ -4825,9 +5049,6 @@ type ClientWithResponsesInterface interface {
|
||||
// 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)
|
||||
|
||||
@@ -4845,6 +5066,9 @@ type ClientWithResponsesInterface interface {
|
||||
// ListClientsWithResponse request
|
||||
ListClientsWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListClientsResponse, error)
|
||||
|
||||
// DeleteDocumentWithResponse request
|
||||
DeleteDocumentWithResponse(ctx context.Context, id DocumentID, params *DeleteDocumentParams, reqEditors ...RequestEditorFn) (*DeleteDocumentResponse, error)
|
||||
|
||||
// GetDocumentWithResponse request
|
||||
GetDocumentWithResponse(ctx context.Context, id DocumentID, params *GetDocumentParams, reqEditors ...RequestEditorFn) (*GetDocumentResponse, error)
|
||||
|
||||
@@ -4887,6 +5111,9 @@ type ClientWithResponsesInterface interface {
|
||||
|
||||
CreateFolderWithResponse(ctx context.Context, body CreateFolderJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateFolderResponse, error)
|
||||
|
||||
// DeleteFolderWithResponse request
|
||||
DeleteFolderWithResponse(ctx context.Context, folderId openapi_types.UUID, params *DeleteFolderParams, reqEditors ...RequestEditorFn) (*DeleteFolderResponse, error)
|
||||
|
||||
// RenameFolderWithBodyWithResponse request with any body
|
||||
RenameFolderWithBodyWithResponse(ctx context.Context, folderId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RenameFolderResponse, error)
|
||||
|
||||
@@ -5362,6 +5589,33 @@ func (r CreateClientResponse) StatusCode() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
type DeleteClientResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
JSON200 *DeleteResponse
|
||||
JSON400 *InvalidRequest
|
||||
JSON401 *Unauthorized
|
||||
JSON404 *NotFound
|
||||
JSON429 *TooManyRequests
|
||||
JSON500 *InternalError
|
||||
}
|
||||
|
||||
// Status returns HTTPResponse.Status
|
||||
func (r DeleteClientResponse) Status() string {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.Status
|
||||
}
|
||||
return http.StatusText(0)
|
||||
}
|
||||
|
||||
// StatusCode returns HTTPResponse.StatusCode
|
||||
func (r DeleteClientResponse) StatusCode() int {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.StatusCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetClientResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
@@ -5567,32 +5821,6 @@ func (r UploadDocumentBatchResponse) StatusCode() int {
|
||||
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
|
||||
@@ -5725,6 +5953,33 @@ func (r ListClientsResponse) StatusCode() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
type DeleteDocumentResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
JSON200 *DeleteResponse
|
||||
JSON400 *InvalidRequest
|
||||
JSON401 *Unauthorized
|
||||
JSON404 *NotFound
|
||||
JSON429 *TooManyRequests
|
||||
JSON500 *InternalError
|
||||
}
|
||||
|
||||
// Status returns HTTPResponse.Status
|
||||
func (r DeleteDocumentResponse) Status() string {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.Status
|
||||
}
|
||||
return http.StatusText(0)
|
||||
}
|
||||
|
||||
// StatusCode returns HTTPResponse.StatusCode
|
||||
func (r DeleteDocumentResponse) StatusCode() int {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.StatusCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetDocumentResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
@@ -6051,6 +6306,34 @@ func (r CreateFolderResponse) StatusCode() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
type DeleteFolderResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
JSON200 *DeleteResponse
|
||||
JSON400 *InvalidRequest
|
||||
JSON401 *Unauthorized
|
||||
JSON404 *NotFound
|
||||
JSON409 *Conflict
|
||||
JSON429 *TooManyRequests
|
||||
JSON500 *InternalError
|
||||
}
|
||||
|
||||
// Status returns HTTPResponse.Status
|
||||
func (r DeleteFolderResponse) Status() string {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.Status
|
||||
}
|
||||
return http.StatusText(0)
|
||||
}
|
||||
|
||||
// StatusCode returns HTTPResponse.StatusCode
|
||||
func (r DeleteFolderResponse) StatusCode() int {
|
||||
if r.HTTPResponse != nil {
|
||||
return r.HTTPResponse.StatusCode
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type RenameFolderResponse struct {
|
||||
Body []byte
|
||||
HTTPResponse *http.Response
|
||||
@@ -6473,6 +6756,15 @@ func (c *ClientWithResponses) CreateClientWithResponse(ctx context.Context, body
|
||||
return ParseCreateClientResponse(rsp)
|
||||
}
|
||||
|
||||
// DeleteClientWithResponse request returning *DeleteClientResponse
|
||||
func (c *ClientWithResponses) DeleteClientWithResponse(ctx context.Context, id ClientID, params *DeleteClientParams, reqEditors ...RequestEditorFn) (*DeleteClientResponse, error) {
|
||||
rsp, err := c.DeleteClient(ctx, id, params, reqEditors...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseDeleteClientResponse(rsp)
|
||||
}
|
||||
|
||||
// GetClientWithResponse request returning *GetClientResponse
|
||||
func (c *ClientWithResponses) GetClientWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*GetClientResponse, error) {
|
||||
rsp, err := c.GetClient(ctx, id, reqEditors...)
|
||||
@@ -6561,15 +6853,6 @@ func (c *ClientWithResponses) UploadDocumentBatchWithBodyWithResponse(ctx contex
|
||||
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...)
|
||||
@@ -6623,6 +6906,15 @@ func (c *ClientWithResponses) ListClientsWithResponse(ctx context.Context, reqEd
|
||||
return ParseListClientsResponse(rsp)
|
||||
}
|
||||
|
||||
// DeleteDocumentWithResponse request returning *DeleteDocumentResponse
|
||||
func (c *ClientWithResponses) DeleteDocumentWithResponse(ctx context.Context, id DocumentID, params *DeleteDocumentParams, reqEditors ...RequestEditorFn) (*DeleteDocumentResponse, error) {
|
||||
rsp, err := c.DeleteDocument(ctx, id, params, reqEditors...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseDeleteDocumentResponse(rsp)
|
||||
}
|
||||
|
||||
// GetDocumentWithResponse request returning *GetDocumentResponse
|
||||
func (c *ClientWithResponses) GetDocumentWithResponse(ctx context.Context, id DocumentID, params *GetDocumentParams, reqEditors ...RequestEditorFn) (*GetDocumentResponse, error) {
|
||||
rsp, err := c.GetDocument(ctx, id, params, reqEditors...)
|
||||
@@ -6755,6 +7047,15 @@ func (c *ClientWithResponses) CreateFolderWithResponse(ctx context.Context, body
|
||||
return ParseCreateFolderResponse(rsp)
|
||||
}
|
||||
|
||||
// DeleteFolderWithResponse request returning *DeleteFolderResponse
|
||||
func (c *ClientWithResponses) DeleteFolderWithResponse(ctx context.Context, folderId openapi_types.UUID, params *DeleteFolderParams, reqEditors ...RequestEditorFn) (*DeleteFolderResponse, error) {
|
||||
rsp, err := c.DeleteFolder(ctx, folderId, params, reqEditors...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ParseDeleteFolderResponse(rsp)
|
||||
}
|
||||
|
||||
// RenameFolderWithBodyWithResponse request with arbitrary body returning *RenameFolderResponse
|
||||
func (c *ClientWithResponses) RenameFolderWithBodyWithResponse(ctx context.Context, folderId openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RenameFolderResponse, error) {
|
||||
rsp, err := c.RenameFolderWithBody(ctx, folderId, contentType, body, reqEditors...)
|
||||
@@ -7911,6 +8212,67 @@ func ParseCreateClientResponse(rsp *http.Response) (*CreateClientResponse, error
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ParseDeleteClientResponse parses an HTTP response from a DeleteClientWithResponse call
|
||||
func ParseDeleteClientResponse(rsp *http.Response) (*DeleteClientResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
defer func() { _ = rsp.Body.Close() }()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := &DeleteClientResponse{
|
||||
Body: bodyBytes,
|
||||
HTTPResponse: rsp,
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
||||
var dest DeleteResponse
|
||||
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
|
||||
}
|
||||
|
||||
// ParseGetClientResponse parses an HTTP response from a GetClientWithResponse call
|
||||
func ParseGetClientResponse(rsp *http.Response) (*GetClientResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
@@ -8322,60 +8684,6 @@ func ParseUploadDocumentBatchResponse(rsp *http.Response) (*UploadDocumentBatchR
|
||||
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)
|
||||
@@ -8660,6 +8968,67 @@ func ParseListClientsResponse(rsp *http.Response) (*ListClientsResponse, error)
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ParseDeleteDocumentResponse parses an HTTP response from a DeleteDocumentWithResponse call
|
||||
func ParseDeleteDocumentResponse(rsp *http.Response) (*DeleteDocumentResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
defer func() { _ = rsp.Body.Close() }()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := &DeleteDocumentResponse{
|
||||
Body: bodyBytes,
|
||||
HTTPResponse: rsp,
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
||||
var dest DeleteResponse
|
||||
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
|
||||
}
|
||||
|
||||
// ParseGetDocumentResponse parses an HTTP response from a GetDocumentWithResponse call
|
||||
func ParseGetDocumentResponse(rsp *http.Response) (*GetDocumentResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
@@ -9382,6 +9751,74 @@ func ParseCreateFolderResponse(rsp *http.Response) (*CreateFolderResponse, error
|
||||
return response, nil
|
||||
}
|
||||
|
||||
// ParseDeleteFolderResponse parses an HTTP response from a DeleteFolderWithResponse call
|
||||
func ParseDeleteFolderResponse(rsp *http.Response) (*DeleteFolderResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
defer func() { _ = rsp.Body.Close() }()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
response := &DeleteFolderResponse{
|
||||
Body: bodyBytes,
|
||||
HTTPResponse: rsp,
|
||||
}
|
||||
|
||||
switch {
|
||||
case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200:
|
||||
var dest DeleteResponse
|
||||
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 == 409:
|
||||
var dest Conflict
|
||||
if err := json.Unmarshal(bodyBytes, &dest); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
response.JSON409 = &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
|
||||
}
|
||||
|
||||
// ParseRenameFolderResponse parses an HTTP response from a RenameFolderWithResponse call
|
||||
func ParseRenameFolderResponse(rsp *http.Response) (*RenameFolderResponse, error) {
|
||||
bodyBytes, err := io.ReadAll(rsp.Body)
|
||||
|
||||
Reference in New Issue
Block a user