apigen

package
v0.0.0-...-5bd7f72 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGetDeployRequest

func NewGetDeployRequest(server string, serviceId string, deployId string) (*http.Request, error)

NewGetDeployRequest generates requests for GetDeploy

func NewGetServiceRequest

func NewGetServiceRequest(server string, serviceId string) (*http.Request, error)

NewGetServiceRequest generates requests for GetService

func NewListDeploysRequest

func NewListDeploysRequest(server string, serviceId string) (*http.Request, error)

NewListDeploysRequest generates requests for ListDeploys

func NewListServicesRequest

func NewListServicesRequest(server string) (*http.Request, error)

NewListServicesRequest generates requests for ListServices

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) GetDeploy

func (c *Client) GetDeploy(ctx context.Context, serviceId string, deployId string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) GetService

func (c *Client) GetService(ctx context.Context, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListDeploys

func (c *Client) ListDeploys(ctx context.Context, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error)

func (*Client) ListServices

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

type ClientInterface

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

	// GetService request
	GetService(ctx context.Context, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// ListDeploys request
	ListDeploys(ctx context.Context, serviceId string, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetDeploy request
	GetDeploy(ctx context.Context, serviceId string, deployId string, 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) GetDeployWithResponse

func (c *ClientWithResponses) GetDeployWithResponse(ctx context.Context, serviceId string, deployId string, reqEditors ...RequestEditorFn) (*GetDeployResponse, error)

GetDeployWithResponse request returning *GetDeployResponse

func (*ClientWithResponses) GetServiceWithResponse

func (c *ClientWithResponses) GetServiceWithResponse(ctx context.Context, serviceId string, reqEditors ...RequestEditorFn) (*GetServiceResponse, error)

GetServiceWithResponse request returning *GetServiceResponse

func (*ClientWithResponses) ListDeploysWithResponse

func (c *ClientWithResponses) ListDeploysWithResponse(ctx context.Context, serviceId string, reqEditors ...RequestEditorFn) (*ListDeploysResponse, error)

ListDeploysWithResponse request returning *ListDeploysResponse

func (*ClientWithResponses) ListServicesWithResponse

func (c *ClientWithResponses) ListServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListServicesResponse, error)

ListServicesWithResponse request returning *ListServicesResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// ListServices request
	ListServicesWithResponse(ctx context.Context, reqEditors ...RequestEditorFn) (*ListServicesResponse, error)

	// GetService request
	GetServiceWithResponse(ctx context.Context, serviceId string, reqEditors ...RequestEditorFn) (*GetServiceResponse, error)

	// ListDeploys request
	ListDeploysWithResponse(ctx context.Context, serviceId string, reqEditors ...RequestEditorFn) (*ListDeploysResponse, error)

	// GetDeploy request
	GetDeployWithResponse(ctx context.Context, serviceId string, deployId string, reqEditors ...RequestEditorFn) (*GetDeployResponse, error)
}

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

type Deploy

type Deploy struct {
	Commit *struct {
		CreatedAt time.Time `json:"createdAt"`
		Id        string    `json:"id"`
		Message   string    `json:"message"`
	} `json:"commit,omitempty"`
	CreatedAt  *time.Time    `json:"createdAt,omitempty"`
	FinishedAt *time.Time    `json:"finishedAt,omitempty"`
	Id         string        `json:"id"`
	Status     *DeployStatus `json:"status,omitempty"`
	UpdatedAt  *time.Time    `json:"updatedAt,omitempty"`
}

Deploy defines model for Deploy.

type DeployStatus

type DeployStatus string

DeployStatus defines model for Deploy.Status.

const (
	BuildFailed      DeployStatus = "build_failed"
	BuildInProgress  DeployStatus = "build_in_progress"
	Canceled         DeployStatus = "canceled"
	Created          DeployStatus = "created"
	Deactivated      DeployStatus = "deactivated"
	Live             DeployStatus = "live"
	UpdateFailed     DeployStatus = "update_failed"
	UpdateInProgress DeployStatus = "update_in_progress"
)

Defines values for DeployStatus.

type GetDeployResponse

type GetDeployResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Deploy
}

func ParseGetDeployResponse

func ParseGetDeployResponse(rsp *http.Response) (*GetDeployResponse, error)

ParseGetDeployResponse parses an HTTP response from a GetDeployWithResponse call

func (GetDeployResponse) Status

func (r GetDeployResponse) Status() string

Status returns HTTPResponse.Status

func (GetDeployResponse) StatusCode

func (r GetDeployResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetServiceResponse

type GetServiceResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *Service
}

func ParseGetServiceResponse

func ParseGetServiceResponse(rsp *http.Response) (*GetServiceResponse, error)

ParseGetServiceResponse parses an HTTP response from a GetServiceWithResponse call

func (GetServiceResponse) Status

func (r GetServiceResponse) Status() string

Status returns HTTPResponse.Status

func (GetServiceResponse) StatusCode

func (r GetServiceResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type ListDeploysResponse

type ListDeploysResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]struct {
		Deploy Deploy `json:"deploy"`
	}
}

func ParseListDeploysResponse

func ParseListDeploysResponse(rsp *http.Response) (*ListDeploysResponse, error)

ParseListDeploysResponse parses an HTTP response from a ListDeploysWithResponse call

func (ListDeploysResponse) Status

func (r ListDeploysResponse) Status() string

Status returns HTTPResponse.Status

func (ListDeploysResponse) StatusCode

func (r ListDeploysResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type ListServicesResponse

type ListServicesResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *[]struct {
		Service Service `json:"service"`
	}
}

func ParseListServicesResponse

func ParseListServicesResponse(rsp *http.Response) (*ListServicesResponse, error)

ParseListServicesResponse parses an HTTP response from a ListServicesWithResponse call

func (ListServicesResponse) Status

func (r ListServicesResponse) Status() string

Status returns HTTPResponse.Status

func (ListServicesResponse) StatusCode

func (r ListServicesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type Service

type Service struct {
	AutoDeploy string    `json:"autoDeploy"`
	Branch     string    `json:"branch"`
	CreatedAt  time.Time `json:"createdAt"`
	Id         string    `json:"id"`
	Name       string    `json:"name"`
	Repo       string    `json:"repo"`
	Slug       string    `json:"slug"`
	UpdatedAt  time.Time `json:"updatedAt"`
}

Service defines model for Service.

Jump to

Keyboard shortcuts

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