rest

package
v0.0.0-...-fd96df4 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 0 Imported by: 7

Documentation

Overview

Package rest provides an API for Evergreen users, as well as the GraphQL interface.

The REST API V2 has a series of central types that are useful to understand when adding new endpoints or increasing its functionality.

Model

Models are structs that represent the object returned by the API. A model is an interface with two methods, BuildFromService and ToService that define how to transform to and from an API model. This interface only needs to be satisfied for specific API models; it is not necessary for every single API model to implement it unless there is a reason to do so (e.g. reflection).

Connector

Connector is an interface that defines interaction with the backing database and service layer for operations that rely on mocks for testing purposes. It has two main implementations: one that communicates with the database (and potentially other services) and one that mocks the same functionality.

RequestHandler

RequestHandler is an interface which defines how to process an HTTP request for an API resource. RequestHandlers implement methods for fetching a new copy of the RequestHandler, ParseAndValidate the request body and how to execute the bulk of the request against the database.

MethodHandler

MethodHandler is a struct that contains all of the data necessary for completing an API request. It contains an Authenticator to handle access control. Authenticator is an interface type with many implementations that permit users' access based on different sets of criteria. MethodHandlers also contain functions for attaching data to a request and a RequestHandler to execute the request.

RouteManager

RouteManagers are structs that define all of the functionality of a particular API route, including definitions of each of the methods it implements and the path used to access it.

Directories

Path Synopsis
Package client provides a REST client for API requests to the server.
Package client provides a REST client for API requests to the server.
Package data provides database access for API requests to the server.
Package data provides database access for API requests to the server.
Package model maps database models to API models for REST requests to the server.
Package model maps database models to API models for REST requests to the server.
Package route handles incoming REST requests to the server.
Package route handles incoming REST requests to the server.

Jump to

Keyboard shortcuts

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