// 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" "github.com/oapi-codegen/runtime" openapi_types "github.com/oapi-codegen/runtime/types" ) // 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" ) // ClientCreate defines model for ClientCreate. type ClientCreate struct { // Name The client name Name string `json:"name"` } // ClientUpdate defines model for ClientUpdate. type ClientUpdate struct { // CanSync If the client is allowing active syncs CanSync *bool `json:"can_sync,omitempty"` // Name The client name Name *string `json:"name,omitempty"` } // ExportDetails Payload for export trigger response. type ExportDetails struct { // JobId The job id relative to the export. JobId openapi_types.UUID `json:"job_id"` // OutputLocation The location in which the export zip file will be found. OutputLocation *string `json:"output_location,omitempty"` // Status The possible export job states. Status ExportStatus `json:"status"` } // ExportStatus The possible export job 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 *string `json:"end_date,omitempty"` // StartDate This first date of ingestion. StartDate *string `json:"start_date,omitempty"` } `json:"ingestion_filters,omitempty"` // JobId The job id of the query results to be exported. JobId openapi_types.UUID `json:"job_id"` } // FieldFilter Filtering a column type FieldFilter struct { // Condition The possible field filtering conditions. Condition FieldFilterCondition `json:"condition"` // FieldName The name of the field in question. FieldName string `json:"field_name"` // Values The values useful to the filter. Values []string `json:"values"` } // FieldFilterCondition The possible field filtering conditions. type FieldFilterCondition string // IdMessage defines model for IdMessage. type IdMessage struct { // Id Unique identifier for entity. Id openapi_types.UUID `json:"id"` } // Job defines model for Job. type Job struct { // CanSync Specifies whether the job is actively syncing CanSync bool `json:"can_sync"` // ClientId The client id the job belongs to ClientId openapi_types.UUID `json:"client_id"` // Id The job id Id openapi_types.UUID `json:"id"` } // JobClient defines model for JobClient. type JobClient struct { // CanSync If the client is allowing active syncs CanSync bool `json:"can_sync"` // Id The client id Id openapi_types.UUID `json:"id"` // Name The client name Name string `json:"name"` } // JobCollector JobCollector model. type JobCollector struct { // ActiveVersion The active version of the collector. ActiveVersion int32 `json:"active_version"` // Fields The fields in the job collector. Fields []JobCollectorField `json:"fields"` // JobId The ID of the associated job. JobId openapi_types.UUID `json:"job_id"` // LatestVersion The latest version of the collector. LatestVersion int32 `json:"latest_version"` // MinimumCleanerVersion The minimum version for the document cleaner. MinimumCleanerVersion int32 `json:"minimum_cleaner_version"` // MinimumTextVersion The minimum version for the text parser. MinimumTextVersion int32 `json:"minimum_text_version"` } // JobCollectorField The field properties for the job collector. type JobCollectorField struct { // Name The output field name. Name string `json:"name"` // QueryId The query id that will populate the result. QueryId openapi_types.UUID `json:"query_id"` } // JobCollectorUpdate Payload for updating a JobCollector. type JobCollectorUpdate struct { // ActiveVersion The active version of the collector. ActiveVersion *int32 `json:"active_version,omitempty"` // Fields The fields in the job collector. Fields *[]JobCollectorField `json:"fields,omitempty"` // MinimumCleanerVersion The minimum version for the document cleaner. MinimumCleanerVersion *int32 `json:"minimum_cleaner_version,omitempty"` // MinimumTextVersion The minimum version for the text parser. MinimumTextVersion *int32 `json:"minimum_text_version,omitempty"` } // JobCreate defines model for JobCreate. type JobCreate struct { // ClientId The client id the job belongs to ClientId openapi_types.UUID `json:"client_id"` } // JobUpdate defines model for JobUpdate. type JobUpdate struct { // CanSync Specifies whether the job is actively syncing CanSync *bool `json:"can_sync,omitempty"` } // ListQueries defines model for ListQueries. type ListQueries struct { // Queries List of queries. Queries []Query `json:"queries"` } // Query defines model for Query. type Query struct { // ActiveVersion The active version of the query. ActiveVersion int32 `json:"active_version"` // Config Configuration for the query. Config *string `json:"config,omitempty"` // Id Unique identifier for the query. Id openapi_types.UUID `json:"id"` // LatestVersion The latest version of the query. LatestVersion int32 `json:"latest_version"` // RequiredQueries List of required query IDs. RequiredQueries *[]openapi_types.UUID `json:"required_queries,omitempty"` // Type Specifies the type of the query. Type QueryType `json:"type"` } // QueryCreate defines model for QueryCreate. type QueryCreate struct { // Config Configuration for the new query. Config *string `json:"config,omitempty"` // RequiredQueries List of required query IDs. RequiredQueries *[]openapi_types.UUID `json:"required_queries,omitempty"` // Type Specifies the type of the query. Type QueryType `json:"type"` } // QueryTestRequest defines model for QueryTestRequest. type QueryTestRequest struct { // DocumentId ID of the document to test against. DocumentId openapi_types.UUID `json:"document_id"` // QueryVersion Version of the query to use for testing. QueryVersion int32 `json:"query_version"` } // QueryTestResponse defines model for QueryTestResponse. type QueryTestResponse struct { // Value Result of the query test. Value string `json:"value"` } // QueryType Specifies the type of the query. type QueryType string // QueryUpdate defines model for QueryUpdate. type QueryUpdate struct { // ActiveVersion Updated active version. ActiveVersion *int32 `json:"active_version,omitempty"` // Config Updated configuration for the query. Config *string `json:"config,omitempty"` // RequiredQueries Updated list of required query IDs. RequiredQueries *[]openapi_types.UUID `json:"required_queries,omitempty"` } // CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType. type CreateClientJSONRequestBody = ClientCreate // UpdateClientJSONRequestBody defines body for UpdateClient for application/json ContentType. type UpdateClientJSONRequestBody = ClientUpdate // CreateJobJSONRequestBody defines body for CreateJob for application/json ContentType. type CreateJobJSONRequestBody = JobCreate // TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType. type TriggerExportJSONRequestBody = ExportTrigger // UpdateJobJSONRequestBody defines body for UpdateJob for application/json ContentType. type UpdateJobJSONRequestBody = JobUpdate // UpdateJobCollectorByJobIdJSONRequestBody defines body for UpdateJobCollectorByJobId for application/json ContentType. type UpdateJobCollectorByJobIdJSONRequestBody = JobCollectorUpdate // 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 openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateClientWithBody request with any body UpdateClientWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) UpdateClient(ctx context.Context, id openapi_types.UUID, body UpdateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // CreateJobWithBody request with any body CreateJobWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) CreateJob(ctx context.Context, body CreateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // TriggerExportWithBody request with any body TriggerExportWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) TriggerExport(ctx context.Context, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetJob request GetJob(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateJobWithBody request with any body UpdateJobWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) UpdateJob(ctx context.Context, id openapi_types.UUID, body UpdateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // GetJobCollectorByJobId request GetJobCollectorByJobId(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateJobCollectorByJobIdWithBody request with any body UpdateJobCollectorByJobIdWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) UpdateJobCollectorByJobId(ctx context.Context, id openapi_types.UUID, body UpdateJobCollectorByJobIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // ExportState request ExportState(ctx context.Context, id openapi_types.UUID, 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 openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) // UpdateQueryWithBody request with any body UpdateQueryWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) UpdateQuery(ctx context.Context, id openapi_types.UUID, body UpdateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // TestQueryWithBody request with any body TestQueryWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) TestQuery(ctx context.Context, id openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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) CreateJobWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateJobRequestWithBody(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) CreateJob(ctx context.Context, body CreateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewCreateJobRequest(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) TriggerExportWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewTriggerExportRequestWithBody(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) TriggerExport(ctx context.Context, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewTriggerExportRequest(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) GetJob(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetJobRequest(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) UpdateJobWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateJobRequestWithBody(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) UpdateJob(ctx context.Context, id openapi_types.UUID, body UpdateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateJobRequest(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) GetJobCollectorByJobId(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewGetJobCollectorByJobIdRequest(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) UpdateJobCollectorByJobIdWithBody(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateJobCollectorByJobIdRequestWithBody(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) UpdateJobCollectorByJobId(ctx context.Context, id openapi_types.UUID, body UpdateJobCollectorByJobIdJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewUpdateJobCollectorByJobIdRequest(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) ExportState(ctx context.Context, id openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID) (*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 openapi_types.UUID, 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 openapi_types.UUID, 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 } // NewCreateJobRequest calls the generic CreateJob builder with application/json body func NewCreateJobRequest(server string, body CreateJobJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewCreateJobRequestWithBody(server, "application/json", bodyReader) } // NewCreateJobRequestWithBody generates requests for CreateJob with any type of body func NewCreateJobRequestWithBody(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("/job") if operationPath[0] == '/' { operationPath = "." + operationPath } queryURL, err := serverURL.Parse(operationPath) if err != nil { return nil, err } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { return nil, err } req.Header.Add("Content-Type", contentType) return req, nil } // NewTriggerExportRequest calls the generic TriggerExport builder with application/json body func NewTriggerExportRequest(server string, 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, "application/json", bodyReader) } // NewTriggerExportRequestWithBody generates requests for TriggerExport with any type of body func NewTriggerExportRequestWithBody(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("/job/export") 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 } // NewGetJobRequest generates requests for GetJob func NewGetJobRequest(server string, id openapi_types.UUID) (*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("/job/%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 } // NewUpdateJobRequest calls the generic UpdateJob builder with application/json body func NewUpdateJobRequest(server string, id openapi_types.UUID, body UpdateJobJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewUpdateJobRequestWithBody(server, id, "application/json", bodyReader) } // NewUpdateJobRequestWithBody generates requests for UpdateJob with any type of body func NewUpdateJobRequestWithBody(server string, id openapi_types.UUID, 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("/job/%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 } // NewGetJobCollectorByJobIdRequest generates requests for GetJobCollectorByJobId func NewGetJobCollectorByJobIdRequest(server string, id openapi_types.UUID) (*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("/job/%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 } // NewUpdateJobCollectorByJobIdRequest calls the generic UpdateJobCollectorByJobId builder with application/json body func NewUpdateJobCollectorByJobIdRequest(server string, id openapi_types.UUID, body UpdateJobCollectorByJobIdJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) return NewUpdateJobCollectorByJobIdRequestWithBody(server, id, "application/json", bodyReader) } // NewUpdateJobCollectorByJobIdRequestWithBody generates requests for UpdateJobCollectorByJobId with any type of body func NewUpdateJobCollectorByJobIdRequestWithBody(server string, id openapi_types.UUID, 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("/job/%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 } // NewExportStateRequest generates requests for ExportState func NewExportStateRequest(server string, id openapi_types.UUID) (*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("/job/%s/export", 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 openapi_types.UUID) (*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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetClientResponse, error) // UpdateClientWithBodyWithResponse request with any body UpdateClientWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateClientResponse, error) UpdateClientWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateClientResponse, error) // CreateJobWithBodyWithResponse request with any body CreateJobWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateJobResponse, error) CreateJobWithResponse(ctx context.Context, body CreateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateJobResponse, error) // TriggerExportWithBodyWithResponse request with any body TriggerExportWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) TriggerExportWithResponse(ctx context.Context, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) // GetJobWithResponse request GetJobWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetJobResponse, error) // UpdateJobWithBodyWithResponse request with any body UpdateJobWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateJobResponse, error) UpdateJobWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateJobResponse, error) // GetJobCollectorByJobIdWithResponse request GetJobCollectorByJobIdWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetJobCollectorByJobIdResponse, error) // UpdateJobCollectorByJobIdWithBodyWithResponse request with any body UpdateJobCollectorByJobIdWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateJobCollectorByJobIdResponse, error) UpdateJobCollectorByJobIdWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateJobCollectorByJobIdJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateJobCollectorByJobIdResponse, error) // ExportStateWithResponse request ExportStateWithResponse(ctx context.Context, id openapi_types.UUID, 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 openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetQueryResponse, error) // UpdateQueryWithBodyWithResponse request with any body UpdateQueryWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateQueryResponse, error) UpdateQueryWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateQueryResponse, error) // TestQueryWithBodyWithResponse request with any body TestQueryWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TestQueryResponse, error) TestQueryWithResponse(ctx context.Context, id openapi_types.UUID, body TestQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*TestQueryResponse, error) } type CreateClientResponse struct { Body []byte HTTPResponse *http.Response JSON201 *IdMessage } // 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 *JobClient } // 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 CreateJobResponse struct { Body []byte HTTPResponse *http.Response JSON201 *IdMessage } // Status returns HTTPResponse.Status func (r CreateJobResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r CreateJobResponse) 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 GetJobResponse struct { Body []byte HTTPResponse *http.Response JSON200 *Job } // Status returns HTTPResponse.Status func (r GetJobResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetJobResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type UpdateJobResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status func (r UpdateJobResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r UpdateJobResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type GetJobCollectorByJobIdResponse struct { Body []byte HTTPResponse *http.Response JSON200 *JobCollector } // Status returns HTTPResponse.Status func (r GetJobCollectorByJobIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r GetJobCollectorByJobIdResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } type UpdateJobCollectorByJobIdResponse struct { Body []byte HTTPResponse *http.Response } // Status returns HTTPResponse.Status func (r UpdateJobCollectorByJobIdResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } return http.StatusText(0) } // StatusCode returns HTTPResponse.StatusCode func (r UpdateJobCollectorByJobIdResponse) 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, body UpdateClientJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateClientResponse, error) { rsp, err := c.UpdateClient(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateClientResponse(rsp) } // CreateJobWithBodyWithResponse request with arbitrary body returning *CreateJobResponse func (c *ClientWithResponses) CreateJobWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateJobResponse, error) { rsp, err := c.CreateJobWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseCreateJobResponse(rsp) } func (c *ClientWithResponses) CreateJobWithResponse(ctx context.Context, body CreateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateJobResponse, error) { rsp, err := c.CreateJob(ctx, body, reqEditors...) if err != nil { return nil, err } return ParseCreateJobResponse(rsp) } // TriggerExportWithBodyWithResponse request with arbitrary body returning *TriggerExportResponse func (c *ClientWithResponses) TriggerExportWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) { rsp, err := c.TriggerExportWithBody(ctx, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseTriggerExportResponse(rsp) } func (c *ClientWithResponses) TriggerExportWithResponse(ctx context.Context, body TriggerExportJSONRequestBody, reqEditors ...RequestEditorFn) (*TriggerExportResponse, error) { rsp, err := c.TriggerExport(ctx, body, reqEditors...) if err != nil { return nil, err } return ParseTriggerExportResponse(rsp) } // GetJobWithResponse request returning *GetJobResponse func (c *ClientWithResponses) GetJobWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetJobResponse, error) { rsp, err := c.GetJob(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetJobResponse(rsp) } // UpdateJobWithBodyWithResponse request with arbitrary body returning *UpdateJobResponse func (c *ClientWithResponses) UpdateJobWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateJobResponse, error) { rsp, err := c.UpdateJobWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateJobResponse(rsp) } func (c *ClientWithResponses) UpdateJobWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateJobJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateJobResponse, error) { rsp, err := c.UpdateJob(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateJobResponse(rsp) } // GetJobCollectorByJobIdWithResponse request returning *GetJobCollectorByJobIdResponse func (c *ClientWithResponses) GetJobCollectorByJobIdWithResponse(ctx context.Context, id openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetJobCollectorByJobIdResponse, error) { rsp, err := c.GetJobCollectorByJobId(ctx, id, reqEditors...) if err != nil { return nil, err } return ParseGetJobCollectorByJobIdResponse(rsp) } // UpdateJobCollectorByJobIdWithBodyWithResponse request with arbitrary body returning *UpdateJobCollectorByJobIdResponse func (c *ClientWithResponses) UpdateJobCollectorByJobIdWithBodyWithResponse(ctx context.Context, id openapi_types.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateJobCollectorByJobIdResponse, error) { rsp, err := c.UpdateJobCollectorByJobIdWithBody(ctx, id, contentType, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateJobCollectorByJobIdResponse(rsp) } func (c *ClientWithResponses) UpdateJobCollectorByJobIdWithResponse(ctx context.Context, id openapi_types.UUID, body UpdateJobCollectorByJobIdJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateJobCollectorByJobIdResponse, error) { rsp, err := c.UpdateJobCollectorByJobId(ctx, id, body, reqEditors...) if err != nil { return nil, err } return ParseUpdateJobCollectorByJobIdResponse(rsp) } // ExportStateWithResponse request returning *ExportStateResponse func (c *ClientWithResponses) ExportStateWithResponse(ctx context.Context, id openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 openapi_types.UUID, 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 IdMessage 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 JobClient 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 } // ParseCreateJobResponse parses an HTTP response from a CreateJobWithResponse call func ParseCreateJobResponse(rsp *http.Response) (*CreateJobResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &CreateJobResponse{ 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 } // 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 } // ParseGetJobResponse parses an HTTP response from a GetJobWithResponse call func ParseGetJobResponse(rsp *http.Response) (*GetJobResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetJobResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest Job if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseUpdateJobResponse parses an HTTP response from a UpdateJobWithResponse call func ParseUpdateJobResponse(rsp *http.Response) (*UpdateJobResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &UpdateJobResponse{ Body: bodyBytes, HTTPResponse: rsp, } return response, nil } // ParseGetJobCollectorByJobIdResponse parses an HTTP response from a GetJobCollectorByJobIdWithResponse call func ParseGetJobCollectorByJobIdResponse(rsp *http.Response) (*GetJobCollectorByJobIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &GetJobCollectorByJobIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest JobCollector if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest } return response, nil } // ParseUpdateJobCollectorByJobIdResponse parses an HTTP response from a UpdateJobCollectorByJobIdWithResponse call func ParseUpdateJobCollectorByJobIdResponse(rsp *http.Response) (*UpdateJobCollectorByJobIdResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } response := &UpdateJobCollectorByJobIdResponse{ Body: bodyBytes, HTTPResponse: rsp, } 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 }