api

package
v0.0.0-...-fcd1baf Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2025 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package internal/models/api defines models to be used for API requests.

Package internal/models/api defines models to be used for API requests.

Package internal/models/api defines models to be used for API requests.

Index

Constants

View Source
const MAX_LENGTH_QUEUE_NAME = 20

Maximum length of a queue name.

View Source
const MAX_LENGTH_TOKEN_NAME = 20

Maximum length of a token name

View Source
const MIN_LENGTH_QUEUE_NAME = 4

Minimum length of a queue name.

View Source
const MIN_LENGTH_TOKEN_NAME = 4

Minimum length of a token name

Variables

This section is empty.

Functions

This section is empty.

Types

type AddTokenRequest

type AddTokenRequest struct {
	QueueId       db.QueueId
	Name          string
	ContactNumber string
	EmailId       string
}

AddTokenRequest is a model to structure an add token request.

Members

QueueId - QueueId of the queue that this token is to be added to Name - Name of the token, typically name of the person whom the

token was issued to.

ContactNumber - Contact Number. EmailId - Optional. Email ID if the queue collects email ID of users.

func (AddTokenRequest) Validate

func (req AddTokenRequest) Validate() (ValidationError, bool)

type AddTokenResponse

type AddTokenResponse db.TokenId

AddTokenResponse is a model to structure the response of an add token request.

type CreateQueueRequest

type CreateQueueRequest struct {
	QueueName string
}

CreateQueueRequest is a model to structure a create queue request.

Members

QueueName - Name of the queue to be created.

func (CreateQueueRequest) Validate

func (req CreateQueueRequest) Validate() (ValidationError, bool)

Validate function for CreateQueueRequest validates if the queue name is within the defined range.

type CreateQueueResponse

type CreateQueueResponse db.Queue

CreateQueueResponse is a model to strcuture the response of a create queue request.

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

Structure ValidationError is used to describe an error that occurs in a validation.

Members

Field - name of the field which had an error. Message - description of the error.

type Validator

type Validator interface {
	// Method Validate validates the request data.
	// Returns ValidationError, false if the request data is invalid.
	// Returns ValidationError, true if the request data is valid.
	// If ValidationError, true is returned ValidationError is empty and
	// should be ignored.
	Validate() (ValidationError, bool)
}

Interface Validator defines how to define a validator for a request.

Jump to

Keyboard shortcuts

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