delivery

package
v0.0.0-...-3122bcc Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseSuccessfulUpdateCountOrder  = "Успешно изменено количество заказа"
	ResponseSuccessfulUpdateStatusOrder = "Успешно изменен статус заказа"
	ResponseSuccessfulBuyFullBasket     = "Успешная покупка всего из корзины"
	ResponseSuccessfulCloseProduct      = "Объявление успешно закрыто"
	ResponseSuccessfulDeleteProduct     = "Объявление успешно удалено"
	ResponseSuccessfulActivateProduct   = "Объявление успешно активировано"
	ResponseSuccessfulDeleteComment     = "Комментарий успешно удалено"
	ResponseSuccessfulUpdateComment     = "Комментарий успешно изменен"
)
View Source
const TypeConfirmationPayment = "redirect"

Variables

View Source
var (
	ErrMarshallPayment               = myerrors.NewErrorInternal("Ошибка маршалинга платежа")
	ErrCreationRequestAPIYooMany     = myerrors.NewErrorInternal("Ошибка создания запроса к yoomany")
	ErrClosingResponseBody           = myerrors.NewErrorInternal("Ошибка закрытия тела ответа")
	ErrRequestAPIYoomany             = myerrors.NewErrorInternal("Ошибка в запросе к yoomany")
	ErrReadAllAPIYoomany             = myerrors.NewErrorInternal("Ошибка в чтении ответа от yoomany")
	ErrUnmarshallAPIYoomany          = myerrors.NewErrorInternal("Ошибка в unmarshall от yoomany")
	ErrResponseAPIYoomany            = myerrors.NewErrorInternal("Ошибка проверки ответа от yoomany")
	ErrResponseWrongStatusAPIYoomany = myerrors.NewErrorBadContentRequest("Ошибка оплаты платежа от yoomany")
)

Functions

This section is empty.

Types

type AmountPayment

type AmountPayment struct {
	Value    string `json:"value"`
	Currency string `json:"currency"`
}

func NewAmountPayment

func NewAmountPayment(value string) AmountPayment

func (AmountPayment) MarshalEasyJSON

func (v AmountPayment) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (AmountPayment) MarshalJSON

func (v AmountPayment) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*AmountPayment) UnmarshalEasyJSON

func (v *AmountPayment) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*AmountPayment) UnmarshalJSON

func (v *AmountPayment) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CommentListResponse

type CommentListResponse struct {
	Status int                     `json:"status"`
	Body   []*models.CommentInFeed `json:"body"`
}

func NewCommentListResponse

func NewCommentListResponse(body []*models.CommentInFeed) *CommentListResponse

func (CommentListResponse) MarshalEasyJSON

func (v CommentListResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CommentListResponse) MarshalJSON

func (v CommentListResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CommentListResponse) UnmarshalEasyJSON

func (v *CommentListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CommentListResponse) UnmarshalJSON

func (v *CommentListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ConfirmationPayment

type ConfirmationPayment struct {
	Type            string `json:"type"`
	ConfirmationURL string `json:"confirmation_url"`
}

func (ConfirmationPayment) MarshalEasyJSON

func (v ConfirmationPayment) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ConfirmationPayment) MarshalJSON

func (v ConfirmationPayment) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ConfirmationPayment) UnmarshalEasyJSON

func (v *ConfirmationPayment) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ConfirmationPayment) UnmarshalJSON

func (v *ConfirmationPayment) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ConfirmationReturnPayment

type ConfirmationReturnPayment struct {
	Type      string `json:"type"`
	ReturnURL string `json:"return_url"`
}

func NewConfirmationReturnPayment

func NewConfirmationReturnPayment(returnURL string) ConfirmationReturnPayment

func (ConfirmationReturnPayment) MarshalEasyJSON

func (v ConfirmationReturnPayment) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ConfirmationReturnPayment) MarshalJSON

func (v ConfirmationReturnPayment) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ConfirmationReturnPayment) UnmarshalEasyJSON

func (v *ConfirmationReturnPayment) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ConfirmationReturnPayment) UnmarshalJSON

func (v *ConfirmationReturnPayment) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type IBasketService

type IBasketService interface {
	AddOrder(ctx context.Context, r io.Reader, userID uint64) (*models.OrderInBasket, error)
	GetOrdersByUserID(ctx context.Context, userID uint64) ([]*models.OrderInBasket, error)
	GetOrdersNotInBasketByUserID(ctx context.Context, userID uint64) ([]*models.OrderNotInBasket, error)
	GetOrdersSoldByUserID(ctx context.Context, userID uint64) ([]*models.OrderNotInBasket, error)
	UpdateOrderCount(ctx context.Context, r io.Reader, userID uint64) error
	UpdateOrderStatus(ctx context.Context, r io.Reader, userID uint64) error
	BuyFullBasket(ctx context.Context, userID uint64) error
	DeleteOrder(ctx context.Context, orderID uint64, ownerID uint64) error
}

type ICommentService

type ICommentService interface {
	GetCommentList(ctx context.Context, offset uint64, count uint64, recipientID uint64,
		senderID uint64) ([]*models.CommentInFeed, error)
	AddComment(ctx context.Context, r io.Reader, userID uint64) (commentID uint64, err error)
	DeleteComment(ctx context.Context, commentID uint64, senderID uint64) error
	UpdateComment(ctx context.Context, r io.Reader, userID uint64, commentID uint64) error
}

type IFavouriteService

type IFavouriteService interface {
	GetUserFavourites(ctx context.Context, userID uint64) ([]*models.ProductInFeed, error)
	AddToFavourites(ctx context.Context, userID uint64, r io.Reader) error
	DeleteFromFavourites(ctx context.Context, userID uint64, productID uint64) error
}

type IPremiumService

type IPremiumService interface {
	AddPremium(ctx context.Context, productID uint64, userID uint64, periodCode uint64) error
	CheckPremiumStatus(ctx context.Context, productID uint64, userID uint64) (uint8, error)
	UpdateStatusPremium(ctx context.Context, status uint8, productID uint64, userID uint64) error
}

type IProductService

type IProductService interface {
	AddProduct(ctx context.Context, r io.Reader, userID uint64) (productID uint64, err error)
	GetProduct(ctx context.Context, productID uint64, userID uint64) (*models.Product, error)
	GetProductsList(ctx context.Context,
		offset uint64, count uint64, userID uint64) ([]*models.ProductInFeed, error)
	GetProductsOfSaler(ctx context.Context, offset uint64,
		count uint64, userID uint64, isMy bool) ([]*models.ProductInFeed, error)
	UpdateProduct(ctx context.Context, r io.Reader, isPartialUpdate bool, productID uint64, userAuthID uint64) error
	CloseProduct(ctx context.Context, productID uint64, userID uint64) error
	ActivateProduct(ctx context.Context, productID uint64, userID uint64) error
	DeleteProduct(ctx context.Context, productID uint64, userID uint64) error
	SearchProduct(ctx context.Context, searchInput string) ([]string, error)
	GetSearchProductFeed(ctx context.Context,
		searchInput string, lastNumber uint64, limit uint64, userID uint64,
	) ([]*models.ProductInFeed, error)
	IBasketService
	IFavouriteService
	IPremiumService
	ICommentService
}

type KeyIdempotencyPayment

type KeyIdempotencyPayment string

type MapIdempotencePayment

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

func NewMapIdempotence

func NewMapIdempotence() *MapIdempotencePayment

func (*MapIdempotencePayment) AddPayment

type MetadataPayment

type MetadataPayment struct {
	UserID     uint64 `json:"user_id"`
	ProductID  uint64 `json:"product_id"`
	PeriodCode uint64 `json:"period_code"`
}

func NewMetadataPayment

func NewMetadataPayment(userID uint64, productID uint64, periodCode uint64) *MetadataPayment

func (MetadataPayment) MarshalEasyJSON

func (v MetadataPayment) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (MetadataPayment) MarshalJSON

func (v MetadataPayment) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*MetadataPayment) UnmarshalEasyJSON

func (v *MetadataPayment) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*MetadataPayment) UnmarshalJSON

func (v *MetadataPayment) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderListResponse

type OrderListResponse struct {
	Status int                     `json:"status"`
	Body   []*models.OrderInBasket `json:"body"`
}

func NewOrderListResponse

func NewOrderListResponse(body []*models.OrderInBasket) *OrderListResponse

func (OrderListResponse) MarshalEasyJSON

func (v OrderListResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderListResponse) MarshalJSON

func (v OrderListResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderListResponse) UnmarshalEasyJSON

func (v *OrderListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderListResponse) UnmarshalJSON

func (v *OrderListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderNotInBasketListResponse

type OrderNotInBasketListResponse struct {
	Status int                        `json:"status"`
	Body   []*models.OrderNotInBasket `json:"body"`
}

func NewOrderNotInBasketListResponse

func NewOrderNotInBasketListResponse(body []*models.OrderNotInBasket) *OrderNotInBasketListResponse

func (OrderNotInBasketListResponse) MarshalEasyJSON

func (v OrderNotInBasketListResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderNotInBasketListResponse) MarshalJSON

func (v OrderNotInBasketListResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderNotInBasketListResponse) UnmarshalEasyJSON

func (v *OrderNotInBasketListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderNotInBasketListResponse) UnmarshalJSON

func (v *OrderNotInBasketListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderResponse

type OrderResponse struct {
	Status int                   `json:"status"`
	Body   *models.OrderInBasket `json:"body"`
}

func NewOrderResponse

func NewOrderResponse(body *models.OrderInBasket) *OrderResponse

func (OrderResponse) MarshalEasyJSON

func (v OrderResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderResponse) MarshalJSON

func (v OrderResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderResponse) UnmarshalEasyJSON

func (v *OrderResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderResponse) UnmarshalJSON

func (v *OrderResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Payment

type Payment struct {
	Amount       AmountPayment             `json:"amount"`
	Capture      bool                      `json:"capture"`
	Confirmation ConfirmationReturnPayment `json:"confirmation"`
	Description  string                    `json:"description"`
	Metadata     *MetadataPayment          `json:"metadata"`
}

func NewPayment

func NewPayment(ctx context.Context, frontendURL string, metadata *MetadataPayment) (*Payment, error)

func (Payment) MarshalEasyJSON

func (v Payment) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Payment) MarshalJSON

func (v Payment) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Payment) UnmarshalEasyJSON

func (v *Payment) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Payment) UnmarshalJSON

func (v *Payment) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PremiumStatus

type PremiumStatus struct {
	PremiumStatus uint8 `json:"premium_status"`
}

func (PremiumStatus) MarshalEasyJSON

func (v PremiumStatus) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PremiumStatus) MarshalJSON

func (v PremiumStatus) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PremiumStatus) UnmarshalEasyJSON

func (v *PremiumStatus) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PremiumStatus) UnmarshalJSON

func (v *PremiumStatus) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PremiumStatusResponse

type PremiumStatusResponse struct {
	Status int           `json:"status"`
	Body   PremiumStatus `json:"body"`
}

func NewPremiumStatusResponse

func NewPremiumStatusResponse(premiumStatus uint8) *PremiumStatusResponse

func (PremiumStatusResponse) MarshalEasyJSON

func (v PremiumStatusResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PremiumStatusResponse) MarshalJSON

func (v PremiumStatusResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PremiumStatusResponse) UnmarshalEasyJSON

func (v *PremiumStatusResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PremiumStatusResponse) UnmarshalJSON

func (v *PremiumStatusResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ProductHandler

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

func NewProductHandler

func NewProductHandler(ctx context.Context, frontendURL,
	premiumShopID, premiumShopSecretKey, pathCertFile string,
	productService IProductService, sessionManagerClient auth.SessionMangerClient,
) (*ProductHandler, error)

func (*ProductHandler) ActivateProductHandler

func (p *ProductHandler) ActivateProductHandler(w http.ResponseWriter, r *http.Request)

ActivateProductHandler godoc

@Summary     activate product
@Description  activate product for saler using user id from cookies\jwt.
@Description  This does product active.
@Tags product
@Accept      json
@Produce    json
@Param      id  query uint64 true  "product id"
@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badFormat(4000)
@Router      /product/activate [patch]

func (*ProductHandler) AddCommentHandler

func (p *ProductHandler) AddCommentHandler(w http.ResponseWriter, r *http.Request)

AddCommentHandler godoc

@Summary    add comment
@Description  add comment by data
@Tags comment

@Accept      json
@Produce    json
@Param      comment  body models.PreComment true  "comment data for adding"
@Success    200  {object} responses.ResponseID
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badContent(4400), badFormat(4000)//nolint:lll
@Router      /comment/add [post]

func (*ProductHandler) AddOrderHandler

func (p *ProductHandler) AddOrderHandler(w http.ResponseWriter, r *http.Request)

AddOrderHandler godoc

@Summary    add order to basket
@Description   add product in basket
@Tags order
@Accept      json
@Produce    json

@Param preOrder body models.PreOrder true "order data for adding"

@Success    200  {object} OrderResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badContent(4400)/badFormat(4000)//nolint:lll
@Router      /order/add [post]

func (*ProductHandler) AddPremiumHandler

func (p *ProductHandler) AddPremiumHandler(w http.ResponseWriter, r *http.Request)

AddPremiumHandler godoc

@Summary     add premium for product
@Description  add premium for product using product id from query and user id from cookies\jwt.
@Description  This does product premium.
@Tags premium
@Accept      json
@Produce    json
@Param      product_id  query uint64 true  "product id"
@Param      period  query uint64 true  "period of premium"
@Success    200  {object} responses.ResponseRedirect
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint:lll
@Router      /premium/add [patch]

func (*ProductHandler) AddProductHandler

func (p *ProductHandler) AddProductHandler(w http.ResponseWriter, r *http.Request)

AddProductHandler godoc

@Summary    add product
@Description  add product by data
@Tags product

@Accept      json
@Produce    json
@Param      product  body models.PreProduct true  "product data for adding"
@Success    200  {object} responses.ResponseID
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badContent(4400), badFormat(4000)//nolint:lll
@Router      /product/add [post]

func (*ProductHandler) AddToFavouritesHandler

func (p *ProductHandler) AddToFavouritesHandler(w http.ResponseWriter, r *http.Request)

AddToFavouritesHandler godoc

@Summary     add product to favs
@Description  add product to favs using product id from query and user id form cookie
@Tags favourite
@Accept      json
@Produce    json
@Param      product_id  body models.ProductID true "product id"
@Success    200  {object} responses.ResponseID
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badFormat(4000)
@Router      /product/add-to-fav [post]

func (*ProductHandler) BuyFullBasketHandler

func (p *ProductHandler) BuyFullBasketHandler(w http.ResponseWriter, r *http.Request)

BuyFullBasketHandler godoc

@Summary    buy all orders from basket
@Description   buy all orders from basket
@Tags order
@Accept      json
@Produce    json
@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badContent(4400)
@Router      /order/buy_full_basket [patch]

func (*ProductHandler) CheckPremiumStatus

func (p *ProductHandler) CheckPremiumStatus(w http.ResponseWriter, r *http.Request)

CheckPremiumStatus godoc

@Summary     check status of premium
@Description  check status of premium using product id from query and user id from cookies\jwt.
@Description  premium_status = 0 not premium

@Description premium_status = 1 pending @Description premium_status = 2 waiting_for_capture @Description premium_status = 3 succeeded @Description premium_status = 4 canceled

@Tags premium
@Accept      json
@Produce    json
@Param      product_id  query uint64 true  "product id"
@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint:lll
@Router      /premium/check [get]

func (*ProductHandler) CloseProductHandler

func (p *ProductHandler) CloseProductHandler(w http.ResponseWriter, r *http.Request)

CloseProductHandler godoc

@Summary     close product
@Description  close product for saler using user id from cookies\jwt.
@Description  This does product not active.
@Tags product
@Accept      json
@Produce    json
@Param      id  query uint64 true  "product id"
@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint
@Router      /product/close [patch]

func (*ProductHandler) DeleteCommentHandler

func (p *ProductHandler) DeleteCommentHandler(w http.ResponseWriter, r *http.Request)

DeleteCommentHandler godoc

@Summary     delete comment
@Description  delete comment for sender using user id from cookies\jwt.
@Description  This totally removed comment. Recovery will be impossible
@Tags comment
@Accept      json
@Produce    json
@Param      comment_id  query uint64 true  "comment id"
@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Router      /comment/delete [delete]

@Failure 222 {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badContent(4400)//nolint:lll

func (*ProductHandler) DeleteFromFavouritesHandler

func (p *ProductHandler) DeleteFromFavouritesHandler(w http.ResponseWriter, r *http.Request)

DeleteFromFavouritesHandler godoc

@Summary     delete product from favs
@Description  delete product from favs using product id from query and user id form cookie
@Tags favourite
@Accept      json
@Produce    json
@Param      product_id  query uint64 true  "product id"
@Success    200  {object} responses.ResponseID
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badFormat(4000)

@Router /product/remove-from-fav [delete]

func (*ProductHandler) DeleteOrderHandler

func (p *ProductHandler) DeleteOrderHandler(w http.ResponseWriter, r *http.Request)

DeleteOrderHandler godoc

@Summary     delete order
@Description  delete order for owner using user id from cookies\jwt.
@Description  This totally removed order. Recovery will be impossible
@Tags order
@Accept      json
@Produce    json
@Param      id  query uint64 true  "order id"
@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badContent(4400)
@Router      /order/delete/ [delete]

func (*ProductHandler) DeleteProductHandler

func (p *ProductHandler) DeleteProductHandler(w http.ResponseWriter, r *http.Request)

DeleteProductHandler godoc

@Summary     delete product
@Description  delete product for saler using user id from cookies\jwt.
@Description  This totally removed product. Recovery will be impossible
@Tags product
@Accept      json
@Produce    json
@Param      id  query uint64 true  "product id"
@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Router      /product/delete [delete]

@Failure 222 {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badContent(4400)//nolint:lll

func (*ProductHandler) GetBasketHandler

func (p *ProductHandler) GetBasketHandler(w http.ResponseWriter, r *http.Request)

GetBasketHandler godoc

@Summary    get basket of orders
@Description  get basket of orders by user id from cookie\jwt token
@Tags order
@Accept     json
@Produce    json
@Success    200  {object} OrderListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badFormat(4000)
@Router      /order/get_basket [get]

func (*ProductHandler) GetCommentListHandler

func (p *ProductHandler) GetCommentListHandler(w http.ResponseWriter, r *http.Request)

GetCommentListHandler godoc

@Summary    get comment list
@Description  get comment by count and offset and user id
@Tags comment
@Accept      json
@Produce    json
@Param      count  query uint64 true  "count comments"
@Param      offset  query uint64 true  "offset of comments"
@Param      user_id  query uint64 true  "user"
@Success    200  {object} CommentListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error" Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint:lll//nolint:lll
@Router      /comment/get_list [get]

func (*ProductHandler) GetFavouritesHandler

func (p *ProductHandler) GetFavouritesHandler(w http.ResponseWriter, r *http.Request)

GetFavouritesHandler godoc

@Summary    get user favourites
@Description  get user favourites by user id from cookie\jwt token
@Tags favourite
@Accept     json
@Produce    json
@Success    200  {object} ProductListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badFormat(4000)
@Router      /profile/favourites [get]

func (*ProductHandler) GetListProductOfAnotherSalerHandler

func (p *ProductHandler) GetListProductOfAnotherSalerHandler(w http.ResponseWriter, r *http.Request)

GetListProductOfAnotherSalerHandler godoc

@Summary     get list of products for another saler
@Description  get list of products for another saler using saler id, count and last product id from query
@Tags product
@Accept      json
@Produce    json
@Param      saler_id  query uint64 true  "saler id"
@Param      count  query uint64 true  "count products"
@Param      offset  query uint64 true  "offset of products"
@Success    200  {object} ProductListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error" Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint:lll
@Router      /product/get_list_of_another_saler [get]

func (*ProductHandler) GetListProductOfSalerHandler

func (p *ProductHandler) GetListProductOfSalerHandler(w http.ResponseWriter, r *http.Request)

GetListProductOfSalerHandler godoc

@Summary     get list of products for saler
@Description  get list of products for saler using user id from cookies\jwt
@Tags product
@Accept      json
@Produce    json
@Param      count  query uint64 true  "count products"
@Param      last_id  query uint64 true  "last product id "
@Success    200  {object} ProductListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error" Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint:lll
@Router      /product/get_list_of_saler [get]

func (*ProductHandler) GetOrdersNotInBasketHandler

func (p *ProductHandler) GetOrdersNotInBasketHandler(w http.ResponseWriter, r *http.Request)

GetOrdersNotInBasketHandler godoc

@Summary    get orders not in basket (with status > 0 and < 255)
@Description  get orders not in basket by user id from cookie\jwt token
@Tags order
@Accept     json
@Produce    json
@Success    200  {object} OrderListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badFormat(4000)
@Router      /order/get_not_in_basket [get]

func (*ProductHandler) GetOrdersSoldHandler

func (p *ProductHandler) GetOrdersSoldHandler(w http.ResponseWriter, r *http.Request)

GetOrdersSoldHandler godoc

@Summary    get orders not in basket sold by user (with status > 0 and < 255)
@Description  get orders not in basket sold by user id from cookie\jwt token
@Tags order
@Accept     json
@Produce    json
@Success    200  {object} OrderListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badFormat(4000)
@Router      /order/sold [get]

func (*ProductHandler) GetProductHandler

func (p *ProductHandler) GetProductHandler(w http.ResponseWriter, r *http.Request)

GetProductHandler godoc

@Summary    get product
@Description  get product by id
@Tags product
@Accept      json
@Produce    json
@Param      id  query uint64 true  "product id"
@Success    200  {object} ProductResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error" Это Http ответ 200, внутри body статус может быть, badContent(4400), badFormat(4000)//nolint:lll
@Router      /product/get [get]

func (*ProductHandler) GetProductListHandler

func (p *ProductHandler) GetProductListHandler(w http.ResponseWriter, r *http.Request)

GetProductListHandler godoc

@Summary    get products list
@Description  get products by count and last_id return old products
@Tags product
@Accept      json
@Produce    json
@Param      count  query uint64 true  "count products"
@Param      offset  query uint64 true  "offset of products"
@Success    200  {object} ProductListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error" Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint:lll//nolint:lll
@Router      /product/get_list [get]

func (*ProductHandler) GetSearchProductFeedHandler

func (p *ProductHandler) GetSearchProductFeedHandler(w http.ResponseWriter, r *http.Request)

GetSearchProductFeedHandler godoc

@Summary    get products search feed
@Description  get products feed after search
@Tags product
@Accept      json
@Produce    json
@Param      count  query uint64 true  "count products"
@Param      offset  query uint64 true  "last product id"
@Param      searched  query string true  "searched string"
@Success    200  {object} ProductListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error" Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint:lll
@Router      /product/get_search_feed [get]

func (*ProductHandler) SearchProductHandler

func (p *ProductHandler) SearchProductHandler(w http.ResponseWriter, r *http.Request)

SearchProductHandler godoc

@Summary    search products
@Description  search top 5 common named/descripted products
@Tags product
@Produce    json
@Param      searched  query string true  "searched string"
@Success    200  {object} ProductInSearchListResponse
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error" Это Http ответ 200, внутри body статус может быть badFormat(4000)//nolint:lll
@Router      /product/search [get]

func (*ProductHandler) UpdateCommentHandler

func (p *ProductHandler) UpdateCommentHandler(w http.ResponseWriter, r *http.Request)

UpdateCommentHandler godoc

@Summary    update comment
@Description  update comment by id
@Tags comment
@Accept      json
@Produce    json
@Param      comment_id  query uint64 true  "product id"
@Param      commentChanges  body models.CommentChanges false  "полностью опционален"
@Success    200  {object} responses.ResponseID
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badContent(4400), badFormat(4000)//nolint:lll
@Router      /comment/update [patch]

func (*ProductHandler) UpdateOrderCountHandler

func (p *ProductHandler) UpdateOrderCountHandler(w http.ResponseWriter, r *http.Request)

UpdateOrderCountHandler godoc

@Summary    update order count
@Description  update order count using user id from cookie\jwt token
@Tags order
@Accept      json
@Produce    json

@Param orderChanges body models.OrderChanges true "order data for updating use only id and count"

@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badContent(4400), badFormat(4000)
@Router      /order/update_count [patch]

func (*ProductHandler) UpdateOrderStatusHandler

func (p *ProductHandler) UpdateOrderStatusHandler(w http.ResponseWriter, r *http.Request)

UpdateOrderStatusHandler godoc

@Summary    update order status
@Description  update order status using user id from cookie\jwt token
@Tags order
@Accept      json
@Produce    json

@Param orderChanges body models.OrderChanges true "order data for updating use only id and status"

@Success    200  {object} responses.ResponseSuccessful
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Внутри body статус может быть badContent(4400)
@Router      /order/update_status [patch]

func (*ProductHandler) UpdateProductHandler

func (p *ProductHandler) UpdateProductHandler(w http.ResponseWriter, r *http.Request)

UpdateProductHandler godoc

@Summary    update product
@Description  update product by id
@Tags product
@Accept      json
@Produce    json
@Param      id  query uint64 true  "product id"
@Param      preProduct  body models.PreProduct false  "полностью опционален"
@Success    200  {object} responses.ResponseID
@Failure    405  {string} string
@Failure    500  {string} string
@Failure    222  {object} responses.ErrorResponse "Error". Это Http ответ 200, внутри body статус может быть badContent(4400), badFormat(4000)//nolint:lll
@Router      /product/update [patch]
@Router      /product/update [put]

type ProductInSearchListResponse

type ProductInSearchListResponse struct {
	Status int      `json:"status"`
	Body   []string `json:"body"`
}

func NewProductInSearchListResponse

func NewProductInSearchListResponse(body []string) *ProductInSearchListResponse

func (ProductInSearchListResponse) MarshalEasyJSON

func (v ProductInSearchListResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProductInSearchListResponse) MarshalJSON

func (v ProductInSearchListResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProductInSearchListResponse) UnmarshalEasyJSON

func (v *ProductInSearchListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProductInSearchListResponse) UnmarshalJSON

func (v *ProductInSearchListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ProductListResponse

type ProductListResponse struct {
	Status int                     `json:"status"`
	Body   []*models.ProductInFeed `json:"body"`
}

func NewProductListResponse

func NewProductListResponse(body []*models.ProductInFeed) *ProductListResponse

func (ProductListResponse) MarshalEasyJSON

func (v ProductListResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProductListResponse) MarshalJSON

func (v ProductListResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProductListResponse) UnmarshalEasyJSON

func (v *ProductListResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProductListResponse) UnmarshalJSON

func (v *ProductListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ProductResponse

type ProductResponse struct {
	Status int             `json:"status"`
	Body   *models.Product `json:"body"`
}

func NewProductResponse

func NewProductResponse(body *models.Product) *ProductResponse

func (ProductResponse) MarshalEasyJSON

func (v ProductResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProductResponse) MarshalJSON

func (v ProductResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProductResponse) UnmarshalEasyJSON

func (v *ProductResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProductResponse) UnmarshalJSON

func (v *ProductResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ResponseGetPaymentsAPIYoomany

type ResponseGetPaymentsAPIYoomany struct {
	Type       string                              `json:"type"`
	NextCursor string                              `json:"next_cursor"`
	Items      []ResponseGetPaymentsItemAPIYoomany `json:"items"`
}

func (*ResponseGetPaymentsAPIYoomany) MarshalJSON

func (r *ResponseGetPaymentsAPIYoomany) MarshalJSON() ([]byte, error)

func (*ResponseGetPaymentsAPIYoomany) UnmarshalJSON

func (r *ResponseGetPaymentsAPIYoomany) UnmarshalJSON(body []byte) error

type ResponseGetPaymentsItemAPIYoomany

type ResponseGetPaymentsItemAPIYoomany struct {
	Status   string          `json:"status"`
	Amount   AmountPayment   `json:"amount"`
	Metadata MetadataPayment `json:"metadata"`
}

type ResponsePostPaymentAPIYoomany

type ResponsePostPaymentAPIYoomany struct {
	Confirmation ConfirmationPayment `json:"confirmation"`
}

func (*ResponsePostPaymentAPIYoomany) IsCorrect

func (r *ResponsePostPaymentAPIYoomany) IsCorrect() bool

func (ResponsePostPaymentAPIYoomany) MarshalEasyJSON

func (v ResponsePostPaymentAPIYoomany) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ResponsePostPaymentAPIYoomany) MarshalJSON

func (v ResponsePostPaymentAPIYoomany) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ResponsePostPaymentAPIYoomany) UnmarshalEasyJSON

func (v *ResponsePostPaymentAPIYoomany) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ResponsePostPaymentAPIYoomany) UnmarshalJSON

func (v *ResponsePostPaymentAPIYoomany) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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