client

package
v0.0.0-...-1a703b8 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

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

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

Index

Constants

View Source
const (
	BearerAuthScopes = "bearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func NewGetLanguagesRequest

func NewGetLanguagesRequest(server string, params *GetLanguagesParams) (*http.Request, error)

NewGetLanguagesRequest generates requests for GetLanguages

func NewGetLinksExportRequest

func NewGetLinksExportRequest(server string, params *GetLinksExportParams) (*http.Request, error)

NewGetLinksExportRequest generates requests for GetLinksExport

func NewGetPhrasesExportRequest

func NewGetPhrasesExportRequest(server string, params *GetPhrasesExportParams) (*http.Request, error)

NewGetPhrasesExportRequest generates requests for GetPhrasesExport

func NewGetProjectsRequest

func NewGetProjectsRequest(server string, params *GetProjectsParams) (*http.Request, error)

NewGetProjectsRequest generates requests for GetProjects

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

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

func (*Client) GetLinksExport

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

func (*Client) GetPhrasesExport

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

func (*Client) GetProjects

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

type ClientInterface

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

	// GetLinksExport request
	GetLinksExport(ctx context.Context, params *GetLinksExportParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetPhrasesExport request
	GetPhrasesExport(ctx context.Context, params *GetPhrasesExportParams, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetProjects request
	GetProjects(ctx context.Context, params *GetProjectsParams, 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) GetLanguagesWithResponse

func (c *ClientWithResponses) GetLanguagesWithResponse(ctx context.Context, params *GetLanguagesParams, reqEditors ...RequestEditorFn) (*GetLanguagesResponse, error)

GetLanguagesWithResponse request returning *GetLanguagesResponse

func (*ClientWithResponses) GetLinksExportWithResponse

func (c *ClientWithResponses) GetLinksExportWithResponse(ctx context.Context, params *GetLinksExportParams, reqEditors ...RequestEditorFn) (*GetLinksExportResponse, error)

GetLinksExportWithResponse request returning *GetLinksExportResponse

func (*ClientWithResponses) GetPhrasesExportWithResponse

func (c *ClientWithResponses) GetPhrasesExportWithResponse(ctx context.Context, params *GetPhrasesExportParams, reqEditors ...RequestEditorFn) (*GetPhrasesExportResponse, error)

GetPhrasesExportWithResponse request returning *GetPhrasesExportResponse

func (*ClientWithResponses) GetProjectsWithResponse

func (c *ClientWithResponses) GetProjectsWithResponse(ctx context.Context, params *GetProjectsParams, reqEditors ...RequestEditorFn) (*GetProjectsResponse, error)

GetProjectsWithResponse request returning *GetProjectsResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// GetLanguages request
	GetLanguagesWithResponse(ctx context.Context, params *GetLanguagesParams, reqEditors ...RequestEditorFn) (*GetLanguagesResponse, error)

	// GetLinksExport request
	GetLinksExportWithResponse(ctx context.Context, params *GetLinksExportParams, reqEditors ...RequestEditorFn) (*GetLinksExportResponse, error)

	// GetPhrasesExport request
	GetPhrasesExportWithResponse(ctx context.Context, params *GetPhrasesExportParams, reqEditors ...RequestEditorFn) (*GetPhrasesExportResponse, error)

	// GetProjects request
	GetProjectsWithResponse(ctx context.Context, params *GetProjectsParams, reqEditors ...RequestEditorFn) (*GetProjectsResponse, error)
}

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

type GetLanguagesParams

type GetLanguagesParams struct {
	// ProjectId Only return projects associated to the project specified by this project ID.
	ProjectId *string `form:"project_id,omitempty" json:"project_id,omitempty"`
}

GetLanguagesParams defines parameters for GetLanguages.

type GetLanguagesResponse

type GetLanguagesResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Data []struct {
			CreatedAt   time.Time `json:"created_at"`
			Id          string    `json:"id"`
			Locale      string    `json:"locale"`
			Name        string    `json:"name"`
			UpdatedAt   time.Time `json:"updated_at"`
			WorkspaceId string    `json:"workspace_id"`
		} `json:"data"`
	}
}

func ParseGetLanguagesResponse

func ParseGetLanguagesResponse(rsp *http.Response) (*GetLanguagesResponse, error)

ParseGetLanguagesResponse parses an HTTP response from a GetLanguagesWithResponse call

func (GetLanguagesResponse) Status

func (r GetLanguagesResponse) Status() string

Status returns HTTPResponse.Status

func (GetLanguagesResponse) StatusCode

func (r GetLanguagesResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetLinksExportParams

type GetLinksExportParams struct {
	ProjectId string `form:"project_id" json:"project_id"`
}

GetLinksExportParams defines parameters for GetLinksExport.

type GetLinksExportResponse

type GetLinksExportResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Data map[string]string `json:"data"`
	}
}

func ParseGetLinksExportResponse

func ParseGetLinksExportResponse(rsp *http.Response) (*GetLinksExportResponse, error)

ParseGetLinksExportResponse parses an HTTP response from a GetLinksExportWithResponse call

func (GetLinksExportResponse) Status

func (r GetLinksExportResponse) Status() string

Status returns HTTPResponse.Status

func (GetLinksExportResponse) StatusCode

func (r GetLinksExportResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetPhrasesExportParams

type GetPhrasesExportParams struct {
	ProjectId  string `form:"project_id" json:"project_id"`
	LanguageId string `form:"language_id" json:"language_id"`

	// RevisionId Returns phrases & translations for a specific revision. If not provided, it defaults to "master".
	RevisionId *string `form:"revision_id,omitempty" json:"revision_id,omitempty"`
}

GetPhrasesExportParams defines parameters for GetPhrasesExport.

type GetPhrasesExportResponse

type GetPhrasesExportResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Data map[string]string `json:"data"`
	}
}

func ParseGetPhrasesExportResponse

func ParseGetPhrasesExportResponse(rsp *http.Response) (*GetPhrasesExportResponse, error)

ParseGetPhrasesExportResponse parses an HTTP response from a GetPhrasesExportWithResponse call

func (GetPhrasesExportResponse) Status

func (r GetPhrasesExportResponse) Status() string

Status returns HTTPResponse.Status

func (GetPhrasesExportResponse) StatusCode

func (r GetPhrasesExportResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetProjectsParams

type GetProjectsParams struct {
	// Limit A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 100.
	Limit *int `form:"limit,omitempty" json:"limit,omitempty"`

	// After A cursor for use in pagination. For instance, if you make a list request and receive 100 objects, ending with 123456, your subsequent call can include after=123456 in order to fetch the next page of the list.
	After *string `form:"after,omitempty" json:"after,omitempty"`
}

GetProjectsParams defines parameters for GetProjects.

type GetProjectsResponse

type GetProjectsResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *struct {
		Data []struct {
			CreatedAt   time.Time `json:"created_at"`
			Description *string   `json:"description"`
			Id          string    `json:"id"`
			Name        string    `json:"name"`
			UpdatedAt   time.Time `json:"updated_at"`
			WorkspaceId string    `json:"workspace_id"`
		} `json:"data"`
		HasMore    bool `json:"has_more"`
		TotalCount int  `json:"total_count"`
	}
}

func ParseGetProjectsResponse

func ParseGetProjectsResponse(rsp *http.Response) (*GetProjectsResponse, error)

ParseGetProjectsResponse parses an HTTP response from a GetProjectsWithResponse call

func (GetProjectsResponse) Status

func (r GetProjectsResponse) Status() string

Status returns HTTPResponse.Status

func (GetProjectsResponse) StatusCode

func (r GetProjectsResponse) 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 RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

Jump to

Keyboard shortcuts

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