api

package
v0.0.0-...-26e77a4 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnableToGetURL = errors.New("unable to get URL from context")

ErrUnableToGetURL is returned when the URL cannot be retrieved from the context.

Functions

This section is empty.

Types

type API

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

API represents an API with a handler.

func New

func New(ctx context.Context, opts ...Option) (*API, error)

New creates a new instance of the API. It returns a pointer to the API and an error, if any.

func (*API) GetOpenapiJson

GetOpenapiJSON returns the OpenAPI schema as JSON.

func (API) GetProjectId

GetProjectId retrieves a project by its ID. It takes a context.Context and a GetProjectIdRequestObject as input parameters. It returns a GetProjectIdResponseObject and an error. The error will be non-nil if there was an error retrieving the project.

func (API) GetProjectProjectIdClassificationTaskId

GetProjectProjectIdClassificationTaskId retrieves a classification task by its ID for a specific project.

func (API) GetProjectProjectIdClassificationTaskLabelId

GetProjectProjectIdClassificationTaskLabelId retrieves a classification task label by its ID for a specific project.

func (*API) GetProjectProjectIdClassificationTasks

GetProjectProjectIdClassificationTasks gets the project classification tasks for the given project, optionally filtered by whether they've been completed.

func (*API) GetProjectProjectIdPendingClassificationTasks

GetProjectProjectIdPendingClassificationTasks gets the pending classification tasks for the given project.

func (*API) GetProjects

GetProjects retrieves a list of all projects.

func (API) PostProject

PostProject creates a new project in the database based on the provided parameters. It returns the created project details in the form of a PostProjectResponseObject. If an error occurs during project creation or retrieval, it returns an error.

func (API) PostProjectProjectIdClassificationTask

PostProjectProjectIdClassificationTask creates a new classification task for a specific project.

func (*API) PostProjectProjectIdClassificationTaskIdLabel

PostProjectProjectIdClassificationTaskIdLabel allows a task to be labelled with the given task.

func (API) PostProjectProjectIdClassificationTaskLabel

PostProjectProjectIdClassificationTaskLabel is a function that handles the creation of a classification task label for a specific project. The function creates a classification task label in the database using the provided parameters and returns the created label. If an error occurs during the creation or retrieval of the label, an error is returned.

func (*API) ServeHTTP

func (a *API) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP handles the HTTP requests for the API. It delegates the request to the underlying handler.

type Option

type Option = func(a *API)

Option represents a function that can be used to configure an API instance.

func WithConfig

func WithConfig(cfg *config.Config) Option

WithConfig sets the configuration on the API.

func WithDatabase

func WithDatabase(db *storage.Database) Option

WithDatabase sets the database on the API.

func WithLogging

func WithLogging(logging bool) Option

WithLogging sets the logging enabled flag.

Directories

Path Synopsis
Package headers provides utilities for storing and retrieving HTTP headers from a context.
Package headers provides utilities for storing and retrieving HTTP headers from a context.
Package origin provides utilities for determining the origin of a request.
Package origin provides utilities for determining the origin of a request.
Package redirect provides utilities for redirecting requests depending upon the origin.
Package redirect provides utilities for redirecting requests depending upon the origin.
Package URL allows for storing and retrieving request URL details in the strict server endpoints.
Package URL allows for storing and retrieving request URL details in the strict server endpoints.

Jump to

Keyboard shortcuts

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