// Package queryservice provides primitives to interact with the openapi HTTP API. // // Code generated by github.com/oapi-codegen/oapi-codegen/v2 version 2.4.1 DO NOT EDIT. package queryservice import ( "bytes" "context" "encoding/json" "fmt" "io" "net/http" "net/url" "strings" "time" "github.com/oapi-codegen/runtime" openapi_types "github.com/oapi-codegen/runtime/types" ) const ( PlaceholderAuthScopes = "placeholderAuth.Scopes" ) // Defines values for ClientStatus. const ( INSYNC ClientStatus = "IN_SYNC" NOTSYNCED ClientStatus = "NOT_SYNCED" NOTSYNCING ClientStatus = "NOT_SYNCING" ) // Defines values for ExportStatus. const ( Completed ExportStatus = "completed" Failed ExportStatus = "failed" InProgress ExportStatus = "in_progress" ) // Defines values for FieldFilterCondition. const ( ClosedInterval FieldFilterCondition = "closed_interval" Exclude FieldFilterCondition = "exclude" GreaterThan FieldFilterCondition = "greater_than" Include FieldFilterCondition = "include" LeftClosedInterval FieldFilterCondition = "left_closed_interval" LessThan FieldFilterCondition = "less_than" OpenInterval FieldFilterCondition = "open_interval" RightClosedInterval FieldFilterCondition = "right_closed_interval" ) // Defines values for QueryType. const ( CONTEXTFULL QueryType = "CONTEXT_FULL" JSONEXTRACTOR QueryType = "JSON_EXTRACTOR" ) // ClientCanSync If the client is allowing active syncs type ClientCanSync = bool // ClientCreate The properties for creation. type ClientCreate struct { // Id The client external id Id ClientID `json:"id"` // Name The client name Name ClientName `json:"name"` } // ClientID The client external id type ClientID = string // ClientIDBody The client id. type ClientIDBody struct { // Id The client external id Id ClientID `json:"id"` } // ClientName The client name type ClientName = string // ClientStatus Specifies the status of a client. type ClientStatus string // ClientStatusBody A client status information object. type ClientStatusBody struct { // Status Specifies the status of a client. Status ClientStatus `json:"status"` } // ClientUID The client internal unique id type ClientUID = openapi_types.UUID // ClientUpdate The properties that may be updated. type ClientUpdate struct { // CanSync If the client is allowing active syncs CanSync *ClientCanSync `json:"can_sync,omitempty"` // Name The client name Name *ClientName `json:"name,omitempty"` } // CodeVersion The desired code version. type CodeVersion = int64 // Collector Collector model. type Collector struct { // ActiveVersion The desired version. ActiveVersion Version `json:"active_version"` // ClientId The client external id ClientId ClientID `json:"client_id"` // Fields The fields in the collector. Fields CollectorFields `json:"fields"` // LatestVersion The desired version. LatestVersion Version `json:"latest_version"` // MinimumCleanerVersion The desired code version. MinimumCleanerVersion CodeVersion `json:"minimum_cleaner_version"` // MinimumTextVersion The desired code version. MinimumTextVersion CodeVersion `json:"minimum_text_version"` } // CollectorField The field properties for the collector. type CollectorField struct { // Name The output field name. Name CollectorFieldName `json:"name"` // QueryId The query id. QueryId QueryID `json:"query_id"` } // CollectorFieldName The output field name. type CollectorFieldName = string // CollectorFields The fields in the collector. type CollectorFields = []CollectorField // CollectorSet Payload for updating a Collector. type CollectorSet struct { // ActiveVersion The desired version. ActiveVersion *Version `json:"active_version,omitempty"` // Fields The fields in the collector. Fields *CollectorFields `json:"fields,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. type DocClient struct { // CanSync If the client is allowing active syncs CanSync ClientCanSync `json:"can_sync"` // Id The client external id Id ClientID `json:"id"` // Name The client name Name ClientName `json:"name"` // Uid The client internal unique id Uid ClientUID `json:"uid"` } // Document The document properties. type Document struct { // Bucket The bucket containing the document Bucket string `json:"bucket"` // Id The document id. Id DocumentID `json:"id"` // Key The path to the document Key string `json:"key"` } // DocumentID The document id. type DocumentID = openapi_types.UUID // ExportDetails Payload for export trigger response. type ExportDetails struct { // ClientId The client external id ClientId ClientID `json:"client_id"` // OutputLocation The location in which the export zip file will be found. OutputLocation *string `json:"output_location,omitempty"` // Status The possible export states. Status ExportStatus `json:"status"` } // ExportID The export id. type ExportID = openapi_types.UUID // ExportStatus The possible export states. type ExportStatus string // ExportTrigger Payload for triggering an export. type ExportTrigger struct { // FieldFilters Filter the scope based on field output values. FieldFilters *[]FieldFilter `json:"field_filters,omitempty"` // IngestionFilters Filter the scope based on ingestion parameters. IngestionFilters *struct { // EndDate The last date of ingestion. EndDate *time.Time `json:"end_date,omitempty"` // StartDate This first date of ingestion. StartDate *time.Time `json:"start_date,omitempty"` } `json:"ingestion_filters,omitempty"` } // FieldFilter Filtering a column type FieldFilter struct { // Condition The possible field filtering conditions. Condition FieldFilterCondition `json:"condition"` // FieldName The output field name. FieldName CollectorFieldName `json:"field_name"` // Values The values useful to the filter. Values []string `json:"values"` } // FieldFilterCondition The possible field filtering conditions. type FieldFilterCondition string // IdMessage A single uuid. type IdMessage struct { // Id Unique identifier for entity. Id openapi_types.UUID `json:"id"` } // ListDocuments The documents in the client. type ListDocuments = []Document // ListQueries A set of queries. type ListQueries struct { // Queries List of queries. Queries []Query `json:"queries"` } // Query A logic unit of execution. type Query struct { // ActiveVersion The desired version. ActiveVersion Version `json:"active_version"` // Config Configuration for the query. Config *QueryConfig `json:"config,omitempty"` // Id The query id. Id QueryID `json:"id"` // LatestVersion The desired version. LatestVersion Version `json:"latest_version"` // RequiredQueries List of required query IDs. RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"` // Type Specifies the type of the query. Type QueryType `json:"type"` } // QueryConfig Configuration for the query. type QueryConfig = string // QueryCreate The parameters required to create a query. type QueryCreate struct { // Config Configuration for the query. Config *QueryConfig `json:"config,omitempty"` // RequiredQueries List of required query IDs. RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"` // Type Specifies the type of the query. Type QueryType `json:"type"` } // QueryID The query id. type QueryID = openapi_types.UUID // QueryTestRequest The properties for a query test request. type QueryTestRequest struct { // DocumentId The document id. DocumentId DocumentID `json:"document_id"` // QueryVersion The desired version. QueryVersion Version `json:"query_version"` } // QueryTestResponse The response from a query test. type QueryTestResponse struct { // Value Result of the query test. Value string `json:"value"` } // QueryType Specifies the type of the query. type QueryType string // QueryUpdate The properties that may be updated for a query. type QueryUpdate struct { // ActiveVersion The desired version. ActiveVersion *Version `json:"active_version,omitempty"` // Config Configuration for the query. Config *QueryConfig `json:"config,omitempty"` // RequiredQueries List of required query IDs. RequiredQueries *RequiredQueryIDs `json:"required_queries,omitempty"` } // RequiredQueryIDs List of required query IDs. type RequiredQueryIDs = []QueryID // Version The desired version. type Version = int32 // CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType. type CreateClientJSONRequestBody = ClientCreate // UpdateClientJSONRequestBody defines body for UpdateClient for application/json ContentType. type UpdateClientJSONRequestBody = ClientUpdate // SetCollectorByClientIdJSONRequestBody defines body for SetCollectorByClientId for application/json ContentType. type SetCollectorByClientIdJSONRequestBody = CollectorSet // TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType. type TriggerExportJSONRequestBody = ExportTrigger // CreateQueryJSONRequestBody defines body for CreateQuery for application/json ContentType. type CreateQueryJSONRequestBody = QueryCreate // UpdateQueryJSONRequestBody defines body for UpdateQuery for application/json ContentType. type UpdateQueryJSONRequestBody = QueryUpdate // TestQueryJSONRequestBody defines body for TestQuery for application/json ContentType. type TestQueryJSONRequestBody = QueryTestRequest // RequestEditorFn is the function signature for the RequestEditor callback function type RequestEditorFn func(ctx context.Context, req *http.Request) error // Doer performs HTTP requests. // // The standard http.Client implements this interface. type HttpRequestDoer interface { Do(req *http.Request) (*http.Response, error) } // Client which conforms to the OpenAPI3 specification for this service. type Client struct { // The endpoint of the server conforming to this interface, with scheme, // https://api.deepmap.com for example. This can contain a path relative // to the server, such as https://api.deepmap.com/dev-test, and all the // paths in the swagger spec will be appended to the server. Server string // Doer for performing requests, typically a *http.Client with any // customized settings, such as certificate chains. Client HttpRequestDoer // A list of callbacks for modifying requests which are generated before sending over // the network. RequestEditors []RequestEditorFn } // ClientOption allows setting custom parameters during construction type ClientOption func(*Client) error // Creates a new Client, with reasonable defaults func NewClient(server string, opts ...ClientOption) (*Client, error) { // create a client with sane default values client := Client{ Server: server, } // mutate client and add all optional params for _, o := range opts { if err := o(&client); err != nil { return nil, err } } // ensure the server URL always has a trailing slash if !strings.HasSuffix(client.Server, "/") { client.Server += "/" } // create httpClient, if not already present if client.Client == nil { client.Client = &http.Client{} } return &client, nil } // WithHTTPClient allows overriding the default Doer, which is // automatically created using http.Client. This is useful for tests. func WithHTTPClient(doer HttpRequestDoer) ClientOption { return func(c *Client) error { c.Client = doer return nil } } // WithRequestEditorFn allows setting up a callback function, which will be // called right before sending the request. This can be used to mutate the request. func WithRequestEditorFn(fn RequestEditorFn) ClientOption { return func(c *Client) error { c.RequestEditors = append(c.RequestEditors, fn) return nil } } // The interface specification for the client above. type ClientInterface interface { // CreateClientWithBody request with any body CreateClientWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateClient(ctx context.Context, body CreateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetClient request GetClient(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateClientWithBody request with any body UpdateClientWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) UpdateClient(ctx context.Context, id ClientID, body UpdateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetCollectorByClientId request GetCollectorByClientId(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error) // SetCollectorByClientIdWithBody request with any body SetCollectorByClientIdWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) SetCollectorByClientId(ctx context.Context, id ClientID, body SetCollectorByClientIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // ListDocumentsByClientId request ListDocumentsByClientId(ctx context.Context, id ClientID, 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) TriggerExport(ctx context.Context, id ClientID, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetStatusByClientId request GetStatusByClientId(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error) // ExportState request ExportState(ctx context.Context, id ExportID, reqEditors ...RequestEditorFn) (*http.Response, error) // ListQueries request ListQueries(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateQueryWithBody request with any body CreateQueryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateQuery(ctx context.Context, body CreateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetQuery request GetQuery(ctx context.Context, id QueryID, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateQueryWithBody request with any body UpdateQueryWithBody(ctx context.Context, id QueryID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) UpdateQuery(ctx context.Context, id QueryID, body UpdateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // TestQueryWithBody request with any body TestQueryWithBody(ctx context.Context, id QueryID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) TestQuery(ctx context.Context, id QueryID, body TestQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) } func (c *Client) CreateClientWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateClientRequestWithBody(c.Server, 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) CreateClient(ctx context.Context, body CreateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateClientRequest(c.Server, 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) GetClient(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetClientRequest(c.Server, id) 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) UpdateClientWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateClientRequestWithBody(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) UpdateClient(ctx context.Context, id ClientID, body UpdateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateClientRequest(c.Server, id, 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) GetCollectorByClientId(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetCollectorByClientIdRequest(c.Server, id) 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) SetCollectorByClientIdWithBody(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetCollectorByClientIdRequestWithBody(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) SetCollectorByClientId(ctx context.Context, id ClientID, body SetCollectorByClientIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewSetCollectorByClientIdRequest(c.Server, id, 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) ListDocumentsByClientId(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListDocumentsByClientIdRequest(c.Server, id) 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 { 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) TriggerExport(ctx context.Context, id ClientID, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewTriggerExportRequest(c.Server, id, 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) GetStatusByClientId(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetStatusByClientIdRequest(c.Server, id) 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) ExportState(ctx context.Context, id ExportID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewExportStateRequest(c.Server, id) 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) ListQueries(ctx context.Context, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewListQueriesRequest(c.Server) 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) CreateQueryWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateQueryRequestWithBody(c.Server, 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) CreateQuery(ctx context.Context, body CreateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateQueryRequest(c.Server, 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) GetQuery(ctx context.Context, id QueryID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetQueryRequest(c.Server, id) 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) UpdateQueryWithBody(ctx context.Context, id QueryID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateQueryRequestWithBody(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) UpdateQuery(ctx context.Context, id QueryID, body UpdateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateQueryRequest(c.Server, id, 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) TestQueryWithBody(ctx context.Context, id QueryID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewTestQueryRequestWithBody(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) TestQuery(ctx context.Context, id QueryID, body TestQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewTestQueryRequest(c.Server, id, 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) } // NewCreateClientRequest calls the generic CreateClient builder with application/json body func NewCreateClientRequest(server string, body CreateClientJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewCreateClientRequestWithBody(server, "application/json", bodyReader) } // NewCreateClientRequestWithBody generates requests for CreateClient with any type of body func NewCreateClientRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/client") 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 } // NewGetClientRequest generates requests for GetClient func NewGetClientRequest(server string, id ClientID) (*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 } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } return req, nil } // NewUpdateClientRequest calls the generic UpdateClient builder with application/json body func NewUpdateClientRequest(server string, id ClientID, body UpdateClientJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewUpdateClientRequestWithBody(server, id, "application/json", bodyReader) } // NewUpdateClientRequestWithBody generates requests for UpdateClient with any type of body func NewUpdateClientRequestWithBody(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", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("PATCH", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewGetCollectorByClientIdRequest generates requests for GetCollectorByClientId func NewGetCollectorByClientIdRequest(server string, id ClientID) (*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/collector", pathParam0) 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 } // NewSetCollectorByClientIdRequest calls the generic SetCollectorByClientId builder with application/json body func NewSetCollectorByClientIdRequest(server string, id ClientID, body SetCollectorByClientIdJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewSetCollectorByClientIdRequestWithBody(server, id, "application/json", bodyReader) } // NewSetCollectorByClientIdRequestWithBody generates requests for SetCollectorByClientId with any type of body func NewSetCollectorByClientIdRequestWithBody(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/collector", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("PATCH", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewListDocumentsByClientIdRequest generates requests for ListDocumentsByClientId func NewListDocumentsByClientIdRequest(server string, id ClientID) (*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/documents", pathParam0) 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 buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewTriggerExportRequestWithBody(server, id, "application/json", bodyReader) } // NewTriggerExportRequestWithBody generates requests for TriggerExport with any type of body func NewTriggerExportRequestWithBody(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/export", 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 } // NewGetStatusByClientIdRequest generates requests for GetStatusByClientId func NewGetStatusByClientIdRequest(server string, id ClientID) (*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/status", pathParam0) 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 } // NewExportStateRequest generates requests for ExportState func NewExportStateRequest(server string, id ExportID) (*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("/export/%s", pathParam0) 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 } // NewListQueriesRequest generates requests for ListQueries func NewListQueriesRequest(server string) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/query") 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 } // NewCreateQueryRequest calls the generic CreateQuery builder with application/json body func NewCreateQueryRequest(server string, body CreateQueryJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewCreateQueryRequestWithBody(server, "application/json", bodyReader) } // NewCreateQueryRequestWithBody generates requests for CreateQuery with any type of body func NewCreateQueryRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } operationPath := fmt.Sprintf("/query") 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 } // NewGetQueryRequest generates requests for GetQuery func NewGetQueryRequest(server string, id QueryID) (*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("/query/%s", pathParam0) 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 } // NewUpdateQueryRequest calls the generic UpdateQuery builder with application/json body func NewUpdateQueryRequest(server string, id QueryID, body UpdateQueryJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewUpdateQueryRequestWithBody(server, id, "application/json", bodyReader) } // NewUpdateQueryRequestWithBody generates requests for UpdateQuery with any type of body func NewUpdateQueryRequestWithBody(server string, id QueryID, 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("/query/%s", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("PATCH", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewTestQueryRequest calls the generic TestQuery builder with application/json body func NewTestQueryRequest(server string, id QueryID, body TestQueryJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewTestQueryRequestWithBody(server, id, "application/json", bodyReader) } // NewTestQueryRequestWithBody generates requests for TestQuery with any type of body func NewTestQueryRequestWithBody(server string, id QueryID, 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("/query/%s/test", 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 } func (c *Client) applyEditors(ctx context.Context, req *http.Request, additionalEditors []RequestEditorFn) error { for _, r := range c.RequestEditors { if err := r(ctx, req); err != nil { return err } } for _, r := range additionalEditors { if err := r(ctx, req); err != nil { return err } } return nil } // ClientWithResponses builds on ClientInterface to offer response payloads type ClientWithResponses struct { ClientInterface } // NewClientWithResponses creates a new ClientWithResponses, which wraps // Client with return type handling func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error) { client, err := NewClient(server, opts...) if err != nil { return nil, err } return &ClientWithResponses{client}, nil } // WithBaseURL overrides the baseURL. func WithBaseURL(baseURL string) ClientOption { return func(c *Client) error { newBaseURL, err := url.Parse(baseURL) if err != nil { return err } c.Server = newBaseURL.String() return nil } } // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { // CreateClientWithBodyWithResponse request with any body CreateClientWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateClientResponse, error) CreateClientWithResponse(ctx context.Context, body CreateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateClientResponse, error) // GetClientWithResponse request GetClientWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*GetClientResponse, error) // UpdateClientWithBodyWithResponse request with any body UpdateClientWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateClientResponse, error) UpdateClientWithResponse(ctx context.Context, id ClientID, body UpdateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateClientResponse, error) // GetCollectorByClientIdWithResponse request GetCollectorByClientIdWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*GetCollectorByClientIdResponse, error) // SetCollectorByClientIdWithBodyWithResponse request with any body SetCollectorByClientIdWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetCollectorByClientIdResponse, error) SetCollectorByClientIdWithResponse(ctx context.Context, id ClientID, body SetCollectorByClientIdJSONRequestBody, reqEditors ...RequestEditorFn) (*SetCollectorByClientIdResponse, error) // ListDocumentsByClientIdWithResponse request ListDocumentsByClientIdWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*ListDocumentsByClientIdResponse, error) // TriggerExportWithBodyWithResponse request with any body TriggerExportWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) TriggerExportWithResponse(ctx context.Context, id ClientID, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) // GetStatusByClientIdWithResponse request GetStatusByClientIdWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*GetStatusByClientIdResponse, error) // ExportStateWithResponse request ExportStateWithResponse(ctx context.Context, id ExportID, reqEditors ...RequestEditorFn) (*ExportStateResponse, error) // ListQueriesWithResponse request ListQueriesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListQueriesResponse, error) // CreateQueryWithBodyWithResponse request with any body CreateQueryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateQueryResponse, error) CreateQueryWithResponse(ctx context.Context, body CreateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateQueryResponse, error) // GetQueryWithResponse request GetQueryWithResponse(ctx context.Context, id QueryID, reqEditors ...RequestEditorFn) (*GetQueryResponse, error) // UpdateQueryWithBodyWithResponse request with any body UpdateQueryWithBodyWithResponse(ctx context.Context, id QueryID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateQueryResponse, error) UpdateQueryWithResponse(ctx context.Context, id QueryID, body UpdateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateQueryResponse, error) // TestQueryWithBodyWithResponse request with any body TestQueryWithBodyWithResponse(ctx context.Context, id QueryID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TestQueryResponse, error) TestQueryWithResponse(ctx context.Context, id QueryID, body TestQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*TestQueryResponse, error) } type CreateClientResponse struct { Body []byte HTTPResponse *http.Response JSON201 *ClientIDBody } // Status returns HTTPResponse.Status func (r CreateClientResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r CreateClientResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetClientResponse struct { Body []byte HTTPResponse *http.Response JSON200 *DocClient } // Status returns HTTPResponse.Status func (r GetClientResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetClientResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type UpdateClientResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status func (r UpdateClientResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r UpdateClientResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetCollectorByClientIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Collector } // Status returns HTTPResponse.Status func (r GetCollectorByClientIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetCollectorByClientIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type SetCollectorByClientIdResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status func (r SetCollectorByClientIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r SetCollectorByClientIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type ListDocumentsByClientIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ListDocuments } // Status returns HTTPResponse.Status func (r ListDocumentsByClientIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ListDocumentsByClientIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type TriggerExportResponse struct { Body []byte HTTPResponse *http.Response JSON201 *IdMessage } // Status returns HTTPResponse.Status func (r TriggerExportResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r TriggerExportResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetStatusByClientIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ClientStatusBody } // Status returns HTTPResponse.Status func (r GetStatusByClientIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetStatusByClientIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type ExportStateResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ExportDetails } // Status returns HTTPResponse.Status func (r ExportStateResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ExportStateResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type ListQueriesResponse struct { Body []byte HTTPResponse *http.Response JSON200 *ListQueries } // Status returns HTTPResponse.Status func (r ListQueriesResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r ListQueriesResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type CreateQueryResponse struct { Body []byte HTTPResponse *http.Response JSON201 *IdMessage } // Status returns HTTPResponse.Status func (r CreateQueryResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r CreateQueryResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetQueryResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Query } // Status returns HTTPResponse.Status func (r GetQueryResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetQueryResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type UpdateQueryResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status func (r UpdateQueryResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r UpdateQueryResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type TestQueryResponse struct { Body []byte HTTPResponse *http.Response JSON200 *QueryTestResponse } // Status returns HTTPResponse.Status func (r TestQueryResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r TestQueryResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } // CreateClientWithBodyWithResponse request with arbitrary body returning *CreateClientResponse func (c *ClientWithResponses) CreateClientWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateClientResponse, error) { rsp, err := c.CreateClientWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseCreateClientResponse(rsp) } func (c *ClientWithResponses) CreateClientWithResponse(ctx context.Context, body CreateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateClientResponse, error) { rsp, err := c.CreateClient(ctx, body, reqEditors...) if err != nil { return nil, err } return ParseCreateClientResponse(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...) if err != nil { return nil, err } return ParseGetClientResponse(rsp) } // UpdateClientWithBodyWithResponse request with arbitrary body returning *UpdateClientResponse func (c *ClientWithResponses) UpdateClientWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateClientResponse, error) { rsp, err := c.UpdateClientWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateClientResponse(rsp) } func (c *ClientWithResponses) UpdateClientWithResponse(ctx context.Context, id ClientID, body UpdateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateClientResponse, error) { rsp, err := c.UpdateClient(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateClientResponse(rsp) } // GetCollectorByClientIdWithResponse request returning *GetCollectorByClientIdResponse func (c *ClientWithResponses) GetCollectorByClientIdWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*GetCollectorByClientIdResponse, error) { rsp, err := c.GetCollectorByClientId(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetCollectorByClientIdResponse(rsp) } // SetCollectorByClientIdWithBodyWithResponse request with arbitrary body returning *SetCollectorByClientIdResponse func (c *ClientWithResponses) SetCollectorByClientIdWithBodyWithResponse(ctx context.Context, id ClientID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*SetCollectorByClientIdResponse, error) { rsp, err := c.SetCollectorByClientIdWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseSetCollectorByClientIdResponse(rsp) } func (c *ClientWithResponses) SetCollectorByClientIdWithResponse(ctx context.Context, id ClientID, body SetCollectorByClientIdJSONRequestBody, reqEditors ...RequestEditorFn) (*SetCollectorByClientIdResponse, error) { rsp, err := c.SetCollectorByClientId(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseSetCollectorByClientIdResponse(rsp) } // ListDocumentsByClientIdWithResponse request returning *ListDocumentsByClientIdResponse func (c *ClientWithResponses) ListDocumentsByClientIdWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*ListDocumentsByClientIdResponse, error) { rsp, err := c.ListDocumentsByClientId(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseListDocumentsByClientIdResponse(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...) if err != nil { return nil, err } return ParseTriggerExportResponse(rsp) } func (c *ClientWithResponses) TriggerExportWithResponse(ctx context.Context, id ClientID, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) { rsp, err := c.TriggerExport(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseTriggerExportResponse(rsp) } // GetStatusByClientIdWithResponse request returning *GetStatusByClientIdResponse func (c *ClientWithResponses) GetStatusByClientIdWithResponse(ctx context.Context, id ClientID, reqEditors ...RequestEditorFn) (*GetStatusByClientIdResponse, error) { rsp, err := c.GetStatusByClientId(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetStatusByClientIdResponse(rsp) } // ExportStateWithResponse request returning *ExportStateResponse func (c *ClientWithResponses) ExportStateWithResponse(ctx context.Context, id ExportID, reqEditors ...RequestEditorFn) (*ExportStateResponse, error) { rsp, err := c.ExportState(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseExportStateResponse(rsp) } // ListQueriesWithResponse request returning *ListQueriesResponse func (c *ClientWithResponses) ListQueriesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListQueriesResponse, error) { rsp, err := c.ListQueries(ctx, reqEditors...) if err != nil { return nil, err } return ParseListQueriesResponse(rsp) } // CreateQueryWithBodyWithResponse request with arbitrary body returning *CreateQueryResponse func (c *ClientWithResponses) CreateQueryWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateQueryResponse, error) { rsp, err := c.CreateQueryWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseCreateQueryResponse(rsp) } func (c *ClientWithResponses) CreateQueryWithResponse(ctx context.Context, body CreateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateQueryResponse, error) { rsp, err := c.CreateQuery(ctx, body, reqEditors...) if err != nil { return nil, err } return ParseCreateQueryResponse(rsp) } // GetQueryWithResponse request returning *GetQueryResponse func (c *ClientWithResponses) GetQueryWithResponse(ctx context.Context, id QueryID, reqEditors ...RequestEditorFn) (*GetQueryResponse, error) { rsp, err := c.GetQuery(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetQueryResponse(rsp) } // UpdateQueryWithBodyWithResponse request with arbitrary body returning *UpdateQueryResponse func (c *ClientWithResponses) UpdateQueryWithBodyWithResponse(ctx context.Context, id QueryID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateQueryResponse, error) { rsp, err := c.UpdateQueryWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateQueryResponse(rsp) } func (c *ClientWithResponses) UpdateQueryWithResponse(ctx context.Context, id QueryID, body UpdateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateQueryResponse, error) { rsp, err := c.UpdateQuery(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateQueryResponse(rsp) } // TestQueryWithBodyWithResponse request with arbitrary body returning *TestQueryResponse func (c *ClientWithResponses) TestQueryWithBodyWithResponse(ctx context.Context, id QueryID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TestQueryResponse, error) { rsp, err := c.TestQueryWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseTestQueryResponse(rsp) } func (c *ClientWithResponses) TestQueryWithResponse(ctx context.Context, id QueryID, body TestQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*TestQueryResponse, error) { rsp, err := c.TestQuery(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseTestQueryResponse(rsp) } // ParseCreateClientResponse parses an HTTP response from a CreateClientWithResponse call func ParseCreateClientResponse(rsp *http.Response) (*CreateClientResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &CreateClientResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: var dest ClientIDBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON201 = &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) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetClientResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest DocClient if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseUpdateClientResponse parses an HTTP response from a UpdateClientWithResponse call func ParseUpdateClientResponse(rsp *http.Response) (*UpdateClientResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &UpdateClientResponse{ Body: bodyBytes, HTTPResponse: rsp, } return response, nil } // ParseGetCollectorByClientIdResponse parses an HTTP response from a GetCollectorByClientIdWithResponse call func ParseGetCollectorByClientIdResponse(rsp *http.Response) (*GetCollectorByClientIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetCollectorByClientIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Collector if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseSetCollectorByClientIdResponse parses an HTTP response from a SetCollectorByClientIdWithResponse call func ParseSetCollectorByClientIdResponse(rsp *http.Response) (*SetCollectorByClientIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &SetCollectorByClientIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } return response, nil } // ParseListDocumentsByClientIdResponse parses an HTTP response from a ListDocumentsByClientIdWithResponse call func ParseListDocumentsByClientIdResponse(rsp *http.Response) (*ListDocumentsByClientIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ListDocumentsByClientIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest ListDocuments if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &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) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &TriggerExportResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: var dest IdMessage if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON201 = &dest } return response, nil } // ParseGetStatusByClientIdResponse parses an HTTP response from a GetStatusByClientIdWithResponse call func ParseGetStatusByClientIdResponse(rsp *http.Response) (*GetStatusByClientIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetStatusByClientIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest ClientStatusBody if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseExportStateResponse parses an HTTP response from a ExportStateWithResponse call func ParseExportStateResponse(rsp *http.Response) (*ExportStateResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ExportStateResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest ExportDetails if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseListQueriesResponse parses an HTTP response from a ListQueriesWithResponse call func ParseListQueriesResponse(rsp *http.Response) (*ListQueriesResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &ListQueriesResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest ListQueries if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseCreateQueryResponse parses an HTTP response from a CreateQueryWithResponse call func ParseCreateQueryResponse(rsp *http.Response) (*CreateQueryResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &CreateQueryResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: var dest IdMessage if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON201 = &dest } return response, nil } // ParseGetQueryResponse parses an HTTP response from a GetQueryWithResponse call func ParseGetQueryResponse(rsp *http.Response) (*GetQueryResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetQueryResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Query if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseUpdateQueryResponse parses an HTTP response from a UpdateQueryWithResponse call func ParseUpdateQueryResponse(rsp *http.Response) (*UpdateQueryResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &UpdateQueryResponse{ Body: bodyBytes, HTTPResponse: rsp, } return response, nil } // ParseTestQueryResponse parses an HTTP response from a TestQueryWithResponse call func ParseTestQueryResponse(rsp *http.Response) (*TestQueryResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &TestQueryResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest QueryTestResponse if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil }