rest

package
v0.0.0-...-f15602e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package rest provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen/v2 version v2.0.0 DO NOT EDIT.

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	City     string  `json:"city"`
	Country  string  `json:"country"`
	Flat     *int    `json:"flat,omitempty"`
	House    int     `json:"house"`
	Id       int64   `json:"id"`
	Letter   *string `json:"letter,omitempty"`
	Postcode int     `json:"postcode"`
	Street   string  `json:"street"`
	UserId   int64   `json:"userId"`
}

Address defines model for Address.

type AddressList

type AddressList = []Address

AddressList defines model for AddressList.

type BadRequest

type BadRequest = Error

BadRequest defines model for BadRequest.

type Cart

type Cart struct {
	Amount  int64   `json:"amount"`
	Id      int64   `json:"id"`
	Product Product `json:"product"`
	UserId  int64   `json:"userId"`
}

Cart defines model for Cart.

type CartList

type CartList = []Cart

CartList defines model for CartList.

type CartProduct

type CartProduct struct {
	Amount    int   `json:"amount"`
	ProductId int64 `json:"productId"`
}

CartProduct defines model for CartProduct.

func (CartProduct) ToDomainEntity

func (r CartProduct) ToDomainEntity() *cart.Props

ToDomainEntity transforms api template into domain entity.

func (CartProduct) Validate

func (r CartProduct) Validate() error

Validate body of CartProduct.

type Category

type Category struct {
	Id   int64  `json:"id"`
	Name string `json:"name"`
}

Category defines model for Category.

func (Category) Validate

func (r Category) Validate() error

Validate body of Category.

type CategoryList

type CategoryList = []Category

CategoryList defines model for CategoryList.

type Conflict

type Conflict = Error

Conflict defines model for Conflict.

type CreateAddressRequest

type CreateAddressRequest struct {
	City     string  `json:"city"`
	Country  string  `json:"country"`
	Flat     *int    `json:"flat,omitempty"`
	House    int     `json:"house"`
	Letter   *string `json:"letter,omitempty"`
	Postcode int     `json:"postcode"`
	Street   string  `json:"street"`
}

CreateAddressRequest defines model for CreateAddressRequest.

func (CreateAddressRequest) ToDomainEntity

func (r CreateAddressRequest) ToDomainEntity() *address.Props

ToDomainEntity transforms api template into domain entity.

func (CreateAddressRequest) Validate

func (r CreateAddressRequest) Validate() error

Validate body of CreateAddressRequest.

type CreateCategoryRequest

type CreateCategoryRequest struct {
	Name string `json:"name"`
}

CreateCategoryRequest defines model for CreateCategoryRequest.

func (CreateCategoryRequest) ToDomainEntity

func (r CreateCategoryRequest) ToDomainEntity() *category.Props

ToDomainEntity transforms api template into domain entity.

func (CreateCategoryRequest) Validate

func (r CreateCategoryRequest) Validate() error

Validate body of CreateCategoryRequest.

type CreateProductRequest

type CreateProductRequest struct {
	Amount      int64  `json:"amount"`
	CategoryId  int    `json:"categoryId"`
	Description string `json:"description"`
	Name        string `json:"name"`
	Price       int64  `json:"price"`
}

CreateProductRequest defines model for CreateProductRequest.

func (CreateProductRequest) ToDomainEntity

func (r CreateProductRequest) ToDomainEntity() *product.Props

ToDomainEntity transforms api template into domain entity.

func (CreateProductRequest) Validate

func (r CreateProductRequest) Validate() error

Validate body of CreateProductRequest.

type Error

type Error struct {
	Message string `json:"message"`
}

Error defines model for Error.

type Image

type Image struct {
	Id        int64  `json:"id"`
	Name      string `json:"name"`
	ProductId int64  `json:"productId"`
}

Image defines model for Image.

type ImageList

type ImageList = []Image

ImageList defines model for ImageList.

type InternalError

type InternalError = Error

InternalError defines model for InternalError.

type LoginRequest

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

LoginRequest defines model for LoginRequest.

func (LoginRequest) ToDomainEntity

func (r LoginRequest) ToDomainEntity() *auth.LoginProps

ToDomainEntity transforms api template into domain entity.

func (LoginRequest) Validate

func (r LoginRequest) Validate() error

Validate body of LoginRequest.

type LoginResponse

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

LoginResponse defines model for LoginResponse.

type NotFound

type NotFound = Error

NotFound defines model for NotFound.

type Order

type Order struct {
	Id     int64       `json:"id"`
	Status OrderStatus `json:"status"`
	UserId int64       `json:"userId"`
}

Order defines model for Order.

type OrderDetailed

type OrderDetailed struct {
	Id       int64            `json:"id"`
	Products OrderProductList `json:"products"`
	UserId   int64            `json:"userId"`
}

OrderDetailed defines model for OrderDetailed.

type OrderList

type OrderList = []Order

OrderList defines model for OrderList.

type OrderProduct

type OrderProduct struct {
	Amount    int   `json:"amount"`
	ProductId int64 `json:"productId"`
}

OrderProduct defines model for OrderProduct.

type OrderProductList

type OrderProductList = []OrderProduct

OrderProductList defines model for OrderProductList.

type OrderStatus

type OrderStatus string

OrderStatus defines model for Order.Status.

const (
	ACCEPTED OrderStatus = "ACCEPTED"
	CANCELED OrderStatus = "CANCELED"
	CREATED  OrderStatus = "CREATED"
)

Defines values for OrderStatus.

type PaginationResponse

type PaginationResponse struct {
	Quantity int `json:"quantity"`
}

PaginationResponse defines model for PaginationResponse.

type PatchCartJSONRequestBody

type PatchCartJSONRequestBody = CartProduct

PatchCartJSONRequestBody defines body for PatchCart for application/json ContentType.

type PatchCategoryJSONRequestBody

type PatchCategoryJSONRequestBody = Category

PatchCategoryJSONRequestBody defines body for PatchCategory for application/json ContentType.

type PatchProductProductIdJSONRequestBody

type PatchProductProductIdJSONRequestBody = CreateProductRequest

PatchProductProductIdJSONRequestBody defines body for PatchProductProductId for application/json ContentType.

type PostAddressJSONRequestBody

type PostAddressJSONRequestBody = CreateAddressRequest

PostAddressJSONRequestBody defines body for PostAddress for application/json ContentType.

type PostAuthLoginJSONRequestBody

type PostAuthLoginJSONRequestBody = LoginRequest

PostAuthLoginJSONRequestBody defines body for PostAuthLogin for application/json ContentType.

type PostAuthSignupJSONRequestBody

type PostAuthSignupJSONRequestBody = SignupRequest

PostAuthSignupJSONRequestBody defines body for PostAuthSignup for application/json ContentType.

type PostCartJSONRequestBody

type PostCartJSONRequestBody = CartProduct

PostCartJSONRequestBody defines body for PostCart for application/json ContentType.

type PostCategoryJSONRequestBody

type PostCategoryJSONRequestBody = CreateCategoryRequest

PostCategoryJSONRequestBody defines body for PostCategory for application/json ContentType.

type PostProductJSONRequestBody

type PostProductJSONRequestBody = CreateProductRequest

PostProductJSONRequestBody defines body for PostProduct for application/json ContentType.

type PostProductProductIdImageMultipartRequestBody

type PostProductProductIdImageMultipartRequestBody = UploadImagesRequest

PostProductProductIdImageMultipartRequestBody defines body for PostProductProductIdImage for multipart/form-data ContentType.

type Product

type Product struct {
	Amount      int64     `json:"amount"`
	CategoryId  int64     `json:"categoryId"`
	Description *string   `json:"description,omitempty"`
	Id          int64     `json:"id"`
	Images      ImageList `json:"images"`
	Name        string    `json:"name"`
	Price       int64     `json:"price"`
}

Product defines model for Product.

type ProductList

type ProductList struct {
	Items    []Product `json:"items"`
	Quantity int       `json:"quantity"`
}

ProductList defines model for ProductList.

type SignupRequest

type SignupRequest struct {
	Email    string `json:"email"`
	Name     string `json:"name"`
	Password string `json:"password"`
	Phone    string `json:"phone"`
}

SignupRequest defines model for SignupRequest.

func (SignupRequest) ToDomainEntity

func (r SignupRequest) ToDomainEntity() *auth.SignupProps

ToDomainEntity transforms api template into domain entity.

func (SignupRequest) Validate

func (r SignupRequest) Validate() error

Validate body of SignupRequest.

type Unauthorized

type Unauthorized = Error

Unauthorized defines model for Unauthorized.

type UploadImagesRequest

type UploadImagesRequest struct {
	Files []openapi_types.File `json:"files"`
}

UploadImagesRequest defines model for UploadImagesRequest.

type User

type User struct {
	Email string   `json:"email"`
	Id    int64    `json:"id"`
	Name  string   `json:"name"`
	Phone string   `json:"phone"`
	Role  UserRole `json:"role"`
}

User defines model for User.

type UserRole

type UserRole string

UserRole defines model for User.Role.

const (
	ADMIN UserRole = "ADMIN"
	USER  UserRole = "USER"
)

Defines values for UserRole.

Directories

Path Synopsis
Package controller contains rest controllers.
Package controller contains rest controllers.
mapping
Package mapping contains logic to convert domain entities
Package mapping contains logic to convert domain entities
Package middleware contains rest middlewares
Package middleware contains rest middlewares

Jump to

Keyboard shortcuts

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