Documentation
¶
Overview ¶
Package apis provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.
Package apis provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.
Index ¶
- func GetSpec() (swagger *openapi3.T, err error)
- func GetSpecJSON() ([]byte, error)
- func GetSwagger() (*openapi3.T, error)deprecated
- func NewCreateSiteRequest(server string, body CreateSiteJSONRequestBody) (*http.Request, error)
- func NewCreateSiteRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
- func NewGetSiteRequest(server string, params *GetSiteParams) (*http.Request, error)
- func NewUploadFileRequestWithBody(server string, siteId string, params *UploadFileParams, contentType string, ...) (*http.Request, error)
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type Client
- func (c *Client) CreateSite(ctx context.Context, body CreateSiteJSONRequestBody, ...) (*http.Response, error)
- func (c *Client) CreateSiteWithBody(ctx context.Context, contentType string, body io.Reader, ...) (*http.Response, error)
- func (c *Client) GetSite(ctx context.Context, params *GetSiteParams, reqEditors ...RequestEditorFn) (*http.Response, error)
- func (c *Client) UploadFileWithBody(ctx context.Context, siteId string, params *UploadFileParams, ...) (*http.Response, error)
- type ClientInterface
- type ClientOption
- type ClientWithResponses
- func (c *ClientWithResponses) CreateSiteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, ...) (*CreateSiteResponse, error)
- func (c *ClientWithResponses) CreateSiteWithResponse(ctx context.Context, body CreateSiteJSONRequestBody, ...) (*CreateSiteResponse, error)
- func (c *ClientWithResponses) GetSiteWithResponse(ctx context.Context, params *GetSiteParams, reqEditors ...RequestEditorFn) (*GetSiteResponse, error)
- func (c *ClientWithResponses) UploadFileWithBodyWithResponse(ctx context.Context, siteId string, params *UploadFileParams, ...) (*UploadFileResponse, error)
- type ClientWithResponsesInterface
- type CreateSiteInputBody
- type CreateSiteJSONRequestBody
- type CreateSiteResponse
- type DeletedAt
- type ErrorDetail
- type ErrorModel
- type GetSiteOutputBody
- type GetSiteParams
- type GetSiteResponse
- type HttpRequestDoer
- type RequestEditorFn
- type Site
- type UploadFileParams
- type UploadFileResponse
- func (r UploadFileResponse) ContentType() string
- func (r UploadFileResponse) GetApplicationproblemJSONDefault() *ErrorModel
- func (r UploadFileResponse) GetBody() []byte
- func (r UploadFileResponse) GetJSON200() *string
- func (r UploadFileResponse) Status() string
- func (r UploadFileResponse) StatusCode() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSpec ¶
GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.
func GetSpecJSON ¶
GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.
func GetSwagger
deprecated
func NewCreateSiteRequest ¶
func NewCreateSiteRequest(server string, body CreateSiteJSONRequestBody) (*http.Request, error)
NewCreateSiteRequest calls the generic CreateSite builder with application/json body
func NewCreateSiteRequestWithBody ¶ added in v0.3.0
func NewCreateSiteRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error)
NewCreateSiteRequestWithBody constructs an http.Request for the CreateSite method, with any body, and a specified content type
func NewGetSiteRequest ¶
func NewGetSiteRequest(server string, params *GetSiteParams) (*http.Request, error)
NewGetSiteRequest constructs an http.Request for the GetSite method
func NewUploadFileRequestWithBody ¶ added in v0.3.0
func NewUploadFileRequestWithBody(server string, siteId string, params *UploadFileParams, contentType string, body io.Reader) (*http.Request, error)
NewUploadFileRequestWithBody constructs an http.Request for the UploadFile method, with any body, and a specified content type
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) CreateSite ¶
func (c *Client) CreateSite(ctx context.Context, body CreateSiteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
CreateSite Create a new site
Creates a new site in the builder. This will create a new site folder.
Takes a body of the `application/json` content type.
Corresponds with POST /sites (the `CreateSite` operationId).
func (*Client) CreateSiteWithBody ¶ added in v0.3.0
func (c *Client) CreateSiteWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
CreateSiteWithBody Create a new site
Creates a new site in the builder. This will create a new site folder.
Takes any type of body and a specified content type.
Corresponds with POST /sites (the `CreateSite` operationId).
func (*Client) GetSite ¶
func (c *Client) GetSite(ctx context.Context, params *GetSiteParams, reqEditors ...RequestEditorFn) (*http.Response, error)
GetSite Get a site
Gets a site by its name.
Corresponds with GET /sites (the `GetSite` operationId).
func (*Client) UploadFileWithBody ¶ added in v0.3.0
func (c *Client) UploadFileWithBody(ctx context.Context, siteId string, params *UploadFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
UploadFileWithBody This endpoint uploads a new file to the site.
Upload a new file to the site.
Takes any type of body and a specified content type.
Corresponds with POST /sites/{siteId}/files/upload (the `UploadFile` operationId).
type ClientInterface ¶
type ClientInterface interface {
// GetSite Get a site
//
// Gets a site by its name.
//
// Corresponds with GET /sites (the `GetSite` operationId).
GetSite(ctx context.Context, params *GetSiteParams, reqEditors ...RequestEditorFn) (*http.Response, error)
// CreateSiteWithBody Create a new site
//
// Creates a new site in the builder. This will create a new site folder.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /sites (the `CreateSite` operationId).
CreateSiteWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
// CreateSite Create a new site
//
// Creates a new site in the builder. This will create a new site folder.
//
// Takes a body of the `application/json` content type.
//
// Corresponds with POST /sites (the `CreateSite` operationId).
CreateSite(ctx context.Context, body CreateSiteJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)
// UploadFileWithBody This endpoint uploads a new file to the site.
//
// Upload a new file to the site.
//
// Takes any type of body and a specified content type.
//
// Corresponds with POST /sites/{siteId}/files/upload (the `UploadFile` operationId).
UploadFileWithBody(ctx context.Context, siteId string, params *UploadFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)
}
The interface specification for the client above.
type ClientOption ¶
ClientOption allows setting custom parameters during construction
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) CreateSiteWithBodyWithResponse ¶ added in v0.3.0
func (c *ClientWithResponses) CreateSiteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)
CreateSiteWithBodyWithResponse Create a new site
Creates a new site in the builder. This will create a new site folder.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /sites (the `CreateSite` operationId).
func (*ClientWithResponses) CreateSiteWithResponse ¶
func (c *ClientWithResponses) CreateSiteWithResponse(ctx context.Context, body CreateSiteJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)
CreateSiteWithResponse Create a new site
Creates a new site in the builder. This will create a new site folder.
Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /sites (the `CreateSite` operationId).
func (*ClientWithResponses) GetSiteWithResponse ¶
func (c *ClientWithResponses) GetSiteWithResponse(ctx context.Context, params *GetSiteParams, reqEditors ...RequestEditorFn) (*GetSiteResponse, error)
GetSiteWithResponse Get a site
Gets a site by its name.
Returns a wrapper object for the known response body format(s).
Corresponds with GET /sites (the `GetSite` operationId).
func (*ClientWithResponses) UploadFileWithBodyWithResponse ¶ added in v0.3.0
func (c *ClientWithResponses) UploadFileWithBodyWithResponse(ctx context.Context, siteId string, params *UploadFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadFileResponse, error)
UploadFileWithBodyWithResponse This endpoint uploads a new file to the site.
Upload a new file to the site.
Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
Corresponds with POST /sites/{siteId}/files/upload (the `UploadFile` operationId).
type ClientWithResponsesInterface ¶
type ClientWithResponsesInterface interface {
// GetSiteWithResponse Get a site
//
// Gets a site by its name.
//
// Returns a wrapper object for the known response body format(s).
//
// Corresponds with GET /sites (the `GetSite` operationId).
GetSiteWithResponse(ctx context.Context, params *GetSiteParams, reqEditors ...RequestEditorFn) (*GetSiteResponse, error)
// CreateSiteWithBodyWithResponse Create a new site
//
// Creates a new site in the builder. This will create a new site folder.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /sites (the `CreateSite` operationId).
CreateSiteWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)
// CreateSiteWithResponse Create a new site
//
// Creates a new site in the builder. This will create a new site folder.
//
// Takes a body of the `application/json` content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /sites (the `CreateSite` operationId).
CreateSiteWithResponse(ctx context.Context, body CreateSiteJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSiteResponse, error)
// UploadFileWithBodyWithResponse This endpoint uploads a new file to the site.
//
// Upload a new file to the site.
//
// Takes any type of body and a specified content type, and returns a wrapper object for the known response body format(s).
//
// Corresponds with POST /sites/{siteId}/files/upload (the `UploadFile` operationId).
UploadFileWithBodyWithResponse(ctx context.Context, siteId string, params *UploadFileParams, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UploadFileResponse, error)
}
ClientWithResponsesInterface is the interface specification for the client with responses above.
type CreateSiteInputBody ¶ added in v0.3.0
type CreateSiteInputBody struct {
// Schema A URL to the JSON Schema for this object.
//
// Example: https://example.com/schemas/CreateSiteInputBody.json
Schema *string `json:"$schema,omitempty"`
// Name The name of the site (e.g. fizzy-buzzy).
//
// Example: fizzy-buzzy
Name string `json:"name"`
}
CreateSiteInputBody defines model for CreateSiteInputBody.
type CreateSiteJSONRequestBody ¶ added in v0.3.0
type CreateSiteJSONRequestBody = CreateSiteInputBody
CreateSiteJSONRequestBody defines body for CreateSite for application/json ContentType.
type CreateSiteResponse ¶
type CreateSiteResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *Site
}
func ParseCreateSiteResponse ¶
func ParseCreateSiteResponse(rsp *http.Response) (*CreateSiteResponse, error)
ParseCreateSiteResponse parses an HTTP response from a CreateSiteWithResponse call
func (CreateSiteResponse) ContentType ¶
func (r CreateSiteResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (CreateSiteResponse) GetBody ¶ added in v0.3.0
func (r CreateSiteResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (CreateSiteResponse) GetJSON200 ¶ added in v0.3.0
func (r CreateSiteResponse) GetJSON200() *Site
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (CreateSiteResponse) Status ¶
func (r CreateSiteResponse) Status() string
Status returns HTTPResponse.Status
func (CreateSiteResponse) StatusCode ¶
func (r CreateSiteResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type ErrorDetail ¶
type ErrorDetail struct {
// Location Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
Location *string `json:"location,omitempty"`
// Message Error message text
Message *string `json:"message,omitempty"`
// Value The value at the given location
Value interface{} `json:"value,omitempty"`
}
ErrorDetail defines model for ErrorDetail.
type ErrorModel ¶
type ErrorModel struct {
// Schema A URL to the JSON Schema for this object.
//
// Example: https://example.com/schemas/ErrorModel.json
Schema *string `json:"$schema,omitempty"`
// Detail A human-readable explanation specific to this occurrence of the problem.
//
// Example: Property foo is required but is missing.
Detail *string `json:"detail,omitempty"`
// Errors Optional list of individual error details
Errors *[]ErrorDetail `json:"errors,omitempty"`
// Instance A URI reference that identifies the specific occurrence of the problem.
//
// Example: https://example.com/error-log/abc123
Instance *string `json:"instance,omitempty"`
// Status HTTP status code
//
// Example: 400
Status *int64 `json:"status,omitempty"`
// Title A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
//
// Example: Bad Request
Title *string `json:"title,omitempty"`
// Type A URI reference to human-readable documentation for the error.
//
// Example: https://example.com/errors/example
Type *string `json:"type,omitempty"`
}
ErrorModel defines model for ErrorModel.
type GetSiteOutputBody ¶ added in v0.3.0
type GetSiteOutputBody struct {
// Schema A URL to the JSON Schema for this object.
//
// Example: https://example.com/schemas/GetSiteOutputBody.json
Schema *string `json:"$schema,omitempty"`
Site Site `json:"site"`
}
GetSiteOutputBody defines model for GetSiteOutputBody.
type GetSiteParams ¶ added in v0.3.0
type GetSiteParams struct {
// Name The name of the site.
Name string `form:"name" json:"name"`
}
GetSiteParams defines parameters for GetSite.
type GetSiteResponse ¶
type GetSiteResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *GetSiteOutputBody
}
func ParseGetSiteResponse ¶
func ParseGetSiteResponse(rsp *http.Response) (*GetSiteResponse, error)
ParseGetSiteResponse parses an HTTP response from a GetSiteWithResponse call
func (GetSiteResponse) ContentType ¶
func (r GetSiteResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (GetSiteResponse) GetBody ¶ added in v0.3.0
func (r GetSiteResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (GetSiteResponse) GetJSON200 ¶ added in v0.3.0
func (r GetSiteResponse) GetJSON200() *GetSiteOutputBody
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (GetSiteResponse) Status ¶
func (r GetSiteResponse) Status() string
Status returns HTTPResponse.Status
func (GetSiteResponse) StatusCode ¶
func (r GetSiteResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode
type HttpRequestDoer ¶
Doer performs HTTP requests.
The standard http.Client implements this interface.
type RequestEditorFn ¶
RequestEditorFn is the function signature for the RequestEditor callback function
type Site ¶ added in v0.3.0
type Site struct {
// Schema A URL to the JSON Schema for this object.
//
// Example: https://example.com/schemas/Site.json
Schema *string `json:"$schema,omitempty"`
CreatedAt time.Time `json:"createdAt"`
DeletedAt DeletedAt `json:"deletedAt"`
// Id Example: 6c785b65-e689-4653-ae78-81621226c48c
Id string `json:"id"`
// Name Example: fizzy-buzzy
Name string `json:"name"`
UpdatedAt time.Time `json:"updatedAt"`
}
Site defines model for Site.
type UploadFileParams ¶ added in v0.3.0
type UploadFileParams struct {
// FileName The name of the file.
FileName string `form:"fileName" json:"fileName"`
}
UploadFileParams defines parameters for UploadFile.
type UploadFileResponse ¶ added in v0.3.0
type UploadFileResponse struct {
Body []byte
HTTPResponse *http.Response
// JSON200 the response for an HTTP 200 `application/json` response
JSON200 *string
// ApplicationproblemJSONDefault the response for an HTTP default `application/problem+json` response
ApplicationproblemJSONDefault *ErrorModel
}
func ParseUploadFileResponse ¶ added in v0.3.0
func ParseUploadFileResponse(rsp *http.Response) (*UploadFileResponse, error)
ParseUploadFileResponse parses an HTTP response from a UploadFileWithResponse call
func (UploadFileResponse) ContentType ¶ added in v0.3.0
func (r UploadFileResponse) ContentType() string
ContentType is a convenience method to retrieve the Content-Type value from the HTTP response headers
func (UploadFileResponse) GetApplicationproblemJSONDefault ¶ added in v0.3.0
func (r UploadFileResponse) GetApplicationproblemJSONDefault() *ErrorModel
GetApplicationproblemJSONDefault returns the response for an HTTP default `application/problem+json` response
func (UploadFileResponse) GetBody ¶ added in v0.3.0
func (r UploadFileResponse) GetBody() []byte
GetBody returns the raw response body bytes
func (UploadFileResponse) GetJSON200 ¶ added in v0.3.0
func (r UploadFileResponse) GetJSON200() *string
GetJSON200 returns the response for an HTTP 200 `application/json` response
func (UploadFileResponse) Status ¶ added in v0.3.0
func (r UploadFileResponse) Status() string
Status returns HTTPResponse.Status
func (UploadFileResponse) StatusCode ¶ added in v0.3.0
func (r UploadFileResponse) StatusCode() int
StatusCode returns HTTPResponse.StatusCode