assets

package
v0.0.0-...-4ae6852 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: AGPL-3.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

View Source
const APIName = "gram"

APIName is the name of the API as defined in the design.

View Source
const APIVersion = "0.0.1"

APIVersion is the version of the API as defined in the design.

View Source
const ServiceName = "assets"

ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.

Variables

View Source
var MethodNames = [6]string{"serveImage", "uploadImage", "uploadFunctions", "uploadOpenAPIv3", "serveOpenAPIv3", "listAssets"}

MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.

Functions

func MakeBadRequest

func MakeBadRequest(err error) *goa.ServiceError

MakeBadRequest builds a goa.ServiceError from an error.

func MakeConflict

func MakeConflict(err error) *goa.ServiceError

MakeConflict builds a goa.ServiceError from an error.

func MakeForbidden

func MakeForbidden(err error) *goa.ServiceError

MakeForbidden builds a goa.ServiceError from an error.

func MakeGatewayError

func MakeGatewayError(err error) *goa.ServiceError

MakeGatewayError builds a goa.ServiceError from an error.

func MakeInvalid

func MakeInvalid(err error) *goa.ServiceError

MakeInvalid builds a goa.ServiceError from an error.

func MakeInvariantViolation

func MakeInvariantViolation(err error) *goa.ServiceError

MakeInvariantViolation builds a goa.ServiceError from an error.

func MakeNotFound

func MakeNotFound(err error) *goa.ServiceError

MakeNotFound builds a goa.ServiceError from an error.

func MakeUnauthorized

func MakeUnauthorized(err error) *goa.ServiceError

MakeUnauthorized builds a goa.ServiceError from an error.

func MakeUnexpected

func MakeUnexpected(err error) *goa.ServiceError

MakeUnexpected builds a goa.ServiceError from an error.

func MakeUnsupportedMedia

func MakeUnsupportedMedia(err error) *goa.ServiceError

MakeUnsupportedMedia builds a goa.ServiceError from an error.

func NewListAssetsEndpoint

func NewListAssetsEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewListAssetsEndpoint returns an endpoint function that calls the method "listAssets" of service "assets".

func NewServeImageEndpoint

func NewServeImageEndpoint(s Service) goa.Endpoint

NewServeImageEndpoint returns an endpoint function that calls the method "serveImage" of service "assets".

func NewServeOpenAPIv3Endpoint

func NewServeOpenAPIv3Endpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewServeOpenAPIv3Endpoint returns an endpoint function that calls the method "serveOpenAPIv3" of service "assets".

func NewUploadFunctionsEndpoint

func NewUploadFunctionsEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewUploadFunctionsEndpoint returns an endpoint function that calls the method "uploadFunctions" of service "assets".

func NewUploadImageEndpoint

func NewUploadImageEndpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewUploadImageEndpoint returns an endpoint function that calls the method "uploadImage" of service "assets".

func NewUploadOpenAPIv3Endpoint

func NewUploadOpenAPIv3Endpoint(s Service, authAPIKeyFn security.AuthAPIKeyFunc) goa.Endpoint

NewUploadOpenAPIv3Endpoint returns an endpoint function that calls the method "uploadOpenAPIv3" of service "assets".

Types

type Asset

type Asset struct {
	// The ID of the asset
	ID   string
	Kind string
	// The SHA256 hash of the asset
	Sha256 string
	// The content type of the asset
	ContentType string
	// The content length of the asset
	ContentLength int64
	// The creation date of the asset.
	CreatedAt string
	// The last update date of the asset.
	UpdatedAt string
}

type Auther

type Auther interface {
	// APIKeyAuth implements the authorization logic for the APIKey security scheme.
	APIKeyAuth(ctx context.Context, key string, schema *security.APIKeyScheme) (context.Context, error)
}

Auther defines the authorization functions to be implemented by the service.

type Client

type Client struct {
	ServeImageEndpoint      goa.Endpoint
	UploadImageEndpoint     goa.Endpoint
	UploadFunctionsEndpoint goa.Endpoint
	UploadOpenAPIv3Endpoint goa.Endpoint
	ServeOpenAPIv3Endpoint  goa.Endpoint
	ListAssetsEndpoint      goa.Endpoint
}

Client is the "assets" service client.

func NewClient

func NewClient(serveImage, uploadImage, uploadFunctions, uploadOpenAPIv3, serveOpenAPIv3, listAssets goa.Endpoint) *Client

NewClient initializes a "assets" service client given the endpoints.

func (*Client) ListAssets

func (c *Client) ListAssets(ctx context.Context, p *ListAssetsPayload) (res *ListAssetsResult, err error)

ListAssets calls the "listAssets" endpoint of the "assets" service. ListAssets may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) ServeImage

func (c *Client) ServeImage(ctx context.Context, p *ServeImageForm) (res *ServeImageResult, resp io.ReadCloser, err error)

ServeImage calls the "serveImage" endpoint of the "assets" service. ServeImage may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) ServeOpenAPIv3

func (c *Client) ServeOpenAPIv3(ctx context.Context, p *ServeOpenAPIv3Form) (res *ServeOpenAPIv3Result, resp io.ReadCloser, err error)

ServeOpenAPIv3 calls the "serveOpenAPIv3" endpoint of the "assets" service. ServeOpenAPIv3 may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) UploadFunctions

func (c *Client) UploadFunctions(ctx context.Context, p *UploadFunctionsForm, req io.ReadCloser) (res *UploadFunctionsResult, err error)

UploadFunctions calls the "uploadFunctions" endpoint of the "assets" service. UploadFunctions may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) UploadImage

func (c *Client) UploadImage(ctx context.Context, p *UploadImageForm, req io.ReadCloser) (res *UploadImageResult, err error)

UploadImage calls the "uploadImage" endpoint of the "assets" service. UploadImage may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

func (*Client) UploadOpenAPIv3

func (c *Client) UploadOpenAPIv3(ctx context.Context, p *UploadOpenAPIv3Form, req io.ReadCloser) (res *UploadOpenAPIv3Result, err error)

UploadOpenAPIv3 calls the "uploadOpenAPIv3" endpoint of the "assets" service. UploadOpenAPIv3 may return the following errors:

  • "unauthorized" (type *goa.ServiceError): unauthorized access
  • "forbidden" (type *goa.ServiceError): permission denied
  • "bad_request" (type *goa.ServiceError): request is invalid
  • "not_found" (type *goa.ServiceError): resource not found
  • "conflict" (type *goa.ServiceError): resource already exists
  • "unsupported_media" (type *goa.ServiceError): unsupported media type
  • "invalid" (type *goa.ServiceError): request contains one or more invalidation fields
  • "invariant_violation" (type *goa.ServiceError): an unexpected error occurred
  • "unexpected" (type *goa.ServiceError): an unexpected error occurred
  • "gateway_error" (type *goa.ServiceError): an unexpected error occurred
  • error: internal error

type Endpoints

type Endpoints struct {
	ServeImage      goa.Endpoint
	UploadImage     goa.Endpoint
	UploadFunctions goa.Endpoint
	UploadOpenAPIv3 goa.Endpoint
	ServeOpenAPIv3  goa.Endpoint
	ListAssets      goa.Endpoint
}

Endpoints wraps the "assets" service endpoints.

func NewEndpoints

func NewEndpoints(s Service) *Endpoints

NewEndpoints wraps the methods of the "assets" service with endpoints.

func (*Endpoints) Use

func (e *Endpoints) Use(m func(goa.Endpoint) goa.Endpoint)

Use applies the given middleware to all the "assets" service endpoints.

type ListAssetsPayload

type ListAssetsPayload struct {
	SessionToken     *string
	ProjectSlugInput *string
	ApikeyToken      *string
}

ListAssetsPayload is the payload type of the assets service listAssets method.

type ListAssetsResult

type ListAssetsResult struct {
	// The list of assets
	Assets []*Asset
}

ListAssetsResult is the result type of the assets service listAssets method.

type ServeImageForm

type ServeImageForm struct {
	// The ID of the asset to serve
	ID string
}

ServeImageForm is the payload type of the assets service serveImage method.

type ServeImageResponseData

type ServeImageResponseData struct {
	// Result is the method result.
	Result *ServeImageResult
	// Body streams the HTTP response body.
	Body io.ReadCloser
}

ServeImageResponseData holds both the result and the HTTP response body reader of the "serveImage" method.

type ServeImageResult

type ServeImageResult struct {
	ContentType              string
	ContentLength            int64
	LastModified             string
	AccessControlAllowOrigin *string
}

ServeImageResult is the result type of the assets service serveImage method.

type ServeOpenAPIv3Form

type ServeOpenAPIv3Form struct {
	ApikeyToken  *string
	SessionToken *string
	// The ID of the asset to serve
	ID string
	// The procect ID that the asset belongs to
	ProjectID string
}

ServeOpenAPIv3Form is the payload type of the assets service serveOpenAPIv3 method.

type ServeOpenAPIv3ResponseData

type ServeOpenAPIv3ResponseData struct {
	// Result is the method result.
	Result *ServeOpenAPIv3Result
	// Body streams the HTTP response body.
	Body io.ReadCloser
}

ServeOpenAPIv3ResponseData holds both the result and the HTTP response body reader of the "serveOpenAPIv3" method.

type ServeOpenAPIv3Result

type ServeOpenAPIv3Result struct {
	ContentType   string
	ContentLength int64
	LastModified  string
}

ServeOpenAPIv3Result is the result type of the assets service serveOpenAPIv3 method.

type Service

type Service interface {

	// If body implements [io.WriterTo], that implementation will be used instead.
	// Consider [goa.design/goa/v3/pkg.SkipResponseWriter] to adapt existing
	// implementations.
	ServeImage(context.Context, *ServeImageForm) (res *ServeImageResult, body io.ReadCloser, err error)
	// Upload an image to Gram.
	UploadImage(context.Context, *UploadImageForm, io.ReadCloser) (res *UploadImageResult, err error)
	// Upload functions to Gram.
	UploadFunctions(context.Context, *UploadFunctionsForm, io.ReadCloser) (res *UploadFunctionsResult, err error)
	// Upload an OpenAPI v3 document to Gram.
	UploadOpenAPIv3(context.Context, *UploadOpenAPIv3Form, io.ReadCloser) (res *UploadOpenAPIv3Result, err error)

	// If body implements [io.WriterTo], that implementation will be used instead.
	// Consider [goa.design/goa/v3/pkg.SkipResponseWriter] to adapt existing
	// implementations.
	ServeOpenAPIv3(context.Context, *ServeOpenAPIv3Form) (res *ServeOpenAPIv3Result, body io.ReadCloser, err error)
	// List all assets for a project.
	ListAssets(context.Context, *ListAssetsPayload) (res *ListAssetsResult, err error)
}

Manages assets used by Gram projects.

type UploadFunctionsForm

type UploadFunctionsForm struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	ContentType      string
	ContentLength    int64
}

UploadFunctionsForm is the payload type of the assets service uploadFunctions method.

type UploadFunctionsRequestData

type UploadFunctionsRequestData struct {
	// Payload is the method payload.
	Payload *UploadFunctionsForm
	// Body streams the HTTP request body.
	Body io.ReadCloser
}

UploadFunctionsRequestData holds both the payload and the HTTP request body reader of the "uploadFunctions" method.

type UploadFunctionsResult

type UploadFunctionsResult struct {
	// The asset entry that was created in Gram
	Asset *Asset
}

UploadFunctionsResult is the result type of the assets service uploadFunctions method.

type UploadImageForm

type UploadImageForm struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	ContentType      string
	ContentLength    int64
}

UploadImageForm is the payload type of the assets service uploadImage method.

type UploadImageRequestData

type UploadImageRequestData struct {
	// Payload is the method payload.
	Payload *UploadImageForm
	// Body streams the HTTP request body.
	Body io.ReadCloser
}

UploadImageRequestData holds both the payload and the HTTP request body reader of the "uploadImage" method.

type UploadImageResult

type UploadImageResult struct {
	// The asset entry that was created in Gram
	Asset *Asset
}

UploadImageResult is the result type of the assets service uploadImage method.

type UploadOpenAPIv3Form

type UploadOpenAPIv3Form struct {
	ApikeyToken      *string
	SessionToken     *string
	ProjectSlugInput *string
	ContentType      string
	ContentLength    int64
}

UploadOpenAPIv3Form is the payload type of the assets service uploadOpenAPIv3 method.

type UploadOpenAPIv3RequestData

type UploadOpenAPIv3RequestData struct {
	// Payload is the method payload.
	Payload *UploadOpenAPIv3Form
	// Body streams the HTTP request body.
	Body io.ReadCloser
}

UploadOpenAPIv3RequestData holds both the payload and the HTTP request body reader of the "uploadOpenAPIv3" method.

type UploadOpenAPIv3Result

type UploadOpenAPIv3Result struct {
	// The asset entry that was created in Gram
	Asset *Asset
}

UploadOpenAPIv3Result is the result type of the assets service uploadOpenAPIv3 method.

Jump to

Keyboard shortcuts

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