vtrest

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.5.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSwagger

func GetSwagger() (swagger *openapi3.T, err error)

GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func NewCreateTranscodeRequest

func NewCreateTranscodeRequest(server string, body CreateTranscodeJSONRequestBody) (*http.Request, error)

NewCreateTranscodeRequest calls the generic CreateTranscode builder with application/json body

func NewCreateTranscodeRequestWithBody

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

NewCreateTranscodeRequestWithBody generates requests for CreateTranscode with any type of body

func NewGetTranscodeStatusRequest

func NewGetTranscodeStatusRequest(server string, uuid openapi_types.UUID) (*http.Request, error)

NewGetTranscodeStatusRequest generates requests for GetTranscodeStatus

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

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

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

func (*Client) CreateTranscodeWithBody

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

func (*Client) GetTranscodeStatus

func (c *Client) GetTranscodeStatus(ctx context.Context, uuid openapi_types.UUID, reqEditors ...RequestEditorFn) (*http.Response, error)

type ClientInterface

type ClientInterface interface {
	// CreateTranscodeWithBody request with any body
	CreateTranscodeWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error)

	CreateTranscode(ctx context.Context, body CreateTranscodeJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error)

	// GetTranscodeStatus request
	GetTranscodeStatus(ctx context.Context, uuid openapi_types.UUID, 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) CreateTranscodeWithBodyWithResponse

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

CreateTranscodeWithBodyWithResponse request with arbitrary body returning *CreateTranscodeResponse

func (*ClientWithResponses) CreateTranscodeWithResponse

func (c *ClientWithResponses) CreateTranscodeWithResponse(ctx context.Context, body CreateTranscodeJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateTranscodeResponse, error)

func (*ClientWithResponses) GetTranscodeStatusWithResponse

func (c *ClientWithResponses) GetTranscodeStatusWithResponse(ctx context.Context, uuid openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetTranscodeStatusResponse, error)

GetTranscodeStatusWithResponse request returning *GetTranscodeStatusResponse

type ClientWithResponsesInterface

type ClientWithResponsesInterface interface {
	// CreateTranscodeWithBodyWithResponse request with any body
	CreateTranscodeWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateTranscodeResponse, error)

	CreateTranscodeWithResponse(ctx context.Context, body CreateTranscodeJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateTranscodeResponse, error)

	// GetTranscodeStatusWithResponse request
	GetTranscodeStatusWithResponse(ctx context.Context, uuid openapi_types.UUID, reqEditors ...RequestEditorFn) (*GetTranscodeStatusResponse, error)
}

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

type CreateTranscode201JSONResponse

type CreateTranscode201JSONResponse TranscodeJob

func (CreateTranscode201JSONResponse) VisitCreateTranscodeResponse

func (response CreateTranscode201JSONResponse) VisitCreateTranscodeResponse(w http.ResponseWriter) error

type CreateTranscode400JSONResponse

type CreateTranscode400JSONResponse Error

func (CreateTranscode400JSONResponse) VisitCreateTranscodeResponse

func (response CreateTranscode400JSONResponse) VisitCreateTranscodeResponse(w http.ResponseWriter) error

type CreateTranscode409JSONResponse

type CreateTranscode409JSONResponse Error

func (CreateTranscode409JSONResponse) VisitCreateTranscodeResponse

func (response CreateTranscode409JSONResponse) VisitCreateTranscodeResponse(w http.ResponseWriter) error

type CreateTranscode500JSONResponse

type CreateTranscode500JSONResponse Error

func (CreateTranscode500JSONResponse) VisitCreateTranscodeResponse

func (response CreateTranscode500JSONResponse) VisitCreateTranscodeResponse(w http.ResponseWriter) error

type CreateTranscodeJSONRequestBody

type CreateTranscodeJSONRequestBody = TranscodeRequest

CreateTranscodeJSONRequestBody defines body for CreateTranscode for application/json ContentType.

type CreateTranscodeRequestObject

type CreateTranscodeRequestObject struct {
	Body *CreateTranscodeJSONRequestBody
}

type CreateTranscodeResponse

type CreateTranscodeResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON201      *TranscodeJob
	JSON400      *Error
	JSON409      *Error
	JSON500      *Error
}

func ParseCreateTranscodeResponse

func ParseCreateTranscodeResponse(rsp *http.Response) (*CreateTranscodeResponse, error)

ParseCreateTranscodeResponse parses an HTTP response from a CreateTranscodeWithResponse call

func (CreateTranscodeResponse) Status

func (r CreateTranscodeResponse) Status() string

Status returns HTTPResponse.Status

func (CreateTranscodeResponse) StatusCode

func (r CreateTranscodeResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type CreateTranscodeResponseObject

type CreateTranscodeResponseObject interface {
	VisitCreateTranscodeResponse(w http.ResponseWriter) error
}

type Error

type Error struct {
	// Code Error code
	Code string `json:"code"`

	// Message Human-readable error message
	Message string `json:"message"`
}

Error defines model for Error.

type GetTranscodeStatus200JSONResponse

type GetTranscodeStatus200JSONResponse TranscodeJob

func (GetTranscodeStatus200JSONResponse) VisitGetTranscodeStatusResponse

func (response GetTranscodeStatus200JSONResponse) VisitGetTranscodeStatusResponse(w http.ResponseWriter) error

type GetTranscodeStatus404JSONResponse

type GetTranscodeStatus404JSONResponse Error

func (GetTranscodeStatus404JSONResponse) VisitGetTranscodeStatusResponse

func (response GetTranscodeStatus404JSONResponse) VisitGetTranscodeStatusResponse(w http.ResponseWriter) error

type GetTranscodeStatus500JSONResponse

type GetTranscodeStatus500JSONResponse Error

func (GetTranscodeStatus500JSONResponse) VisitGetTranscodeStatusResponse

func (response GetTranscodeStatus500JSONResponse) VisitGetTranscodeStatusResponse(w http.ResponseWriter) error

type GetTranscodeStatusRequestObject

type GetTranscodeStatusRequestObject struct {
	Uuid openapi_types.UUID `json:"uuid"`
}

type GetTranscodeStatusResponse

type GetTranscodeStatusResponse struct {
	Body         []byte
	HTTPResponse *http.Response
	JSON200      *TranscodeJob
	JSON404      *Error
	JSON500      *Error
}

func ParseGetTranscodeStatusResponse

func ParseGetTranscodeStatusResponse(rsp *http.Response) (*GetTranscodeStatusResponse, error)

ParseGetTranscodeStatusResponse parses an HTTP response from a GetTranscodeStatusWithResponse call

func (GetTranscodeStatusResponse) Status

Status returns HTTPResponse.Status

func (GetTranscodeStatusResponse) StatusCode

func (r GetTranscodeStatusResponse) StatusCode() int

StatusCode returns HTTPResponse.StatusCode

type GetTranscodeStatusResponseObject

type GetTranscodeStatusResponseObject interface {
	VisitGetTranscodeStatusResponse(w http.ResponseWriter) error
}

type HttpRequestDoer

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

Doer performs HTTP requests.

The standard http.Client implements this interface.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type RequestEditorFn

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

RequestEditorFn is the function signature for the RequestEditor callback function

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	ServeHTTP(w http.ResponseWriter, r *http.Request)
}

ServeMux is an abstraction of http.ServeMux.

type ServerInterface

type ServerInterface interface {
	// Start a new transcode job
	// (POST /transcodes)
	CreateTranscode(w http.ResponseWriter, r *http.Request)
	// Get transcode job status
	// (GET /transcodes/{uuid})
	GetTranscodeStatus(w http.ResponseWriter, r *http.Request, uuid openapi_types.UUID)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateTranscode

func (siw *ServerInterfaceWrapper) CreateTranscode(w http.ResponseWriter, r *http.Request)

CreateTranscode operation middleware

func (*ServerInterfaceWrapper) GetTranscodeStatus

func (siw *ServerInterfaceWrapper) GetTranscodeStatus(w http.ResponseWriter, r *http.Request)

GetTranscodeStatus operation middleware

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictServerInterface

type StrictServerInterface interface {
	// Start a new transcode job
	// (POST /transcodes)
	CreateTranscode(ctx context.Context, request CreateTranscodeRequestObject) (CreateTranscodeResponseObject, error)
	// Get transcode job status
	// (GET /transcodes/{uuid})
	GetTranscodeStatus(ctx context.Context, request GetTranscodeStatusRequestObject) (GetTranscodeStatusResponseObject, error)
}

StrictServerInterface represents all server handlers.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type TranscodeJob

type TranscodeJob struct {
	// CreatedAt Timestamp when the job was created
	CreatedAt time.Time `json:"createdAt"`

	// DestinationPath Path for the transcoded output file
	DestinationPath string `json:"destinationPath"`

	// Error Error message if the transcode failed
	Error *string `json:"error,omitempty"`

	// Profile Transcoding profile used
	Profile string `json:"profile"`

	// Progress Transcoding progress percentage
	Progress float64 `json:"progress"`

	// SourcePath Path to the source video file
	SourcePath string `json:"sourcePath"`

	// Status Current status of the transcode job
	Status TranscodeStatus `json:"status"`

	// UpdatedAt Timestamp when the job was last updated
	UpdatedAt time.Time `json:"updatedAt"`

	// Uuid Unique identifier for the transcode job
	Uuid openapi_types.UUID `json:"uuid"`
}

TranscodeJob defines model for TranscodeJob.

type TranscodeRequest

type TranscodeRequest struct {
	// DestinationPath Path for the transcoded output file
	DestinationPath string `json:"destinationPath"`

	// HeartbeatWebhookUri Optional URI to POST heartbeat webhook notifications with progress updates during transcoding
	HeartbeatWebhookUri *string `json:"heartbeatWebhookUri,omitempty"`

	// Profile Transcoding profile to use.
	Profile string `json:"profile"`

	// SourcePath Path to the source video file
	SourcePath string `json:"sourcePath"`

	// Uuid Client-provided UUID for the transcode job
	Uuid openapi_types.UUID `json:"uuid"`

	// WebhookToken Optional opaque token to include in webhook payload for authentication
	WebhookToken []byte `json:"webhookToken,omitempty"`

	// WebhookUri Optional URI to POST webhook notification when job completes
	WebhookUri *string `json:"webhookUri,omitempty"`
}

TranscodeRequest defines model for TranscodeRequest.

type TranscodeStatus

type TranscodeStatus string

TranscodeStatus Current status of the transcode job

const (
	Completed TranscodeStatus = "completed"
	Failed    TranscodeStatus = "failed"
	Pending   TranscodeStatus = "pending"
	Running   TranscodeStatus = "running"
)

Defines values for TranscodeStatus.

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

Jump to

Keyboard shortcuts

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