in

package
v1.31.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

NewRouter registerNewRouters routes to the Server.

func WithSwaggerEnvConfig

func WithSwaggerEnvConfig() fiber.Handler

WithSwaggerEnvConfig sets the Swagger configuration for the API documentation from environment variables if they are set.

Types

type AccountHandler

type AccountHandler struct {
	Command *command.UseCase
	Query   *query.UseCase
}

AccountHandler struct contains an account use case for managing account related operations.

func (*AccountHandler) CreateAccount

func (handler *AccountHandler) CreateAccount(i any, c *fiber.Ctx) error

CreateAccount is a method that creates account information.

@Summary		Create an Account
@Description	Create an Account with the input payload
@Tags			Accounts
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger_id		path		string						true	"Ledger ID"
@Param			account			body		mmodel.CreateAccountInput	true	"Account"
@Success		200				{object}	mmodel.Account
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts [post]

func (*AccountHandler) CreateAccountFromPortfolio

func (handler *AccountHandler) CreateAccountFromPortfolio(i any, c *fiber.Ctx) error

CreateAccountFromPortfolio is a method that creates account information from a given portfolio id.

Will be deprecated in the future. Use CreateAccount instead.

@Summary		Create an Account from Portfolio
@Description	## This endpoint will be deprecated soon. Use Create an Account instead. ##
@Description	---
@Description	Create an Account with the input payload from a Portfolio
@Tags			Accounts
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger_id		path		string						true	"Ledger ID"
@Param			portfolio_id	path		string						true	"Portfolio ID"
@Param			account			body		mmodel.CreateAccountInput	true	"Account"
@Success		200				{object}	mmodel.Account
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{portfolio_id}/accounts [post]

func (*AccountHandler) DeleteAccountByID

func (handler *AccountHandler) DeleteAccountByID(c *fiber.Ctx) error

DeleteAccountByID is a method that removes Account information by a given account id.

@Summary		Delete an Account by ID
@Description	Delete an Account with the input ID
@Tags			Accounts
@Param			Authorization	header	string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header	string	false	"Request ID"
@Param			organization_id	path	string	true	"Organization ID"
@Param			ledger_id		path	string	true	"Ledger ID"
@Param			id				path	string	true	"Account ID"
@Success		204
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{id} [delete]

func (*AccountHandler) DeleteAccountByIDFromPortfolio

func (handler *AccountHandler) DeleteAccountByIDFromPortfolio(c *fiber.Ctx) error

DeleteAccountByIDFromPortfolio is a method that removes Account information by a given portfolio id and account id.

Will be deprecated in the future. Use DeleteAccountByID instead.

@Summary		Delete an Account by ID from Portfolio
@Description	## This endpoint will be deprecated soon. Use Delete an Account by ID instead. ##
@Description	---
@Description	Delete an Account with the input ID from a Portfolio
@Tags			Accounts
@Param			Authorization	header	string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header	string	false	"Request ID"
@Param			organization_id	path	string	true	"Organization ID"
@Param			ledger_id		path	string	true	"Ledger ID"
@Param			portfolio_id	path	string	true	"Portfolio ID"
@Param			id				path	string	true	"Account ID"
@Success		204
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{portfolio_id}/accounts/{id} [delete]

func (*AccountHandler) GetAccountByID

func (handler *AccountHandler) GetAccountByID(c *fiber.Ctx) error

GetAccountByID is a method that retrieves Account information by a given account id.

@Summary		Get an Account by ID
@Description	Get an Account with the input ID
@Tags			Accounts
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			id				path		string	true	"Account ID"
@Success		200				{object}	mmodel.Account
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{id} [get]

func (*AccountHandler) GetAccountByIDFromPortfolio

func (handler *AccountHandler) GetAccountByIDFromPortfolio(c *fiber.Ctx) error

GetAccountByIDFromPortfolio is a method that retrieves Account information by a given portfolio id and account id.

Will be deprecated in the future. Use GetAccountByID instead.

@Summary		Get an Account by ID from Portfolio
@Description	## This endpoint will be deprecated soon. Use Get an Account by ID instead. ##
@Description	---
@Description	Get an Account with the input ID from a Portfolio.
@Tags			Accounts
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			portfolio_id	path		string	true	"Portfolio ID"
@Param			id				path		string	true	"Account ID"
@Success		200				{object}	mmodel.Account
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{portfolio_id}/accounts/{id} [get]

func (*AccountHandler) GetAllAccounts

func (handler *AccountHandler) GetAllAccounts(c *fiber.Ctx) error

GetAllAccounts is a method that retrieves all Accounts.

@Summary		Get all Accounts
@Description	Get all Accounts with the input metadata or without metadata
@Tags			Accounts
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			metadata		query		string	false	"Metadata"
@Success		200				{object}	mpostgres.Pagination{items=[]mmodel.Account}
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts [get]

func (*AccountHandler) GetAllAccountsByIDFromPortfolio

func (handler *AccountHandler) GetAllAccountsByIDFromPortfolio(c *fiber.Ctx) error

GetAllAccountsByIDFromPortfolio is a method that retrieves all Accounts by a given portfolio id.

Will be deprecated in the future. Use GetAllAccounts instead.

@Summary		Get all Accounts from Portfolio
@Description	## This endpoint will be deprecated soon. Use Get all Accounts instead. ##
@Description	---
@Description	Get all Accounts with the input metadata or without metadata from a Portfolio
@Tags			Accounts
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			portfolio_id	path		string	true	"Portfolio ID"
@Param			metadata		query		string	false	"Metadata"
@Success		200				{object}	mpostgres.Pagination{items=[]mmodel.Account}
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{portfolio_id}/accounts [get]

func (*AccountHandler) UpdateAccount

func (handler *AccountHandler) UpdateAccount(i any, c *fiber.Ctx) error

UpdateAccount is a method that updates Account information.

@Summary		Update an Account
@Description	Update an Account with the input payload
@Tags			Accounts
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger_id		path		string						true	"Ledger ID"
@Param			id				path		string						true	"Account ID"
@Param			account			body		mmodel.UpdateAccountInput	true	"Account"
@Success		200				{object}	mmodel.Account
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/accounts/{id} [patch]

func (*AccountHandler) UpdateAccountFromPortfolio

func (handler *AccountHandler) UpdateAccountFromPortfolio(i any, c *fiber.Ctx) error

UpdateAccountFromPortfolio is a method that updates Account information from a given portfolio id and account id.

Will be deprecated in the future. Use UpdateAccount instead.

@Summary		Update an Account from Portfolio
@Description	## This endpoint will be deprecated soon. Use Update an Account instead. ##
@Description	---
@Description	Update an Account with the input payload from a Portfolio
@Tags			Accounts
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger_id		path		string						true	"Ledger ID"
@Param			portfolio_id	path		string						true	"Portfolio ID"
@Param			id				path		string						true	"Account ID"
@Param			account			body		mmodel.UpdateAccountInput	true	"Account"
@Success		200				{object}	mmodel.Account
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{portfolio_id}/accounts/{id} [patch]

type AssetHandler

type AssetHandler struct {
	Command *command.UseCase
	Query   *query.UseCase
}

AssetHandler struct contains a cqrs use case for managing asset in related operations.

func (*AssetHandler) CreateAsset

func (handler *AssetHandler) CreateAsset(a any, c *fiber.Ctx) error

CreateAsset is a method that creates asset information.

@Summary		Create an Asset
@Description	Create an Asset with the input payload
@Tags			Assets
@Accept			json
@Produce		json
@Param			Authorization	header		string					true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string					false	"Request ID"
@Param			organization_id	path		string					true	"Organization ID"
@Param			ledger_id		path		string					true	"Ledger ID"
@Param			asset			body		mmodel.CreateAssetInput	true	"Asset Input"
@Success		200				{object}	mmodel.Asset
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/assets [post]

func (*AssetHandler) DeleteAssetByID

func (handler *AssetHandler) DeleteAssetByID(c *fiber.Ctx) error

DeleteAssetByID is a method that removes Asset information by a given ids.

@Summary		Delete an Asset by ID
@Description	Delete an Asset with the input ID
@Tags			Assets
@Param			Authorization	header	string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header	string	false	"Request ID"
@Param			organization_id	path	string	true	"Organization ID"
@Param			ledger_id		path	string	true	"Ledger ID"
@Param			id				path	string	true	"Asset ID"
@Success		204
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/assets/{id} [delete]

func (*AssetHandler) GetAllAssets

func (handler *AssetHandler) GetAllAssets(c *fiber.Ctx) error

GetAllAssets is a method that retrieves all Assets.

@Summary		Get all Assets
@Description	Get all Assets with the input metadata or without metadata
@Tags			Assets
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			metadata		query		string	false	"Metadata"
@Success		200				{object}	mpostgres.Pagination{items=[]mmodel.Asset}
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/assets [get]

func (*AssetHandler) GetAssetByID

func (handler *AssetHandler) GetAssetByID(c *fiber.Ctx) error

GetAssetByID is a method that retrieves Asset information by a given id.

@Summary		Get an Asset by ID
@Description	Get an Asset with the input ID
@Tags			Assets
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			id				path		string	true	"Asset ID"
@Success		200				{object}	mmodel.Asset
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/assets/{id} [get]

func (*AssetHandler) UpdateAsset

func (handler *AssetHandler) UpdateAsset(a any, c *fiber.Ctx) error

UpdateAsset is a method that updates Asset information.

@Summary		Update an Asset
@Description	Update an Asset with the input payload
@Tags			Assets
@Accept			json
@Produce		json
@Param			Authorization	header		string					true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string					false	"Request ID"
@Param			organization_id	path		string					true	"Organization ID"
@Param			ledger_id		path		string					true	"Ledger ID"
@Param			id				path		string					true	"Asset ID"
@Param			asset			body		mmodel.UpdateAssetInput	true	"Asset Input"
@Success		200				{object}	mmodel.Asset
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/assets/{id} [patch]

type LedgerHandler

type LedgerHandler struct {
	Command *command.UseCase
	Query   *query.UseCase
}

LedgerHandler struct contains a ledger use case for managing ledger related operations.

func (*LedgerHandler) CreateLedger

func (handler *LedgerHandler) CreateLedger(i any, c *fiber.Ctx) error

CreateLedger is a method that creates Ledger information.

@Summary		Create a Ledger
@Description	Create a Ledger with the input payload
@Tags			Ledgers
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger			body		mmodel.CreateLedgerInput	true	"Ledger Input"
@Success		200				{object}	mmodel.Ledger
@Router			/v1/organizations/{organization_id}/ledgers [post]

func (*LedgerHandler) DeleteLedgerByID

func (handler *LedgerHandler) DeleteLedgerByID(c *fiber.Ctx) error

DeleteLedgerByID is a method that removes Ledger information by a given id.

@Summary		Delete a Ledger by ID
@Description	Delete a Ledger with the input ID
@Tags			Ledgers
@Param			Authorization	header	string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header	string	false	"Request ID"
@Param			organization_id	path	string	true	"Organization ID"
@Param			id				path	string	true	"Ledger ID"
@Success		204
@Router			/v1/organizations/{organization_id}/ledgers/{id} [delete]

func (*LedgerHandler) GetAllLedgers

func (handler *LedgerHandler) GetAllLedgers(c *fiber.Ctx) error

GetAllLedgers is a method that retrieves all ledgers.

@Summary		Get all Ledgers
@Description	Get all Ledgers with the input metadata or without metadata
@Tags			Ledgers
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			id				path		string	true	"Ledger ID"
@Success		200				{object}	mpostgres.Pagination{items=[]mmodel.Ledger}
@Router			/v1/organizations/{organization_id}/ledgers [get]

func (*LedgerHandler) GetLedgerByID

func (handler *LedgerHandler) GetLedgerByID(c *fiber.Ctx) error

GetLedgerByID is a method that retrieves Ledger information by a given id.

@Summary		Get a Ledger by ID
@Description	Get a Ledger with the input ID
@Tags			Ledgers
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			id				path		string	true	"Ledger ID"
@Success		200				{object}	mmodel.Ledger
@Router			/v1/organizations/{organization_id}/ledgers/{id} [get]

func (*LedgerHandler) UpdateLedger

func (handler *LedgerHandler) UpdateLedger(p any, c *fiber.Ctx) error

UpdateLedger is a method that updates Ledger information.

@Summary		Update a Ledger
@Description	Update a Ledger with the input payload
@Tags			Ledgers
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			id				path		string						true	"Ledger ID"
@Param			ledger			body		mmodel.UpdateLedgerInput	true	"Ledger Input"
@Success		200				{object}	mmodel.Ledger
@Router			/v1/organizations/{organization_id}/ledgers/{id} [patch]

type OrganizationHandler

type OrganizationHandler struct {
	Command *command.UseCase
	Query   *query.UseCase
}

OrganizationHandler struct contains an organization use case for managing organization related operations.

func (*OrganizationHandler) CreateOrganization

func (handler *OrganizationHandler) CreateOrganization(p any, c *fiber.Ctx) error

CreateOrganization is a method that creates Organization information.

@Summary		Create an Organization
@Description	Create an Organization with the input payload
@Tags			Organizations
@Accept			json
@Produce		json
@Param			Authorization	header		string							true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string							false	"Request ID"
@Param			organization	body		mmodel.CreateOrganizationInput	true	"Organization Input"
@Success		200				{object}	mmodel.Organization
@Router			/v1/organizations [post]

func (*OrganizationHandler) DeleteOrganizationByID

func (handler *OrganizationHandler) DeleteOrganizationByID(c *fiber.Ctx) error

DeleteOrganizationByID is a method that removes Organization information by a given id.

@Summary		Delete an Organization by ID
@Description	Delete an Organization with the input ID
@Tags			Organizations
@Param			Authorization	header	string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header	string	false	"Request ID"
@Param			id				path	string	true	"Organization ID"
@Success		204
@Router			/v1/organizations/{id} [delete]

func (*OrganizationHandler) GetAllOrganizations

func (handler *OrganizationHandler) GetAllOrganizations(c *fiber.Ctx) error

GetAllOrganizations is a method that retrieves all Organizations.

@Summary		Get all Organizations
@Description	Get all Organizations with the input metadata or without metadata
@Tags			Organizations
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			metadata		query		string	false	"Metadata"
@Success		200				{object}	mpostgres.Pagination{items=[]mmodel.Organization}
@Router			/v1/organizations [get]

func (*OrganizationHandler) GetOrganizationByID

func (handler *OrganizationHandler) GetOrganizationByID(c *fiber.Ctx) error

GetOrganizationByID is a method that retrieves Organization information by a given id.

@Summary		Get an Organization by ID
@Description	Get an Organization with the input ID
@Tags			Organizations
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			id				path		string	true	"Organization ID"
@Success		200				{object}	mmodel.Organization
@Router			/v1/organizations/{id} [get]

func (*OrganizationHandler) UpdateOrganization

func (handler *OrganizationHandler) UpdateOrganization(p any, c *fiber.Ctx) error

UpdateOrganization is a method that updates Organization information.

@Summary		Update an Organization
@Description	Update an Organization with the input payload
@Tags			Organizations
@Accept			json
@Produce		json
@Param			Authorization	header		string							true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string							false	"Request ID"
@Param			id				path		string							true	"Organization ID"
@Param			organization	body		mmodel.UpdateOrganizationInput	true	"Organization Input"
@Success		200				{object}	mmodel.Organization
@Router			/v1/organizations/{id} [patch]

type PortfolioHandler

type PortfolioHandler struct {
	Command *command.UseCase
	Query   *query.UseCase
}

PortfolioHandler struct contains a portfolio use case for managing portfolio related operations.

func (*PortfolioHandler) CreatePortfolio

func (handler *PortfolioHandler) CreatePortfolio(i any, c *fiber.Ctx) error

CreatePortfolio is a method that creates portfolio information.

@Summary		Create a Portfolio
@Description	Create a Portfolio with the input payload
@Tags			Portfolios
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger_id		path		string						true	"Ledger ID"
@Param			portfolio		body		mmodel.CreatePortfolioInput	true	"Portfolio Payload"
@Success		200				{object}	mmodel.Portfolio
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios [post]

func (*PortfolioHandler) DeletePortfolioByID

func (handler *PortfolioHandler) DeletePortfolioByID(c *fiber.Ctx) error

DeletePortfolioByID is a method that removes Portfolio information by a given ids.

@Summary		Delete a Portfolio by ID
@Description	Delete a Portfolio with the input ID
@Tags			Portfolios
@Param			Authorization	header	string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header	string	false	"Request ID"
@Param			organization_id	path	string	true	"Organization ID"
@Param			ledger_id		path	string	true	"Ledger ID"
@Param			id				path	string	true	"Portfolio ID"
@Success		204
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{id} [delete]

func (*PortfolioHandler) GetAllPortfolios

func (handler *PortfolioHandler) GetAllPortfolios(c *fiber.Ctx) error

GetAllPortfolios is a method that retrieves all Portfolios.

@Summary		Get all Portfolios
@Description	Get all Portfolios with the input metadata or without metadata
@Tags			Portfolios
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			metadata		query		string	false	"Metadata query"
@Success		200				{object}	mpostgres.Pagination{items=[]mmodel.Portfolio}
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios [get]

func (*PortfolioHandler) GetPortfolioByID

func (handler *PortfolioHandler) GetPortfolioByID(c *fiber.Ctx) error

GetPortfolioByID is a method that retrieves Portfolio information by a given id.

@Summary		Get a Portfolio by ID
@Description	Get a Portfolio with the input ID
@Tags			Portfolios
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			id				path		string	true	"Portfolio ID"
@Success		200				{object}	mmodel.Portfolio
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{id} [get]

func (*PortfolioHandler) UpdatePortfolio

func (handler *PortfolioHandler) UpdatePortfolio(i any, c *fiber.Ctx) error

UpdatePortfolio is a method that updates Portfolio information.

@Summary		Update a Portfolio
@Description	Update a Portfolio with the input payload
@Tags			Portfolios
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger_id		path		string						true	"Ledger ID"
@Param			id				path		string						true	"Portfolio ID"
@Param			portfolio		body		mmodel.UpdatePortfolioInput	true	"Portfolio Payload"
@Success		200				{object}	mmodel.Portfolio
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/portfolios/{id} [patch]

type ProductHandler

type ProductHandler struct {
	Command *command.UseCase
	Query   *query.UseCase
}

ProductHandler struct contains a product use case for managing product related operations.

func (*ProductHandler) CreateProduct

func (handler *ProductHandler) CreateProduct(i any, c *fiber.Ctx) error

CreateProduct is a method that creates product information.

@Summary		Create a Product
@Description	Create a Product with the input payload
@Tags			Products
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger_id		path		string						true	"Ledger ID"
@Param			product			body		mmodel.CreateProductInput	true	"Product"
@Success		200				{object}	mmodel.Product
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/products [post]

func (*ProductHandler) DeleteProductByID

func (handler *ProductHandler) DeleteProductByID(c *fiber.Ctx) error

DeleteProductByID is a method that removes Product information by a given ids.

@Summary		Delete a Product by ID
@Description	Delete a Product with the input ID
@Tags			Products
@Param			Authorization	header	string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header	string	false	"Request ID"
@Param			organization_id	path	string	true	"Organization ID"
@Param			ledger_id		path	string	true	"Ledger ID"
@Param			id				path	string	true	"Product ID"
@Success		204
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/products/{id} [delete]

func (*ProductHandler) GetAllProducts

func (handler *ProductHandler) GetAllProducts(c *fiber.Ctx) error

GetAllProducts is a method that retrieves all Products.

@Summary		Get all Products
@Description	Get all Products with the input metadata or without metadata
@Tags			Products
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			metadata		query		string	false	"Metadata"
@Success		200				{object}	mpostgres.Pagination{items=[]mmodel.Product}
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/products [get]

func (*ProductHandler) GetProductByID

func (handler *ProductHandler) GetProductByID(c *fiber.Ctx) error

GetProductByID is a method that retrieves Product information by a given id.

@Summary		Get a Product by ID
@Description	Get a Product with the input ID
@Tags			Products
@Produce		json
@Param			Authorization	header		string	true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string	false	"Request ID"
@Param			organization_id	path		string	true	"Organization ID"
@Param			ledger_id		path		string	true	"Ledger ID"
@Param			id				path		string	true	"Product ID"
@Success		200				{object}	mmodel.Product
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/products/{id} [get]

func (*ProductHandler) UpdateProduct

func (handler *ProductHandler) UpdateProduct(i any, c *fiber.Ctx) error

UpdateProduct is a method that updates Product information.

@Summary		Update a Product
@Description	Update a Product with the input payload
@Tags			Products
@Accept			json
@Produce		json
@Param			Authorization	header		string						true	"Authorization Bearer Token"
@Param			Midaz-Id		header		string						false	"Request ID"
@Param			organization_id	path		string						true	"Organization ID"
@Param			ledger_id		path		string						true	"Ledger ID"
@Param			id				path		string						true	"Product ID"
@Param			product			body		mmodel.UpdateProductInput	true	"Product"
@Success		200				{object}	mmodel.Product
@Router			/v1/organizations/{organization_id}/ledgers/{ledger_id}/products/{id} [patch]

Jump to

Keyboard shortcuts

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