api

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

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

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.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 PathToRawSpec

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

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

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type CacheDownloadInstruction

type CacheDownloadInstruction struct {
	// Method HTTP method
	Method string  `json:"method"`
	Offset *Offset `json:"offset,omitempty"`

	// Url URL
	Url string `json:"url"`
}

CacheDownloadInstruction defines model for CacheDownloadInstruction.

type CacheEntry

type CacheEntry struct {
	// Branch Git branch
	Branch string `json:"branch"`

	// Compression Compression algorithm
	Compression string `json:"compression"`

	// FileSize Size of the cache entry in bytes
	FileSize int64 `json:"file_size"`

	// Key Key of the cache entry
	Key string `json:"key"`

	// Name GitHub repository
	Name string `json:"name"`

	// Paths Paths to upload the cache entry
	Paths []string `json:"paths"`

	// Sha256sum SHA256 checksum of the cache entry
	Sha256sum string `json:"sha256sum"`

	// Url URL to upload the cache entry
	Url *string `json:"url,omitempty"`
}

CacheEntry defines model for CacheEntry.

type CacheEntryCreateRequest

type CacheEntryCreateRequest struct {
	CacheEntry CacheEntry `json:"cache_entry"`

	// MultipartSupported multipart supported
	MultipartSupported bool `json:"multipart_supported"`
}

CacheEntryCreateRequest defines model for CacheEntryCreateRequest.

type CacheEntryCreateResponse

type CacheEntryCreateResponse struct {
	// Id Upload ID
	Id                 string                   `json:"id"`
	Multipart          bool                     `json:"multipart"`
	UploadInstructions []CacheUploadInstruction `json:"upload_instructions"`
}

CacheEntryCreateResponse defines model for CacheEntryCreateResponse.

type CacheEntryGetResponse

type CacheEntryGetResponse struct {
	CacheEntry           CacheEntry                 `json:"cache_entry"`
	DownloadInstructions []CacheDownloadInstruction `json:"download_instructions"`
	Multipart            bool                       `json:"multipart"`
}

CacheEntryGetResponse defines model for CacheEntryGetResponse.

type CacheEntryUpdateRequest

type CacheEntryUpdateRequest struct {
	// Branch Git branch
	Branch string `json:"branch"`

	// Id Upload ID
	Id string `json:"id"`

	// Key Key of the cache entry
	Key string `json:"key"`

	// MultipartEtags ETags
	MultipartEtags []CachePartETag `json:"multipart_etags"`

	// Name GitHub repository
	Name string `json:"name"`
}

CacheEntryUpdateRequest defines model for CacheEntryUpdateRequest.

type CacheEntryUpdateResponse

type CacheEntryUpdateResponse struct {
	// Id Response ID
	Id string `json:"id"`
}

CacheEntryUpdateResponse defines model for CacheEntryUpdateResponse.

type CachePartETag

type CachePartETag struct {
	// Etag ETag
	Etag string `json:"etag"`

	// Part Part index
	Part     int32 `json:"part"`
	PartSize int64 `json:"part_size"`
}

CachePartETag Part index and ETag

type CacheUploadInstruction

type CacheUploadInstruction struct {
	// Method HTTP method
	Method string  `json:"method"`
	Offset *Offset `json:"offset,omitempty"`

	// Url URL
	Url string `json:"url"`
}

CacheUploadInstruction defines model for CacheUploadInstruction.

type CreateCacheEntryJSONRequestBody

type CreateCacheEntryJSONRequestBody = CacheEntryCreateRequest

CreateCacheEntryJSONRequestBody defines body for CreateCacheEntry for application/json ContentType.

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type Error

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

	// Message Error message
	Message string `json:"message"`
}

Error defines model for Error.

type GetCacheEntryByKeyParams added in v1.3.0

type GetCacheEntryByKeyParams struct {
	Name   string `form:"name" json:"name"`
	Branch string `form:"branch" json:"branch"`
}

GetCacheEntryByKeyParams defines parameters for GetCacheEntryByKey.

type Offset

type Offset struct {
	// End End position of the part
	End int64 `json:"end"`

	// Part Part number
	Part int32 `json:"part"`

	// Start Start position of the part
	Start int64 `json:"start"`
}

Offset defines model for Offset.

type Provider added in v1.2.0

type Provider string

Provider defines model for Provider.

const (
	Buildkite     Provider = "buildkite"
	GithubActions Provider = "github_actions"
	Gitlab        Provider = "gitlab"
)

Defines values for Provider.

type ServerInterface

type ServerInterface interface {
	// Creates a cache entry
	// (POST /v1/cache/{provider})
	CreateCacheEntry(ctx echo.Context, provider Provider) error
	// Updates a cache entry
	// (PUT /v1/cache/{provider})
	UpdateCacheEntry(ctx echo.Context, provider Provider) error
	// Get a cache entry by key
	// (GET /v1/cache/{provider}/{key})
	GetCacheEntryByKey(ctx echo.Context, provider Provider, key string, params GetCacheEntryByKeyParams) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) CreateCacheEntry

func (w *ServerInterfaceWrapper) CreateCacheEntry(ctx echo.Context) error

CreateCacheEntry converts echo context to params.

func (*ServerInterfaceWrapper) GetCacheEntryByKey

func (w *ServerInterfaceWrapper) GetCacheEntryByKey(ctx echo.Context) error

GetCacheEntryByKey converts echo context to params.

func (*ServerInterfaceWrapper) UpdateCacheEntry

func (w *ServerInterfaceWrapper) UpdateCacheEntry(ctx echo.Context) error

UpdateCacheEntry converts echo context to params.

type UpdateCacheEntryJSONRequestBody

type UpdateCacheEntryJSONRequestBody = CacheEntryUpdateRequest

UpdateCacheEntryJSONRequestBody defines body for UpdateCacheEntry for application/json ContentType.

Jump to

Keyboard shortcuts

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