api

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

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

Go to latest
Published: Dec 1, 2022 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/deepmap/oapi-codegen version v1.12.3 DO NOT EDIT.

Index

Constants

View Source
const (
	BearerAuthScopes = "bearerAuth.Scopes"
)

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 *gin.Engine, si ServerInterface) *gin.Engine

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router *gin.Engine, si ServerInterface, options GinServerOptions) *gin.Engine

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type AuthLoginJSONRequestBody

type AuthLoginJSONRequestBody = AuthLoginRequest

AuthLoginJSONRequestBody defines body for AuthLogin for application/json ContentType.

type AuthLoginRequest

type AuthLoginRequest struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

AuthLoginRequest defines model for AuthLoginRequest.

type AuthLoginResponse

type AuthLoginResponse struct {
	Token string `json:"token"`
}

AuthLoginResponse defines model for AuthLoginResponse.

type Class

type Class struct {
	// CreatedAt An RFC3339 date/time string
	CreatedAt   DateTime `json:"createdAt"`
	Description string   `json:"description"`
	DisplayName string   `json:"displayName"`

	// EndDate An RFC3339 date/time string
	EndDate DateTime `json:"endDate"`

	// Id A cuid
	Id   Cuid   `json:"id"`
	Name string `json:"name"`

	// StartDate An RFC3339 date/time string
	StartDate  DateTime `json:"startDate"`
	StudentIds *[]Cuid  `json:"studentIds,omitempty"`

	// UpdatedAt An RFC3339 date/time string
	UpdatedAt DateTime `json:"updatedAt"`
}

Class defines model for Class.

type ClassList

type ClassList = []Class

ClassList An array of Classes

type ClassesCreateJSONRequestBody

type ClassesCreateJSONRequestBody = ClassesCreateRequest

ClassesCreateJSONRequestBody defines body for ClassesCreate for application/json ContentType.

type ClassesCreateRequest

type ClassesCreateRequest struct {
	// Description The description of the Class
	Description *string `json:"description,omitempty"`

	// DisplayName The display name of the Class
	DisplayName string `json:"displayName"`

	// EndDate An RFC3339 date/time string
	EndDate *DateTime `json:"endDate,omitempty"`

	// Name The name of the Class
	Name *string `json:"name,omitempty"`

	// StartDate An RFC3339 date/time string
	StartDate *DateTime `json:"startDate,omitempty"`

	// StudentIds A list of student IDs.
	StudentIds *[]Cuid `json:"studentIds,omitempty"`
}

ClassesCreateRequest defines model for ClassesCreateRequest.

type ClassesCreateResponse

type ClassesCreateResponse struct {
	Class Class `json:"class"`
}

ClassesCreateResponse defines model for ClassesCreateResponse.

type ClassesListParams

type ClassesListParams struct {
	// PerPage The number of results to retrieve in each page.
	PerPage *int `form:"perPage,omitempty" json:"perPage,omitempty"`

	// Page The page to load.
	Page *int `form:"page,omitempty" json:"page,omitempty"`
}

ClassesListParams defines parameters for ClassesList.

type ClassesListResponse

type ClassesListResponse struct {
	// Classes An array of Classes
	Classes    ClassList      `json:"classes"`
	Pagination PaginationData `json:"pagination"`
}

ClassesListResponse The response for the /v1/classes endpoint

type ClassesUpdateJSONRequestBody

type ClassesUpdateJSONRequestBody = ClassesUpdateRequest

ClassesUpdateJSONRequestBody defines body for ClassesUpdate for application/json ContentType.

type ClassesUpdateRequest

type ClassesUpdateRequest struct {
	// Description The description of the Class
	Description *string `json:"description,omitempty"`

	// DisplayName The display name of the Class
	DisplayName *string `json:"displayName,omitempty"`

	// EndDate An RFC3339 date/time string
	EndDate *DateTime `json:"endDate,omitempty"`

	// Name The name of the Class
	Name *string `json:"name,omitempty"`

	// StartDate An RFC3339 date/time string
	StartDate *DateTime `json:"startDate,omitempty"`

	// StudentIds An array of Student IDs.
	StudentIds *[]Cuid `json:"studentIds,omitempty"`
}

ClassesUpdateRequest defines model for ClassesUpdateRequest.

type ClassesUpdateResponse

type ClassesUpdateResponse struct {
	Class Class `json:"class"`
}

ClassesUpdateResponse defines model for ClassesUpdateResponse.

type Cuid

type Cuid = string

Cuid A cuid

type DateTime

type DateTime = string

DateTime An RFC3339 date/time string

type Error

type Error struct {
	// Code The HTTP error code
	Code int `json:"code"`

	// Message A human readable error message
	Message string `json:"message"`
}

Error defines model for Error.

type GinServerOptions

type GinServerOptions struct {
	BaseURL      string
	Middlewares  []MiddlewareFunc
	ErrorHandler func(*gin.Context, error, int)
}

GinServerOptions provides options for the Gin server.

type Grade

type Grade struct {
	// CreatedAt An RFC3339 date/time string
	CreatedAt DateTime `json:"createdAt"`

	// Id A cuid
	Id Cuid `json:"id"`

	// StudentId A cuid
	StudentId Cuid `json:"studentId"`

	// UpdatedAt An RFC3339 date/time string
	UpdatedAt DateTime `json:"updatedAt"`
	Value     int      `json:"value"`
}

Grade defines model for Grade.

type GradeList

type GradeList = []Grade

GradeList An array of Grades

type GradesCreateJSONRequestBody

type GradesCreateJSONRequestBody = GradesCreateRequest

GradesCreateJSONRequestBody defines body for GradesCreate for application/json ContentType.

type GradesCreateRequest

type GradesCreateRequest struct {
	// StudentId A cuid
	StudentId Cuid `json:"studentId"`

	// Value The grade for the provided student.
	Value int `json:"value"`
}

GradesCreateRequest defines model for GradesCreateRequest.

type GradesCreateResponse

type GradesCreateResponse struct {
	Grade Grade `json:"grade"`
}

GradesCreateResponse defines model for GradesCreateResponse.

type GradesListParams

type GradesListParams struct {
	// PerPage The number of results to retrieve in each page.
	PerPage *int `form:"perPage,omitempty" json:"perPage,omitempty"`

	// Page The page to load.
	Page *int `form:"page,omitempty" json:"page,omitempty"`
}

GradesListParams defines parameters for GradesList.

type GradesListResponse

type GradesListResponse struct {
	// Grades An array of Grades
	Grades     GradeList      `json:"grades"`
	Pagination PaginationData `json:"pagination"`
}

GradesListResponse The response for the /v1/classes/{id}/grades endpoint

type GradesUpdateJSONRequestBody

type GradesUpdateJSONRequestBody = GradesUpdateRequest

GradesUpdateJSONRequestBody defines body for GradesUpdate for application/json ContentType.

type GradesUpdateRequest

type GradesUpdateRequest struct {
	// Value The grade for the provided student.
	Value *int `json:"value,omitempty"`
}

GradesUpdateRequest defines model for GradesUpdateRequest.

type GradesUpdateResponse

type GradesUpdateResponse struct {
	Grade Grade `json:"grade"`
}

GradesUpdateResponse defines model for GradesUpdateResponse.

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type PaginationData

type PaginationData struct {
	FirstUrl string `json:"firstUrl"`
	LastUrl  string `json:"lastUrl"`
	NextUrl  string `json:"nextUrl"`
	Page     int    `json:"page"`
	PerPage  int    `json:"perPage"`
	PrevUrl  string `json:"prevUrl"`
	Total    int    `json:"total"`
}

PaginationData defines model for PaginationData.

type ServerInterface

type ServerInterface interface {
	// Generate a JWT to use as a bearer token for authentication.
	// (POST /v1/auth/login)
	AuthLogin(c *gin.Context)
	// Use a JWT to get the currently-authenticated user.
	// (GET /v1/auth/me)
	AuthCurrentUser(c *gin.Context)
	// List all classes
	// (GET /v1/classes)
	ClassesList(c *gin.Context, params ClassesListParams)
	// Create a new class
	// (POST /v1/classes)
	ClassesCreate(c *gin.Context)
	// Delete a class by its CUID
	// (DELETE /v1/classes/{id})
	ClassesDelete(c *gin.Context, id Cuid)
	// Get a class by its CUID
	// (GET /v1/classes/{id})
	ClassesGet(c *gin.Context, id Cuid)
	// Update a class by its CUID
	// (PATCH /v1/classes/{id})
	ClassesUpdate(c *gin.Context, id Cuid)
	// List all grades
	// (GET /v1/classes/{id}/grades)
	GradesList(c *gin.Context, id Cuid, params GradesListParams)
	// Store a new grade
	// (POST /v1/classes/{id}/grades)
	GradesCreate(c *gin.Context, id Cuid)
	// Delete a grade by its CUID
	// (DELETE /v1/classes/{id}/grades/{grade})
	GradesDelete(c *gin.Context, id Cuid, grade Cuid)
	// Get a grade by its CUID and class CUID
	// (GET /v1/classes/{id}/grades/{grade})
	GradesGet(c *gin.Context, id Cuid, grade Cuid)
	// Update a grade by its CUID
	// (PATCH /v1/classes/{id}/grades/{grade})
	GradesUpdate(c *gin.Context, id Cuid, grade Cuid)
	// List all students
	// (GET /v1/students)
	StudentsList(c *gin.Context, params StudentsListParams)
	// Create a new student
	// (POST /v1/students)
	StudentsCreate(c *gin.Context)
	// Delete a student by its CUID
	// (DELETE /v1/students/{id})
	StudentsDelete(c *gin.Context, id Cuid)
	// Get a student by its CUID
	// (GET /v1/students/{id})
	StudentsGet(c *gin.Context, id Cuid)
	// Update a student by its CUID
	// (PATCH /v1/students/{id})
	StudentsUpdate(c *gin.Context, id Cuid)
	// List all teachers
	// (GET /v1/teachers)
	TeachersList(c *gin.Context, params TeachersListParams)
	// Create a new teacher
	// (POST /v1/teachers)
	TeachersCreate(c *gin.Context)
	// Delete a teacher by its CUID
	// (DELETE /v1/teachers/{id})
	TeachersDelete(c *gin.Context, id Cuid)
	// Get a teacher by its CUID
	// (GET /v1/teachers/{id})
	TeachersGet(c *gin.Context, id Cuid)
	// Update a teacher by its CUID
	// (PATCH /v1/teachers/{id})
	TeachersUpdate(c *gin.Context, id Cuid)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandler       func(*gin.Context, error, int)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AuthCurrentUser

func (siw *ServerInterfaceWrapper) AuthCurrentUser(c *gin.Context)

AuthCurrentUser operation middleware

func (*ServerInterfaceWrapper) AuthLogin

func (siw *ServerInterfaceWrapper) AuthLogin(c *gin.Context)

AuthLogin operation middleware

func (*ServerInterfaceWrapper) ClassesCreate

func (siw *ServerInterfaceWrapper) ClassesCreate(c *gin.Context)

ClassesCreate operation middleware

func (*ServerInterfaceWrapper) ClassesDelete

func (siw *ServerInterfaceWrapper) ClassesDelete(c *gin.Context)

ClassesDelete operation middleware

func (*ServerInterfaceWrapper) ClassesGet

func (siw *ServerInterfaceWrapper) ClassesGet(c *gin.Context)

ClassesGet operation middleware

func (*ServerInterfaceWrapper) ClassesList

func (siw *ServerInterfaceWrapper) ClassesList(c *gin.Context)

ClassesList operation middleware

func (*ServerInterfaceWrapper) ClassesUpdate

func (siw *ServerInterfaceWrapper) ClassesUpdate(c *gin.Context)

ClassesUpdate operation middleware

func (*ServerInterfaceWrapper) GradesCreate

func (siw *ServerInterfaceWrapper) GradesCreate(c *gin.Context)

GradesCreate operation middleware

func (*ServerInterfaceWrapper) GradesDelete

func (siw *ServerInterfaceWrapper) GradesDelete(c *gin.Context)

GradesDelete operation middleware

func (*ServerInterfaceWrapper) GradesGet

func (siw *ServerInterfaceWrapper) GradesGet(c *gin.Context)

GradesGet operation middleware

func (*ServerInterfaceWrapper) GradesList

func (siw *ServerInterfaceWrapper) GradesList(c *gin.Context)

GradesList operation middleware

func (*ServerInterfaceWrapper) GradesUpdate

func (siw *ServerInterfaceWrapper) GradesUpdate(c *gin.Context)

GradesUpdate operation middleware

func (*ServerInterfaceWrapper) StudentsCreate

func (siw *ServerInterfaceWrapper) StudentsCreate(c *gin.Context)

StudentsCreate operation middleware

func (*ServerInterfaceWrapper) StudentsDelete

func (siw *ServerInterfaceWrapper) StudentsDelete(c *gin.Context)

StudentsDelete operation middleware

func (*ServerInterfaceWrapper) StudentsGet

func (siw *ServerInterfaceWrapper) StudentsGet(c *gin.Context)

StudentsGet operation middleware

func (*ServerInterfaceWrapper) StudentsList

func (siw *ServerInterfaceWrapper) StudentsList(c *gin.Context)

StudentsList operation middleware

func (*ServerInterfaceWrapper) StudentsUpdate

func (siw *ServerInterfaceWrapper) StudentsUpdate(c *gin.Context)

StudentsUpdate operation middleware

func (*ServerInterfaceWrapper) TeachersCreate

func (siw *ServerInterfaceWrapper) TeachersCreate(c *gin.Context)

TeachersCreate operation middleware

func (*ServerInterfaceWrapper) TeachersDelete

func (siw *ServerInterfaceWrapper) TeachersDelete(c *gin.Context)

TeachersDelete operation middleware

func (*ServerInterfaceWrapper) TeachersGet

func (siw *ServerInterfaceWrapper) TeachersGet(c *gin.Context)

TeachersGet operation middleware

func (*ServerInterfaceWrapper) TeachersList

func (siw *ServerInterfaceWrapper) TeachersList(c *gin.Context)

TeachersList operation middleware

func (*ServerInterfaceWrapper) TeachersUpdate

func (siw *ServerInterfaceWrapper) TeachersUpdate(c *gin.Context)

TeachersUpdate operation middleware

type Student

type Student struct {
	// ClassId A cuid
	ClassId *Cuid `json:"classId,omitempty"`

	// CreatedAt An RFC3339 date/time string
	CreatedAt DateTime `json:"createdAt"`
	FullName  string   `json:"fullName"`

	// Id A cuid
	Id Cuid `json:"id"`

	// UpdatedAt An RFC3339 date/time string
	UpdatedAt DateTime `json:"updatedAt"`
}

Student defines model for Student.

type StudentList

type StudentList = []Student

StudentList An array of Students

type StudentsCreateJSONRequestBody

type StudentsCreateJSONRequestBody = StudentsCreateRequest

StudentsCreateJSONRequestBody defines body for StudentsCreate for application/json ContentType.

type StudentsCreateRequest

type StudentsCreateRequest struct {
	FullName string `json:"fullName"`
}

StudentsCreateRequest defines model for StudentsCreateRequest.

type StudentsCreateResponse

type StudentsCreateResponse struct {
	Student Student `json:"student"`
}

StudentsCreateResponse defines model for StudentsCreateResponse.

type StudentsListParams

type StudentsListParams struct {
	// PerPage The number of results to retrieve in each page.
	PerPage *int `form:"perPage,omitempty" json:"perPage,omitempty"`

	// Page The page to load.
	Page *int `form:"page,omitempty" json:"page,omitempty"`
}

StudentsListParams defines parameters for StudentsList.

type StudentsListResponse

type StudentsListResponse struct {
	Pagination PaginationData `json:"pagination"`

	// Students An array of Students
	Students StudentList `json:"students"`
}

StudentsListResponse The response for the /v1/teachers endpoint

type StudentsUpdateJSONRequestBody

type StudentsUpdateJSONRequestBody = StudentsUpdateRequest

StudentsUpdateJSONRequestBody defines body for StudentsUpdate for application/json ContentType.

type StudentsUpdateRequest

type StudentsUpdateRequest struct {
	FullName string `json:"fullName"`
}

StudentsUpdateRequest defines model for StudentsUpdateRequest.

type StudentsUpdateResponse

type StudentsUpdateResponse struct {
	Student Student `json:"student"`
}

StudentsUpdateResponse defines model for StudentsUpdateResponse.

type Teacher

type Teacher struct {
	// CreatedAt An RFC3339 date/time string
	CreatedAt DateTime `json:"createdAt"`
	Email     string   `json:"email"`
	FullName  string   `json:"fullName"`

	// Id A cuid
	Id Cuid `json:"id"`

	// UpdatedAt An RFC3339 date/time string
	UpdatedAt DateTime `json:"updatedAt"`
}

Teacher defines model for Teacher.

type TeacherList

type TeacherList = []Teacher

TeacherList An array of Teachers

type TeachersCreateJSONRequestBody

type TeachersCreateJSONRequestBody = TeachersCreateRequest

TeachersCreateJSONRequestBody defines body for TeachersCreate for application/json ContentType.

type TeachersCreateRequest

type TeachersCreateRequest struct {
	Email    string `json:"email"`
	FullName string `json:"fullName"`
}

TeachersCreateRequest defines model for TeachersCreateRequest.

type TeachersCreateResponse

type TeachersCreateResponse struct {
	Teacher Teacher `json:"teacher"`
}

TeachersCreateResponse defines model for TeachersCreateResponse.

type TeachersListParams

type TeachersListParams struct {
	// PerPage The number of results to retrieve in each page.
	PerPage *int `form:"perPage,omitempty" json:"perPage,omitempty"`

	// Page The page to load.
	Page *int `form:"page,omitempty" json:"page,omitempty"`
}

TeachersListParams defines parameters for TeachersList.

type TeachersListResponse

type TeachersListResponse struct {
	Pagination PaginationData `json:"pagination"`

	// Teachers An array of Teachers
	Teachers TeacherList `json:"teachers"`
}

TeachersListResponse The response for the /v1/teachers endpoint

type TeachersUpdateJSONRequestBody

type TeachersUpdateJSONRequestBody = TeachersUpdateRequest

TeachersUpdateJSONRequestBody defines body for TeachersUpdate for application/json ContentType.

type TeachersUpdateRequest

type TeachersUpdateRequest struct {
	Email    string `json:"email"`
	FullName string `json:"fullName"`
}

TeachersUpdateRequest defines model for TeachersUpdateRequest.

type TeachersUpdateResponse

type TeachersUpdateResponse struct {
	Teacher Teacher `json:"teacher"`
}

TeachersUpdateResponse defines model for TeachersUpdateResponse.

Jump to

Keyboard shortcuts

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