api

package
v0.0.0-...-f96b470 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.15.0 DO NOT EDIT.

Index

Constants

View Source
const (
	ApiKeyAuthScopes = "ApiKeyAuth.Scopes"
)

Variables

This section is empty.

Functions

func NewCreateProjectRequest

func NewCreateProjectRequest(server string, body CreateProjectJSONRequestBody) (*http.Request, error)

NewCreateProjectRequest calls the generic CreateProject builder with application/json body

func NewCreateProjectRequestWithBody

func NewCreateProjectRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewCreateProjectRequestWithBody generates requests for CreateProject with any type of body

func NewCreateScenarioRequest

func NewCreateScenarioRequest(server string, projectId uuid.UUID, body CreateScenarioJSONRequestBody) (*http.Request, error)

NewCreateScenarioRequest calls the generic CreateScenario builder with application/json body

func NewCreateScenarioRequestWithBody

func NewCreateScenarioRequestWithBody(server string, projectId uuid.UUID, contentType string, body io.Reader) (*http.Request, error)

NewCreateScenarioRequestWithBody generates requests for CreateScenario with any type of body

func NewListProjectsRequest

func NewListProjectsRequest(server string, params *ListProjectsParams) (*http.Request, error)

NewListProjectsRequest generates requests for ListProjects

func NewListRunsForProjectRequest

func NewListRunsForProjectRequest(server string, id uuid.UUID, params *ListRunsForProjectParams) (*http.Request, error)

NewListRunsForProjectRequest generates requests for ListRunsForProject

func NewListScenariosForProjectRequest

func NewListScenariosForProjectRequest(server string, projectId uuid.UUID, params *ListScenariosForProjectParams) (*http.Request, error)

NewListScenariosForProjectRequest generates requests for ListScenariosForProject

func NewRunProjectRequest

func NewRunProjectRequest(server string, body RunProjectJSONRequestBody) (*http.Request, error)

NewRunProjectRequest calls the generic RunProject builder with application/json body

func NewRunProjectRequestWithBody

func NewRunProjectRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)

NewRunProjectRequestWithBody generates requests for RunProject with any type of body

Types

type Client

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
}

Client which conforms to the OpenAPI3 specification for this service.

func NewClient

func NewClient(server string, opts ...ClientOption) (*Client, error)

Creates a new Client, with reasonable defaults

func (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, body CreateProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateProjectWithBody

func (c *Client) CreateProjectWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateScenario

func (c *Client) CreateScenario(ctx context.Context, projectId uuid.UUID, body CreateScenarioJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) CreateScenarioWithBody

func (c *Client) CreateScenarioWithBody(ctx context.Context, projectId uuid.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListRunsForProject

func (c *Client) ListRunsForProject(ctx context.Context, id uuid.UUID, params *ListRunsForProjectParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListScenariosForProject

func (c *Client) ListScenariosForProject(ctx context.Context, projectId uuid.UUID, params *ListScenariosForProjectParams, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RunProject

func (c *Client) RunProject(ctx context.Context, body RunProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) RunProjectWithBody

func (c *Client) RunProjectWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// ListProjects request
	ListProjects(ctx context.Context, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateProjectWithBody request with any body
	CreateProjectWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreateProject(ctx context.Context, body CreateProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// RunProjectWithBody request with any body
	RunProjectWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	RunProject(ctx context.Context, body RunProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListRunsForProject request
	ListRunsForProject(ctx context.Context, id uuid.UUID, params *ListRunsForProjectParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListScenariosForProject request
	ListScenariosForProject(ctx context.Context, projectId uuid.UUID, params *ListScenariosForProjectParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// CreateScenarioWithBody request with any body
	CreateScenarioWithBody(ctx context.Context, projectId uuid.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreateScenario(ctx context.Context, projectId uuid.UUID, body CreateScenarioJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
}

The interface specification for the client above.

type ClientOption

type ClientOption func(*Client) error

ClientOption allows setting custom parameters during construction

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the baseURL.

func WithHTTPClient

func WithHTTPClient(doer HttpRequestDoer) ClientOption

WithHTTPClient allows overriding the default Doer, which is automatically created using http.Client. This is useful for tests.

func WithRequestEditorFn

func WithRequestEditorFn(fn RequestEditorFn) ClientOption

WithRequestEditorFn allows setting up a callback function, which will be called right before sending the request. This can be used to mutate the request.

type ClientWithResponses

type ClientWithResponses struct {
	ClientInterface
}

ClientWithResponses builds on ClientInterface to offer response payloads

func NewClientWithResponses

func NewClientWithResponses(server string, opts ...ClientOption) (*ClientWithResponses, error)

NewClientWithResponses creates a new ClientWithResponses, which wraps Client with return type handling

func (*ClientWithResponses) CreateProjectWithBodyWithResponse

func (c *ClientWithResponses) CreateProjectWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateProjectResponse, error)

CreateProjectWithBodyWithResponse request with arbitrary body returning *CreateProjectResponse

func (*ClientWithResponses) CreateProjectWithResponse

func (c *ClientWithResponses) CreateProjectWithResponse(ctx context.Context, body CreateProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateProjectResponse, error)

func (*ClientWithResponses) CreateScenarioWithBodyWithResponse

func (c *ClientWithResponses) CreateScenarioWithBodyWithResponse(ctx context.Context, projectId uuid.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateScenarioResponse, error)

CreateScenarioWithBodyWithResponse request with arbitrary body returning *CreateScenarioResponse

func (*ClientWithResponses) CreateScenarioWithResponse

func (c *ClientWithResponses) CreateScenarioWithResponse(ctx context.Context, projectId uuid.UUID, body CreateScenarioJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateScenarioResponse, error)

func (*ClientWithResponses) ListProjectsWithResponse

func (c *ClientWithResponses) ListProjectsWithResponse(ctx context.Context, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error)

ListProjectsWithResponse request returning *ListProjectsResponse

func (*ClientWithResponses) ListRunsForProjectWithResponse

func (c *ClientWithResponses) ListRunsForProjectWithResponse(ctx context.Context, id uuid.UUID, params *ListRunsForProjectParams, reqEditors ...RequestEditorFn) (*ListRunsForProjectResponse, error)

ListRunsForProjectWithResponse request returning *ListRunsForProjectResponse

func (*ClientWithResponses) ListScenariosForProjectWithResponse

func (c *ClientWithResponses) ListScenariosForProjectWithResponse(ctx context.Context, projectId uuid.UUID, params *ListScenariosForProjectParams, reqEditors ...RequestEditorFn) (*ListScenariosForProjectResponse, error)

ListScenariosForProjectWithResponse request returning *ListScenariosForProjectResponse

func (*ClientWithResponses) RunProjectWithBodyWithResponse

func (c *ClientWithResponses) RunProjectWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RunProjectResponse, error)

RunProjectWithBodyWithResponse request with arbitrary body returning *RunProjectResponse

func (*ClientWithResponses) RunProjectWithResponse

func (c *ClientWithResponses) RunProjectWithResponse(ctx context.Context, body RunProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*RunProjectResponse, error)

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListProjectsWithResponse request
	ListProjectsWithResponse(ctx context.Context, params *ListProjectsParams, reqEditors ...RequestEditorFn) (*ListProjectsResponse, error)

	// CreateProjectWithBodyWithResponse request with any body
	CreateProjectWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateProjectResponse, error)

	CreateProjectWithResponse(ctx context.Context, body CreateProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateProjectResponse, error)

	// RunProjectWithBodyWithResponse request with any body
	RunProjectWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*RunProjectResponse, error)

	RunProjectWithResponse(ctx context.Context, body RunProjectJSONRequestBody, reqEditors ...RequestEditorFn) (*RunProjectResponse, error)

	// ListRunsForProjectWithResponse request
	ListRunsForProjectWithResponse(ctx context.Context, id uuid.UUID, params *ListRunsForProjectParams, reqEditors ...RequestEditorFn) (*ListRunsForProjectResponse, error)

	// ListScenariosForProjectWithResponse request
	ListScenariosForProjectWithResponse(ctx context.Context, projectId uuid.UUID, params *ListScenariosForProjectParams, reqEditors ...RequestEditorFn) (*ListScenariosForProjectResponse, error)

	// CreateScenarioWithBodyWithResponse request with any body
	CreateScenarioWithBodyWithResponse(ctx context.Context, projectId uuid.UUID, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateScenarioResponse, error)

	CreateScenarioWithResponse(ctx context.Context, projectId uuid.UUID, body CreateScenarioJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateScenarioResponse, error)
}

ClientWithResponsesInterface is the interface specification for the client with responses above.

type CreateProjectJSONRequestBody

type CreateProjectJSONRequestBody = Project

CreateProjectJSONRequestBody defines body for CreateProject for application/json ContentType.

type CreateProjectResponse

type CreateProjectResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *Project
	JSONDefault  *ErrMsg
}

func ParseCreateProjectResponse

func ParseCreateProjectResponse(rsp *http.Response) (*CreateProjectResponse, error)

ParseCreateProjectResponse parses an HTTP response from a CreateProjectWithResponse call

func (CreateProjectResponse) Status

func (r CreateProjectResponse) Status() string

Status returns HTTPResponse.Status

func (CreateProjectResponse) StatusCode

func (r CreateProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type CreateScenarioJSONRequestBody

type CreateScenarioJSONRequestBody = ScenarioCreateRequest

CreateScenarioJSONRequestBody defines body for CreateScenario for application/json ContentType.

type CreateScenarioResponse

type CreateScenarioResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *Scenario
	JSONDefault  *ErrMsg
}

func ParseCreateScenarioResponse

func ParseCreateScenarioResponse(rsp *http.Response) (*CreateScenarioResponse, error)

ParseCreateScenarioResponse parses an HTTP response from a CreateScenarioWithResponse call

func (CreateScenarioResponse) Status

func (r CreateScenarioResponse) Status() string

Status returns HTTPResponse.Status

func (CreateScenarioResponse) StatusCode

func (r CreateScenarioResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ErrMsg

type ErrMsg struct {
	Message string `json:"message"`
}

ErrMsg defines model for ErrMsg.

type HttpRequestDoer

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListProjectsParams

type ListProjectsParams struct {
	// Limit The number of projects to return
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset The number of projects to skip
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

ListProjectsParams defines parameters for ListProjects.

type ListProjectsResponse

type ListProjectsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ProjectArray
	JSONDefault  *ErrMsg
}

func ParseListProjectsResponse

func ParseListProjectsResponse(rsp *http.Response) (*ListProjectsResponse, error)

ParseListProjectsResponse parses an HTTP response from a ListProjectsWithResponse call

func (ListProjectsResponse) Status

func (r ListProjectsResponse) Status() string

Status returns HTTPResponse.Status

func (ListProjectsResponse) StatusCode

func (r ListProjectsResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListRunsForProjectParams

type ListRunsForProjectParams struct {
	// Limit The number of runs to return
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset The number of runs to skip
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

ListRunsForProjectParams defines parameters for ListRunsForProject.

type ListRunsForProjectResponse

type ListRunsForProjectResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ProjectRunOutputArray
	JSONDefault  *ErrMsg
}

func ParseListRunsForProjectResponse

func ParseListRunsForProjectResponse(rsp *http.Response) (*ListRunsForProjectResponse, error)

ParseListRunsForProjectResponse parses an HTTP response from a ListRunsForProjectWithResponse call

func (ListRunsForProjectResponse) Status

Status returns HTTPResponse.Status

func (ListRunsForProjectResponse) StatusCode

func (r ListRunsForProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListScenariosForProjectParams

type ListScenariosForProjectParams struct {
	// Limit The number of scenarios to return
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// Offset The number of scenarios to skip
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

ListScenariosForProjectParams defines parameters for ListScenariosForProject.

type ListScenariosForProjectResponse

type ListScenariosForProjectResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ScenarioArray
	JSONDefault  *ErrMsg
}

func ParseListScenariosForProjectResponse

func ParseListScenariosForProjectResponse(rsp *http.Response) (*ListScenariosForProjectResponse, error)

ParseListScenariosForProjectResponse parses an HTTP response from a ListScenariosForProjectWithResponse call

func (ListScenariosForProjectResponse) Status

Status returns HTTPResponse.Status

func (ListScenariosForProjectResponse) StatusCode

func (r ListScenariosForProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Project

type Project struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

Project defines model for Project.

type ProjectArray

type ProjectArray = []Project

ProjectArray defines model for ProjectArray.

type ProjectRunOutput

type ProjectRunOutput struct {
	ID                 uuid.UUID             `json:"id"`
	ProjectID          uuid.UUID             `json:"project_id"`
	ScenarioRunDetails []ScenarioRunDetails  `json:"scenario_run_details"`
	State              ProjectRunOutputState `json:"state"`
	Success            bool                  `json:"success"`
}

ProjectRunOutput defines model for ProjectRunOutput.

type ProjectRunOutputArray

type ProjectRunOutputArray = []ProjectRunOutput

ProjectRunOutputArray defines model for ProjectRunOutputArray.

type ProjectRunOutputState

type ProjectRunOutputState string

ProjectRunOutputState defines model for ProjectRunOutput.State.

const (
	Cancelled ProjectRunOutputState = "cancelled"
	Completed ProjectRunOutputState = "completed"
	Failure   ProjectRunOutputState = "failure"
	Pending   ProjectRunOutputState = "pending"
	Running   ProjectRunOutputState = "running"
)

Defines values for ProjectRunOutputState.

type ProjectRunRequest

type ProjectRunRequest struct {
	ProjectID   *uuid.UUID `json:"project_id,omitempty"`
	ProjectName *string    `json:"project_name,omitempty"`
}

ProjectRunRequest defines model for ProjectRunRequest.

type RequestEditorFn

type RequestEditorFn func(ctx context.Context, req *http.Request) error

RequestEditorFn is the function signature for the RequestEditor callback function

type RunProjectJSONRequestBody

type RunProjectJSONRequestBody = ProjectRunRequest

RunProjectJSONRequestBody defines body for RunProject for application/json ContentType.

type RunProjectResponse

type RunProjectResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *ProjectRunOutput
	JSONDefault  *ErrMsg
}

func ParseRunProjectResponse

func ParseRunProjectResponse(rsp *http.Response) (*RunProjectResponse, error)

ParseRunProjectResponse parses an HTTP response from a RunProjectWithResponse call

func (RunProjectResponse) Status

func (r RunProjectResponse) Status() string

Status returns HTTPResponse.Status

func (RunProjectResponse) StatusCode

func (r RunProjectResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type Scenario

type Scenario struct {
	ID        uuid.UUID        `json:"id"`
	Name      string           `json:"name"`
	ProjectID uuid.UUID        `json:"project_id"`
	Spec      string           `json:"spec"`
	SpecType  ScenarioSpecType `json:"spec_type"`
}

Scenario defines model for Scenario.

type ScenarioArray

type ScenarioArray = []Scenario

ScenarioArray defines model for ScenarioArray.

type ScenarioCreateRequest

type ScenarioCreateRequest struct {
	Name string `json:"name"`

	// Spec A base64 encoded string of the spec
	Spec     string `json:"spec"`
	SpecType string `json:"spec_type"`
}

ScenarioCreateRequest defines model for ScenarioCreateRequest.

type ScenarioRunDetails

type ScenarioRunDetails struct {
	Assertions   int              `json:"assertions"`
	DurationInMs int              `json:"duration_in_ms"`
	Name         string           `json:"name"`
	Steps        []StepRunDetails `json:"steps"`
	Success      bool             `json:"success"`
}

ScenarioRunDetails defines model for ScenarioRunDetails.

type ScenarioSpecType

type ScenarioSpecType string

ScenarioSpecType defines model for Scenario.SpecType.

const (
	Yaml ScenarioSpecType = "yaml"
)

Defines values for ScenarioSpecType.

type StepRunDetails

type StepRunDetails struct {
	Assertions          int    `json:"assertions"`
	DurationInMs        int    `json:"duration_in_ms"`
	Name                string `json:"name"`
	RequestDurationInMs int    `json:"request_duration_in_ms"`
	Retries             int    `json:"retries"`
	Success             bool   `json:"success"`
	URL                 string `json:"url"`
}

StepRunDetails defines model for StepRunDetails.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL