1510 lines
45 KiB
Go
1510 lines
45 KiB
Go
|
|
// 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"
|
||
|
|
)
|
||
|
|
|
||
|
|
// Defines values for QueryType.
|
||
|
|
const (
|
||
|
|
CONTEXTFULL QueryType = "CONTEXT_FULL"
|
||
|
|
JSONEXTRACTOR QueryType = "JSON_EXTRACTOR"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ExportTrigger Payload for triggering an export.
|
||
|
|
type ExportTrigger struct {
|
||
|
|
// ExampleProperty Example property for ExportTrigger.
|
||
|
|
ExampleProperty *string `json:"example_property,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// IdMessage defines model for IdMessage.
|
||
|
|
type IdMessage struct {
|
||
|
|
// Id Unique identifier.
|
||
|
|
Id string `json:"id"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// JobCollector JobCollector model.
|
||
|
|
type JobCollector struct {
|
||
|
|
// ExampleProperty Example property for JobCollector.
|
||
|
|
ExampleProperty *string `json:"example_property,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// JobCollectorCreate Payload for creating a JobCollector.
|
||
|
|
type JobCollectorCreate struct {
|
||
|
|
// ExampleProperty Example property for JobCollectorCreate.
|
||
|
|
ExampleProperty *string `json:"example_property,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// JobCollectorUpdate Payload for updating a JobCollector.
|
||
|
|
type JobCollectorUpdate struct {
|
||
|
|
// ExampleProperty Example property for JobCollectorUpdate.
|
||
|
|
ExampleProperty *string `json:"example_property,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 string `json:"id"`
|
||
|
|
|
||
|
|
// LatestVersion The latest version of the query.
|
||
|
|
LatestVersion int32 `json:"latest_version"`
|
||
|
|
|
||
|
|
// RequiredQueries List of required query IDs.
|
||
|
|
RequiredQueries []string `json:"required_queries"`
|
||
|
|
|
||
|
|
// 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 *[]string `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 string `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 *[]string `json:"required_queries,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
// TriggerExportJSONRequestBody defines body for TriggerExport for application/json ContentType.
|
||
|
|
type TriggerExportJSONRequestBody = ExportTrigger
|
||
|
|
|
||
|
|
// CreateJobCollectorJSONRequestBody defines body for CreateJobCollector for application/json ContentType.
|
||
|
|
type CreateJobCollectorJSONRequestBody = JobCollectorCreate
|
||
|
|
|
||
|
|
// UpdateJobCollectorJSONRequestBody defines body for UpdateJobCollector for application/json ContentType.
|
||
|
|
type UpdateJobCollectorJSONRequestBody = 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 {
|
||
|
|
// 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)
|
||
|
|
|
||
|
|
// CreateJobCollectorWithBody request with any body
|
||
|
|
CreateJobCollectorWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
CreateJobCollector(ctx context.Context, body CreateJobCollectorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
// GetJobCollectorById request
|
||
|
|
GetJobCollectorById(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
// UpdateJobCollectorWithBody request with any body
|
||
|
|
UpdateJobCollectorWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
UpdateJobCollector(ctx context.Context, id string, body UpdateJobCollectorJSONRequestBody, 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)
|
||
|
|
|
||
|
|
// DeprecateQuery request
|
||
|
|
DeprecateQuery(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
// GetQueryById request
|
||
|
|
GetQueryById(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
// UpdateQueryWithBody request with any body
|
||
|
|
UpdateQueryWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
UpdateQuery(ctx context.Context, id string, body UpdateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
// TestQueryWithBody request with any body
|
||
|
|
TestQueryWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
|
||
|
|
TestQuery(ctx context.Context, id string, body TestQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
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) CreateJobCollectorWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||
|
|
req, err := NewCreateJobCollectorRequestWithBody(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) CreateJobCollector(ctx context.Context, body CreateJobCollectorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||
|
|
req, err := NewCreateJobCollectorRequest(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) GetJobCollectorById(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||
|
|
req, err := NewGetJobCollectorByIdRequest(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) UpdateJobCollectorWithBody(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||
|
|
req, err := NewUpdateJobCollectorRequestWithBody(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) UpdateJobCollector(ctx context.Context, id string, body UpdateJobCollectorJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||
|
|
req, err := NewUpdateJobCollectorRequest(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) 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) DeprecateQuery(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||
|
|
req, err := NewDeprecateQueryRequest(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) GetQueryById(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*http.Response, error) {
|
||
|
|
req, err := NewGetQueryByIdRequest(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 string, 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 string, 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 string, 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 string, 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)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 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("/exports/trigger")
|
||
|
|
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
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewCreateJobCollectorRequest calls the generic CreateJobCollector builder with application/json body
|
||
|
|
func NewCreateJobCollectorRequest(server string, body CreateJobCollectorJSONRequestBody) (*http.Request, error) {
|
||
|
|
var bodyReader io.Reader
|
||
|
|
buf, err := json.Marshal(body)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
bodyReader = bytes.NewReader(buf)
|
||
|
|
return NewCreateJobCollectorRequestWithBody(server, "application/json", bodyReader)
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewCreateJobCollectorRequestWithBody generates requests for CreateJobCollector with any type of body
|
||
|
|
func NewCreateJobCollectorRequestWithBody(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-collectors")
|
||
|
|
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
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewGetJobCollectorByIdRequest generates requests for GetJobCollectorById
|
||
|
|
func NewGetJobCollectorByIdRequest(server string, id string) (*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-collectors/%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
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewUpdateJobCollectorRequest calls the generic UpdateJobCollector builder with application/json body
|
||
|
|
func NewUpdateJobCollectorRequest(server string, id string, body UpdateJobCollectorJSONRequestBody) (*http.Request, error) {
|
||
|
|
var bodyReader io.Reader
|
||
|
|
buf, err := json.Marshal(body)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
bodyReader = bytes.NewReader(buf)
|
||
|
|
return NewUpdateJobCollectorRequestWithBody(server, id, "application/json", bodyReader)
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewUpdateJobCollectorRequestWithBody generates requests for UpdateJobCollector with any type of body
|
||
|
|
func NewUpdateJobCollectorRequestWithBody(server string, id string, 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-collectors/%s", pathParam0)
|
||
|
|
if operationPath[0] == '/' {
|
||
|
|
operationPath = "." + operationPath
|
||
|
|
}
|
||
|
|
|
||
|
|
queryURL, err := serverURL.Parse(operationPath)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
req, err := http.NewRequest("PUT", queryURL.String(), body)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
req.Header.Add("Content-Type", contentType)
|
||
|
|
|
||
|
|
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("/queries")
|
||
|
|
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("/queries")
|
||
|
|
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
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewDeprecateQueryRequest generates requests for DeprecateQuery
|
||
|
|
func NewDeprecateQueryRequest(server string, id string) (*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("/queries/%s", pathParam0)
|
||
|
|
if operationPath[0] == '/' {
|
||
|
|
operationPath = "." + operationPath
|
||
|
|
}
|
||
|
|
|
||
|
|
queryURL, err := serverURL.Parse(operationPath)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
req, err := http.NewRequest("DELETE", queryURL.String(), nil)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
return req, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// NewGetQueryByIdRequest generates requests for GetQueryById
|
||
|
|
func NewGetQueryByIdRequest(server string, id string) (*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("/queries/%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 string, 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 string, 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("/queries/%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 string, 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 string, 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("/queries/%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 {
|
||
|
|
// 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)
|
||
|
|
|
||
|
|
// CreateJobCollectorWithBodyWithResponse request with any body
|
||
|
|
CreateJobCollectorWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateJobCollectorResponse, error)
|
||
|
|
|
||
|
|
CreateJobCollectorWithResponse(ctx context.Context, body CreateJobCollectorJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateJobCollectorResponse, error)
|
||
|
|
|
||
|
|
// GetJobCollectorByIdWithResponse request
|
||
|
|
GetJobCollectorByIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetJobCollectorByIdResponse, error)
|
||
|
|
|
||
|
|
// UpdateJobCollectorWithBodyWithResponse request with any body
|
||
|
|
UpdateJobCollectorWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateJobCollectorResponse, error)
|
||
|
|
|
||
|
|
UpdateJobCollectorWithResponse(ctx context.Context, id string, body UpdateJobCollectorJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateJobCollectorResponse, 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)
|
||
|
|
|
||
|
|
// DeprecateQueryWithResponse request
|
||
|
|
DeprecateQueryWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeprecateQueryResponse, error)
|
||
|
|
|
||
|
|
// GetQueryByIdWithResponse request
|
||
|
|
GetQueryByIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetQueryByIdResponse, error)
|
||
|
|
|
||
|
|
// UpdateQueryWithBodyWithResponse request with any body
|
||
|
|
UpdateQueryWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateQueryResponse, error)
|
||
|
|
|
||
|
|
UpdateQueryWithResponse(ctx context.Context, id string, body UpdateQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateQueryResponse, error)
|
||
|
|
|
||
|
|
// TestQueryWithBodyWithResponse request with any body
|
||
|
|
TestQueryWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TestQueryResponse, error)
|
||
|
|
|
||
|
|
TestQueryWithResponse(ctx context.Context, id string, body TestQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*TestQueryResponse, error)
|
||
|
|
}
|
||
|
|
|
||
|
|
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 CreateJobCollectorResponse struct {
|
||
|
|
Body []byte
|
||
|
|
HTTPResponse *http.Response
|
||
|
|
JSON201 *IdMessage
|
||
|
|
}
|
||
|
|
|
||
|
|
// Status returns HTTPResponse.Status
|
||
|
|
func (r CreateJobCollectorResponse) Status() string {
|
||
|
|
if r.HTTPResponse != nil {
|
||
|
|
return r.HTTPResponse.Status
|
||
|
|
}
|
||
|
|
return http.StatusText(0)
|
||
|
|
}
|
||
|
|
|
||
|
|
// StatusCode returns HTTPResponse.StatusCode
|
||
|
|
func (r CreateJobCollectorResponse) StatusCode() int {
|
||
|
|
if r.HTTPResponse != nil {
|
||
|
|
return r.HTTPResponse.StatusCode
|
||
|
|
}
|
||
|
|
return 0
|
||
|
|
}
|
||
|
|
|
||
|
|
type GetJobCollectorByIdResponse struct {
|
||
|
|
Body []byte
|
||
|
|
HTTPResponse *http.Response
|
||
|
|
JSON200 *JobCollector
|
||
|
|
}
|
||
|
|
|
||
|
|
// Status returns HTTPResponse.Status
|
||
|
|
func (r GetJobCollectorByIdResponse) Status() string {
|
||
|
|
if r.HTTPResponse != nil {
|
||
|
|
return r.HTTPResponse.Status
|
||
|
|
}
|
||
|
|
return http.StatusText(0)
|
||
|
|
}
|
||
|
|
|
||
|
|
// StatusCode returns HTTPResponse.StatusCode
|
||
|
|
func (r GetJobCollectorByIdResponse) StatusCode() int {
|
||
|
|
if r.HTTPResponse != nil {
|
||
|
|
return r.HTTPResponse.StatusCode
|
||
|
|
}
|
||
|
|
return 0
|
||
|
|
}
|
||
|
|
|
||
|
|
type UpdateJobCollectorResponse struct {
|
||
|
|
Body []byte
|
||
|
|
HTTPResponse *http.Response
|
||
|
|
}
|
||
|
|
|
||
|
|
// Status returns HTTPResponse.Status
|
||
|
|
func (r UpdateJobCollectorResponse) Status() string {
|
||
|
|
if r.HTTPResponse != nil {
|
||
|
|
return r.HTTPResponse.Status
|
||
|
|
}
|
||
|
|
return http.StatusText(0)
|
||
|
|
}
|
||
|
|
|
||
|
|
// StatusCode returns HTTPResponse.StatusCode
|
||
|
|
func (r UpdateJobCollectorResponse) 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 DeprecateQueryResponse struct {
|
||
|
|
Body []byte
|
||
|
|
HTTPResponse *http.Response
|
||
|
|
}
|
||
|
|
|
||
|
|
// Status returns HTTPResponse.Status
|
||
|
|
func (r DeprecateQueryResponse) Status() string {
|
||
|
|
if r.HTTPResponse != nil {
|
||
|
|
return r.HTTPResponse.Status
|
||
|
|
}
|
||
|
|
return http.StatusText(0)
|
||
|
|
}
|
||
|
|
|
||
|
|
// StatusCode returns HTTPResponse.StatusCode
|
||
|
|
func (r DeprecateQueryResponse) StatusCode() int {
|
||
|
|
if r.HTTPResponse != nil {
|
||
|
|
return r.HTTPResponse.StatusCode
|
||
|
|
}
|
||
|
|
return 0
|
||
|
|
}
|
||
|
|
|
||
|
|
type GetQueryByIdResponse struct {
|
||
|
|
Body []byte
|
||
|
|
HTTPResponse *http.Response
|
||
|
|
JSON200 *Query
|
||
|
|
}
|
||
|
|
|
||
|
|
// Status returns HTTPResponse.Status
|
||
|
|
func (r GetQueryByIdResponse) Status() string {
|
||
|
|
if r.HTTPResponse != nil {
|
||
|
|
return r.HTTPResponse.Status
|
||
|
|
}
|
||
|
|
return http.StatusText(0)
|
||
|
|
}
|
||
|
|
|
||
|
|
// StatusCode returns HTTPResponse.StatusCode
|
||
|
|
func (r GetQueryByIdResponse) 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
|
||
|
|
}
|
||
|
|
|
||
|
|
// 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)
|
||
|
|
}
|
||
|
|
|
||
|
|
// CreateJobCollectorWithBodyWithResponse request with arbitrary body returning *CreateJobCollectorResponse
|
||
|
|
func (c *ClientWithResponses) CreateJobCollectorWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateJobCollectorResponse, error) {
|
||
|
|
rsp, err := c.CreateJobCollectorWithBody(ctx, contentType, body, reqEditors...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return ParseCreateJobCollectorResponse(rsp)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *ClientWithResponses) CreateJobCollectorWithResponse(ctx context.Context, body CreateJobCollectorJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateJobCollectorResponse, error) {
|
||
|
|
rsp, err := c.CreateJobCollector(ctx, body, reqEditors...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return ParseCreateJobCollectorResponse(rsp)
|
||
|
|
}
|
||
|
|
|
||
|
|
// GetJobCollectorByIdWithResponse request returning *GetJobCollectorByIdResponse
|
||
|
|
func (c *ClientWithResponses) GetJobCollectorByIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetJobCollectorByIdResponse, error) {
|
||
|
|
rsp, err := c.GetJobCollectorById(ctx, id, reqEditors...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return ParseGetJobCollectorByIdResponse(rsp)
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateJobCollectorWithBodyWithResponse request with arbitrary body returning *UpdateJobCollectorResponse
|
||
|
|
func (c *ClientWithResponses) UpdateJobCollectorWithBodyWithResponse(ctx context.Context, id string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateJobCollectorResponse, error) {
|
||
|
|
rsp, err := c.UpdateJobCollectorWithBody(ctx, id, contentType, body, reqEditors...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return ParseUpdateJobCollectorResponse(rsp)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (c *ClientWithResponses) UpdateJobCollectorWithResponse(ctx context.Context, id string, body UpdateJobCollectorJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateJobCollectorResponse, error) {
|
||
|
|
rsp, err := c.UpdateJobCollector(ctx, id, body, reqEditors...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return ParseUpdateJobCollectorResponse(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)
|
||
|
|
}
|
||
|
|
|
||
|
|
// DeprecateQueryWithResponse request returning *DeprecateQueryResponse
|
||
|
|
func (c *ClientWithResponses) DeprecateQueryWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*DeprecateQueryResponse, error) {
|
||
|
|
rsp, err := c.DeprecateQuery(ctx, id, reqEditors...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return ParseDeprecateQueryResponse(rsp)
|
||
|
|
}
|
||
|
|
|
||
|
|
// GetQueryByIdWithResponse request returning *GetQueryByIdResponse
|
||
|
|
func (c *ClientWithResponses) GetQueryByIdWithResponse(ctx context.Context, id string, reqEditors ...RequestEditorFn) (*GetQueryByIdResponse, error) {
|
||
|
|
rsp, err := c.GetQueryById(ctx, id, reqEditors...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return ParseGetQueryByIdResponse(rsp)
|
||
|
|
}
|
||
|
|
|
||
|
|
// UpdateQueryWithBodyWithResponse request with arbitrary body returning *UpdateQueryResponse
|
||
|
|
func (c *ClientWithResponses) UpdateQueryWithBodyWithResponse(ctx context.Context, id string, 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 string, 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 string, 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 string, body TestQueryJSONRequestBody, reqEditors ...RequestEditorFn) (*TestQueryResponse, error) {
|
||
|
|
rsp, err := c.TestQuery(ctx, id, body, reqEditors...)
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
return ParseTestQueryResponse(rsp)
|
||
|
|
}
|
||
|
|
|
||
|
|
// 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
|
||
|
|
}
|
||
|
|
|
||
|
|
// ParseCreateJobCollectorResponse parses an HTTP response from a CreateJobCollectorWithResponse call
|
||
|
|
func ParseCreateJobCollectorResponse(rsp *http.Response) (*CreateJobCollectorResponse, error) {
|
||
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
||
|
|
defer func() { _ = rsp.Body.Close() }()
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
response := &CreateJobCollectorResponse{
|
||
|
|
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
|
||
|
|
}
|
||
|
|
|
||
|
|
// ParseGetJobCollectorByIdResponse parses an HTTP response from a GetJobCollectorByIdWithResponse call
|
||
|
|
func ParseGetJobCollectorByIdResponse(rsp *http.Response) (*GetJobCollectorByIdResponse, error) {
|
||
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
||
|
|
defer func() { _ = rsp.Body.Close() }()
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
response := &GetJobCollectorByIdResponse{
|
||
|
|
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
|
||
|
|
}
|
||
|
|
|
||
|
|
// ParseUpdateJobCollectorResponse parses an HTTP response from a UpdateJobCollectorWithResponse call
|
||
|
|
func ParseUpdateJobCollectorResponse(rsp *http.Response) (*UpdateJobCollectorResponse, error) {
|
||
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
||
|
|
defer func() { _ = rsp.Body.Close() }()
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
response := &UpdateJobCollectorResponse{
|
||
|
|
Body: bodyBytes,
|
||
|
|
HTTPResponse: rsp,
|
||
|
|
}
|
||
|
|
|
||
|
|
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
|
||
|
|
}
|
||
|
|
|
||
|
|
// ParseDeprecateQueryResponse parses an HTTP response from a DeprecateQueryWithResponse call
|
||
|
|
func ParseDeprecateQueryResponse(rsp *http.Response) (*DeprecateQueryResponse, error) {
|
||
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
||
|
|
defer func() { _ = rsp.Body.Close() }()
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
response := &DeprecateQueryResponse{
|
||
|
|
Body: bodyBytes,
|
||
|
|
HTTPResponse: rsp,
|
||
|
|
}
|
||
|
|
|
||
|
|
return response, nil
|
||
|
|
}
|
||
|
|
|
||
|
|
// ParseGetQueryByIdResponse parses an HTTP response from a GetQueryByIdWithResponse call
|
||
|
|
func ParseGetQueryByIdResponse(rsp *http.Response) (*GetQueryByIdResponse, error) {
|
||
|
|
bodyBytes, err := io.ReadAll(rsp.Body)
|
||
|
|
defer func() { _ = rsp.Body.Close() }()
|
||
|
|
if err != nil {
|
||
|
|
return nil, err
|
||
|
|
}
|
||
|
|
|
||
|
|
response := &GetQueryByIdResponse{
|
||
|
|
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
|
||
|
|
}
|