v1

package
v0.0.0-...-d6c8fca Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TokenProperty       = "token"
	UserDetailsProperty = "user-details"
)

Variables

View Source
var (
	ValueInternalSeverError = fmt.Errorf("internal server error")
)

Functions

func EncodeJSONResponse

func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error

EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code

func ExtractUserId

func ExtractUserId(r *http.Request) (model.UserId, error)

func GenerateToken

func GenerateToken(user model.User) (model.Token, error)

func GetAuthMiddleware

func GetAuthMiddleware() *jwtmiddleware.JWTMiddleware

func Logger

func Logger(inner http.Handler, name string) http.Handler

func NewLoggedResponseWriter

func NewLoggedResponseWriter(w http.ResponseWriter) *loggedResponseWriter

func NewRouter

func NewRouter(routers ...Router) *mux.Router

NewRouter creates a new router for any number of api routers

func ReadFormFileToTempFile

func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)

ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file

func WithUserDetails

func WithUserDetails(handler http.Handler) http.HandlerFunc

Types

type Address

type Address struct {

	// The first name of the person at the address.
	FirstName string `json:"firstName,omitempty"`

	// The last name of the person at the address.
	LastName string `json:"lastName,omitempty"`

	// The precise location of address.
	Address string `json:"address,omitempty"`

	// The complement of the precise location of address.
	AddressComplement string `json:"addressComplement,omitempty"`

	// The city of the address.
	City string `json:"city,omitempty"`

	// The state of the address.
	State string `json:"state,omitempty"`

	// The postal code/zip of the address.
	PostalCode string `json:"postalCode,omitempty"`

	// The country of the address.
	Country string `json:"country,omitempty"`
}

type AnonymousUsersApiController

type AnonymousUsersApiController struct {
	// contains filtered or unexported fields
}

A AnonymousUsersApiController binds http requests to an api service and writes the service results to the http response

func (*AnonymousUsersApiController) IsLogged

func (c *AnonymousUsersApiController) IsLogged() bool

IsLogged returns true if this api uses the logger middleware, false otherwise

func (*AnonymousUsersApiController) IsPrivate

func (c *AnonymousUsersApiController) IsPrivate() bool

IsPrivate returns true if this api requires authentication, false otherwise

func (*AnonymousUsersApiController) Routes

func (c *AnonymousUsersApiController) Routes() Routes

Routes returns all of the api route for the AnonymousUsersApiController

func (*AnonymousUsersApiController) Signin

Signin - Attempts to login a user.

func (*AnonymousUsersApiController) Signup

Signup - Attempts to register a new user.

func (*AnonymousUsersApiController) WithAuthentication

func (c *AnonymousUsersApiController) WithAuthentication() Router

WithAuthentication flags this api as private

func (*AnonymousUsersApiController) WithLog

func (c *AnonymousUsersApiController) WithLog() Router

WithLog flags this api as using the logger middleware

type AnonymousUsersApiRouter

type AnonymousUsersApiRouter interface {
	Signin(http.ResponseWriter, *http.Request)
	Signup(http.ResponseWriter, *http.Request)
}

AnonymousUsersApiRouter defines the required methods for binding the api requests to a responses for the AnonymousUsersApi The AnonymousUsersApiRouter implementation should parse necessary information from the http request, pass the data to a AnonymousUsersApiServicer to perform the required actions, then write the service results to the http response.

type AnonymousUsersApiService

type AnonymousUsersApiService struct {
}

AnonymousUsersApiService is a service that implents the logic for the AnonymousUsersApiServicer This service should implement the business logic for every endpoint for the AnonymousUsersApi API. Include any external packages or services that will be required by this service.

func (*AnonymousUsersApiService) Signin

func (s *AnonymousUsersApiService) Signin(signInRequest SignInRequest) response.Response

Signin - Attempts to login a user.

func (*AnonymousUsersApiService) Signup

func (s *AnonymousUsersApiService) Signup(signUpRequest SignUpRequest) response.Response

Signup - Attempts to register a new user.

type AnonymousUsersApiServicer

type AnonymousUsersApiServicer interface {
	Signin(SignInRequest) response.Response
	Signup(SignUpRequest) response.Response
}

AnonymousUsersApiServicer defines the api actions for the AnonymousUsersApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewAnonymousUsersApiService

func NewAnonymousUsersApiService() AnonymousUsersApiServicer

NewAnonymousUsersApiService creates a default api service

type AuthenticatedUsersApiController

type AuthenticatedUsersApiController struct {
	// contains filtered or unexported fields
}

A AuthenticatedUsersApiController binds http requests to an api service and writes the service results to the http response

func (*AuthenticatedUsersApiController) IsLogged

func (c *AuthenticatedUsersApiController) IsLogged() bool

IsLogged returns true if this api uses the logger middleware, false otherwise

func (*AuthenticatedUsersApiController) IsPrivate

func (c *AuthenticatedUsersApiController) IsPrivate() bool

IsPrivate returns true if this api requires authentication, false otherwise

func (*AuthenticatedUsersApiController) Routes

Routes returns all of the api route for the AuthenticatedUsersApiController

func (*AuthenticatedUsersApiController) Signout

Signout - Attempts to logout a user.

func (*AuthenticatedUsersApiController) WithAuthentication

func (c *AuthenticatedUsersApiController) WithAuthentication() Router

WithAuthentication flags this api as private

func (*AuthenticatedUsersApiController) WithLog

WithLog flags this api as using the logger middleware

type AuthenticatedUsersApiRouter

type AuthenticatedUsersApiRouter interface {
	Signout(http.ResponseWriter, *http.Request)
}

AuthenticatedUsersApiRouter defines the required methods for binding the api requests to a responses for the AuthenticatedUsersApi The AuthenticatedUsersApiRouter implementation should parse necessary information from the http request, pass the data to a AuthenticatedUsersApiServicer to perform the required actions, then write the service results to the http response.

type AuthenticatedUsersApiService

type AuthenticatedUsersApiService struct {
}

AuthenticatedUsersApiService is a service that implents the logic for the AuthenticatedUsersApiServicer This service should implement the business logic for every endpoint for the AuthenticatedUsersApi API. Include any external packages or services that will be required by this service.

func (*AuthenticatedUsersApiService) Signout

Signout - Attempts to logout a user.

type AuthenticatedUsersApiServicer

type AuthenticatedUsersApiServicer interface {
	Signout(model.Token) response.Response
}

AuthenticatedUsersApiServicer defines the api actions for the AuthenticatedUsersApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewAuthenticatedUsersApiService

func NewAuthenticatedUsersApiService() AuthenticatedUsersApiServicer

NewAuthenticatedUsersApiService creates a default api service

type Cart

type Cart struct {

	// The content of the cart.
	Items []CartItem `json:"items"`

	// The cart's total price.
	Total float64 `json:"total"`

	// The cart's total price after applying all the discounts.
	SaleTotal float64 `json:"saleTotal"`

	// Timestamp of the last update of the cart.
	LastUpdate time.Time `json:"lastUpdate"`

	// The coupon code applied to the cart, if any.
	CouponCode string `json:"couponCode,omitempty"`
}

type CartApiController

type CartApiController struct {
	// contains filtered or unexported fields
}

A CartApiController binds http requests to an api service and writes the service results to the http response

func (*CartApiController) ApplyCoupon

func (c *CartApiController) ApplyCoupon(w http.ResponseWriter, r *http.Request)

ApplyCoupon - Applies a coupon to the cart.

func (*CartApiController) DeleteCart

func (c *CartApiController) DeleteCart(w http.ResponseWriter, r *http.Request)

DeleteCart - Empties the authenticated user's cart content.

func (*CartApiController) GetCart

func (c *CartApiController) GetCart(w http.ResponseWriter, r *http.Request)

GetCart - Returns the authenticated user's cart.

func (*CartApiController) IsLogged

func (c *CartApiController) IsLogged() bool

IsLogged returns true if this api uses the logger middleware, false otherwise

func (*CartApiController) IsPrivate

func (c *CartApiController) IsPrivate() bool

IsPrivate returns true if this api requires authentication, false otherwise

func (*CartApiController) Routes

func (c *CartApiController) Routes() Routes

Routes returns all of the api route for the CartApiController

func (*CartApiController) WithAuthentication

func (c *CartApiController) WithAuthentication() Router

WithAuthentication flags this api as private

func (*CartApiController) WithLog

func (c *CartApiController) WithLog() Router

WithLog flags this api as using the logger middleware

type CartApiRouter

type CartApiRouter interface {
	ApplyCoupon(http.ResponseWriter, *http.Request)
	DeleteCart(http.ResponseWriter, *http.Request)
	GetCart(http.ResponseWriter, *http.Request)
}

CartApiRouter defines the required methods for binding the api requests to a responses for the CartApi The CartApiRouter implementation should parse necessary information from the http request, pass the data to a CartApiServicer to perform the required actions, then write the service results to the http response.

type CartApiService

type CartApiService struct {
}

CartApiService is a service that implents the logic for the CartApiServicer This service should implement the business logic for every endpoint for the CartApi API. Include any external packages or services that will be required by this service.

func (*CartApiService) ApplyCoupon

func (s *CartApiService) ApplyCoupon(userId model.UserId, coupon Coupon) response.Response

ApplyCoupon - Applies a coupon to the cart.

func (*CartApiService) DeleteCart

func (s *CartApiService) DeleteCart(userId model.UserId) response.Response

DeleteCart - Empties the authenticated user's cart content.

func (*CartApiService) GetCart

func (s *CartApiService) GetCart(userId model.UserId) response.Response

GetCart - Returns the authenticated user's cart.

type CartApiServicer

type CartApiServicer interface {
	ApplyCoupon(model.UserId, Coupon) response.Response
	DeleteCart(model.UserId) response.Response
	GetCart(model.UserId) response.Response
}

CartApiServicer defines the api actions for the CartApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewCartApiService

func NewCartApiService() CartApiServicer

NewCartApiService creates a default api service

type CartItem

type CartItem struct {

	// The product ID.
	Id int32 `json:"id"`

	// The product label.
	Label string `json:"label"`

	// The product description.
	Description string `json:"description,omitempty"`

	// The product's image URI.
	Image string `json:"image,omitempty"`

	// The product price.
	Price float64 `json:"price"`

	// The item ID.
	ItemId int32 `json:"itemId"`

	// The item quantity.
	Quantity int32 `json:"quantity"`
}

type CartItemAllOf

type CartItemAllOf struct {

	// The item ID.
	ItemId int32 `json:"itemId"`

	// The item quantity.
	Quantity int32 `json:"quantity"`
}

type CartItemsApiController

type CartItemsApiController struct {
	// contains filtered or unexported fields
}

A CartItemsApiController binds http requests to an api service and writes the service results to the http response

func (*CartItemsApiController) AddCartItem

func (c *CartItemsApiController) AddCartItem(w http.ResponseWriter, r *http.Request)

AddCartItem - Adds one item of the selected product to the authenticated user's cart. If the product is already in the cart, increment its quantity by 1.

func (*CartItemsApiController) DeleteCartItem

func (c *CartItemsApiController) DeleteCartItem(w http.ResponseWriter, r *http.Request)

DeleteCartItem - Deletes an item from the cart given its ID.

func (*CartItemsApiController) IsLogged

func (c *CartItemsApiController) IsLogged() bool

IsLogged returns true if this api uses the logger middleware, false otherwise

func (*CartItemsApiController) IsPrivate

func (c *CartItemsApiController) IsPrivate() bool

IsPrivate returns true if this api requires authentication, false otherwise

func (*CartItemsApiController) Routes

func (c *CartItemsApiController) Routes() Routes

Routes returns all of the api route for the CartItemsApiController

func (*CartItemsApiController) UpdateCartItem

func (c *CartItemsApiController) UpdateCartItem(w http.ResponseWriter, r *http.Request)

UpdateCartItem - Modifies the count of an item in the cart given its ID. If the new quantity is 0, deletes the item from the cart.

func (*CartItemsApiController) WithAuthentication

func (c *CartItemsApiController) WithAuthentication() Router

WithAuthentication flags this api as private

func (*CartItemsApiController) WithLog

func (c *CartItemsApiController) WithLog() Router

WithLog flags this api as using the logger middleware

type CartItemsApiRouter

type CartItemsApiRouter interface {
	AddCartItem(http.ResponseWriter, *http.Request)
	DeleteCartItem(http.ResponseWriter, *http.Request)
	UpdateCartItem(http.ResponseWriter, *http.Request)
}

CartItemsApiRouter defines the required methods for binding the api requests to a responses for the CartItemsApi The CartItemsApiRouter implementation should parse necessary information from the http request, pass the data to a CartItemsApiServicer to perform the required actions, then write the service results to the http response.

type CartItemsApiService

type CartItemsApiService struct {
}

CartItemsApiService is a service that implents the logic for the CartItemsApiServicer This service should implement the business logic for every endpoint for the CartItemsApi API. Include any external packages or services that will be required by this service.

func (*CartItemsApiService) AddCartItem

func (s *CartItemsApiService) AddCartItem(userId model.UserId, productReference ProductReference) response.Response

AddCartItem - Adds one item of the selected product to the authenticated user's cart. If the product is already in the cart, increment its quantity by 1.

func (*CartItemsApiService) DeleteCartItem

func (s *CartItemsApiService) DeleteCartItem(userId model.UserId, itemId string) response.Response

DeleteCartItem - Deletes an item from the cart given its ID.

func (*CartItemsApiService) UpdateCartItem

func (s *CartItemsApiService) UpdateCartItem(userId model.UserId, itemId string, itemQuantity ItemQuantity) response.Response

UpdateCartItem - Modifies the count of an item in the cart given its ID. If the new quantity is 0, deletes the item from the cart.

type CartItemsApiServicer

type CartItemsApiServicer interface {
	DeleteCartItem(model.UserId, string) response.Response
	UpdateCartItem(model.UserId, string, ItemQuantity) response.Response
	AddCartItem(model.UserId, ProductReference) response.Response
}

CartItemsApiServicer defines the api actions for the CartItemsApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewCartItemsApiService

func NewCartItemsApiService() CartItemsApiServicer

NewCartItemsApiService creates a default api service

type Coupon

type Coupon struct {

	// A coupon code.
	Code string `json:"code" valid:"required~Coupon code is blank,length(10|100)~Coupon code is not valid"`
}

type CreditCard

type CreditCard struct {

	// The Credit Card holder.
	CardHolder string `json:"cardHolder" valid:"required~Credit Card holder is blank"`

	// The Credit Card number.
	CardNumber string `json:"cardNumber" valid:"required~Credit Card number is blank"`

	// The expiry date of the Credit Card.
	ExpiryDate string `json:"expiryDate" valid:"required~Expiry date of the Credit Card is blank"`

	// The CVV of the Credit Card.
	Cvv string `json:"cvv" valid:"required~CVV of the Credit Card is blank"`
}

type Error

type Error struct {

	// The ID code of the error.
	Code int32 `json:"code"`

	// The error message.
	Message string `json:"message"`

	// The error timestamp.
	Timestamp time.Time `json:"timestamp"`
}

func NewErrorResponse

func NewErrorResponse(message string, code int32) Error

type ItemQuantity

type ItemQuantity struct {

	// The new quantity of an item in the cart.
	Quantity int32 `json:"quantity" valid:"required~Item quantity is required,range(0|1000)~Item quantity should be between 0 and 1000"`
}

type KubernetesProbesApiController

type KubernetesProbesApiController struct {
	// contains filtered or unexported fields
}

A KubernetesProbesApiController binds http requests to an api service and writes the service results to the http response

func (*KubernetesProbesApiController) IsLogged

func (c *KubernetesProbesApiController) IsLogged() bool

IsLogged returns true if this api uses the logger middleware, false otherwise

func (*KubernetesProbesApiController) IsPrivate

func (c *KubernetesProbesApiController) IsPrivate() bool

IsPrivate returns true if this api requires authentication, false otherwise

func (*KubernetesProbesApiController) KubernetesLivenessProbe

func (c *KubernetesProbesApiController) KubernetesLivenessProbe(w http.ResponseWriter, r *http.Request)

KubernetesLivenessProbe - Kubernetes liveness probe.

func (*KubernetesProbesApiController) KubernetesReadinessProbe

func (c *KubernetesProbesApiController) KubernetesReadinessProbe(w http.ResponseWriter, r *http.Request)

KubernetesReadinessProbe - Kubernetes readiness probe.

func (*KubernetesProbesApiController) Routes

Routes returns all of the api route for the KubernetesProbesApiController

func (*KubernetesProbesApiController) WithAuthentication

func (c *KubernetesProbesApiController) WithAuthentication() Router

WithAuthentication flags this api as private

func (*KubernetesProbesApiController) WithLog

WithLog flags this api as using the logger middleware

type KubernetesProbesApiRouter

type KubernetesProbesApiRouter interface {
	KubernetesLivenessProbe(http.ResponseWriter, *http.Request)
	KubernetesReadinessProbe(http.ResponseWriter, *http.Request)
}

KubernetesProbesApiRouter defines the required methods for binding the api requests to a responses for the KubernetesProbesApi The KubernetesProbesApiRouter implementation should parse necessary information from the http request, pass the data to a KubernetesProbesApiServicer to perform the required actions, then write the service results to the http response.

type KubernetesProbesApiService

type KubernetesProbesApiService struct {
}

KubernetesProbesApiService is a service that implents the logic for the KubernetesProbesApiServicer This service should implement the business logic for every endpoint for the KubernetesProbesApi API. Include any external packages or services that will be required by this service.

func (*KubernetesProbesApiService) KubernetesLivenessProbe

func (s *KubernetesProbesApiService) KubernetesLivenessProbe() (interface{}, error)

KubernetesLivenessProbe - Kubernetes liveness probe.

func (*KubernetesProbesApiService) KubernetesReadinessProbe

func (s *KubernetesProbesApiService) KubernetesReadinessProbe() (interface{}, error)

KubernetesReadinessProbe - Kubernetes readiness probe.

type KubernetesProbesApiServicer

type KubernetesProbesApiServicer interface {
	KubernetesLivenessProbe() (interface{}, error)
	KubernetesReadinessProbe() (interface{}, error)
}

KubernetesProbesApiServicer defines the api actions for the KubernetesProbesApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewKubernetesProbesApiService

func NewKubernetesProbesApiService() KubernetesProbesApiServicer

NewKubernetesProbesApiService creates a default api service

type Order

type Order struct {

	// The string-formatted timestamp of the last update of the cart.
	CartVersion string `json:"cartVersion" valid:"required~Cart version is invalid"`

	// The shipping address.
	ShippingAddress Address `json:"shippingAddress" valid:"required~Shipping address is invalid"`

	// The billing address.
	BillingAddress Address `json:"billingAddress" valid:"required~Billing address is invalid"`

	// The Credit Card details.
	CreditCard CreditCard `json:"creditCard" valid:"required~Credit Card is invalid"`
}

type PaymentApiController

type PaymentApiController struct {
	// contains filtered or unexported fields
}

A PaymentApiController binds http requests to an api service and writes the service results to the http response

func (*PaymentApiController) IsLogged

func (c *PaymentApiController) IsLogged() bool

IsLogged returns true if this api uses the logger middleware, false otherwise

func (*PaymentApiController) IsPrivate

func (c *PaymentApiController) IsPrivate() bool

IsPrivate returns true if this api requires authentication, false otherwise

func (*PaymentApiController) Routes

func (c *PaymentApiController) Routes() Routes

Routes returns all of the api route for the PaymentApiController

func (*PaymentApiController) ValidatePayment

func (c *PaymentApiController) ValidatePayment(w http.ResponseWriter, r *http.Request)

ValidatePayment - Validates the status of the purchase upon the response of the payment gateway.

func (*PaymentApiController) WithAuthentication

func (c *PaymentApiController) WithAuthentication() Router

WithAuthentication flags this api as private

func (*PaymentApiController) WithLog

func (c *PaymentApiController) WithLog() Router

WithLog flags this api as using the logger middleware

type PaymentApiRouter

type PaymentApiRouter interface {
	ValidatePayment(http.ResponseWriter, *http.Request)
}

PaymentApiRouter defines the required methods for binding the api requests to a responses for the PaymentApi The PaymentApiRouter implementation should parse necessary information from the http request, pass the data to a PaymentApiServicer to perform the required actions, then write the service results to the http response.

type PaymentApiService

type PaymentApiService struct {
}

PaymentApiService is a service that implents the logic for the PaymentApiServicer This service should implement the business logic for every endpoint for the PaymentApi API. Include any external packages or services that will be required by this service.

func (*PaymentApiService) ValidatePayment

func (s *PaymentApiService) ValidatePayment(userId model.UserId, order Order) response.Response

ValidatePayment - Validates the status of the purchase upon the response of the payment gateway.

type PaymentApiServicer

type PaymentApiServicer interface {
	ValidatePayment(model.UserId, Order) response.Response
}

PaymentApiServicer defines the api actions for the PaymentApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewPaymentApiService

func NewPaymentApiService() PaymentApiServicer

NewPaymentApiService creates a default api service

type PaymentStatus

type PaymentStatus struct {

	// The ID of the transaction returned by the payment gateway.
	TransactionId string `json:"transactionId"`

	// The status of the transaction according to the payment gateway.
	Status string `json:"status"`
}

type Product

type Product struct {

	// The product ID.
	Id int32 `json:"id"`

	// The product label.
	Label string `json:"label"`

	// The product description.
	Description string `json:"description,omitempty"`

	// The product's image URI.
	Image string `json:"image,omitempty"`

	// The product price.
	Price float64 `json:"price"`
}

type ProductReference

type ProductReference struct {

	// A product ID.
	ProductId int32 `json:"productId" valid:"required~Product id is required"`
}

type ProductsApiController

type ProductsApiController struct {
	// contains filtered or unexported fields
}

A ProductsApiController binds http requests to an api service and writes the service results to the http response

func (*ProductsApiController) GetProductById

func (c *ProductsApiController) GetProductById(w http.ResponseWriter, r *http.Request)

GetProductById - Returns a product by its ID, if found.

func (*ProductsApiController) GetProducts

func (c *ProductsApiController) GetProducts(w http.ResponseWriter, r *http.Request)

GetProducts - Returns a list of the products.

func (*ProductsApiController) IsLogged

func (c *ProductsApiController) IsLogged() bool

IsLogged returns true if this api uses the logger middleware, false otherwise

func (*ProductsApiController) IsPrivate

func (c *ProductsApiController) IsPrivate() bool

IsPrivate returns true if this api requires authentication, false otherwise

func (*ProductsApiController) Routes

func (c *ProductsApiController) Routes() Routes

Routes returns all of the api route for the ProductsApiController

func (*ProductsApiController) WithAuthentication

func (c *ProductsApiController) WithAuthentication() Router

WithAuthentication flags this api as private

func (*ProductsApiController) WithLog

func (c *ProductsApiController) WithLog() Router

WithLog flags this api as using the logger middleware

type ProductsApiRouter

type ProductsApiRouter interface {
	GetProductById(http.ResponseWriter, *http.Request)
	GetProducts(http.ResponseWriter, *http.Request)
}

ProductsApiRouter defines the required methods for binding the api requests to a responses for the ProductsApi The ProductsApiRouter implementation should parse necessary information from the http request, pass the data to a ProductsApiServicer to perform the required actions, then write the service results to the http response.

type ProductsApiService

type ProductsApiService struct {
}

ProductsApiService is a service that implents the logic for the ProductsApiServicer This service should implement the business logic for every endpoint for the ProductsApi API. Include any external packages or services that will be required by this service.

func (*ProductsApiService) GetProductById

func (s *ProductsApiService) GetProductById(productId string) response.Response

GetProductById - Returns a product by its ID, if found.

func (*ProductsApiService) GetProducts

func (s *ProductsApiService) GetProducts(sort string) response.Response

GetProducts - Returns a list of the products.

type ProductsApiServicer

type ProductsApiServicer interface {
	GetProducts(string) response.Response
	GetProductById(string) response.Response
}

ProductsApiServicer defines the api actions for the ProductsApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewProductsApiService

func NewProductsApiService() ProductsApiServicer

NewProductsApiService creates a default api service

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

A Route defines the parameters for an api endpoint

type Router

type Router interface {
	Routes() Routes
	WithAuthentication() Router
	IsPrivate() bool
	WithLog() Router
	IsLogged() bool
}

Router defines the required methods for retrieving api routes

func NewAnonymousUsersApiController

func NewAnonymousUsersApiController(s AnonymousUsersApiServicer) Router

NewAnonymousUsersApiController creates a default api controller

func NewAuthenticatedUsersApiController

func NewAuthenticatedUsersApiController(s AuthenticatedUsersApiServicer) Router

NewAuthenticatedUsersApiController creates a default api controller

func NewCartApiController

func NewCartApiController(s CartApiServicer) Router

NewCartApiController creates a default api controller

func NewCartItemsApiController

func NewCartItemsApiController(s CartItemsApiServicer) Router

NewCartItemsApiController creates a default api controller

func NewKubernetesProbesApiController

func NewKubernetesProbesApiController(s KubernetesProbesApiServicer) Router

NewKubernetesProbesApiController creates a default api controller

func NewPaymentApiController

func NewPaymentApiController(s PaymentApiServicer) Router

NewPaymentApiController creates a default api controller

func NewProductsApiController

func NewProductsApiController(s ProductsApiServicer) Router

NewProductsApiController creates a default api controller

type Routes

type Routes []Route

Routes are a collection of defined api endpoints

type SignInRequest

type SignInRequest struct {

	// The user email.
	Email string `json:"email" valid:"required~Email is blank,email~Email is not valid"`

	// The user password.
	Password string `json:"password" valid:"required~Password is blank"`
}

type SignInResponse

type SignInResponse struct {

	// The first name of the user.
	FirstName string `json:"firstName"`

	// The last name of the user.
	LastName string `json:"lastName"`

	// The user email.
	Email string `json:"email"`

	// The JWT token of the logged user.
	AccessToken string `json:"accessToken"`
}

type SignUpRequest

type SignUpRequest struct {

	// The first name of the user.
	FirstName string `json:"firstName" valid:"required~First name is blank"`

	// The last name of the user.
	LastName string `json:"lastName" valid:"required~Last name is blank"`

	// The user email.
	Email string `json:"email" valid:"required~Email is blank,email~Email is not valid"`

	// The user password.
	Password string `json:"password" valid:"required~Password is blank,length(8|100)~Password length should be between 8 and 100"`
}

type SignUpRequestAllOf

type SignUpRequestAllOf struct {

	// The first name of the user.
	FirstName string `json:"firstName"`

	// The last name of the user.
	LastName string `json:"lastName"`
}

Jump to

Keyboard shortcuts

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