requests

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OTP

type OTP struct {
	Code string `json:"code" validate:"required,numeric,len=6"`
}

OTP request that should be used inside endpoint `otp`

func (*OTP) Validate

func (o *OTP) Validate() validator.ValidationErrors

Validate do validate the struct that should be parsed from request body.

type Send

type Send struct {
	Url       string                `form:"url" validate:"required"`
	Send      *multipart.FileHeader `form:"send" validate:"required"`
	Permanent string                `form:"permanent" validate:"required,boolean"`

	paginate.M
	// Order the field name to query Order. Default to id.
	Order string `json:"-" query:"order"`
	// Sort to query Order. Should be filled with either asc or desc. Default
	// to asc.
	Sort string `json:"-" query:"sort"`
	// Search do search for url from given string.
	Search string `json:"-" query:"search"`
}

Send standard request object that may be used to parse request in /send.

func (*Send) PermanentToBool

func (s *Send) PermanentToBool() bool

PermanentToBool convert Permanent field to bool.

func (*Send) SetQuery

func (s *Send) SetQuery()

SetQuery do setup Order and Sort.

func (*Send) Validate

func (s *Send) Validate() validator.ValidationErrors

Validate validation rules for Send that should be parsed from request body.

type SendDelete

type SendDelete struct {
	ID uint `json:"id" validate:"required,numeric"`
}

SendDelete standard request object that may be used to parse request in /send/delete endpoint.

func (*SendDelete) Validate

func (s *SendDelete) Validate() validator.ValidationErrors

Validate validation rules for SendDelete.

type SendUpdate

type SendUpdate struct {
	ID        uint   `form:"id" validate:"required,numeric"`
	Url       string `form:"url" validate:"required"`
	Send      *multipart.FileHeader
	Permanent string `form:"permanent" validate:"required,boolean"`
}

SendUpdate standard request object that may be used to parse request in /send/update endpoint.

func (*SendUpdate) PermanentToBool

func (s *SendUpdate) PermanentToBool() bool

PermanentToBool convert Permanent field to bool.

func (*SendUpdate) Validate

func (s *SendUpdate) Validate() validator.ValidationErrors

Validate validation rules for SendUpdate.

type Shorten

type Shorten struct {
	Url       string `json:"url" validate:"required"`
	Shorten   string `json:"shorten" validate:"required,url"`
	Permanent string `json:"permanent" validate:"required,boolean"`

	paginate.M
	// Order the field name to query Order. Default to id.
	Order string `json:"-" query:"order"`
	// Sort to query Order. Should be filled with either asc or desc. Default
	// to asc.
	Sort string `json:"-" query:"sort"`
	// Search do search for url from given string.
	Search string `json:"-" query:"search"`
}

Shorten standard request object that may be used to parse request in /shorten & /shorten/create endpoints.

func (*Shorten) PermanentToBool

func (s *Shorten) PermanentToBool() bool

PermanentToBool convert Permanent field to bool.

func (*Shorten) SetQuery

func (s *Shorten) SetQuery()

SetQuery do setup Order and Sort.

func (*Shorten) Validate

func (s *Shorten) Validate() validator.ValidationErrors

Validate validation rules for Shorten that should be parsed from request body.

type ShortenDelete

type ShortenDelete struct {
	ID uint `json:"id" validate:"required,numeric"`
}

ShortenDelete standard request object that may be used to parse request in /shorten/delete endpoint.

func (*ShortenDelete) Validate

func (s *ShortenDelete) Validate() validator.ValidationErrors

Validate validation rules for ShortenDelete.

type ShortenUpdate

type ShortenUpdate struct {
	ID        uint    `json:"id" validate:"required,numeric"`
	Url       string  `json:"url" validate:"required"`
	Shorten   *string `json:"shorten" validate:"required,url"`
	Permanent string  `json:"permanent" validate:"required,boolean"`
}

ShortenUpdate standard request object that may be used to parse request in /shorten/update endpoint.

func (*ShortenUpdate) PermanentToBool

func (s *ShortenUpdate) PermanentToBool() bool

PermanentToBool convert Permanent field to bool.

func (*ShortenUpdate) Validate

func (s *ShortenUpdate) Validate() validator.ValidationErrors

Validate validation rules for ShortenUpdate.

Jump to

Keyboard shortcuts

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