mmodel

package
v3.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetValidMetadataIndexEntities added in v3.5.0

func GetValidMetadataIndexEntities() []string

GetValidMetadataIndexEntities returns a slice of valid entity names for metadata indexes

func IsValidMetadataIndexEntity added in v3.5.0

func IsValidMetadataIndexEntity(entityName string) bool

IsValidMetadataIndexEntity checks if the entity name is valid for metadata index operations

Types

type Account

type Account struct {
	// Unique identifier for the account (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Human-readable name of the account
	// example: Corporate Checking Account
	// maxLength: 256
	Name string `json:"name" example:"Corporate Checking Account" maxLength:"256"`

	// ID of the parent account if this is a sub-account (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	ParentAccountID *string `json:"parentAccountId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Optional external identifier for linking to external systems
	// example: EXT-ACC-12345
	// maxLength: 256
	EntityID *string `json:"entityId" example:"EXT-ACC-12345" maxLength:"256"`

	// Asset code associated with this account (determines currency/asset type)
	// example: USD
	// maxLength: 100
	AssetCode string `json:"assetCode" example:"USD" maxLength:"100"`

	// ID of the organization that owns this account (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	OrganizationID string `json:"organizationId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// ID of the ledger this account belongs to (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	LedgerID string `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// ID of the portfolio this account belongs to (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	PortfolioID *string `json:"portfolioId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// ID of the segment this account belongs to (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	SegmentID *string `json:"segmentId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Current operating status of the account
	Status Status `json:"status"`

	// Unique alias for the account (makes referencing easier)
	// example: @treasury_checking
	// maxLength: 100
	Alias *string `json:"alias" example:"@treasury_checking" maxLength:"100"`

	// Type of the account.
	// example: deposit
	Type string `json:"type" example:"deposit"`

	// Indicates if the account is blocked
	Blocked *bool `json:"blocked"`

	// Timestamp when the account was created (RFC3339 format)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the account was last updated (RFC3339 format)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the account was soft deleted, null if not deleted (RFC3339 format)
	// example: null
	// format: date-time
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Custom key-value pairs for extending the account information
	// example: {"department": "Treasury", "purpose": "Operating Expenses", "region": "Global"}
	Metadata map[string]any `json:"metadata,omitempty"`

	// NullFields tracks fields explicitly set to null in the request.
	// Used internally to enable RFC 7396 JSON Merge Patch semantics.
	// Hidden from JSON serialization.
	NullFields []string `json:"-"`

} //	@name	Account

Account is a struct designed to encapsulate response payload data.

swagger:model Account

@Description	Complete account entity containing all fields including system-generated fields like ID, creation timestamps, and metadata. This is the response format for account operations. Accounts represent individual financial entities (bank accounts, cards, expense categories, etc.) within a ledger and are the primary structures for tracking balances and transactions.

@example		{
  "id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
  "name": "Corporate Checking Account",
  "assetCode": "USD",
  "organizationId": "b2c3d4e5-f6a1-7890-bcde-2345678901cd",
  "ledgerId": "c3d4e5f6-a1b2-7890-cdef-3456789012de",
  "portfolioId": "d4e5f6a1-b2c3-7890-defg-4567890123ef",
  "segmentId": "e5f6a1b2-c3d4-7890-efgh-5678901234fg",
  "status": {
    "code": "ACTIVE"
  },
  "alias": "@treasury_checking",
  "type": "deposit",
  "createdAt": "2022-04-15T09:30:00Z",
  "updatedAt": "2022-04-15T09:30:00Z",
  "metadata": {
    "department": "Treasury",
    "purpose": "Operating Expenses",
    "region": "Global"
  }
}

func (*Account) IDtoUUID

func (a *Account) IDtoUUID() uuid.UUID

IDtoUUID converts the account's string ID to a UUID object

Returns the UUID representation of the account's ID

type AccountCache

type AccountCache struct {
	RuleType string `json:"ruleType"`
	ValidIf  any    `json:"validIf"`
}

AccountCache represents the cached account rule data

type AccountErrorResponse

type AccountErrorResponse struct {
	// in: body
	Body struct {
		// Error code identifying the specific error
		// example: 400001
		Code int `json:"code"`

		// Human-readable error message
		// example: Invalid input: field 'assetCode' is required
		Message string `json:"message"`

		// Additional error details if available
		// example: {"field": "assetCode", "violation": "required"}
		Details map[string]any `json:"details,omitempty"`
	}
}

AccountErrorResponse represents an error response for account operations.

swagger:response AccountErrorResponse

@Description	Error response for account operations with error code and message.

@example		{
  "code": 400001,
  "message": "Invalid input: field 'assetCode' is required",
  "details": {
    "field": "assetCode",
    "violation": "required"
  }
}

type AccountResponse

type AccountResponse struct {
	// in: body
	Body Account
}

AccountResponse represents a success response containing a single account.

swagger:response AccountResponse

@Description	Successful response containing a single account entity.

type AccountRule

type AccountRule struct {
	// The rule type for account selection.
	RuleType string `json:"ruleType,omitempty" example:"alias" enum:"alias,account_type"`
	// The rule condition for account selection. String for alias type (e.g. "@cash_account"), array for account_type.
	ValidIf any `json:"validIf,omitempty"`

} // @name AccountRule

AccountRule represents the account selection rule configuration.

@Description AccountRule object containing the rule type and condition for account selection in operation routes.

type AccountType

type AccountType struct {
	// The unique identifier of the Account Type.
	ID uuid.UUID `json:"id,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// The unique identifier of the Organization.
	OrganizationID uuid.UUID `json:"organizationId,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// The unique identifier of the Ledger.
	LedgerID uuid.UUID `json:"ledgerId,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// The name of the account type.
	Name string `json:"name,omitempty" example:"Current Assets"`
	// Detailed description of the account type.
	Description string `json:"description,omitempty" example:"Assets that are expected to be converted to cash within one year"`
	// A unique key value identifier for the account type.
	KeyValue string `json:"keyValue,omitempty" example:"current_assets"`
	// The timestamp when the account type was created.
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`
	// The timestamp when the account type was last updated.
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`
	// The timestamp when the account type was deleted.
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`
	// Custom key-value pairs for extending the account type information
	// example: {"department": "Treasury", "purpose": "Operating Expenses", "region": "Global"}
	Metadata map[string]any `json:"metadata,omitempty"`

} // @name AccountType

AccountType is a struct designed to store Account Type object data.

swagger:model AccountType @Description AccountType object

type Accounts

type Accounts struct {
	// Array of account records returned in this page
	// example: [{"id":"00000000-0000-0000-0000-000000000000","name":"Corporate Checking Account","assetCode":"USD","status":{"code": "ACTIVE"}}]
	Items []Account `json:"items"`

	// Current page number in the pagination
	// example: 1
	// minimum: 1
	Page int `json:"page" example:"1" minimum:"1"`

	// Maximum number of items per page
	// example: 10
	// minimum: 1
	// maximum: 100
	Limit int `json:"limit" example:"10" minimum:"1" maximum:"100"`

} //	@name	Accounts

Accounts struct to return a paginated list of accounts.

swagger:model Accounts

@Description	Paginated list of accounts with metadata about the current page, limit, and the account items themselves. Used for list operations.

@example		{
  "items": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
      "name": "Corporate Checking Account",
      "assetCode": "USD",
      "ledgerId": "c3d4e5f6-a1b2-7890-cdef-3456789012de",
      "status": {
        "code": "ACTIVE"
      },
      "alias": "@treasury_checking",
      "type": "deposit",
      "createdAt": "2022-04-15T09:30:00Z",
      "updatedAt": "2022-04-15T09:30:00Z"
    },
    {
      "id": "f6a1b2c3-d4e5-7890-fghi-6789012345gh",
      "name": "Operating Expenses",
      "assetCode": "USD",
      "ledgerId": "c3d4e5f6-a1b2-7890-cdef-3456789012de",
      "status": {
        "code": "ACTIVE"
      },
      "alias": "@operating_expenses",
      "type": "expense",
      "createdAt": "2022-04-16T10:15:00Z",
      "updatedAt": "2022-04-16T10:15:00Z"
    }
  ],
  "page": 1,
  "limit": 10
}

type AccountsResponse

type AccountsResponse struct {
	// in: body
	Body Accounts
}

AccountsResponse represents a success response containing a paginated list of accounts.

swagger:response AccountsResponse

@Description	Successful response containing a paginated list of accounts.

type Address

type Address struct {
	// Primary address line (street address or PO Box)
	// example: 123 Financial Avenue
	// maxLength: 256
	Line1 string `json:"line1" example:"123 Financial Avenue" maxLength:"256"`

	// Secondary address information like apartment number, suite, or floor
	// example: Suite 1500
	// maxLength: 256
	Line2 *string `json:"line2" example:"Suite 1500" maxLength:"256"`

	// Postal code or ZIP code
	// example: 10001
	// maxLength: 20
	ZipCode string `json:"zipCode" example:"10001" maxLength:"20"`

	// City or locality name
	// example: New York
	// maxLength: 100
	City string `json:"city" example:"New York" maxLength:"100"`

	// State, province, or region name or code
	// example: NY
	// maxLength: 100
	State string `json:"state" example:"NY" maxLength:"100"`

	// Country code in ISO 3166-1 alpha-2 format (two-letter country code)
	// example: US
	// minLength: 2
	// maxLength: 2
	Country string `json:"country" example:"US" minLength:"2" maxLength:"2"` // According to ISO 3166-1 alpha-2

} //	@name	Address

Address structure for marshaling/unmarshalling JSON.

swagger:model Address

@Description	Structured address information following standard postal address format. Country field follows ISO 3166-1 alpha-2 standard (2-letter country codes). Used for organization physical locations and other address needs.

func (Address) IsEmpty

func (a Address) IsEmpty() bool

IsEmpty method determines if an Address is empty or nil in all fields

Returns true if all fields of the address are empty or nil, false otherwise

type Addresses added in v3.5.0

type Addresses struct {
	Primary     *Address `json:"primary,omitempty"`
	Additional1 *Address `json:"additional1,omitempty"`
	Additional2 *Address `json:"additional2,omitempty"`

} // @name Addresses

Addresses is a struct designed to store addresses data.

swagger:model Addresses @Description Addresses object

type Alias added in v3.5.0

type Alias struct {
	ID               *uuid.UUID        `json:"id,omitempty" example:"00000000-0000-0000-0000-000000000000"`
	Document         *string           `json:"document,omitempty" example:"91315026015"`
	Type             *string           `json:"type,omitempty" example:"LEGAL_PERSON"`
	LedgerID         *string           `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000"`
	AccountID        *string           `json:"accountId" example:"00000000-0000-0000-0000-000000000000"`
	HolderID         *uuid.UUID        `json:"holderId" example:"00000000-0000-0000-0000-000000000000"`
	Metadata         map[string]any    `json:"metadata,omitempty"`
	BankingDetails   *BankingDetails   `json:"bankingDetails,omitempty"`
	RegulatoryFields *RegulatoryFields `json:"regulatoryFields,omitempty"`
	RelatedParties   []*RelatedParty   `json:"relatedParties,omitempty"`
	CreatedAt        time.Time         `json:"createdAt" example:"2025-01-01T00:00:00Z"`
	UpdatedAt        time.Time         `json:"updatedAt" example:"2025-01-01T00:00:00Z"`
	DeletedAt        *time.Time        `json:"deletedAt" example:"2025-01-01T00:00:00Z"`

} // @name AliasResponse

Alias is a struct designed to store account data.

swagger:model Alias @Description AliasResponse payload

type Asset

type Asset struct {
	// Unique identifier for the asset (UUID format)
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Name of the asset (max length 256 characters)
	Name string `json:"name" example:"US Dollar" maxLength:"256"`

	// Type of the asset (e.g., currency, cryptocurrency, commodity, stock)
	Type string `json:"type" example:"currency"`

	// Unique code/symbol for the asset (max length 100 characters)
	Code string `json:"code" example:"USD" maxLength:"100"`

	// Status of the asset (active, inactive, pending)
	Status Status `json:"status"`

	// ID of the ledger this asset belongs to (UUID format)
	LedgerID string `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// ID of the organization that owns this asset (UUID format)
	OrganizationID string `json:"organizationId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Timestamp when the asset was created
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the asset was last updated
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the asset was deleted (null if not deleted)
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Additional custom attributes for the asset
	Metadata map[string]any `json:"metadata,omitempty"`

} //	@name	Asset

Asset is a struct designed to encapsulate payload data.

swagger:model Asset

@Description	Asset represents a financial instrument within a ledger, such as a currency, cryptocurrency, commodity, or other asset type.

type AssetErrorResponse

type AssetErrorResponse struct {
	// in: body
	Body struct {
		// Error code identifying the specific error
		// example: 400001
		Code int `json:"code"`

		// Human-readable error message
		// example: Invalid input: field 'code' is required
		Message string `json:"message"`

		// Additional error details if available
		// example: {"field": "code", "violation": "required"}
		Details map[string]any `json:"details,omitempty"`
	}
}

AssetErrorResponse represents an error response for asset operations.

swagger:response AssetErrorResponse @Description Error response for asset operations with error code and message.

type AssetResponse

type AssetResponse struct {
	// in: body
	Body Asset
}

AssetResponse represents a success response containing a single asset.

swagger:response AssetResponse @Description Successful response containing a single asset entity.

type Assets

type Assets struct {
	// Array of asset records
	// example: [{"id":"00000000-0000-0000-0000-000000000000","name":"US Dollar","code":"USD","type":"currency"}]
	Items []Asset `json:"items"`

	// Current page number
	// example: 1
	// minimum: 1
	Page int `json:"page" example:"1" minimum:"1"`

	// Maximum number of items per page
	// example: 10
	// minimum: 1
	// maximum: 100
	Limit int `json:"limit" example:"10" minimum:"1" maximum:"100"`

} //	@name	Assets

Assets struct to return get all.

swagger:model Assets

@Description	Assets represents a paginated collection of asset records returned by list operations.

type AssetsResponse

type AssetsResponse struct {
	// in: body
	Body Assets
}

AssetsResponse represents a success response containing a paginated list of assets.

swagger:response AssetsResponse @Description Successful response containing a paginated list of assets.

type Balance

type Balance struct {
	// Unique identifier for the balance (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Organization that owns this balance
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	OrganizationID string `json:"organizationId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Ledger containing the account this balance belongs to
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	LedgerID string `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Account that holds this balance
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	AccountID string `json:"accountId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Alias for the account, used for easy identification or tagging
	// example: @person1
	// maxLength: 256
	Alias string `json:"alias" example:"@person1" maxLength:"256"`

	// Unique key for the balance
	// example: asset-freeze
	// maxLength: 100
	Key string `json:"key" example:"asset-freeze" maxLength:"100"`

	// Asset code identifying the currency or asset type of this balance
	// example: USD
	// minLength: 2
	// maxLength: 10
	AssetCode string `json:"assetCode" example:"USD" minLength:"2" maxLength:"10"`

	// Amount available for transactions (in the smallest unit of the asset, e.g. cents)
	// example: 1500
	// minimum: 0
	Available decimal.Decimal `json:"available" example:"1500" minimum:"0"`

	// Amount currently on hold and unavailable for transactions
	// example: 500
	// minimum: 0
	OnHold decimal.Decimal `json:"onHold" example:"500" minimum:"0"`

	// Optimistic concurrency control version
	// example: 1
	// minimum: 1
	Version int64 `json:"version" example:"1" minimum:"1"`

	// Type of account holding this balance
	// example: creditCard
	// maxLength: 50
	AccountType string `json:"accountType" example:"creditCard" maxLength:"50"`

	// Whether the account can send funds from this balance
	// example: true
	AllowSending bool `json:"allowSending" example:"true"`

	// Whether the account can receive funds to this balance
	// example: true
	AllowReceiving bool `json:"allowReceiving" example:"true"`

	// Timestamp when the balance was created (RFC3339 format)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the balance was last updated (RFC3339 format)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the balance was softly deleted, null if not deleted (RFC3339 format)
	// example: null
	// format: date-time
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Custom key-value pairs for extending the balance information
	// example: {"purpose": "Main savings", "category": "Personal"}
	Metadata map[string]any `json:"metadata,omitempty"`
}

Balance is a struct designed to encapsulate response payload data.

swagger:model Balance @Description Complete balance entity containing all fields including system-generated fields like ID, creation timestamps, and metadata. This is the response format for balance operations. Balances represent the amount of a specific asset held in an account, including available and on-hold amounts.

func (*Balance) IDtoUUID

func (b *Balance) IDtoUUID() uuid.UUID

IDtoUUID is a func that convert UUID string to uuid.UUID

func (*Balance) ToTransactionBalance added in v3.5.0

func (b *Balance) ToTransactionBalance() *pkgTransaction.Balance

ToTransactionBalance converts mmodel.Balance to pkgTransaction.Balance

type BalanceErrorResponse

type BalanceErrorResponse struct {
	// in: body
	Body struct {
		// Error code identifying the specific error
		// example: 400001
		Code int `json:"code"`

		// Human-readable error message
		// example: Invalid input: field 'assetCode' is required
		Message string `json:"message"`

		// Additional error details if available
		// example: {"field": "assetCode", "violation": "required"}
		Details map[string]any `json:"details,omitempty"`
	}
}

BalanceErrorResponse represents an error response for balance operations.

swagger:response BalanceErrorResponse @Description Error response for balance operations with error code and message.

type BalanceOperation added in v3.3.0

type BalanceOperation struct {
	Balance     *Balance
	Alias       string
	Amount      pkgTransaction.Amount
	InternalKey string
}

BalanceOperation represents a balance operation with associated metadata for transaction processing on redis by cache-aside

type BalanceRedis

type BalanceRedis struct {
	// Unique identifier for the balance (UUID format)
	ID string `json:"id"`

	// Alias for the account, used for easy identification or tagging
	// example: @person1
	// maxLength: 256
	Alias string `json:"alias" example:"@person1" maxLength:"256"`

	// Unique key for the balance (defaults to "default" if not provided)
	// example: default
	// maxLength: 100
	Key string `json:"key" example:"default" maxLength:"100"`

	// Account that holds this balance
	AccountID string `json:"accountId"`

	// Asset code identifying the currency or asset type of this balance
	AssetCode string `json:"assetCode"`

	// Amount available for transactions
	Available decimal.Decimal `json:"available"`

	// Amount currently on hold
	OnHold decimal.Decimal `json:"onHold"`

	// Optimistic concurrency control version
	Version int64 `json:"version"`

	// Type of account holding this balance
	AccountType string `json:"accountType"`

	// Whether the account can send funds (1=true, 0=false)
	AllowSending int `json:"allowSending"`

	// Whether the account can receive funds (1=true, 0=false)
	AllowReceiving int `json:"allowReceiving"`
}

BalanceRedis is an internal struct for Redis cache representation of balance data.

This is an internal model not exposed via API.

func (*BalanceRedis) UnmarshalJSON

func (b *BalanceRedis) UnmarshalJSON(data []byte) error

UnmarshalJSON is a custom unmarshal function for BalanceRedis

type Balances

type Balances struct {
	// Array of balance records returned in this page
	// example: [{"id":"00000000-0000-0000-0000-000000000000","accountId":"00000000-0000-0000-0000-000000000000","assetCode":"USD","available":1500}]
	Items []Balance `json:"items"`

	// Current page number in the pagination
	// example: 1
	// minimum: 1
	Page int `json:"page" example:"1" minimum:"1"`

	// Maximum number of items per page
	// example: 10
	// minimum: 1
	// maximum: 100
	Limit int `json:"limit" example:"10" minimum:"1" maximum:"100"`

} // @name Balances

Balances struct to return paginated list of balances.

swagger:model Balances @Description Paginated list of balances with metadata about the current page, limit, and the balance items themselves. Used for list operations.

type BankingDetails added in v3.5.0

type BankingDetails struct {
	// The branch number or code.
	Branch *string `json:"branch,omitempty" example:"0001"`
	// The account code or number.
	Account *string `json:"account,omitempty" example:"123450"`
	// Type of account.
	Type *string `json:"type,omitempty" example:"CACC"`
	// The date the account was opened.
	OpeningDate *string `json:"openingDate,omitempty" example:"2025-01-01"`
	// The date the account was closed.
	ClosingDate *Date `json:"closingDate,omitempty" example:"2025-12-31"`
	// The International Bank Account Number.
	IBAN *string `json:"iban,omitempty" example:"US12345678901234567890"`
	// The country code where the bank is located.
	CountryCode *string `json:"countryCode,omitempty" example:"US"`
	// The code or identifier for correlation with the bank holding the account.
	BankID *string `json:"bankId,omitempty" example:"12345"`

} // @name BankingDetails

BankingDetails is a struct designed to store account banking details data.

swagger:model BankingDetails @Description BankingDetails object

type Contact added in v3.5.0

type Contact struct {
	// The primary email address of the holder.
	PrimaryEmail *string `json:"primaryEmail,omitempty" example:"john.doe@example.com"`
	// The secondary email address of the holder.
	SecondaryEmail *string `json:"secondaryEmail,omitempty" example:"john.doe@example.com"`
	// The mobile phone number of the holder, including country code.
	MobilePhone *string `json:"mobilePhone,omitempty" example:"+1555555555"`
	// Any additional phone number of the holder.
	OtherPhone *string `json:"otherPhone,omitempty" example:"+1555555555"`

} // @name Contact

Contact is a struct designed to store contact data.

swagger:model Contact @Description Contact object

type CreateAccountInput

type CreateAccountInput struct {
	// Human-readable name of the account
	// required: false
	// example: Corporate Checking Account
	// maxLength: 256
	Name string `json:"name" validate:"max=256" example:"Corporate Checking Account" maxLength:"256"`

	// ID of the parent account if this is a subaccount (optional)
	// required: false
	// format: uuid
	ParentAccountID *string `json:"parentAccountId" validate:"omitempty,uuid" format:"uuid"`

	// Optional external identifier for linking to external systems
	// required: false
	// example: EXT-ACC-12345
	// maxLength: 256
	EntityID *string `json:"entityId" validate:"omitempty,max=256" example:"EXT-ACC-12345" maxLength:"256"`

	// Asset code that this account will use for balances and transactions
	// required: true
	// example: USD
	// maxLength: 100
	AssetCode string `json:"assetCode" validate:"required,max=100" example:"USD" maxLength:"100"`

	// ID of the portfolio this account belongs to (optional)
	// required: false
	// format: uuid
	PortfolioID *string `json:"portfolioId" validate:"omitempty,uuid" format:"uuid"`

	// ID of the segment this account belongs to (optional)
	// required: false
	// format: uuid
	SegmentID *string `json:"segmentId" validate:"omitempty,uuid" format:"uuid"`

	// Current operating status of the account
	// required: false
	Status Status `json:"status"`

	// Unique alias for the account (optional, must follow alias format rules)
	// required: false
	// example: @treasury_checking
	// maxLength: 100
	Alias *string `` /* 141-byte string literal not displayed */

	// Type of the account
	// required: true
	// example: deposit
	// maxLength: 256
	Type string `json:"type" validate:"required,max=256,invalidstrings=external" example:"deposit"`

	// Whether the account should start blocked
	// required: false
	// default: false
	Blocked *bool `json:"blocked"`

	// Custom key-value pairs for extending the account information
	// required: false
	// example: {"department": "Treasury", "purpose": "Operating Expenses", "region": "Global"}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`

} //	@name	CreateAccountInput

CreateAccountInput is a struct designed to encapsulate request create payload data.

swagger:model CreateAccountInput

@Description	Request payload for creating a new account within a ledger. Accounts represent individual financial entities such as bank accounts, credit cards, expense categories, or any other financial buckets within a ledger. Accounts are identified by a unique ID, can have aliases for easy reference, and are associated with a specific asset type.

@example		{
  "name": "Corporate Checking Account",
  "assetCode": "USD",
  "status": {
    "code": "ACTIVE"
  },
  "alias": "@treasury_checking",
  "type": "deposit",
  "metadata": {
    "department": "Treasury",
    "purpose": "Operating Expenses",
    "region": "Global"
  }
}

type CreateAccountTypeInput

type CreateAccountTypeInput struct {
	// The name of the account type.
	Name string `json:"name" validate:"required,max=100" example:"Current Assets"`
	// Detailed description of the account type.
	Description string `json:"description,omitempty" validate:"max=500" example:"Assets that are expected to be converted to cash within one year"`
	// A unique key value identifier for the account type.
	KeyValue string `json:"keyValue" validate:"required,max=50,invalidaccounttype" example:"current_assets"`
	// Custom key-value pairs for extending the account type information
	// required: false
	// example: {"department": "Treasury", "purpose": "Operating Expenses", "region": "Global"}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`

} // @name CreateAccountTypeInput

CreateAccountTypeInput is a struct designed to store Account Type input data.

swagger:model CreateAccountTypeInput @Description CreateAccountTypeInput payload

type CreateAdditionalBalance added in v3.3.0

type CreateAdditionalBalance struct {
	// Unique key for the balance
	// required: true
	// maxLength: 100
	// example: asset-freeze
	Key string `json:"key" validate:"required,nowhitespaces,max=100" example:"asset-freeze"`
	// Whether the account should be allowed to send funds from this balance
	// required: false
	// example: true
	AllowSending *bool `json:"allowSending" example:"true"`

	// Whether the account should be allowed to receive funds to this balance
	// required: false
	// example: true
	AllowReceiving *bool `json:"allowReceiving" example:"true"`

} // @name CreateAdditionalBalance

CreateAdditionalBalance is a struct designed to encapsulate balance create request payload data.

swagger:model CreateAdditionalBalance @Description Request payload for creating a new balance with specified permissions and custom key.

type CreateAliasInput added in v3.5.0

type CreateAliasInput struct {
	// Unique identifier of the ledger of the related account.
	LedgerID string `json:"ledgerId" validate:"required" example:"00000000-0000-0000-0000-000000000000"`
	// Unique identifier of the related account on ledger.
	AccountID string `json:"accountId" validate:"required" example:"00000000-0000-0000-0000-000000000000"`
	// An object containing key-value pairs to add as metadata, where the field name is the key and the field value is the value.
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`
	// Object with banking information of the related account.
	BankingDetails *BankingDetails `json:"bankingDetails"`
	// Object with regulatory fields.
	RegulatoryFields *RegulatoryFields `json:"regulatoryFields,omitempty"`
	// List of related parties to add at creation.
	RelatedParties []*RelatedParty `json:"relatedParties,omitempty"`

} // @name CreateAliasRequest

CreateAliasInput is a struct designed to encapsulate request create payload data.

swagger:model CreateAliasInput @Description CreateAliasRequest payload

type CreateAssetInput

type CreateAssetInput struct {
	// Name of the asset (required, max length 256 characters)
	Name string `json:"name" validate:"required,max=256" example:"US Dollar"`

	// Type of the asset (e.g., currency, cryptocurrency, commodity, stock)
	Type string `json:"type" validate:"required" example:"currency"`

	// Unique code/symbol for the asset (required, max length 100 characters)
	Code string `json:"code" validate:"required,max=100" example:"USD"`

	// Status of the asset (active, inactive, pending)
	Status Status `json:"status"`

	// Additional custom attributes for the asset
	// Keys max length: 100 characters, Values max length: 2000 characters
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`

} //	@name	CreateAssetInput

CreateAssetInput is a struct design to encapsulate request create payload data.

swagger:model CreateAssetInput

@Description	CreateAssetInput is the input payload to create an asset within a ledger, such as a currency, cryptocurrency, or other financial instrument.

type CreateBalanceInput added in v3.4.1

type CreateBalanceInput struct {
	// Request ID for tracing
	// example: 123e4567-e89b-12d3-a456-426614174000
	// format: string uuid
	RequestID string

	// Organization that owns this balance
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	OrganizationID uuid.UUID

	// Ledger containing the account this balance belongs to
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	LedgerID uuid.UUID

	// Account that holds this balance
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	AccountID uuid.UUID

	// Alias for the account, used for easy identification or tagging
	// example: @person1
	// maxLength: 256
	Alias string

	// Unique key for the balance
	// example: asset-freeze
	// maxLength: 100
	Key string

	// Asset code identifying the currency or asset type of this balance
	// example: USD
	// minLength: 2
	// maxLength: 10
	AssetCode string

	// Type of account holding this balance
	// example: creditCard
	// maxLength: 50
	AccountType string

	// Whether the account should be allowed to send funds from this balance
	// example: true
	AllowSending bool

	// Whether the account should be allowed to receive funds to this balance
	// example: true
	AllowReceiving bool
}

CreateBalanceInput is the input model used by services to create a balance synchronously.

It centralizes all properties required to perform validations and persist the new balance, keeping call sites simple and reducing the chance of inconsistent argument ordering.

type CreateHolderInput added in v3.5.0

type CreateHolderInput struct {
	// Optional field for an external identifier to client correlation purposes.
	ExternalID *string `json:"externalId" example:"G4K7N8M2"`
	// Type of person.
	// * NATURAL_PERSON - Individual
	// * LEGAL_PERSON - Company
	Type *string `json:"type" validate:"required" example:"NATURAL_PERSON" enums:"NATURAL_PERSON,LEGAL_PERSON"`
	// Holders name.
	// **Notes:** If the person type is LEGAL_PERSON, this must be the full legal name. If the person type is NATURAL_PERSON, this should be the individuals full name.
	Name string `json:"name" validate:"required" example:"John Doe"`
	// The holder's identification document.
	Document string `json:"document" validate:"required" example:"91315026015"`
	// Object of addresses.
	Addresses *Addresses `json:"addresses"`
	// Object with contact information.
	Contact *Contact `json:"contact"`
	// Object with natural person information.
	NaturalPerson *NaturalPerson `json:"naturalPerson"`
	// Object with legal person information.
	LegalPerson *LegalPerson `json:"legalPerson"`
	// An object containing key-value pairs to add as metadata, where the field name is the key and the field value is the value.
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`

} // @name CreateHolderRequest

CreateHolderInput is a struct designed to encapsulate request create payload data.

swagger:model CreateHolderInput @Description CreateHolderRequest payload

type CreateLedgerInput

type CreateLedgerInput struct {
	// Display name of the ledger
	// required: true
	// maxLength: 256
	Name string `json:"name" validate:"required,max=256" maxLength:"256"`

	// Current operating status of the ledger (defaults to ACTIVE if not specified)
	// required: false
	Status Status `json:"status"`

	// Custom key-value pairs for extending the ledger information
	// required: false
	// example: {"department": "Finance", "currency": "USD", "region": "North America"}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`

} // @name CreateLedgerInput

CreateLedgerInput is a struct designed to encapsulate request create payload data.

swagger:model CreateLedgerInput @Description Request payload for creating a new ledger. Contains the ledger name (required), status, and optional metadata. Ledgers are organizational units within an organization that group related financial accounts and assets together.

type CreateMetadataIndexInput added in v3.5.0

type CreateMetadataIndexInput struct {
	// The metadata key to index (without "metadata." prefix)
	// required: true
	// maxLength: 100
	MetadataKey string `json:"metadataKey" validate:"required,max=100,metadatakeyformat" example:"tier"`
	// Whether the index should enforce uniqueness
	// required: false
	// default: false
	Unique bool `json:"unique" example:"false"`
	// Whether the index should be sparse (only include documents with the field)
	// required: false
	// default: true
	Sparse *bool `json:"sparse" example:"true"`

} // @name CreateMetadataIndexInput

CreateMetadataIndexInput is a struct designed to store CreateMetadataIndexInput data.

swagger:model CreateMetadataIndexInput @Description CreateMetadataIndexInput payload

type CreateOperationRouteInput

type CreateOperationRouteInput struct {
	// Short text summarizing the purpose of the operation. Used as an entry note for identification.
	Title string `json:"title,omitempty" validate:"required,max=50" example:"Cashin from service charge"`
	// Detailed description of the operation route purpose and usage.
	Description string `` /* 139-byte string literal not displayed */
	// External reference of the operation route.
	Code string `json:"code,omitempty" validate:"max=100" example:"EXT-001"`
	// The type of the operation route.
	OperationType string `json:"operationType,omitempty" validate:"required" example:"source" enum:"source,destination"`
	// Additional metadata stored as JSON
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`
	// The account selection rule configuration.
	Account *AccountRule `json:"account,omitempty"`

} // @name CreateOperationRouteInput

CreateOperationRouteInput is a struct designed to store Operation Route input data.

@Description CreateOperationRouteInput payload for creating a new Operation Route with title, description, operation type, and optional account rules.

type CreateOrganizationInput

type CreateOrganizationInput struct {
	// Official legal name of the organization
	// required: true
	// example: Lerian Financial Services Ltd.
	// maxLength: 256
	LegalName string `json:"legalName" validate:"required,max=256" example:"Lerian Financial Services Ltd." maxLength:"256"`

	// UUID of the parent organization if this is a child organization
	// required: false
	// format: uuid
	ParentOrganizationID *string `json:"parentOrganizationId" validate:"omitempty,uuid" format:"uuid"`

	// Trading or brand name of the organization, if different from legal name
	// required: false
	// example: Lerian FS
	// maxLength: 256
	DoingBusinessAs *string `json:"doingBusinessAs" validate:"omitempty,max=256" example:"Lerian FS" maxLength:"256"`

	// Official tax ID, company registration number, or other legal identification
	// required: true
	// example: 123456789012345
	// maxLength: 256
	LegalDocument string `json:"legalDocument" validate:"required,max=256" example:"123456789012345" maxLength:"256"`

	// Physical address of the organization
	// required: false
	Address Address `json:"address"`

	// Current operating status of the organization (defaults to ACTIVE if not specified)
	// required: false
	Status Status `json:"status"`

	// Custom key-value pairs for extending the organization information
	// required: false
	// example: {"industry": "Financial Services", "founded": 2020, "employees": 150}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`

} //	@name	CreateOrganizationInput

CreateOrganizationInput is a struct designed to encapsulate request create payload data.

swagger:model CreateOrganizationInput

@Description	Request payload for creating a new organization. Contains all the necessary fields for organization creation, with required fields marked as such. Organizations are the top-level entities in the hierarchy and contain ledgers, which in turn contain accounts and assets.

@example		{
  "legalName": "Lerian Financial Services Ltd.",
  "legalDocument": "123456789012345",
  "doingBusinessAs": "Lerian FS",
  "address": {
    "line1": "123 Financial Avenue",
    "line2": "Suite 1500",
    "zipCode": "10001",
    "city": "New York",
    "state": "NY",
    "country": "US"
  },
  "metadata": {
    "industry": "Financial Services",
    "founded": 2020,
    "employees": 150
  }
}

type CreatePortfolioInput

type CreatePortfolioInput struct {
	// Optional external entity identifier (max length 256 characters)
	EntityID string `json:"entityId" validate:"omitempty,max=256" example:"00000000-0000-0000-0000-000000000000"`

	// Name of the portfolio (required, max length 256 characters)
	Name string `json:"name" validate:"required,max=256" example:"My Portfolio"`

	// Status of the portfolio (active, inactive, pending)
	Status Status `json:"status"`

	// Additional custom attributes for the portfolio
	// Keys max length: 100 characters, Values max length: 2000 characters
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`

} // @name CreatePortfolioInput

CreatePortfolioInput is a struct design to encapsulate request create payload data.

swagger:model CreatePortfolioInput

@Description CreatePortfolioInput is the input payload to create a portfolio within a ledger, representing a collection of accounts grouped for specific purposes.

type CreateSegmentInput

type CreateSegmentInput struct {
	// Name of the segment (required, max length 256 characters)
	Name string `json:"name" validate:"required,max=256" example:"My Segment"`

	// Status of the segment (active, inactive, pending)
	Status Status `json:"status"`

	// Additional custom attributes for the segment
	// Keys max length: 100 characters, Values max length: 2000 characters
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,nonested,valuemax=2000"`

} // @name CreateSegmentInput

CreateSegmentInput is a struct design to encapsulate request create payload data.

swagger:model CreateSegmentInput

@Description CreateSegmentInput is the input payload to create a segment within a ledger, representing a logical division such as a business area, product line, or customer category.

type CreateTransactionRouteInput

type CreateTransactionRouteInput struct {
	// Short text summarizing the purpose of the transaction. Used as an entry note for identification.
	Title string `json:"title,omitempty" validate:"required,max=50" example:"Charge Settlement"`
	// A description for the Transaction Route.
	Description string `json:"description,omitempty" validate:"max=250" example:"Settlement route for service charges"`
	// Additional metadata stored as JSON
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`
	// An object containing accounting data of Operation Routes from the Transaction Route.
	OperationRoutes []uuid.UUID `json:"operationRoutes,omitempty" validate:"required"`

} // @name CreateTransactionRouteInput

CreateTransactionRouteInput is a struct designed to store CreateRouteInput data.

swagger:model CreateTransactionRouteInput @Description CreateTransactionRouteInput payload

type Date added in v3.5.0

type Date struct {
	time.Time
}

Date is a custom date type that accepts both "2025-01-23" (date only) and "2025-01-23T00:00:00Z" (RFC3339) formats during JSON unmarshaling. It outputs date-only format ("2025-01-23") during marshaling.

swagger:model Date @Description Date in YYYY-MM-DD format (e.g., "2025-06-15") or null @type string @format date @example "2025-06-15"

func (Date) After added in v3.5.0

func (d Date) After(u Date) bool

After reports whether d is after u (date-only comparison).

func (Date) Before added in v3.5.0

func (d Date) Before(u Date) bool

Before reports whether d is before u (date-only comparison).

func (Date) MarshalJSON added in v3.5.0

func (d Date) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler, outputting date-only format ("2006-01-02").

func (*Date) UnmarshalJSON added in v3.5.0

func (d *Date) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler with flexible date parsing. Accepts both "2025-01-23" and "2025-01-23T00:00:00Z" formats, as well as null.

type Error

type Error struct {
	// Error code identifying the specific error condition
	// example: ERR_INVALID_INPUT
	// maxLength: 50
	Code string `json:"code" example:"ERR_INVALID_INPUT" maxLength:"50"`

	// Short, human-readable error title
	// example: Bad Request
	// maxLength: 100
	Title string `json:"title" example:"Bad Request" maxLength:"100"`

	// Detailed error message explaining the issue
	// example: The request contains invalid fields. Please check the field 'name' and try again.
	// maxLength: 500
	Message string `json:"message" example:"The request contains invalid fields. Please check the field 'name' and try again." maxLength:"500"`

	// Optional type of entity associated with the error
	// example: Organization
	// maxLength: 100
	EntityType string `json:"entityType,omitempty" example:"Organization" maxLength:"100"`

	// Optional detailed field validations for client-side handling
	// example: {"name": "Field 'name' is required"}
	Fields map[string]string `json:"fields,omitempty"`

} // @name Error

Error represents a standardized API error response format

swagger:model Error @Description Standardized error response format used across all API endpoints for error situations. Provides structured information about errors including codes, messages, and field-specific validation details.

type ErrorResponse

type ErrorResponse struct {
	// in: body
	Body Error
}

ErrorResponse represents a standardized API error response

swagger:response ErrorResponse @Description Standard error response format returned by all API endpoints for error situations.

type Event

type Event struct {
	Source         string          `json:"source" example:"midaz"`
	EventType      string          `json:"eventType" example:"transaction"`
	Action         string          `json:"action" example:"APPROVED"`
	TimeStamp      time.Time       `json:"timestamp" example:"2025-06-26T16:00:00Z"`
	Version        string          `json:"version" example:"v2.2.2"`
	OrganizationID string          `json:"organizationId" format:"uuid" example:"00000000-0000-0000-0000-000000000000"`
	LedgerID       string          `json:"ledgerId" format:"uuid" example:"00000000-0000-0000-0000-000000000000"`
	Payload        json.RawMessage `json:"payload" format:"json"`
}

Event is a struct representing a single data event in a queue message.

swagger:model Event @Description Individual struct event within json payload.

type Holder added in v3.5.0

type Holder struct {
	ID            *uuid.UUID     `json:"id,omitempty" example:"00000000-0000-0000-0000-000000000000"`
	ExternalID    *string        `json:"externalId,omitempty" example:"G4K7N8M2"`
	Type          *string        `json:"type,omitempty" example:"NATURAL_PERSON" enums:"NATURAL_PERSON,LEGAL_PERSON"`
	Name          *string        `json:"name,omitempty" example:"John Doe"`
	Document      *string        `json:"document,omitempty" example:"91315026015"`
	Addresses     *Addresses     `json:"addresses,omitempty"`
	Contact       *Contact       `json:"contact,omitempty"`
	NaturalPerson *NaturalPerson `json:"naturalPerson,omitempty"`
	LegalPerson   *LegalPerson   `json:"legalPerson,omitempty"`
	Metadata      map[string]any `json:"metadata,omitempty"`
	CreatedAt     time.Time      `json:"createdAt" example:"2025-01-01T00:00:00Z"`
	UpdatedAt     time.Time      `json:"updatedAt" example:"2025-01-01T00:00:00Z"`
	DeletedAt     *time.Time     `json:"deletedAt" example:"2025-01-01T00:00:00Z"`

} // @name HolderResponse

Holder is a struct designed to store holder data.

swagger:model Holder @Description HolderResponse payload

type IndexStats added in v3.5.0

type IndexStats struct {
	// Number of operations that have used this index
	// example: 1523
	Accesses int64 `json:"accesses" example:"1523"`
	// Timestamp since when the statistics are being collected
	// example: 2024-12-01T10:30:00Z
	// format: date-time
	StatsSince *time.Time `json:"statsSince,omitempty" format:"date-time" example:"2024-12-01T10:30:00Z"`

} // @name IndexStats

IndexStats represents usage statistics for a MongoDB index @Description Usage statistics collected by MongoDB for an index

type Ledger

type Ledger struct {
	// Unique identifier for the ledger (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Display name of the ledger
	// example: Treasury Operations
	// maxLength: 256
	Name string `json:"name" example:"Treasury Operations" maxLength:"256"`

	// Reference to the organization that owns this ledger (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	OrganizationID string `json:"organizationId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Current operating status of the ledger
	Status Status `json:"status"`

	// Timestamp when the ledger was created (RFC3339 format)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the ledger was last updated (RFC3339 format)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the ledger was soft deleted, null if not deleted (RFC3339 format)
	// example: null
	// format: date-time
	DeletedAt *time.Time `json:"deletedAt" sql:"index" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Custom key-value pairs for extending the ledger information
	// example: {"department": "Finance", "currency": "USD", "region": "North America"}
	Metadata map[string]any `json:"metadata,omitempty"`

} // @name Ledger

Ledger is a struct designed to encapsulate response payload data.

swagger:model Ledger @Description Complete ledger entity containing all fields including system-generated fields like ID, creation timestamps, and metadata. This is the response format for ledger operations. Ledgers are organizational units within an organization that group related financial accounts and assets together.

type LedgerErrorResponse

type LedgerErrorResponse struct {
	// in: body
	Body struct {
		// Error code identifying the specific error
		// example: 400001
		Code int `json:"code"`

		// Human-readable error message
		// example: Invalid input: field 'name' is required
		Message string `json:"message"`

		// Additional error details if available
		// example: {"field": "name", "violation": "required"}
		Details map[string]any `json:"details,omitempty"`
	}
}

LedgerErrorResponse represents an error response for ledger operations.

swagger:response LedgerErrorResponse @Description Error response for ledger operations with error code and message.

type LedgerResponse

type LedgerResponse struct {
	// in: body
	Body Ledger
}

LedgerResponse represents a success response containing a single ledger.

swagger:response LedgerResponse @Description Successful response containing a single ledger entity.

type Ledgers

type Ledgers struct {
	// Array of ledger records returned in this page
	// example: [{"id":"00000000-0000-0000-0000-000000000000","name":"Treasury Operations","status":{"code":"ACTIVE"}}]
	Items []Ledger `json:"items"`

	// Current page number in the pagination
	// example: 1
	// minimum: 1
	Page int `json:"page" example:"1" minimum:"1"`

	// Maximum number of items per page
	// example: 10
	// minimum: 1
	// maximum: 100
	Limit int `json:"limit" example:"10" minimum:"1" maximum:"100"`

} // @name Ledgers

Ledgers struct designed to return a paginated list of ledgers.

swagger:model Ledgers @Description Paginated list of ledgers with metadata about the current page, limit, and the ledger items themselves. Used for list operations.

type LedgersResponse

type LedgersResponse struct {
	// in: body
	Body Ledgers
}

LedgersResponse represents a success response containing a paginated list of ledgers.

swagger:response LedgersResponse @Description Successful response containing a paginated list of ledgers.

type LegalPerson added in v3.5.0

type LegalPerson struct {
	// The registered business name of the company, if applicable.
	TradeName *string `json:"tradeName,omitempty" example:"Lerian Studio"`
	// The type of business or activity the company engages in.
	Activity *string `json:"activity,omitempty" example:"Electronic devices development"`
	// The legal structure of the company.
	Type *string `json:"type,omitempty" example:"Limited Liability"`
	// The date when the company was established.
	FoundingDate *string `json:"foundingDate,omitempty" example:"2025-01-01"`
	// The size classification of the company.
	Size *string `json:"size,omitempty" example:"Medium"`
	// The current status of the legal entity.
	Status *string `json:"status,omitempty" example:"Closed"`
	// Object with details of the company's legal representative.
	Representative *Representative `json:"representative,omitempty"`

} // @name LegalPerson

LegalPerson is a struct designed to store legal person data.

swagger:model LegalPerson @Description LegalPerson is a struct designed to encapsulate response payload data.

type MetadataIndex added in v3.5.0

type MetadataIndex struct {
	// The name of the index in MongoDB
	IndexName string `json:"indexName" example:"metadata.tier_1"`
	// The entity/collection name where the index exists
	EntityName string `json:"entityName" example:"transaction"`
	// The metadata key that is indexed
	MetadataKey string `json:"metadataKey" example:"tier"`
	// Whether the index enforces uniqueness
	Unique bool `json:"unique" example:"false"`
	// Whether the index is sparse
	Sparse bool `json:"sparse" example:"true"`
	// Usage statistics for this index (only available on GET, not on CREATE)
	Stats *IndexStats `json:"stats,omitempty"`

} // @name MetadataIndex

MetadataIndex represents a metadata index entity @Description Represents a custom MongoDB index on a metadata field

type MetadataIndexErrorResponse added in v3.5.0

type MetadataIndexErrorResponse struct {
	// in: body
	Body struct {
		// Error code identifying the specific error
		// example: 400001
		Code int `json:"code"`
		// Human-readable error message
		// example: Invalid input: field 'metadataKey' is required
		Message string `json:"message"`
		// Additional error details if available
		// example: {"field": "metadataKey", "violation": "required"}
		Details map[string]any `json:"details,omitempty"`
	}
}

MetadataIndexErrorResponse represents an error response for metadata index operations.

swagger:response MetadataIndexErrorResponse @Description Error response for metadata index operations with error code and message.

type MetadataIndexResponse added in v3.5.0

type MetadataIndexResponse struct {
	// in: body
	Body MetadataIndex
}

MetadataIndexResponse represents a success response containing a single metadata index.

swagger:response MetadataIndexResponse @Description Successful response containing a single metadata index entity.

type MetadataIndexes added in v3.5.0

type MetadataIndexes struct {
	// Array of metadata index records returned in this page
	// example: [{"indexName":"metadata.tier_1","entityName":"transaction","metadataKey":"tier"}]
	Items []MetadataIndex `json:"items"`
	// Current page number in the pagination
	// example: 1
	// minimum: 1
	Page int `json:"page" example:"1" minimum:"1"`
	// Maximum number of items per page
	// example: 10
	// minimum: 1
	// maximum: 100
	Limit int `json:"limit" example:"10" minimum:"1" maximum:"100"`

} // @name MetadataIndexes

MetadataIndexes represents a paginated list of metadata indexes @Description Paginated list of metadata indexes

type MetadataIndexesResponse added in v3.5.0

type MetadataIndexesResponse struct {
	// in: body
	Body MetadataIndexes
}

MetadataIndexesResponse represents a success response containing a paginated list of metadata indexes.

swagger:response MetadataIndexesResponse @Description Successful response containing a paginated list of metadata indexes.

type NaturalPerson added in v3.5.0

type NaturalPerson struct {
	// The person's nickname or preferred name.
	FavoriteName *string `json:"favoriteName,omitempty" example:"John"`
	// The social name or alternate name used by the person, if applicable.
	SocialName *string `json:"socialName,omitempty" example:"John Doe"`
	// Person's gender.
	Gender *string `json:"gender,omitempty" example:"Male"`
	// Person's birth date, formatted as YYYY-MM-DD.
	BirthDate *string `json:"birthDate,omitempty" example:"1990-01-01"`
	// Person's civil status, for example: "Single", "Married", or "Divorced".
	CivilStatus *string `json:"civilStatus,omitempty" example:"Single"`
	// The nationality of the person, for example, "Brazilian".
	Nationality *string `json:"nationality,omitempty" example:"Brazilian"`
	// The name of the person's mother.
	MotherName *string `json:"motherName,omitempty" example:"Jane Doe"`
	// The name of the person's father.
	FatherName *string `json:"fatherName,omitempty" example:"John Doe"`
	// The current status of the individual.
	Status *string `json:"status,omitempty" example:"Active"`

} // @name NaturalPerson

NaturalPerson is a struct designed to store natural person data.

swagger:model NaturalPerson @Description NaturalPerson object

type OperationRoute

type OperationRoute struct {
	// The unique identifier of the Operation Route.
	ID uuid.UUID `json:"id,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// The unique identifier of the Organization.
	OrganizationID uuid.UUID `json:"organizationId,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// The unique identifier of the Ledger.
	LedgerID uuid.UUID `json:"ledgerId,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// Short text summarizing the purpose of the operation. Used as an entry note for identification.
	Title string `json:"title,omitempty" example:"Cashin from service charge"`
	// Detailed description of the operation route purpose and usage.
	Description string `json:"description,omitempty" example:"This operation route handles cash-in transactions from service charge collections"`
	// External reference of the operation route.
	Code string `json:"code,omitempty" example:"EXT-001"`
	// The type of the operation route.
	OperationType string `json:"operationType,omitempty" example:"source" enum:"source,destination"`
	// Additional metadata stored as JSON
	Metadata map[string]any `json:"metadata,omitempty" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`
	// The account selection rule configuration.
	Account *AccountRule `json:"account,omitempty"`
	// The timestamp when the operation route was created.
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`
	// The timestamp when the operation route was last updated.
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`
	// The timestamp when the operation route was deleted.
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

} // @name OperationRoute

OperationRoute is a struct designed to store Operation Route object data.

swagger:model OperationRoute @Description OperationRoute object

type OperationRouteCache

type OperationRouteCache struct {
	Account *AccountCache `json:"account,omitempty"`
}

OperationRouteCache represents the cached data for a single operation route

type Organization

type Organization struct {
	// Unique identifier for the organization (UUID format)
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Reference to the parent organization, if this is a child organization
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	ParentOrganizationID *string `json:"parentOrganizationId" format:"uuid"`

	// Official legal name of the organization
	// example: Lerian Financial Services Ltd.
	// maxLength: 256
	LegalName string `json:"legalName" example:"Lerian Financial Services Ltd." maxLength:"256"`

	// Trading or brand name of the organization, if different from legal name
	// example: Lerian FS
	// maxLength: 256
	DoingBusinessAs *string `json:"doingBusinessAs" example:"Lerian FS" maxLength:"256"`

	// Official tax ID, company registration number, or other legal identification
	// example: 123456789012345
	// maxLength: 256
	LegalDocument string `json:"legalDocument" example:"123456789012345" maxLength:"256"`

	// Physical address of the organization
	Address Address `json:"address"`

	// Current operating status of the organization
	Status Status `json:"status"`

	// Timestamp when the organization was created (RFC3339 format)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the organization was last updated (RFC3339 format)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the organization was soft deleted, null if not deleted (RFC3339 format)
	// example: null
	// format: date-time
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Custom key-value pairs for extending the organization information
	// example: {"industry": "Financial Services", "founded": 2020, "employees": 150}
	Metadata map[string]any `json:"metadata,omitempty"`

} //	@name	Organization

Organization is a struct designed to encapsulate response payload data.

swagger:model Organization

@Description	Complete organization entity containing all fields including system-generated fields like ID, creation timestamps, and metadata. This is the response format for organization operations. Organizations are the top-level entities in the Midaz platform hierarchy.

@example		{
  "id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
  "legalName": "Lerian Financial Services Ltd.",
  "doingBusinessAs": "Lerian FS",
  "legalDocument": "123456789012345",
  "address": {
    "line1": "123 Financial Avenue",
    "line2": "Suite 1500",
    "zipCode": "10001",
    "city": "New York",
    "state": "NY",
    "country": "US"
  },
  "status": {
    "code": "ACTIVE"
  },
  "createdAt": "2022-04-15T09:30:00Z",
  "updatedAt": "2022-04-15T09:30:00Z",
  "metadata": {
    "industry": "Financial Services",
    "founded": 2020,
    "employees": 150
  }
}

type OrganizationErrorResponse

type OrganizationErrorResponse struct {
	// in: body
	Body struct {
		// Error code identifying the specific error
		// example: 400001
		Code int `json:"code"`

		// Human-readable error message
		// example: Invalid input: field 'legalName' is required
		Message string `json:"message"`

		// Additional error details if available
		// example: {"field": "legalName", "violation": "required"}
		Details map[string]any `json:"details,omitempty"`
	}
}

OrganizationErrorResponse represents an error response for organization operations.

swagger:response OrganizationErrorResponse

@Description	Error response for organization operations with error code and message.

@example		{
  "code": 400001,
  "message": "Invalid input: field 'legalName' is required",
  "details": {
    "field": "legalName",
    "violation": "required"
  }
}

type OrganizationResponse

type OrganizationResponse struct {
	// in: body
	Body Organization
}

OrganizationResponse represents a success response containing a single organization.

swagger:response OrganizationResponse

@Description	Successful response containing a single organization entity.

type Organizations

type Organizations struct {
	// Array of organization records returned in this page
	// example: [{"id":"00000000-0000-0000-0000-000000000000","legalName":"Lerian Financial Services Ltd.","status":{"code":"ACTIVE"}}]
	Items []Organization `json:"items"`

	// Current page number in the pagination
	// example: 1
	// minimum: 1
	Page int `json:"page" example:"1" minimum:"1"`

	// Maximum number of items per page
	// example: 10
	// minimum: 1
	// maximum: 100
	Limit int `json:"limit" example:"10" minimum:"1" maximum:"100"`

} //	@name	Organizations

Organizations struct to return paginated list of organizations.

swagger:model Organizations

@Description	Paginated list of organizations with metadata about the current page, limit, and the organization items themselves. Used for list operations.

@example		{
  "items": [
    {
      "id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
      "legalName": "Lerian Financial Services Ltd.",
      "doingBusinessAs": "Lerian FS",
      "legalDocument": "123456789012345",
      "status": {
        "code": "ACTIVE"
      },
      "createdAt": "2022-04-15T09:30:00Z",
      "updatedAt": "2022-04-15T09:30:00Z"
    },
    {
      "id": "b2c3d4e5-f6a1-7890-bcde-2345678901cd",
      "legalName": "Global Finance Partners",
      "doingBusinessAs": "GFP",
      "legalDocument": "987654321012345",
      "status": {
        "code": "ACTIVE"
      },
      "createdAt": "2022-03-10T14:15:00Z",
      "updatedAt": "2022-03-10T14:15:00Z"
    }
  ],
  "page": 1,
  "limit": 10
}

type OrganizationsResponse

type OrganizationsResponse struct {
	// in: body
	Body Organizations
}

OrganizationsResponse represents a success response containing a paginated list of organizations.

swagger:response OrganizationsResponse

@Description	Successful response containing a paginated list of organizations.

type Portfolio

type Portfolio struct {
	// Unique identifier for the portfolio (UUID format)
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Name of the portfolio (max length 256 characters)
	Name string `json:"name" example:"My Portfolio" maxLength:"256"`

	// Optional external entity identifier (max length 256 characters)
	EntityID string `json:"entityId,omitempty" example:"00000000-0000-0000-0000-000000000000" maxLength:"256"`

	// ID of the ledger this portfolio belongs to (UUID format)
	LedgerID string `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// ID of the organization that owns this portfolio (UUID format)
	OrganizationID string `json:"organizationId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Status of the portfolio (active, inactive, pending)
	Status Status `json:"status"`

	// Timestamp when the portfolio was created
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the portfolio was last updated
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the portfolio was deleted (null if not deleted)
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Additional custom attributes for the portfolio
	Metadata map[string]any `json:"metadata,omitempty"`

} // @name Portfolio

Portfolio is a struct designed to encapsulate request update payload data.

swagger:model Portfolio

@Description Portfolio represents a collection of accounts grouped for specific purposes such as business units, departments, or client portfolios.

type PortfolioErrorResponse

type PortfolioErrorResponse struct {
	// in: body
	Body struct {
		// Error code identifying the specific error
		// example: 400001
		Code int `json:"code"`

		// Human-readable error message
		// example: Invalid input: field 'name' is required
		Message string `json:"message"`

		// Additional error details if available
		// example: {"field": "name", "violation": "required"}
		Details map[string]any `json:"details,omitempty"`
	}
}

PortfolioErrorResponse represents an error response for portfolio operations.

swagger:response PortfolioErrorResponse @Description Error response for portfolio operations with error code and message.

type PortfolioResponse

type PortfolioResponse struct {
	// in: body
	Body Portfolio
}

PortfolioResponse represents a success response containing a single portfolio.

swagger:response PortfolioResponse @Description Successful response containing a single portfolio entity.

type Portfolios

type Portfolios struct {
	// Array of portfolio records
	// example: [{"id":"00000000-0000-0000-0000-000000000000","name":"My Portfolio","ledgerId":"00000000-0000-0000-0000-000000000000","status":{"code":"ACTIVE"}}]
	Items []Portfolio `json:"items"`

	// Current page number
	// example: 1
	// minimum: 1
	Page int `json:"page" example:"1" minimum:"1"`

	// Maximum number of items per page
	// example: 10
	// minimum: 1
	// maximum: 100
	Limit int `json:"limit" example:"10" minimum:"1" maximum:"100"`

} // @name Portfolios

Portfolios struct to return get all.

swagger:model Portfolios

@Description Portfolios represents a paginated collection of portfolio records returned by list operations.

type PortfoliosResponse

type PortfoliosResponse struct {
	// in: body
	Body Portfolios
}

PortfoliosResponse represents a success response containing a paginated list of portfolios.

swagger:response PortfoliosResponse @Description Successful response containing a paginated list of portfolios.

type Queue

type Queue struct {
	// Organization identifier for the queue message
	// format: uuid
	// example: 00000000-0000-0000-0000-000000000000
	OrganizationID uuid.UUID `json:"organizationId" format:"uuid" example:"00000000-0000-0000-0000-000000000000"`

	// Ledger identifier for the queue message
	// format: uuid
	// example: 00000000-0000-0000-0000-000000000000
	LedgerID uuid.UUID `json:"ledgerId" format:"uuid" example:"00000000-0000-0000-0000-000000000000"`

	// Audit trail identifier for tracking queue operations
	// format: uuid
	// example: 00000000-0000-0000-0000-000000000000
	AuditID uuid.UUID `json:"auditId" format:"uuid" example:"00000000-0000-0000-0000-000000000000"`

	// Account identifier for the queue message
	// format: uuid
	// example: 00000000-0000-0000-0000-000000000000
	AccountID uuid.UUID `json:"accountId" format:"uuid" example:"00000000-0000-0000-0000-000000000000"`

	// Array of data items contained in this queue message
	// required: true
	QueueData []QueueData `json:"queueData"`

} // @name Queue

Queue is a struct designed for internal message queueing.

swagger:model Queue @Description Internal structure for message queue data transfer between services. Contains entity identifiers and a collection of queue data items.

type QueueData

type QueueData struct {
	// Unique identifier for this queue data item
	// format: uuid
	// example: 00000000-0000-0000-0000-000000000000
	ID uuid.UUID `json:"id" format:"uuid" example:"00000000-0000-0000-0000-000000000000"`

	// Raw JSON payload data
	// example: {"type": "transaction", "amount": 1000}
	Value json.RawMessage `json:"value"`

} // @name QueueData

QueueData is a struct representing a single data item in a queue message.

swagger:model QueueData @Description Individual data item within a queue message, containing a unique identifier and a JSON payload.

type RegulatoryFields added in v3.5.0

type RegulatoryFields struct {
	// Document of the participant (identifies which financial-group entity owns the relationship)
	ParticipantDocument *string `json:"participantDocument,omitempty" example:"12345678912345"`

} // @name RegulatoryFields

RegulatoryFields contains regulatory-specific fields for an alias.

swagger:model RegulatoryFields @Description RegulatoryFields object

type RelatedParty added in v3.5.0

type RelatedParty struct {
	// Unique identifier of the related party.
	ID *uuid.UUID `json:"id,omitempty" example:"00000000-0000-0000-0000-000000000000"`
	// Document of the related party.
	Document string `json:"document" validate:"required" example:"12345678900"`
	// Name of the related party.
	Name string `json:"name" validate:"required" example:"John Smith"`
	// Role of the related party (PRIMARY_HOLDER, LEGAL_REPRESENTATIVE, RESPONSIBLE_PARTY).
	Role string `json:"role" validate:"required,oneof=PRIMARY_HOLDER LEGAL_REPRESENTATIVE RESPONSIBLE_PARTY" example:"PRIMARY_HOLDER"`
	// Start date of the relationship. Accepts both "2025-01-01" and "2025-01-01T00:00:00Z" formats.
	StartDate Date `json:"startDate" validate:"required" example:"2025-01-01"`
	// End date of the relationship (optional). Accepts both "2025-01-01" and "2025-01-01T00:00:00Z" formats.
	EndDate *Date `json:"endDate,omitempty" example:"2026-01-01"`

} // @name RelatedParty

RelatedParty represents a party related to an alias.

swagger:model RelatedParty @Description RelatedParty object

type Representative added in v3.5.0

type Representative struct {
	// The legal representative’s name.
	Name *string `json:"name,omitempty" example:"John Doe"`
	// The document number of the legal representative.
	Document *string `json:"document,omitempty" example:"91315026015"`
	// The email address of the legal representative.
	Email *string `json:"email,omitempty" example:"john.doe@example.com"`
	// The role of the legal representative within the company.
	Role *string `json:"role,omitempty" example:"CFO"`

} // @name Representative

Representative is a struct designed to store legal person representative data.

swagger:model Representative @Description Representative object from LegalPerson

type Segment

type Segment struct {
	// Unique identifier for the segment (UUID format)
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Name of the segment (max length 256 characters)
	Name string `json:"name" example:"My Segment" maxLength:"256"`

	// ID of the ledger this segment belongs to (UUID format)
	LedgerID string `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// ID of the organization that owns this segment (UUID format)
	OrganizationID string `json:"organizationId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`

	// Status of the segment (active, inactive, pending)
	Status Status `json:"status"`

	// Timestamp when the segment was created
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the segment was last updated
	UpdatedAt time.Time `json:"updatedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Timestamp when the segment was deleted (null if not deleted)
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`

	// Additional custom attributes for the segment
	Metadata map[string]any `json:"metadata,omitempty"`

} // @name Segment

Segment is a struct designed to encapsulate payload data.

swagger:model Segment

@Description Segment represents a logical division within a ledger such as a business area, product line, or customer category.

type SegmentErrorResponse

type SegmentErrorResponse struct {
	// in: body
	Body struct {
		// Error code identifying the specific error
		// example: 400001
		Code int `json:"code"`

		// Human-readable error message
		// example: Invalid input: field 'name' is required
		Message string `json:"message"`

		// Additional error details if available
		// example: {"field": "name", "violation": "required"}
		Details map[string]any `json:"details,omitempty"`
	}
}

SegmentErrorResponse represents an error response for segment operations.

swagger:response SegmentErrorResponse @Description Error response for segment operations with error code and message.

type SegmentResponse

type SegmentResponse struct {
	// in: body
	Body Segment
}

SegmentResponse represents a success response containing a single segment.

swagger:response SegmentResponse @Description Successful response containing a single segment entity.

type Segments

type Segments struct {
	// Array of segment records
	// example: [{"id":"00000000-0000-0000-0000-000000000000","name":"My Segment","ledgerId":"00000000-0000-0000-0000-000000000000","status":{"code":"ACTIVE"}}]
	Items []Segment `json:"items"`

	// Current page number
	// example: 1
	// minimum: 1
	Page int `json:"page" example:"1" minimum:"1"`

	// Maximum number of items per page
	// example: 10
	// minimum: 1
	// maximum: 100
	Limit int `json:"limit" example:"10" minimum:"1" maximum:"100"`

} // @name Segments

Segments struct to return get all.

swagger:model Segments

@Description Segments represents a paginated collection of segment records returned by list operations.

type SegmentsResponse

type SegmentsResponse struct {
	// in: body
	Body Segments
}

SegmentsResponse represents a success response containing a paginated list of segments.

swagger:response SegmentsResponse @Description Successful response containing a paginated list of segments.

type Status

type Status struct {
	// Status code identifier, common values include: ACTIVE, INACTIVE, PENDING, SUSPENDED, DELETED
	Code string `json:"code" validate:"max=100" example:"ACTIVE" maxLength:"100" enum:"ACTIVE,INACTIVE,PENDING,SUSPENDED,DELETED"`

	// Optional human-readable description of the status
	Description *string `json:"description" validate:"omitempty,max=256" example:"Active status" maxLength:"256"`

} // @name Status

Status structure for marshaling/unmarshalling JSON.

swagger:model Status @Description Entity status information with a standardized code and optional description. Common status codes include: ACTIVE, INACTIVE, PENDING, SUSPENDED, DELETED.

func (Status) IsEmpty

func (s Status) IsEmpty() bool

IsEmpty method that set empty or nil in fields

type TransactionRedisQueue added in v3.3.0

type TransactionRedisQueue struct {
	HeaderID          string                     `json:"header_id"`
	TransactionID     uuid.UUID                  `json:"transaction_id"`
	OrganizationID    uuid.UUID                  `json:"organization_id"`
	LedgerID          uuid.UUID                  `json:"ledger_id"`
	Balances          []BalanceRedis             `json:"balances"`
	ParserDSL         pkgTransaction.Transaction `json:"parserDSL"`
	TTL               time.Time                  `json:"ttl"`
	Validate          *pkgTransaction.Responses  `json:"validate"`
	TransactionStatus string                     `json:"transaction_status"`
	TransactionDate   time.Time                  `json:"transaction_date"`
}

TransactionRedisQueue represents a transaction queue for cache-aside

type TransactionRoute

type TransactionRoute struct {
	// The unique identifier of the Transaction Route.
	ID uuid.UUID `json:"id,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// The unique identifier of the Organization.
	OrganizationID uuid.UUID `json:"organizationId,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// The unique identifier of the Ledger.
	LedgerID uuid.UUID `json:"ledgerId,omitempty" example:"01965ed9-7fa4-75b2-8872-fc9e8509ab0a"`
	// Short text summarizing the purpose of the transaction. Used as an entry note for identification.
	Title string `json:"title,omitempty" example:"Charge Settlement"`
	// A description for the Transaction Route.
	Description string `json:"description,omitempty" example:"Settlement route for service charges"`
	// Additional metadata stored as JSON
	Metadata map[string]any `json:"metadata,omitempty" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`
	// An object containing accounting data of Operation Routes from the Transaction Route.
	OperationRoutes []OperationRoute `json:"operationRoutes,omitempty"`
	// The timestamp when the transaction route was created.
	CreatedAt time.Time `json:"createdAt" example:"2025-01-01T00:00:00Z"`
	// The timestamp when the transaction route was last updated.
	UpdatedAt time.Time `json:"updatedAt" example:"2025-01-01T00:00:00Z"`
	// The timestamp when the transaction route was deleted.
	DeletedAt *time.Time `json:"deletedAt" example:"2025-01-01T00:00:00Z"`

} // @name TransactionRoute

TransactionRoute is a struct designed to store TransactionRoute data.

swagger:model TransactionRoute @Description TransactionRoute object

func (*TransactionRoute) ToCache

ToCache converts the transaction route into a cache structure for Redis storage. Returns a TransactionRouteCache struct with routes pre-categorized by type.

type TransactionRouteCache

type TransactionRouteCache struct {
	Source      map[string]OperationRouteCache `json:"source"`
	Destination map[string]OperationRouteCache `json:"destination"`
}

TransactionRouteCache represents the cache structure for transaction routes in Redis

func (*TransactionRouteCache) FromMsgpack

func (trcd *TransactionRouteCache) FromMsgpack(data []byte) error

FromMsgpack parses msgpack binary data into TransactionRouteCache

func (TransactionRouteCache) ToMsgpack

func (trcd TransactionRouteCache) ToMsgpack() ([]byte, error)

ToMsgpack converts TransactionRouteCache to msgpack binary data

type UpdateAccountInput

type UpdateAccountInput struct {
	// Updated name of the account
	// required: false
	// example: Primary Corporate Checking Account
	// maxLength: 256
	Name string `json:"name" validate:"max=256" example:"Primary Corporate Checking Account" maxLength:"256"`

	// Updated segment ID for the account
	// required: false
	// format: uuid
	SegmentID *string `json:"segmentId" validate:"omitempty,uuid" format:"uuid"`

	// Updated portfolio ID for the account
	// required: false
	// format: uuid
	PortfolioID *string `json:"portfolioId" validate:"omitempty,uuid" format:"uuid"`

	// Optional external identifier for linking to external systems
	// required: false
	// example: EXT-ACC-12345
	// maxLength: 256
	EntityID *string `json:"entityId" validate:"omitempty,max=256" example:"EXT-ACC-12345" maxLength:"256"`

	// Updated status of the account
	// required: false
	Status Status `json:"status"`

	// Whether the account should be blocked
	// required: false
	Blocked *bool `json:"blocked"`

	// Updated custom key-value pairs for extending the account information
	// required: false
	// example: {"department": "Global Treasury", "purpose": "Primary Operations", "region": "Global"}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`

	// NullFields tracks fields explicitly set to null in the request.
	// Used internally to enable RFC 7396 JSON Merge Patch semantics.
	// Hidden from JSON serialization.
	NullFields []string `json:"-"`

} // @name UpdateAccountInput

UpdateAccountInput is a struct designed to encapsulate request update payload data.

swagger:model UpdateAccountInput

@Description	Request payload for updating an existing account. All fields are optional - only specified fields will be updated. Omitted fields will remain unchanged. This allows partial updates to account properties such as name, status, portfolio, segment, and metadata.

@example		{
  "name": "Primary Corporate Checking Account",
  "status": {
    "code": "ACTIVE"
  },
  "metadata": {
    "department": "Global Treasury",
    "purpose": "Primary Operations",
    "region": "Global"
  }
}

type UpdateAccountTypeInput

type UpdateAccountTypeInput struct {
	// The name of the account type.
	Name string `json:"name,omitempty" validate:"max=100" example:"Current Assets"`
	// Detailed description of the account type.
	Description string `json:"description,omitempty" validate:"max=500" example:"Assets that are expected to be converted to cash within one year"`
	// Custom key-value pairs for extending the account type information
	// required: false
	// example: {"department": "Treasury", "purpose": "Operating Expenses", "region": "Global"}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`

} // @name UpdateAccountTypeInput

UpdateAccountTypeInput is a struct designed to store Account Type input data.

swagger:model UpdateAccountTypeInput @Description UpdateAccountTypeInput payload

type UpdateAliasInput added in v3.5.0

type UpdateAliasInput struct {
	// An object containing key-value pairs to add as metadata, where the field name is the key and the field value is the value.
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`
	// Object with banking information of the related account.
	BankingDetails *BankingDetails `json:"bankingDetails"`
	// Object with regulatory fields.
	RegulatoryFields *RegulatoryFields `json:"regulatoryFields,omitempty"`
	// List of related parties to add (appends to existing).
	RelatedParties []*RelatedParty `json:"relatedParties,omitempty"`

} // @name UpdateAliasRequest

UpdateAliasInput is a struct designed to encapsulate request update payload data.

swagger:model UpdateAliasInput @Description UpdateAliasRequest payload

type UpdateAssetInput

type UpdateAssetInput struct {
	// Updated name of the asset (optional, max length 256 characters)
	Name string `json:"name" validate:"max=256" example:"Bitcoin"`

	// Updated status of the asset (active, inactive, pending)
	Status Status `json:"status"`

	// Updated or additional custom attributes for the asset
	// Keys max length: 100 characters, Values max length: 2000 characters
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`

} //	@name	UpdateAssetInput

UpdateAssetInput is a struct design to encapsulate request update payload data.

swagger:model UpdateAssetInput

@Description	UpdateAssetInput is the input payload to update an existing asset's properties such as name, status, and metadata.

type UpdateBalance

type UpdateBalance struct {
	// Whether the account should be allowed to send funds from this balance
	// required: false
	// example: true
	AllowSending *bool `json:"allowSending" example:"true"`

	// Whether the account should be allowed to receive funds to this balance
	// required: false
	// example: true
	AllowReceiving *bool `json:"allowReceiving" example:"true"`

} // @name UpdateBalance

UpdateBalance is a struct designed to encapsulate balance update request payload data.

swagger:model UpdateBalance @Description Request payload for updating an existing balance's permissions. All fields are optional - only specified fields will be updated. Omitted fields will remain unchanged.

type UpdateHolderInput added in v3.5.0

type UpdateHolderInput struct {
	// Optional field for an external identifier to client correlation purposes.
	ExternalID *string `json:"externalId" example:"G4K7N8M"`
	// Holders name.
	Name *string `json:"name" example:"John Doe"`
	// Object of addresses.
	Addresses *Addresses `json:"addresses"`
	// Object with contact information.
	Contact *Contact `json:"contact"`
	// Object with natural person information.
	NaturalPerson *NaturalPerson `json:"naturalPerson"`
	// Object with legal person information.
	LegalPerson *LegalPerson `json:"legalPerson"`
	// An object containing key-value pairs to add as metadata, where the field name is the key and the field value is the value.
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`

} // @name UpdateHolderRequest

UpdateHolderInput is a struct designed to encapsulate update request data

swagger:model UpdateHolderInput @Description UpdateHolderRequest payload

type UpdateLedgerInput

type UpdateLedgerInput struct {
	// Updated display name of the ledger
	// required: false
	// example: Treasury Operations Global
	// maxLength: 256
	Name string `json:"name" validate:"max=256" example:"Treasury Operations Global" maxLength:"256"`

	// Updated status of the ledger
	// required: false
	Status Status `json:"status"`

	// Updated custom key-value pairs for extending the ledger information
	// required: false
	// example: {"department": "Global Finance", "currency": "USD", "region": "Global"}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`

} // @name UpdateLedgerInput

UpdateLedgerInput is a struct designed to encapsulate request update payload data.

swagger:model UpdateLedgerInput @Description Request payload for updating an existing ledger. All fields are optional - only specified fields will be updated. Omitted fields will remain unchanged.

type UpdateOperationRouteInput

type UpdateOperationRouteInput struct {
	// Short text summarizing the purpose of the operation. Used as an entry note for identification.
	Title string `json:"title,omitempty" validate:"max=50" example:"Cashin from service charge"`
	// Detailed description of the operation route purpose and usage.
	Description string `` /* 139-byte string literal not displayed */
	// External reference of the operation route.
	Code string `json:"code,omitempty" validate:"max=100" example:"EXT-001"`
	// Additional metadata stored as JSON
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`
	// The account selection rule configuration.
	Account *AccountRule `json:"account,omitempty"`

} // @name UpdateOperationRouteInput

UpdateOperationRouteInput is a struct designed to store Operation Route input data.

swagger:model UpdateOperationRouteInput @Description UpdateOperationRouteInput payload

type UpdateOrganizationInput

type UpdateOrganizationInput struct {
	// Updated legal name of the organization
	// required: false
	// example: Lerian Financial Group Ltd.
	// maxLength: 256
	LegalName string `json:"legalName" validate:"max=256" example:"Lerian Financial Group Ltd." maxLength:"256"`

	// Updated UUID of the parent organization if this is a child organization
	// required: false
	// format: uuid
	ParentOrganizationID *string `json:"parentOrganizationId" validate:"omitempty,uuid" format:"uuid"`

	// Updated trading or brand name of the organization
	// required: false
	// example: Lerian Group
	// maxLength: 256
	DoingBusinessAs string `json:"doingBusinessAs" validate:"max=256" example:"Lerian Group" maxLength:"256"`

	// Updated physical address of the organization
	// required: false
	Address Address `json:"address"`

	// Updated status of the organization
	// required: false
	Status Status `json:"status"`

	// Updated custom key-value pairs for extending the organization information
	// required: false
	// example: {"industry": "Financial Technology", "founded": 2020, "employees": 200, "headquarters": "New York"}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`

} //	@name	UpdateOrganizationInput

UpdateOrganizationInput is a struct designed to encapsulate request update payload data.

swagger:model UpdateOrganizationInput

@Description	Request payload for updating an existing organization. All fields are optional - only specified fields will be updated. Omitted fields will remain unchanged.

@example		{
  "legalName": "Lerian Financial Group Ltd.",
  "doingBusinessAs": "Lerian Group",
  "address": {
    "line1": "456 Corporate Plaza",
    "line2": "Floor 20",
    "zipCode": "10002",
    "city": "New York",
    "state": "NY",
    "country": "US"
  },
  "status": {
    "code": "ACTIVE"
  },
  "metadata": {
    "industry": "Financial Technology",
    "founded": 2020,
    "employees": 200,
    "headquarters": "New York"
  }
}

type UpdatePortfolioInput

type UpdatePortfolioInput struct {
	// Updated external entity identifier (optional, max length 256 characters)
	EntityID string `json:"entityId" validate:"omitempty,max=256" example:"00000000-0000-0000-0000-000000000000"`

	// Updated name of the portfolio (optional, max length 256 characters)
	Name string `json:"name" validate:"max=256" example:"My Portfolio Updated"`

	// Updated status of the portfolio (active, inactive, pending)
	Status Status `json:"status"`

	// Updated or additional custom attributes for the portfolio
	// Keys max length: 100 characters, Values max length: 2000 characters
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`

} // @name UpdatePortfolioInput

UpdatePortfolioInput is a struct design to encapsulate payload data.

swagger:model UpdatePortfolioInput

@Description UpdatePortfolioInput is the input payload to update an existing portfolio's properties such as name, entity ID, status, and metadata.

type UpdateSegmentInput

type UpdateSegmentInput struct {
	// Updated name of the segment (optional, max length 256 characters)
	Name string `json:"name" validate:"max=256" example:"My Segment Updated"`

	// Updated status of the segment (active, inactive, pending)
	Status Status `json:"status"`

	// Updated or additional custom attributes for the segment
	// Keys max length: 100 characters, Values max length: 2000 characters
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`

} // @name UpdateSegmentInput

UpdateSegmentInput is a struct design to encapsulate request update payload data.

swagger:model UpdateSegmentInput

@Description UpdateSegmentInput is the input payload to update an existing segment's properties such as name, status, and metadata.

type UpdateTransactionRouteInput

type UpdateTransactionRouteInput struct {
	// Short text summarizing the purpose of the transaction. Used as an entry note for identification.
	Title string `json:"title,omitempty" validate:"max=50" example:"Charge Settlement"`
	// A description for the Transaction Route.
	Description string `json:"description,omitempty" validate:"max=250" example:"Settlement route for service charges"`
	// Additional metadata stored as JSON
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`
	// An object containing accounting data of Operation Routes from the Transaction Route.
	OperationRoutes *[]uuid.UUID `json:"operationRoutes,omitempty"`

} // @name UpdateTransactionRouteInput

UpdateTransactionRouteInput is a struct designed to store transaction route update data.

swagger:model UpdateTransactionRouteInput @Description UpdateTransactionRouteInput payload

Jump to

Keyboard shortcuts

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