resource

package
v0.0.0-rc6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrResourceNotUploaded = dto.NewI18nError("resource not uploaded", "errors.resource_not_uploaded")
)

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(svc service.ResourceService) *Handler

func (*Handler) DownloadResource

func (h *Handler) DownloadResource(ctx *gin.Context)

DownloadResource godoc

@Id				DownloadResource
@Summary		Download resource
@Description	Request for getting resource. Return the resource in S3 storage.
@Tags			Resource API
@Produce		*/*
@Param			objectId	path	string	true	"Object id"
@Success		200
@Failure		404	{object}	dto.ErrorResponse	"Resource not found"
@Failure		500	{object}	dto.ErrorResponse	"Internal server error"
@Router			/v0/resources/{objectId} [get]

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(router *gin.Engine, middlewares handler.RouteMiddlewares)

func (*Handler) UploadResource

func (h *Handler) UploadResource(ctx *gin.Context)

UploadResource godoc

@Id				UploadResource
@Summary		Upload resource
@Description	Request for uploading resource. Return the object id in S3 storage.
@Tags			Resource API
@Security		BearerAuth
@Accept			multipart/form-data
@Produce		json
@Param			resource	formData	file	true	"File to upload"
@Success		201			{object}	dto.UploadResourceOutput	"Uploaded resource"
@Failure		400			{object}	dto.ErrorResponse	"Validation error"
@Failure		401			{object}	dto.ErrorResponse	"Unauthorized error"
@Failure		403			{object}	dto.ErrorResponse	"User is blocked or deleted"
@Failure		500			{object}	dto.ErrorResponse	"Internal server error"
@Router			/v0/resources/one [post]

func (*Handler) UploadResources

func (h *Handler) UploadResources(ctx *gin.Context)

UploadResources godoc

@Id				UploadResources
@Summary		Upload resources
@Description	Request for uploading resources. Return the array of object ids in S3 storage for successful uploaded files.
@Tags			Resource API
@Security		BearerAuth
@Accept			multipart/form-data
@Produce		json
@Param			resources	formData	[]file	true	"Files to upload"
@Success		201			{object}	dto.UploadResourcesOutput	"Uploaded resources"
@Failure		400			{object}	dto.ErrorResponse	"Validation error"
@Failure		401			{object}	dto.ErrorResponse	"Unauthorized error"
@Failure		403			{object}	dto.ErrorResponse	"User is blocked or deleted"
@Failure		500			{object}	dto.ErrorResponse	"Internal server error"
@Router			/v0/resources/many [post]

Jump to

Keyboard shortcuts

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