Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package models defines the data models used by the Midaz SDK.
Package models defines the data models used by the Midaz SDK.
Package models defines the data models used by the Midaz SDK.
Package models defines the data models used by the Midaz SDK.
Package models defines the data models used by the Midaz SDK.
Package models defines the data models used by the Midaz SDK.
This package provides models that either: 1. Directly align with backend types from pkg/mmodel where possible 2. Implement SDK-specific types only where necessary
The goal is to maintain a simple, direct approach without unnecessary abstraction layers while ensuring the SDK interfaces cleanly with the backend API.
Key Model Types:
Account: Represents an account in the Midaz system, which is a fundamental entity for tracking assets and balances. Accounts belong to organizations and ledgers.
Asset: Represents a type of value that can be tracked and transferred within the Midaz system, such as currencies, securities, or other financial instruments.
Balance: Represents the current state of an account's holdings for a specific asset, including total, available, and on-hold amounts.
Ledger: Represents a collection of accounts and transactions within an organization, providing a complete record of financial activities.
Organization: Represents a business entity that owns ledgers, accounts, and other resources within the Midaz system.
Portfolio: Represents a collection of accounts that belong to a specific entity within an organization and ledger, used for grouping and management.
Segment: Represents a categorization unit for more granular organization of accounts or other entities within a ledger.
Transaction: Represents a financial event that affects one or more accounts through a series of operations (debits and credits).
Operation: Represents an individual accounting entry within a transaction, typically a debit or credit to a specific account.
Queue: Represents a transaction queue for temporarily storing transaction data before processing, allowing for batched or asynchronous handling.
Each model type includes constructors, conversion methods between SDK and backend models, and utility methods for setting optional fields. Input structures for creating and updating resources are also provided.
Package models defines the data models used by the Midaz SDK.
Package models defines the data models used by the Midaz SDK.
Package models defines the data models used by the Midaz SDK.
Index ¶
- Constants
 - func GetAccountAlias(account Account) string
 - func GetAccountIdentifier(account Account) string
 - func IsStatusEmpty(status Status) bool
 - type Account
 - type AccountFilter
 - type AccountRule
 - type AccountType
 - type Accounts
 - type Address
 - type Amount
 - type AmountInput
 - type Asset
 - type Balance
 - type BaseResponse
 - type CreateAccountInput
 - func (input CreateAccountInput) ToMmodel() mmodel.CreateAccountInput
 - func (input *CreateAccountInput) Validate() error
 - func (input *CreateAccountInput) WithAlias(alias string) *CreateAccountInput
 - func (input *CreateAccountInput) WithEntityID(entityID string) *CreateAccountInput
 - func (input *CreateAccountInput) WithMetadata(metadata map[string]any) *CreateAccountInput
 - func (input *CreateAccountInput) WithParentAccountID(parentAccountID string) *CreateAccountInput
 - func (input *CreateAccountInput) WithPortfolioID(portfolioID string) *CreateAccountInput
 - func (input *CreateAccountInput) WithSegmentID(segmentID string) *CreateAccountInput
 - func (input *CreateAccountInput) WithStatus(status Status) *CreateAccountInput
 
- type CreateAccountTypeInput
 - func NewCreateAccountTypeInput(name, keyValue string) *CreateAccountTypeInput
 - func WithCreateAccountTypeDescription(input *CreateAccountTypeInput, description string) *CreateAccountTypeInput
 - func WithCreateAccountTypeMetadata(input *CreateAccountTypeInput, metadata map[string]any) *CreateAccountTypeInput
 
- type CreateAssetInput
 - type CreateLedgerInput
 - type CreateOperationInput
 - type CreateOperationRouteInput
 - func NewCreateOperationRouteInput(title, description, operationType string) *CreateOperationRouteInput
 - func WithCreateOperationRouteAccountAlias(input *CreateOperationRouteInput, alias string) *CreateOperationRouteInput
 - func WithCreateOperationRouteAccountType(input *CreateOperationRouteInput, accountTypes []string) *CreateOperationRouteInput
 - func WithCreateOperationRouteMetadata(input *CreateOperationRouteInput, metadata map[string]any) *CreateOperationRouteInput
 
- func (input *CreateOperationRouteInput) Validate() error
 - func (input *CreateOperationRouteInput) WithAccountAlias(alias string) *CreateOperationRouteInput
 - func (input *CreateOperationRouteInput) WithAccountTypes(accountTypes []string) *CreateOperationRouteInput
 - func (input *CreateOperationRouteInput) WithMetadata(metadata map[string]any) *CreateOperationRouteInput
 
- type CreateOrganizationInput
 - func (input *CreateOrganizationInput) ToMmodelCreateOrganizationInput() *mmodel.CreateOrganizationInput
 - func (input *CreateOrganizationInput) Validate() error
 - func (input *CreateOrganizationInput) WithAddress(address Address) *CreateOrganizationInput
 - func (input *CreateOrganizationInput) WithDoingBusinessAs(dba string) *CreateOrganizationInput
 - func (input *CreateOrganizationInput) WithLegalDocument(doc string) *CreateOrganizationInput
 - func (input *CreateOrganizationInput) WithMetadata(metadata map[string]any) *CreateOrganizationInput
 - func (input *CreateOrganizationInput) WithStatus(status Status) *CreateOrganizationInput
 
- type CreatePortfolioInput
 - type CreateSegmentInput
 - type CreateTransactionInput
 - func (input *CreateTransactionInput) ToLibTransaction() map[string]any
 - func (input *CreateTransactionInput) Validate() error
 - func (input *CreateTransactionInput) WithDescription(description string) *CreateTransactionInput
 - func (input *CreateTransactionInput) WithExternalID(externalID string) *CreateTransactionInput
 - func (input *CreateTransactionInput) WithMetadata(metadata map[string]any) *CreateTransactionInput
 - func (input *CreateTransactionInput) WithOperations(operations []CreateOperationInput) *CreateTransactionInput
 - func (input *CreateTransactionInput) WithSend(send *SendInput) *CreateTransactionInput
 
- type CreateTransactionRouteInput
 - type DSLAccountRef
 - type DSLAmount
 - type DSLDistribute
 - type DSLFromTo
 - type DSLSend
 - type DSLSource
 - type Destination
 - type DistributeInput
 - type ErrorResponse
 - type FromToInput
 - type Ledger
 - type ListAccountInput
 - type ListAccountResponse
 - type ListOptions
 - func (o *ListOptions) NextPage() *ListOptions
 - func (o *ListOptions) ToQueryParams() map[string]string
 - func (o *ListOptions) WithAdditionalParam(key, value string) *ListOptions
 - func (o *ListOptions) WithCursor(cursor string) *ListOptions
 - func (o *ListOptions) WithDateRange(startDate, endDate string) *ListOptions
 - func (o *ListOptions) WithFilter(key, value string) *ListOptions
 - func (o *ListOptions) WithFilters(filters map[string]string) *ListOptions
 - func (o *ListOptions) WithLimit(limit int) *ListOptions
 - func (o *ListOptions) WithOffset(offset int) *ListOptions
 - func (o *ListOptions) WithOrderBy(field string) *ListOptions
 - func (o *ListOptions) WithOrderDirection(direction SortDirection) *ListOptions
 - func (o *ListOptions) WithPage(page int) *ListOptions
 
- type ListResponse
 - type Metadata
 - type MetricsCount
 - type ObjectWithMetadata
 - type Operation
 - type OperationAmount
 - type OperationBalance
 - type OperationLog
 - type OperationResponse
 - type OperationRoute
 - type OperationRouteInputType
 - type OperationRouteType
 - type OperationType
 - type Operations
 - type OperationsResponse
 - type Organization
 - type Pagination
 - func (p *Pagination) CurrentPage() int
 - func (p *Pagination) HasMorePages() bool
 - func (p *Pagination) HasNextPage() bool
 - func (p *Pagination) HasPrevPage() bool
 - func (p *Pagination) NextPageOptions() *ListOptions
 - func (p *Pagination) PrevPageOptions() *ListOptions
 - func (p *Pagination) TotalPages() int
 
- type Portfolio
 - type Queue
 - type QueueData
 - type Rate
 - type Segment
 - type SendInput
 - type Share
 - type SortDirection
 - type Source
 - type SourceInput
 - type Status
 - type Timestamps
 - type Transaction
 - type TransactionDSLInput
 - func (input *TransactionDSLInput) GetAsset() string
 - func (input *TransactionDSLInput) GetDestinationAccounts() []validation.AccountReference
 - func (input *TransactionDSLInput) GetMetadata() map[string]any
 - func (input *TransactionDSLInput) GetSourceAccounts() []validation.AccountReference
 - func (input *TransactionDSLInput) GetValue() float64
 - func (input *TransactionDSLInput) ToTransactionMap() map[string]any
 - func (input *TransactionDSLInput) Validate() error
 
- type TransactionRoute
 - type UpdateAccountInput
 - func (input UpdateAccountInput) ToMmodel() mmodel.UpdateAccountInput
 - func (input *UpdateAccountInput) Validate() error
 - func (input *UpdateAccountInput) WithMetadata(metadata map[string]any) *UpdateAccountInput
 - func (input *UpdateAccountInput) WithName(name string) *UpdateAccountInput
 - func (input *UpdateAccountInput) WithPortfolioID(portfolioID string) *UpdateAccountInput
 - func (input *UpdateAccountInput) WithSegmentID(segmentID string) *UpdateAccountInput
 - func (input *UpdateAccountInput) WithStatus(status Status) *UpdateAccountInput
 
- type UpdateAccountTypeInput
 - func NewUpdateAccountTypeInput() *UpdateAccountTypeInput
 - func WithUpdateAccountTypeDescription(input *UpdateAccountTypeInput, description string) *UpdateAccountTypeInput
 - func WithUpdateAccountTypeMetadata(input *UpdateAccountTypeInput, metadata map[string]any) *UpdateAccountTypeInput
 - func WithUpdateAccountTypeName(input *UpdateAccountTypeInput, name string) *UpdateAccountTypeInput
 
- func (input *UpdateAccountTypeInput) Validate() error
 - func (input *UpdateAccountTypeInput) WithDescription(description string) *UpdateAccountTypeInput
 - func (input *UpdateAccountTypeInput) WithMetadata(metadata map[string]any) *UpdateAccountTypeInput
 - func (input *UpdateAccountTypeInput) WithName(name string) *UpdateAccountTypeInput
 
- type UpdateAssetInput
 - type UpdateBalanceInput
 - type UpdateLedgerInput
 - type UpdateOperationInput
 - type UpdateOperationRouteInput
 - func NewUpdateOperationRouteInput() *UpdateOperationRouteInput
 - func WithUpdateOperationRouteAccountAlias(input *UpdateOperationRouteInput, alias string) *UpdateOperationRouteInput
 - func WithUpdateOperationRouteAccountType(input *UpdateOperationRouteInput, accountTypes []string) *UpdateOperationRouteInput
 - func WithUpdateOperationRouteDescription(input *UpdateOperationRouteInput, description string) *UpdateOperationRouteInput
 - func WithUpdateOperationRouteMetadata(input *UpdateOperationRouteInput, metadata map[string]any) *UpdateOperationRouteInput
 - func WithUpdateOperationRouteTitle(input *UpdateOperationRouteInput, title string) *UpdateOperationRouteInput
 
- func (input *UpdateOperationRouteInput) Validate() error
 - func (input *UpdateOperationRouteInput) WithAccountTypes(accountTypes []string) *UpdateOperationRouteInput
 - func (input *UpdateOperationRouteInput) WithDescription(description string) *UpdateOperationRouteInput
 - func (input *UpdateOperationRouteInput) WithMetadata(metadata map[string]any) *UpdateOperationRouteInput
 - func (input *UpdateOperationRouteInput) WithTitle(title string) *UpdateOperationRouteInput
 
- type UpdateOrganizationInput
 - func (input *UpdateOrganizationInput) ToMmodelUpdateOrganizationInput() *mmodel.UpdateOrganizationInput
 - func (input *UpdateOrganizationInput) Validate() error
 - func (input *UpdateOrganizationInput) WithAddressUpdate(address Address) *UpdateOrganizationInput
 - func (input *UpdateOrganizationInput) WithDoingBusinessAsUpdate(dba string) *UpdateOrganizationInput
 - func (input *UpdateOrganizationInput) WithLegalName(legalName string) *UpdateOrganizationInput
 - func (input *UpdateOrganizationInput) WithStatusUpdate(status Status) *UpdateOrganizationInput
 - func (input *UpdateOrganizationInput) WithUpdateMetadata(metadata map[string]any) *UpdateOrganizationInput
 
- type UpdatePortfolioInput
 - func (input *UpdatePortfolioInput) Validate() error
 - func (input *UpdatePortfolioInput) WithMetadata(metadata map[string]any) *UpdatePortfolioInput
 - func (input *UpdatePortfolioInput) WithName(name string) *UpdatePortfolioInput
 - func (input *UpdatePortfolioInput) WithStatus(status Status) *UpdatePortfolioInput
 
- type UpdateSegmentInput
 - type UpdateTransactionInput
 - func (input *UpdateTransactionInput) Validate() error
 - func (input *UpdateTransactionInput) WithDescription(description string) *UpdateTransactionInput
 - func (input *UpdateTransactionInput) WithExternalID(externalID string) *UpdateTransactionInput
 - func (input *UpdateTransactionInput) WithMetadata(metadata map[string]any) *UpdateTransactionInput
 
- type UpdateTransactionRouteInput
 - func NewUpdateTransactionRouteInput() *UpdateTransactionRouteInput
 - func WithUpdateTransactionRouteDescription(input *UpdateTransactionRouteInput, description string) *UpdateTransactionRouteInput
 - func WithUpdateTransactionRouteMetadata(input *UpdateTransactionRouteInput, metadata map[string]any) *UpdateTransactionRouteInput
 - func WithUpdateTransactionRouteTitle(input *UpdateTransactionRouteInput, title string) *UpdateTransactionRouteInput
 
Constants ¶
const ( // TransactionStatusPending represents a transaction that is not yet completed // Pending transactions have been created but require explicit commitment // before their operations are applied to account balances. This status // is useful for implementing approval workflows or two-phase commits. TransactionStatusPending = "pending" // TransactionStatusCompleted represents a successfully completed transaction // Completed transactions have been fully processed and their operations // have been applied to the relevant account balances. This is the final // state for successful transactions. TransactionStatusCompleted = "completed" // TransactionStatusFailed represents a transaction that failed to process // Failed transactions encountered an error during processing and were // not applied to account balances. The transaction's FailureReason field // provides details about why the transaction failed. TransactionStatusFailed = "failed" // TransactionStatusCancelled represents a transaction that was cancelled // Cancelled transactions were explicitly cancelled before being committed. // Only pending transactions can be cancelled; completed transactions cannot // be reversed through cancellation. TransactionStatusCancelled = "cancelled" )
Transaction status constants define the possible states of a transaction in the Midaz system. These constants are used throughout the SDK to represent transaction statuses in a consistent way.
Transaction Lifecycle: 1. A transaction is created with status "pending" if it requires explicit commitment 2. When committed, the transaction transitions to "completed" 3. If issues occur, the transaction may transition to "failed" 4. A pending transaction can be cancelled, transitioning to "cancelled"
Usage Examples:
// Check if a transaction is pending and needs to be committed
if transaction.Status == models.TransactionStatusPending {
    // Commit the transaction
    committedTx, err := client.Transactions.CommitTransaction(
        context.Background(),
        "org-123",
        "ledger-456",
        transaction.ID,
    )
}
// Handle different transaction statuses
switch transaction.Status {
case models.TransactionStatusCompleted:
    fmt.Println("Transaction completed successfully")
case models.TransactionStatusPending:
    fmt.Println("Transaction is pending commitment")
case models.TransactionStatusFailed:
    fmt.Println("Transaction failed: ", transaction.FailureReason)
case models.TransactionStatusCancelled:
    fmt.Println("Transaction was cancelled")
}
    const ( // StatusActive represents an active resource that can be used normally // Active accounts can participate in transactions as both source and destination. StatusActive = "ACTIVE" // StatusInactive represents a temporarily inactive resource // Inactive accounts cannot participate in new transactions but can be reactivated. StatusInactive = "INACTIVE" // StatusPending represents a resource awaiting activation or approval // Pending accounts are in the process of being set up or approved. StatusPending = "PENDING" // StatusClosed represents a permanently closed resource // Closed accounts cannot participate in new transactions and cannot be reopened. StatusClosed = "CLOSED" )
Account status constants define the possible states of an account in the Midaz system. These constants are used throughout the SDK to represent account statuses in a consistent way.
const ( // DefaultLimit is the default number of items to return per page DefaultLimit = 10 // MaxLimit is the maximum number of items that can be requested per page MaxLimit = 100 // DefaultOffset is the default starting position for pagination DefaultOffset = 0 // DefaultPage is the default page number for backward compatibility DefaultPage = 1 // DefaultSortDirection is the default sort direction DefaultSortDirection = string(SortDescending) )
PaginationDefaults contains default values for pagination parameters. These constants define the standard default behavior for list operations.
const ( // QueryParamLimit is the query parameter name for limit QueryParamLimit = "limit" // QueryParamOffset is the query parameter name for offset QueryParamOffset = "offset" // QueryParamPage is the query parameter name for page (backward compatibility) QueryParamPage = "page" // QueryParamCursor is the query parameter name for cursor QueryParamCursor = "cursor" // QueryParamOrderBy is the query parameter name for the field to order by QueryParamOrderBy = "orderBy" // QueryParamOrderDirection is the query parameter name for sort direction QueryParamOrderDirection = "orderDirection" // QueryParamStartDate is the query parameter name for start date QueryParamStartDate = "startDate" // QueryParamEndDate is the query parameter name for end date QueryParamEndDate = "endDate" )
QueryParamNames contains the names of query parameters used for API requests. These constants ensure consistent parameter naming across all SDK operations.
Variables ¶
This section is empty.
Functions ¶
func GetAccountAlias ¶
GetAccountAlias safely returns the account alias or empty string if nil. This function prevents nil pointer exceptions when accessing the alias.
func GetAccountIdentifier ¶
GetAccountIdentifier returns the best identifier for an account: - Returns the alias if available - Falls back to ID if alias is not set
This helps prevent nil pointer exceptions and provides a consistent way to reference accounts across the application.
func IsStatusEmpty ¶
IsStatusEmpty returns true if the status is empty.
Types ¶
type Account ¶
Account represents an account in the Midaz Ledger. This is now an alias to mmodel.Account to avoid duplication while maintaining SDK-specific documentation and examples.
Account Types:
- ASSET: Represents resources owned by the entity (e.g., cash, inventory, receivables)
 - LIABILITY: Represents obligations owed by the entity (e.g., loans, payables)
 - EQUITY: Represents the residual interest in the assets after deducting liabilities
 - REVENUE: Represents increases in economic benefits during the accounting period
 - EXPENSE: Represents decreases in economic benefits during the accounting period
 
Account Statuses:
- ACTIVE: The account is in use and can participate in transactions
 - INACTIVE: The account is temporarily not in use but can be reactivated
 - CLOSED: The account is permanently closed and cannot be used in new transactions
 - PENDING: The account is awaiting approval or activation
 
Example Usage:
// Create a new customer asset account using the builder pattern
customerAccount := models.NewCreateAccountInput(
    "John Doe",
    "USD",
    "ASSET",
).WithAlias("customer:john.doe").
  WithMetadata(map[string]any{
    "customer_id": "cust-123",
    "email": "john.doe@example.com",
    "account_manager": "manager-456",
  })
Portfolio and Segment Organization: Accounts can be organized into portfolios and segments for better categorization and reporting. Portfolios represent high-level groupings (e.g., "Investments"), while segments provide finer-grained classification within portfolios (e.g., "US Equities", "International Bonds").
type AccountFilter ¶
type AccountFilter struct {
	// Status is a list of status codes to filter by
	Status []string `json:"status,omitempty"`
}
    AccountFilter for filtering accounts in listings. This structure defines the criteria for filtering accounts when listing them.
type AccountRule ¶
type AccountRule = mmodel.AccountRule
AccountRule is an alias for mmodel.AccountRule to maintain compatibility while using midaz entities.
type AccountType ¶
type AccountType = mmodel.AccountType
AccountType represents an account type in the Midaz Ledger. Account types define templates or categories for accounts, specifying their behavior and characteristics within the ledger system.
AccountTypes provide a way to standardize and categorize accounts by defining:
- Name: Human-readable name for the account type
 - Description: Detailed description of the account type's purpose
 - KeyValue: Unique identifier within the organization/ledger
 - Metadata: Custom attributes for account type configuration
 
Example Usage:
// Create a cash account type
cashType := &models.AccountType{
    ID:          "at-123",
    Name:        "Cash Account",
    Description: "Account type for liquid assets held in cash or cash equivalents.",
    KeyValue:    "CASH",
    Metadata: map[string]any{
        "category":    "liquid_assets",
        "risk_level":  "low",
        "currency":    "USD",
    },
}
// Create a receivables account type
receivablesType := &models.AccountType{
    ID:          "at-456",
    Name:        "Accounts Receivable",
    Description: "Account type for amounts owed by customers.",
    KeyValue:    "AR",
    Metadata: map[string]any{
        "category":        "receivables",
        "aging_required":  true,
        "credit_terms":    "net30",
    },
}
AccountType is an alias for mmodel.AccountType to maintain compatibility while using midaz entities.
type Accounts ¶
type Accounts struct {
	// Items is the collection of accounts in the current page
	Items []Account `json:"items"`
	// Page is the current page number
	Page int `json:"page"`
	// Limit is the maximum number of items per page
	Limit int `json:"limit"`
}
    Accounts represents a list of accounts. This structure is used for paginated responses when listing accounts.
func FromMmodel ¶
FromMmodel converts mmodel.Accounts to SDK Accounts. Since Account is now an alias to mmodel.Account, no conversion is needed for items.
type Address ¶
type Address struct {
	// Line1 is the primary address line (e.g., street number and name)
	Line1 string `json:"line1"`
	// Line2 is an optional secondary address line (e.g., apartment or suite number)
	Line2 *string `json:"line2,omitempty"`
	// ZipCode is the postal or ZIP code
	ZipCode string `json:"zipCode"`
	// City is the city or locality name
	City string `json:"city"`
	// State is the state, province, or region
	State string `json:"state"`
	// Country is the country, typically using ISO country codes
	Country string `json:"country"`
}
    Address represents a physical address. This structure is used across various models where address information is required, such as for organizations or account holders.
func FromMmodelAddress ¶
FromMmodelAddress converts an mmodel Address to an SDK Address (internal use only). This function is used for internal SDK operations when processing responses from the backend.
Parameters:
- modelAddress: The mmodel.Address to convert
 
Returns:
- A models.Address instance with the same values as the input mmodel.Address
 
func NewAddress ¶
NewAddress creates a new Address with the given parameters. This is a convenience constructor for creating Address objects with required fields.
Parameters:
- line1: The primary address line
 - zipCode: The postal or ZIP code
 - city: The city or locality name
 - state: The state, province, or region
 - country: The country code
 
Returns:
- A new Address instance with the specified fields
 
func (Address) ToMmodelAddress ¶
ToMmodelAddress converts an SDK Address to an mmodel Address (internal use only). This method is used for internal SDK operations when interfacing with the backend.
Returns:
- An mmodel.Address instance with the same values as this Address
 
type Amount ¶
type Amount struct {
	// The amount value in the smallest unit of the asset (e.g., cents)
	// example: 1500
	// minimum: 0
	Value *decimal.Decimal `json:"value" example:"1500" minimum:"0"`
} // @name Amount
    Amount structure for marshaling/unmarshalling JSON.
swagger:model Amount @Description Amount is the struct designed to represent the amount of an operation. Contains the value and scale (decimal places) of an operation amount.
type AmountInput ¶
type AmountInput struct {
	// Asset identifies the currency or asset type for this amount
	Asset string `json:"asset"`
	// Value is the numeric value of the amount as a decimal string
	Value string `json:"value"`
}
    AmountInput represents the amount details for an operation. This structure contains the value and asset code for an amount.
func (*AmountInput) ToMap ¶
func (input *AmountInput) ToMap() map[string]any
ToMap converts an AmountInput to a map. This is used internally by the SDK to convert the input to the format expected by the backend.
func (*AmountInput) Validate ¶
func (input *AmountInput) Validate() error
Validate checks that the AmountInput meets all validation requirements. It returns an error if any of the validation checks fail.
type Asset ¶
Asset is an alias for mmodel.Asset to maintain compatibility while using midaz entities.
type Balance ¶
Balance is an alias for mmodel.Balance to maintain compatibility while using midaz entities.
type BaseResponse ¶
type BaseResponse struct {
	// RequestID is a unique identifier for the API request
	// This can be used for troubleshooting and support
	RequestID string `json:"requestId,omitempty"`
}
    BaseResponse represents the common fields in all API responses. This structure is embedded in response models to provide standard fields that are present in all API responses.
type CreateAccountInput ¶
type CreateAccountInput struct {
	// Name is the human-readable name of the account.
	// Max length: 256 characters.
	Name string `json:"name"`
	// ParentAccountID is the ID of the parent account, if this is a sub-account.
	// Must be a valid UUID if provided.
	ParentAccountID *string `json:"parentAccountId,omitempty"`
	// EntityID is an optional external identifier for the account owner.
	// Max length: 256 characters.
	EntityID *string `json:"entityId,omitempty"`
	// AssetCode identifies the type of asset held in this account.
	// Required. Max length: 100 characters.
	AssetCode string `json:"assetCode"`
	// PortfolioID is the optional ID of the portfolio this account belongs to.
	// Must be a valid UUID if provided.
	PortfolioID *string `json:"portfolioId,omitempty"`
	// SegmentID is the optional ID of the segment this account belongs to.
	// Must be a valid UUID if provided.
	SegmentID *string `json:"segmentId,omitempty"`
	// Status represents the current status of the account (e.g., "ACTIVE", "CLOSED").
	Status Status `json:"status"`
	// Alias is an optional human-friendly identifier for the account.
	// Max length: 100 characters.
	Alias *string `json:"alias,omitempty"`
	// Type defines the account type (e.g., "ASSET", "LIABILITY", "EQUITY").
	// Required.
	Type string `json:"type"`
	// Metadata contains additional custom data associated with the account.
	// Keys max length: 100 characters, Values max length: 2000 characters.
	Metadata map[string]any `json:"metadata,omitempty"`
}
    CreateAccountInput is the input for creating an account. This structure contains all the fields that can be specified when creating a new account.
func NewCreateAccountInput ¶
func NewCreateAccountInput(name, assetCode, accountType string) *CreateAccountInput
NewCreateAccountInput creates a new CreateAccountInput with required fields. This constructor ensures that all mandatory fields are provided when creating an account input.
Parameters:
- name: Human-readable name for the account
 - assetCode: Code identifying the type of asset for this account
 - accountType: Type of the account (e.g., "ASSET", "LIABILITY", "EQUITY")
 
Returns:
- A pointer to the newly created CreateAccountInput with default active status
 
func (CreateAccountInput) ToMmodel ¶
func (input CreateAccountInput) ToMmodel() mmodel.CreateAccountInput
ToMmodel converts the SDK CreateAccountInput to mmodel.CreateAccountInput. This method is used internally to convert between SDK and backend models.
func (*CreateAccountInput) Validate ¶
func (input *CreateAccountInput) Validate() error
Validate checks if the CreateAccountInput meets the validation requirements. It returns an error if any of the validation checks fail.
func (*CreateAccountInput) WithAlias ¶
func (input *CreateAccountInput) WithAlias(alias string) *CreateAccountInput
WithAlias sets the account alias. An alias provides a human-friendly identifier for the account.
Parameters:
- alias: The alias to set for the account
 
Returns:
- A pointer to the modified CreateAccountInput for method chaining
 
func (*CreateAccountInput) WithEntityID ¶
func (input *CreateAccountInput) WithEntityID(entityID string) *CreateAccountInput
WithEntityID sets the entity ID. The entity ID can be used to associate the account with an external entity.
Parameters:
- entityID: The external entity identifier
 
Returns:
- A pointer to the modified CreateAccountInput for method chaining
 
func (*CreateAccountInput) WithMetadata ¶
func (input *CreateAccountInput) WithMetadata(metadata map[string]any) *CreateAccountInput
WithMetadata sets the metadata. Metadata can store additional custom information about the account.
Parameters:
- metadata: A map of key-value pairs to store as metadata
 
Returns:
- A pointer to the modified CreateAccountInput for method chaining
 
func (*CreateAccountInput) WithParentAccountID ¶
func (input *CreateAccountInput) WithParentAccountID(parentAccountID string) *CreateAccountInput
WithParentAccountID sets the parent account ID. This is used when creating a sub-account that belongs to a parent account.
Parameters:
- parentAccountID: The ID of the parent account
 
Returns:
- A pointer to the modified CreateAccountInput for method chaining
 
func (*CreateAccountInput) WithPortfolioID ¶
func (input *CreateAccountInput) WithPortfolioID(portfolioID string) *CreateAccountInput
WithPortfolioID sets the portfolio ID. This associates the account with a specific portfolio.
Parameters:
- portfolioID: The ID of the portfolio
 
Returns:
- A pointer to the modified CreateAccountInput for method chaining
 
func (*CreateAccountInput) WithSegmentID ¶
func (input *CreateAccountInput) WithSegmentID(segmentID string) *CreateAccountInput
WithSegmentID sets the segment ID. This associates the account with a specific segment within a portfolio.
Parameters:
- segmentID: The ID of the segment
 
Returns:
- A pointer to the modified CreateAccountInput for method chaining
 
func (*CreateAccountInput) WithStatus ¶
func (input *CreateAccountInput) WithStatus(status Status) *CreateAccountInput
WithStatus sets a custom status. This overrides the default "ACTIVE" status set by the constructor.
Parameters:
- status: The status to set for the account
 
Returns:
- A pointer to the modified CreateAccountInput for method chaining
 
type CreateAccountTypeInput ¶
type CreateAccountTypeInput struct {
	mmodel.CreateAccountTypeInput
}
    CreateAccountTypeInput wraps mmodel.CreateAccountTypeInput to maintain compatibility while using midaz entities.
func NewCreateAccountTypeInput ¶
func NewCreateAccountTypeInput(name, keyValue string) *CreateAccountTypeInput
NewCreateAccountTypeInput creates a new CreateAccountTypeInput with required fields. This constructor ensures that all mandatory fields are provided when creating an account type input.
Parameters:
- name: Human-readable name for the account type
 - keyValue: Unique identifier within the organization/ledger
 
Returns:
- A pointer to the newly created CreateAccountTypeInput
 
func WithCreateAccountTypeDescription ¶
func WithCreateAccountTypeDescription(input *CreateAccountTypeInput, description string) *CreateAccountTypeInput
WithCreateAccountTypeDescription sets the description for CreateAccountTypeInput. This adds a detailed description to the account type.
Parameters:
- input: The CreateAccountTypeInput to modify
 - description: The description for the account type
 
Returns:
- A pointer to the modified CreateAccountTypeInput for method chaining
 
func WithCreateAccountTypeMetadata ¶
func WithCreateAccountTypeMetadata(input *CreateAccountTypeInput, metadata map[string]any) *CreateAccountTypeInput
WithCreateAccountTypeMetadata sets the metadata for CreateAccountTypeInput. Metadata can store additional custom information about the account type.
Parameters:
- input: The CreateAccountTypeInput to modify
 - metadata: A map of key-value pairs to store as metadata
 
Returns:
- A pointer to the modified CreateAccountTypeInput for method chaining
 
func (*CreateAccountTypeInput) Validate ¶
func (input *CreateAccountTypeInput) Validate() error
Validate validates the CreateAccountTypeInput fields.
func (*CreateAccountTypeInput) WithDescription ¶
func (input *CreateAccountTypeInput) WithDescription(description string) *CreateAccountTypeInput
WithDescription sets the description for CreateAccountTypeInput (method on struct).
func (*CreateAccountTypeInput) WithMetadata ¶
func (input *CreateAccountTypeInput) WithMetadata(metadata map[string]any) *CreateAccountTypeInput
WithMetadata sets the metadata for CreateAccountTypeInput (method on struct).
type CreateAssetInput ¶
type CreateAssetInput struct {
	mmodel.CreateAssetInput
}
    CreateAssetInput wraps mmodel.CreateAssetInput to maintain compatibility while using midaz entities.
func NewCreateAssetInput ¶
func NewCreateAssetInput(name, code string) *CreateAssetInput
NewCreateAssetInput creates a new CreateAssetInput with required fields.
func (*CreateAssetInput) Validate ¶
func (input *CreateAssetInput) Validate() error
Validate validates the CreateAssetInput fields.
func (*CreateAssetInput) WithMetadata ¶
func (input *CreateAssetInput) WithMetadata(metadata map[string]any) *CreateAssetInput
WithMetadata sets the metadata.
func (*CreateAssetInput) WithStatus ¶
func (input *CreateAssetInput) WithStatus(status Status) *CreateAssetInput
WithStatus sets the status.
func (*CreateAssetInput) WithType ¶
func (input *CreateAssetInput) WithType(assetType string) *CreateAssetInput
WithType sets the asset type.
type CreateLedgerInput ¶
type CreateLedgerInput struct {
	mmodel.CreateLedgerInput
}
    CreateLedgerInput wraps mmodel.CreateLedgerInput to maintain compatibility while using midaz entities.
func NewCreateLedgerInput ¶
func NewCreateLedgerInput(name string) *CreateLedgerInput
NewCreateLedgerInput creates a new CreateLedgerInput with required fields.
func (*CreateLedgerInput) Validate ¶
func (input *CreateLedgerInput) Validate() error
Validate validates the CreateLedgerInput fields.
func (*CreateLedgerInput) WithMetadata ¶
func (input *CreateLedgerInput) WithMetadata(metadata map[string]any) *CreateLedgerInput
WithMetadata sets the metadata.
func (*CreateLedgerInput) WithStatus ¶
func (input *CreateLedgerInput) WithStatus(status Status) *CreateLedgerInput
WithStatus sets the status.
type CreateOperationInput ¶
type CreateOperationInput struct {
	// Type indicates whether this is a debit or credit operation
	// Must be either "debit" or "credit"
	Type string `json:"type"`
	// AccountID is the identifier of the account to be affected
	// This must be a valid account ID in the ledger
	AccountID string `json:"accountId"`
	// Amount is the numeric value of the operation as a decimal string
	// Examples: "100.50", "1000.00", "0.25"
	Amount string `json:"amount"`
	// AssetCode identifies the currency or asset type for this operation
	// Common examples include "USD", "EUR", "BTC", etc.
	AssetCode string `json:"assetCode,omitempty"`
	// AccountAlias is an optional human-readable name for the account
	// This can be used to reference accounts by their alias instead of ID
	// Format is typically "<type>:<identifier>[:subtype]", e.g., "customer:john.doe"
	AccountAlias *string `json:"accountAlias,omitempty"`
	// Route is the operation route identifier to use for this operation
	// This links the operation to a specific routing rule that determines
	// how the operation should be processed and what account rules to apply
	Route string `json:"route,omitempty"`
}
    CreateOperationInput is the input for creating an operation. This structure contains all the fields needed to create a new operation as part of a transaction.
func (*CreateOperationInput) Validate ¶
func (input *CreateOperationInput) Validate() error
Validate checks that the CreateOperationInput meets all validation requirements. It ensures that required fields are present and that all fields meet their validation constraints as defined in the API specification.
Returns:
- error: An error if validation fails, nil otherwise
 
type CreateOperationRouteInput ¶
type CreateOperationRouteInput struct {
	mmodel.CreateOperationRouteInput
}
    CreateOperationRouteInput wraps mmodel.CreateOperationRouteInput to maintain compatibility while using midaz entities.
func NewCreateOperationRouteInput ¶
func NewCreateOperationRouteInput(title, description, operationType string) *CreateOperationRouteInput
NewCreateOperationRouteInput creates a new CreateOperationRouteInput with required fields.
Parameters:
- title: Short text summarizing the purpose of the operation
 - description: Detailed description of the operation route purpose and usage
 - operationType: The type of the operation route ("source" or "destination")
 
Returns:
- A pointer to the newly created CreateOperationRouteInput
 
func WithCreateOperationRouteAccountAlias ¶
func WithCreateOperationRouteAccountAlias(input *CreateOperationRouteInput, alias string) *CreateOperationRouteInput
WithAccountAlias sets the account rule to use alias-based selection.
Parameters:
- input: The CreateOperationRouteInput to modify
 - alias: The account alias to use for selection
 
Returns:
- A pointer to the modified CreateOperationRouteInput for method chaining
 
func WithCreateOperationRouteAccountType ¶
func WithCreateOperationRouteAccountType(input *CreateOperationRouteInput, accountTypes []string) *CreateOperationRouteInput
WithAccountType sets the account rule to use account type-based selection.
Parameters:
- input: The CreateOperationRouteInput to modify
 - accountTypes: The account types to use for selection
 
Returns:
- A pointer to the modified CreateOperationRouteInput for method chaining
 
func WithCreateOperationRouteMetadata ¶
func WithCreateOperationRouteMetadata(input *CreateOperationRouteInput, metadata map[string]any) *CreateOperationRouteInput
WithMetadata sets the metadata for CreateOperationRouteInput.
Parameters:
- input: The CreateOperationRouteInput to modify
 - metadata: A map of key-value pairs to store as metadata
 
Returns:
- A pointer to the modified CreateOperationRouteInput for method chaining
 
func (*CreateOperationRouteInput) Validate ¶
func (input *CreateOperationRouteInput) Validate() error
Validate validates the CreateOperationRouteInput fields.
func (*CreateOperationRouteInput) WithAccountAlias ¶
func (input *CreateOperationRouteInput) WithAccountAlias(alias string) *CreateOperationRouteInput
WithAccountAlias sets the account rule to use alias-based selection (method on struct).
func (*CreateOperationRouteInput) WithAccountTypes ¶
func (input *CreateOperationRouteInput) WithAccountTypes(accountTypes []string) *CreateOperationRouteInput
WithAccountTypes sets the account rule to use account type-based selection (method on struct).
func (*CreateOperationRouteInput) WithMetadata ¶
func (input *CreateOperationRouteInput) WithMetadata(metadata map[string]any) *CreateOperationRouteInput
WithMetadata sets the metadata for CreateOperationRouteInput (method on struct).
type CreateOrganizationInput ¶
type CreateOrganizationInput struct {
	mmodel.CreateOrganizationInput
}
    CreateOrganizationInput wraps mmodel.CreateOrganizationInput to maintain compatibility while using midaz entities.
func NewCreateOrganizationInput ¶
func NewCreateOrganizationInput(legalName string) *CreateOrganizationInput
NewCreateOrganizationInput creates a new CreateOrganizationInput with required fields.
func (*CreateOrganizationInput) ToMmodelCreateOrganizationInput ¶
func (input *CreateOrganizationInput) ToMmodelCreateOrganizationInput() *mmodel.CreateOrganizationInput
ToMmodelCreateOrganizationInput converts the SDK CreateOrganizationInput to mmodel CreateOrganizationInput.
func (*CreateOrganizationInput) Validate ¶
func (input *CreateOrganizationInput) Validate() error
Validate validates the CreateOrganizationInput fields.
func (*CreateOrganizationInput) WithAddress ¶
func (input *CreateOrganizationInput) WithAddress(address Address) *CreateOrganizationInput
WithAddress sets the organization address.
func (*CreateOrganizationInput) WithDoingBusinessAs ¶
func (input *CreateOrganizationInput) WithDoingBusinessAs(dba string) *CreateOrganizationInput
WithDoingBusinessAs sets the doing business as name.
func (*CreateOrganizationInput) WithLegalDocument ¶
func (input *CreateOrganizationInput) WithLegalDocument(doc string) *CreateOrganizationInput
WithLegalDocument sets the legal document number.
func (*CreateOrganizationInput) WithMetadata ¶
func (input *CreateOrganizationInput) WithMetadata(metadata map[string]any) *CreateOrganizationInput
WithMetadata sets the organization metadata.
func (*CreateOrganizationInput) WithStatus ¶
func (input *CreateOrganizationInput) WithStatus(status Status) *CreateOrganizationInput
WithStatus sets the organization status.
type CreatePortfolioInput ¶
type CreatePortfolioInput struct {
	mmodel.CreatePortfolioInput
}
    CreatePortfolioInput wraps mmodel.CreatePortfolioInput to maintain compatibility while using midaz entities.
func NewCreatePortfolioInput ¶
func NewCreatePortfolioInput(entityID, name string) *CreatePortfolioInput
NewCreatePortfolioInput creates a new CreatePortfolioInput with required fields.
func (*CreatePortfolioInput) Validate ¶
func (input *CreatePortfolioInput) Validate() error
Validate validates the CreatePortfolioInput fields.
func (*CreatePortfolioInput) WithMetadata ¶
func (input *CreatePortfolioInput) WithMetadata(metadata map[string]any) *CreatePortfolioInput
WithMetadata sets the metadata.
func (*CreatePortfolioInput) WithStatus ¶
func (input *CreatePortfolioInput) WithStatus(status Status) *CreatePortfolioInput
WithStatus sets the status.
type CreateSegmentInput ¶
type CreateSegmentInput struct {
	mmodel.CreateSegmentInput
}
    CreateSegmentInput wraps mmodel.CreateSegmentInput to maintain compatibility while using midaz entities.
func NewCreateSegmentInput ¶
func NewCreateSegmentInput(name string) *CreateSegmentInput
NewCreateSegmentInput creates a new CreateSegmentInput with required fields.
func (*CreateSegmentInput) Validate ¶
func (input *CreateSegmentInput) Validate() error
Validate validates the CreateSegmentInput fields.
func (*CreateSegmentInput) WithMetadata ¶
func (input *CreateSegmentInput) WithMetadata(metadata map[string]any) *CreateSegmentInput
WithMetadata sets the metadata.
func (*CreateSegmentInput) WithStatus ¶
func (input *CreateSegmentInput) WithStatus(status Status) *CreateSegmentInput
WithStatus sets the status.
type CreateTransactionInput ¶
type CreateTransactionInput struct {
	// Template is an optional identifier for the transaction template to use
	// Templates can be used to create standardized transactions with predefined
	// structures and validation rules
	// Note: This is used for SDK logic but not sent in the API request
	Template string
	// Amount is the numeric value of the transaction as a decimal string
	// This represents the total value of the transaction (e.g., "100.50" for $100.50)
	// Note: This is used for validation but sent within the Send structure
	Amount string
	// AssetCode identifies the currency or asset type for this transaction
	// Common examples include "USD", "EUR", "BTC", etc.
	// Note: This is used for validation but sent within the Send structure
	AssetCode string
	// Operations contains the individual debit and credit operations
	// Each operation represents a single accounting entry (debit or credit)
	// The sum of all operations for each asset must balance to zero
	// Note: Operations are an alternative to Send and should not be serialized when Send is used
	Operations []CreateOperationInput
	// ChartOfAccountsGroupName is REQUIRED by the API specification
	// This categorizes the transaction under a specific chart of accounts group
	ChartOfAccountsGroupName string `json:"chartOfAccountsGroupName"`
	// Description is a human-readable description of the transaction (REQUIRED by API)
	// This should provide context about the purpose or nature of the transaction
	Description string `json:"description"`
	// Pending indicates whether the transaction should be created in a pending state
	// Pending transactions require explicit commitment before affecting account balances
	Pending bool `json:"pending,omitempty"`
	// Route is the transaction route identifier (optional)
	// This defines the overall flow of the transaction structure
	Route string `json:"route,omitempty"`
	// Metadata contains additional custom data for the transaction
	// This can be used to store application-specific information
	// such as references to external systems, tags, or other contextual data
	Metadata map[string]any `json:"metadata,omitempty"`
	// ExternalID is an optional identifier for linking to external systems
	// This can be used to correlate transactions with records in other systems
	// and to prevent duplicate transactions
	// Note: This is handled separately, not in request body for Send format
	ExternalID string
	// IdempotencyKey is a client-generated key to ensure transaction uniqueness
	// If a transaction with the same idempotency key already exists, that transaction
	// will be returned instead of creating a new one
	// Note: This is sent as a header (X-Idempotency), not in the request body
	IdempotencyKey string
	// Send contains the source and distribution information for the transaction (REQUIRED by API)
	// This is an alternative to using Operations and provides a more structured way
	// to define the transaction flow
	Send *SendInput `json:"send"`
}
    CreateTransactionInput is the input for creating a transaction. This structure contains all the fields needed to create a new transaction.
CreateTransactionInput is used with the TransactionsService.CreateTransaction method to create new transactions in the standard format (as opposed to the DSL format). It allows for specifying the transaction details including operations, metadata, and other properties.
When creating a transaction, the following rules apply:
- The transaction must be balanced (total debits must equal total credits for each asset)
 - Each operation must specify an account, type (debit or credit), amount, and asset code
 - The transaction can be created as pending (requiring explicit commitment later)
 - External IDs and idempotency keys can be used to prevent duplicate transactions
 
Example - Creating a simple payment transaction:
// Create a payment transaction with two operations (debit and credit)
input := &models.CreateTransactionInput{
    Description: "Payment for invoice #123",
    AssetCode:   "USD",
    Amount:      10000,
    Scale:       2, // $100.00
    Operations: []models.CreateOperationInput{
        {
            // Debit the customer's account (decrease balance)
            Type:        "debit",
            AccountID:   "acc-123", // Customer account ID
            AccountAlias: stringPtr("customer:john.doe"), // Optional alias
            Amount:      10000,
            AssetCode:   "USD",
            Scale:       2,
        },
        {
            // Credit the revenue account (increase balance)
            Type:        "credit",
            AccountID:   "acc-456", // Revenue account ID
            AccountAlias: stringPtr("revenue:payments"), // Optional alias
            Amount:      10000,
            AssetCode:   "USD",
            Scale:       2,
        },
    },
    Metadata: map[string]any{
        "invoice_id": "inv-123",
        "customer_id": "cust-456",
    },
    ExternalID: "payment-inv123-20230401",
}
Example - Creating a pending transaction:
// Create a pending transaction that requires explicit commitment
input := &models.CreateTransactionInput{
    Description: "Large transfer pending approval",
    AssetCode:   "USD",
    Amount:      100000,
    Scale:       2, // $1,000.00
    Operations: []models.CreateOperationInput{
        // Debit operation
        {
            Type:        "debit",
            AccountID:   "acc-789", // Source account ID
            Amount:      100000,
            AssetCode:   "USD",
            Scale:       2,
        },
        // Credit operation
        {
            Type:        "credit",
            AccountID:   "acc-012", // Target account ID
            Amount:      100000,
            AssetCode:   "USD",
            Scale:       2,
        },
    },
    Metadata: map[string]any{
        "requires_approval": true,
        "approval_level": "manager",
    },
}
// Later, after approval:
// client.Transactions.CommitTransaction(ctx, orgID, ledgerID, tx.ID)
Helper function for creating string pointers:
func stringPtr(s string) *string {
    return &s
}
func NewCreateTransactionInput ¶
func NewCreateTransactionInput(assetCode string, amount string) *CreateTransactionInput
NewCreateTransactionInput creates a new CreateTransactionInput with required fields. This constructor ensures that all mandatory fields are provided when creating a transaction input.
func (*CreateTransactionInput) ToLibTransaction ¶
func (input *CreateTransactionInput) ToLibTransaction() map[string]any
ToLibTransaction converts a CreateTransactionInput to a lib-commons transaction. This is used internally by the SDK to convert the input to the format expected by the backend.
func (*CreateTransactionInput) Validate ¶
func (input *CreateTransactionInput) Validate() error
Validate checks that the CreateTransactionInput meets all validation requirements. It returns an error if any of the validation checks fail.
func (*CreateTransactionInput) WithDescription ¶
func (input *CreateTransactionInput) WithDescription(description string) *CreateTransactionInput
WithDescription sets the description. This adds a human-readable description to the transaction.
func (*CreateTransactionInput) WithExternalID ¶
func (input *CreateTransactionInput) WithExternalID(externalID string) *CreateTransactionInput
WithExternalID sets the external ID. This links the transaction to external systems.
func (*CreateTransactionInput) WithMetadata ¶
func (input *CreateTransactionInput) WithMetadata(metadata map[string]any) *CreateTransactionInput
WithMetadata sets the metadata. This adds custom key-value data to the transaction.
func (*CreateTransactionInput) WithOperations ¶
func (input *CreateTransactionInput) WithOperations(operations []CreateOperationInput) *CreateTransactionInput
WithOperations sets the operations list. This defines the individual debit and credit operations.
func (*CreateTransactionInput) WithSend ¶
func (input *CreateTransactionInput) WithSend(send *SendInput) *CreateTransactionInput
WithSend sets the send structure. This provides an alternative way to define transaction flow.
type CreateTransactionRouteInput ¶
type CreateTransactionRouteInput struct {
	mmodel.CreateTransactionRouteInput
}
    CreateTransactionRouteInput wraps mmodel.CreateTransactionRouteInput to maintain compatibility while using midaz entities.
func NewCreateTransactionRouteInput ¶
func NewCreateTransactionRouteInput(title, description string, operationRoutes []string) *CreateTransactionRouteInput
NewCreateTransactionRouteInput creates a new CreateTransactionRouteInput with required fields.
Parameters:
- title: Short text summarizing the purpose of the transaction
 - description: A description for the Transaction Route
 
Returns:
- A pointer to the newly created CreateTransactionRouteInput
 
func WithTransactionRouteMetadata ¶
func WithTransactionRouteMetadata(input *CreateTransactionRouteInput, metadata map[string]any) *CreateTransactionRouteInput
WithTransactionRouteMetadata sets the metadata for CreateTransactionRouteInput.
Parameters:
- input: The CreateTransactionRouteInput to modify
 - metadata: A map of key-value pairs to store as metadata
 
Returns:
- A pointer to the modified CreateTransactionRouteInput for method chaining
 
func (*CreateTransactionRouteInput) Validate ¶
func (input *CreateTransactionRouteInput) Validate() error
Validate validates the CreateTransactionRouteInput fields.
func (*CreateTransactionRouteInput) WithMetadata ¶
func (input *CreateTransactionRouteInput) WithMetadata(metadata map[string]any) *CreateTransactionRouteInput
WithMetadata sets the metadata for CreateTransactionRouteInput (method on struct).
type DSLAccountRef ¶
type DSLAccountRef struct {
	Account string
}
    DSLAccountRef is a helper struct to implement the AccountReference interface
func (*DSLAccountRef) GetAccount ¶
func (ref *DSLAccountRef) GetAccount() string
GetAccount returns the account identifier
type DSLAmount ¶
type DSLAmount struct {
	// Value is the numeric value of the amount as a decimal string
	Value string `json:"value"`
	// Asset is the asset code for the amount
	Asset string `json:"asset,omitempty"`
}
    DSLAmount represents an amount with a value and asset code for DSL transactions. This is aligned with the lib-commons Amount structure.
type DSLDistribute ¶
type DSLDistribute struct {
	// Remaining is an optional remaining account
	Remaining string `json:"remaining,omitempty"`
	// To is a collection of destination accounts and amounts
	To []DSLFromTo `json:"to"`
}
    DSLDistribute represents the distribution of a DSL transaction. This is aligned with the lib-commons Distribute structure.
type DSLFromTo ¶
type DSLFromTo struct {
	// Account is the identifier of the account
	Account string `json:"account"`
	// Amount specifies the amount details if applicable
	Amount *DSLAmount `json:"amount,omitempty"`
	Share *Share `json:"share,omitempty"`
	// Remaining is an optional remaining account
	Remaining string `json:"remaining,omitempty"`
	// Rate is the exchange rate configuration
	Rate *Rate `json:"rate,omitempty"`
	// Description is a human-readable description
	Description string `json:"description,omitempty"`
	// ChartOfAccounts is the chart of accounts code
	ChartOfAccounts string `json:"chartOfAccounts,omitempty"`
	// Metadata contains additional custom data
	Metadata map[string]any `json:"metadata,omitempty"`
}
    DSLFromTo represents a source or destination in a DSL transaction. This is aligned with the lib-commons FromTo structure.
type DSLSend ¶
type DSLSend struct {
	// Asset identifies the currency or asset type for this transaction
	Asset string `json:"asset"`
	// Value is the numeric value of the transaction as a decimal string
	Value string `json:"value"`
	// Source specifies where the funds come from
	Source *DSLSource `json:"source,omitempty"`
	// Distribute specifies where the funds go to
	Distribute *DSLDistribute `json:"distribute,omitempty"`
}
    DSLSend represents the send operation in a DSL transaction. This is aligned with the lib-commons Send structure.
type DSLSource ¶
type DSLSource struct {
	// Remaining is an optional remaining account
	Remaining string `json:"remaining,omitempty"`
	// From is a collection of source accounts and amounts
	From []DSLFromTo `json:"from"`
}
    DSLSource represents the source of a DSL transaction. This is aligned with the lib-commons Source structure.
type Destination ¶
type Destination struct {
	// ID is the unique identifier for the destination account
	ID string `json:"id"`
	// Alias is an optional human-readable name for the destination account
	Alias *string `json:"alias,omitempty"`
	// Source indicates if this destination is also a source
	Source bool `json:"source"`
}
    Destination represents the destination of an operation. This identifies where funds or assets are going to in a transaction.
type DistributeInput ¶
type DistributeInput struct {
	// To contains the list of destination accounts and amounts
	To []FromToInput `json:"to"`
}
    DistributeInput represents the distribution information for a transaction. This structure contains the destination accounts for a transaction.
func (*DistributeInput) ToMap ¶
func (input *DistributeInput) ToMap() map[string]any
ToMap converts a DistributeInput to a map. This is used internally by the SDK to convert the input to the format expected by the backend.
func (*DistributeInput) Validate ¶
func (input *DistributeInput) Validate() error
Validate checks that the DistributeInput meets all validation requirements. It returns an error if any of the validation checks fail.
type ErrorResponse ¶
type ErrorResponse struct {
	// Error is the error message
	Error string `json:"error"`
	// Code is the error code for programmatic handling
	Code string `json:"code,omitempty"`
	// Details contains additional information about the error
	Details map[string]any `json:"details,omitempty"`
}
    ErrorResponse represents an error response from the API. This structure is used to parse and represent error responses returned by the Midaz API.
type FromToInput ¶
type FromToInput struct {
	// Account identifies the account affected by this operation
	Account string `json:"account"`
	// Amount specifies the amount details for this operation
	Amount AmountInput `json:"amount"`
	// Route is the operation route identifier for this operation (optional)
	// This links the operation to a specific routing rule
	Route string `json:"route,omitempty"`
	// Description provides additional context for this operation (optional)
	Description string `json:"description,omitempty"`
	// ChartOfAccounts specifies the chart of accounts for this operation (optional)
	ChartOfAccounts string `json:"chartOfAccounts,omitempty"`
	// AccountAlias provides an alternative account identifier (optional)
	AccountAlias string `json:"accountAlias,omitempty"`
	// Metadata contains additional custom data for this operation
	Metadata map[string]any `json:"metadata,omitempty"`
}
    FromToInput represents a single source or destination account in a transaction. This structure contains the account and amount details.
func (FromToInput) ToMap ¶
func (input FromToInput) ToMap() map[string]any
ToMap converts a FromToInput to a map. This is used internally by the SDK to convert the input to the format expected by the backend.
func (*FromToInput) Validate ¶
func (input *FromToInput) Validate() error
Validate checks that the FromToInput meets all validation requirements. It returns an error if any of the validation checks fail.
type Ledger ¶
Ledger is an alias for mmodel.Ledger to maintain compatibility while using midaz entities.
type ListAccountInput ¶
type ListAccountInput struct {
	// Page is the page number to retrieve
	Page int `json:"page,omitempty"`
	// PerPage is the number of items per page
	PerPage int `json:"perPage,omitempty"`
	// Filter contains the filtering criteria
	Filter AccountFilter `json:"filter,omitempty"`
}
    ListAccountInput for configuring account listing requests. This structure defines the parameters for listing accounts.
func (*ListAccountInput) Validate ¶
func (input *ListAccountInput) Validate() error
Validate checks if the ListAccountInput meets the validation requirements. It returns an error if any of the validation checks fail.
Returns:
- error: An error if the input is invalid, nil otherwise
 
type ListAccountResponse ¶
type ListAccountResponse struct {
	// Items is the collection of accounts in the current page
	Items []Account `json:"items"`
	// Total is the total number of accounts matching the criteria
	Total int `json:"total"`
	// CurrentPage is the current page number
	CurrentPage int `json:"currentPage"`
	// PageSize is the number of items per page
	PageSize int `json:"pageSize"`
	// TotalPages is the total number of pages
	TotalPages int `json:"totalPages"`
}
    ListAccountResponse for account listing responses. This structure represents the response from a list accounts request.
type ListOptions ¶
type ListOptions struct {
	// Limit is the maximum number of items to return per page
	Limit int `json:"limit,omitempty"`
	// Offset is the starting position for pagination
	Offset int `json:"offset,omitempty"`
	// Filters are additional filters to apply to the query
	// The map keys are filter names and values are the filter criteria
	Filters map[string]string `json:"filters,omitempty"`
	// OrderBy specifies the field to order results by
	OrderBy string `json:"orderBy,omitempty"`
	// OrderDirection is the order direction ("asc" for ascending or "desc" for descending)
	OrderDirection string `json:"orderDirection,omitempty"`
	// Page is the page number to return (when using page-based pagination)
	// This is kept for backward compatibility
	Page int `json:"page,omitempty"`
	// Cursor is the cursor for pagination (when using cursor-based pagination)
	// This is kept for backward compatibility
	Cursor string `json:"cursor,omitempty"`
	// StartDate and EndDate for filtering by date range
	// These should be in ISO 8601 format (YYYY-MM-DD)
	StartDate string `json:"startDate,omitempty"`
	EndDate   string `json:"endDate,omitempty"`
	// AdditionalParams contains additional parameters that are specific to certain endpoints
	// These parameters are not serialized to JSON but are used when making API requests
	AdditionalParams map[string]string `json:"-"`
}
    ListOptions represents the common options for list operations. This structure is used to specify filtering, pagination, and sorting parameters when retrieving lists of resources from the Midaz API.
func NewListOptions ¶
func NewListOptions() *ListOptions
NewListOptions creates a new ListOptions with default values. This constructor ensures that the default pagination values are applied consistently.
Returns:
- A new ListOptions instance with default values
 
func (*ListOptions) NextPage ¶
func (o *ListOptions) NextPage() *ListOptions
NextPage returns a copy of the ListOptions configured for the next page. This method is useful for implementing pagination in client code.
Returns:
- A new ListOptions instance configured for the next page
 
func (*ListOptions) ToQueryParams ¶
func (o *ListOptions) ToQueryParams() map[string]string
ToQueryParams converts ListOptions to a map of query parameters. This method transforms the ListOptions structure into a format suitable for use as URL query parameters in API requests.
Returns:
- A map of string key-value pairs representing the query parameters
 
func (*ListOptions) WithAdditionalParam ¶
func (o *ListOptions) WithAdditionalParam(key, value string) *ListOptions
WithAdditionalParam adds an additional query parameter.
Parameters:
- key: The parameter name
 - value: The parameter value
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithCursor ¶
func (o *ListOptions) WithCursor(cursor string) *ListOptions
WithCursor sets the cursor for cursor-based pagination.
Parameters:
- cursor: The pagination cursor
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithDateRange ¶
func (o *ListOptions) WithDateRange(startDate, endDate string) *ListOptions
WithDateRange sets the date range for filtering.
Parameters:
- startDate: The start date in ISO 8601 format (YYYY-MM-DD)
 - endDate: The end date in ISO 8601 format (YYYY-MM-DD)
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithFilter ¶
func (o *ListOptions) WithFilter(key, value string) *ListOptions
WithFilter adds a filter criterion.
Parameters:
- key: The filter name
 - value: The filter value
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithFilters ¶
func (o *ListOptions) WithFilters(filters map[string]string) *ListOptions
WithFilters sets multiple filters at once.
Parameters:
- filters: A map of filter names to values
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithLimit ¶
func (o *ListOptions) WithLimit(limit int) *ListOptions
WithLimit sets the maximum number of items to return per page. This method validates that the limit is within acceptable bounds.
Parameters:
- limit: The maximum number of items to return (will be capped at MaxLimit)
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithOffset ¶
func (o *ListOptions) WithOffset(offset int) *ListOptions
WithOffset sets the starting position for pagination.
Parameters:
- offset: The starting position (must be >= 0)
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithOrderBy ¶
func (o *ListOptions) WithOrderBy(field string) *ListOptions
WithOrderBy sets the field to order results by.
Parameters:
- field: The field name to sort by
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithOrderDirection ¶
func (o *ListOptions) WithOrderDirection(direction SortDirection) *ListOptions
WithOrderDirection sets the sort direction.
Parameters:
- direction: The sort direction (use models.SortAscending or models.SortDescending)
 
Returns:
- The modified ListOptions instance for method chaining
 
func (*ListOptions) WithPage ¶
func (o *ListOptions) WithPage(page int) *ListOptions
WithPage sets the page number for backward compatibility. Note: Using offset-based pagination (WithOffset) is recommended over page-based pagination.
Parameters:
- page: The page number (must be >= 1)
 
Returns:
- The modified ListOptions instance for method chaining
 
type ListResponse ¶
type ListResponse[T any] struct { // Embedding BaseResponse to include common response fields BaseResponse // Items is the collection of resources returned by the list operation Items []T `json:"items"` // Pagination contains information about the pagination state Pagination Pagination `json:"pagination,omitempty"` }
ListResponse is a generic response for list operations. It contains a collection of items along with pagination information.
type Metadata ¶
Metadata is a map of key-value pairs that can be attached to resources. It allows for storing arbitrary data with resources in a flexible way.
type MetricsCount ¶
type MetricsCount struct {
	// OrganizationsCount is the total number of organizations in the system
	OrganizationsCount int `json:"organizationsCount"`
	// LedgersCount is the total number of ledgers in the system
	LedgersCount int `json:"ledgersCount"`
	// AssetsCount is the total number of assets in the system
	AssetsCount int `json:"assetsCount"`
	// SegmentsCount is the total number of segments in the system
	SegmentsCount int `json:"segmentsCount"`
	// PortfoliosCount is the total number of portfolios in the system
	PortfoliosCount int `json:"portfoliosCount"`
	// AccountsCount is the total number of accounts in the system
	AccountsCount int `json:"accountsCount"`
	// TransactionsCount is the total number of transactions in the system
	TransactionsCount int `json:"transactionsCount"`
	// OperationsCount is the total number of operations in the system
	OperationsCount int `json:"operationsCount"`
}
    MetricsCount represents the count metrics for various entities in the Midaz system. It provides aggregated counts of different resource types within the system. This structure is used across various models to report on system usage and statistics.
func (MetricsCount) IsEmpty ¶
func (m MetricsCount) IsEmpty() bool
IsEmpty returns true if all count values are zero. This can be useful to check if the metrics response contains any data.
Returns:
- true if all metrics are zero, false otherwise
 
type ObjectWithMetadata ¶
type ObjectWithMetadata struct {
	// Metadata is a map of key-value pairs associated with the object
	Metadata map[string]any `json:"metadata,omitempty"`
}
    ObjectWithMetadata is an object that has metadata. This interface is implemented by resources that support attaching arbitrary metadata.
func (*ObjectWithMetadata) HasMetadata ¶
func (o *ObjectWithMetadata) HasMetadata() bool
HasMetadata checks if the object has metadata.
Returns:
- true if the object has metadata, false otherwise
 
type Operation ¶
type Operation struct {
	// Unique identifier for the operation
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Parent transaction identifier
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	TransactionID string `json:"transactionId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Human-readable description of the operation
	// example: Credit card operation
	// maxLength: 256
	Description string `json:"description" example:"Credit card operation" maxLength:"256"`
	// Type of operation (e.g., DEBIT, CREDIT)
	// example: DEBIT
	// maxLength: 50
	Type string `json:"type" example:"DEBIT" maxLength:"50"`
	// Asset code for the operation
	// example: BRL
	// minLength: 2
	// maxLength: 10
	AssetCode string `json:"assetCode" example:"BRL" minLength:"2" maxLength:"10"`
	// Chart of accounts code for accounting purposes
	// example: 1000
	// maxLength: 20
	ChartOfAccounts string `json:"chartOfAccounts" example:"1000" maxLength:"20"`
	// Operation amount information
	Amount Amount `json:"amount"`
	// Balance before the operation
	Balance OperationBalance `json:"balance"`
	// Balance after the operation
	BalanceAfter OperationBalance `json:"balanceAfter"`
	// Operation status information
	Status Status `json:"status"`
	// Account identifier associated with this operation
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	AccountID string `json:"accountId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Human-readable alias for the account
	// example: @person1
	// maxLength: 256
	AccountAlias string `json:"accountAlias" example:"@person1" maxLength:"256"`
	// Balance identifier affected by this operation
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	BalanceID string `json:"balanceId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Organization identifier
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	OrganizationID string `json:"organizationId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Ledger identifier
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	LedgerID string `json:"ledgerId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Route
	// example: 00000000-0000-0000-0000-000000000000
	// format: string
	Route string `json:"route" example:"00000000-0000-0000-0000-000000000000" format:"string"`
	// Timestamp when the operation was created
	// 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 operation was last updated
	// 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 operation was deleted (if soft-deleted)
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	DeletedAt *time.Time `json:"deletedAt" example:"2021-01-01T00:00:00Z" format:"date-time"`
	// Additional custom attributes
	// example: {"reason": "Purchase refund", "reference": "INV-12345"}
	Metadata map[string]any `json:"metadata"`
} // @name Operation
    Operation is a struct designed to encapsulate response payload data.
swagger:model Operation @Description Operation is a struct designed to store operation data. Represents a financial operation that affects account balances, including details such as amount, balance before and after, transaction association, and metadata.
type OperationAmount ¶
type OperationAmount struct {
	// Value is the string representation of the amount
	Value string `json:"value"`
}
    OperationAmount represents the amount structure in operation responses This is SDK-specific and used for backward compatibility
type OperationBalance ¶
type OperationBalance struct {
	// Amount available for transactions (in the smallest unit of asset)
	// example: 1500
	// minimum: 0
	Available *decimal.Decimal `json:"available" example:"1500" minimum:"0"`
	// Amount on hold and unavailable for transactions (in the smallest unit of asset)
	// example: 500
	// minimum: 0
	OnHold *decimal.Decimal `json:"onHold" example:"500" minimum:"0"`
} // @name OperationBalance
    OperationBalance structure for marshaling/unmarshalling JSON. Named OperationBalance to avoid conflict with existing Balance model
swagger:model OperationBalance @Description OperationBalance is the struct designed to represent the account balance. Contains available and on-hold amounts along with the scale (decimal places).
func (OperationBalance) IsEmpty ¶
func (b OperationBalance) IsEmpty() bool
IsEmpty method that set empty or nil in fields
type OperationLog ¶
type OperationLog struct {
	// Unique identifier for the operation
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	ID string `json:"id" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Parent transaction identifier
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	TransactionID string `json:"transactionId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Type of operation (e.g., creditCard, transfer, payment)
	// example: creditCard
	// maxLength: 50
	Type string `json:"type" example:"creditCard" maxLength:"50"`
	// Asset code for the operation
	// example: BRL
	// minLength: 2
	// maxLength: 10
	AssetCode string `json:"assetCode" example:"BRL" minLength:"2" maxLength:"10"`
	// Chart of accounts code for accounting purposes
	// example: 1000
	// maxLength: 20
	ChartOfAccounts string `json:"chartOfAccounts" example:"1000" maxLength:"20"`
	// Operation amount information
	Amount Amount `json:"amount"`
	// Balance before the operation
	Balance OperationBalance `json:"balance"`
	// Balance after the operation
	BalanceAfter OperationBalance `json:"balanceAfter"`
	// Operation status information
	Status Status `json:"status"`
	// Account identifier associated with this operation
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	AccountID string `json:"accountId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Human-readable alias for the account
	// example: @person1
	// maxLength: 256
	AccountAlias string `json:"accountAlias" example:"@person1" maxLength:"256"`
	// Balance identifier affected by this operation
	// example: 00000000-0000-0000-0000-000000000000
	// format: uuid
	BalanceID string `json:"balanceId" example:"00000000-0000-0000-0000-000000000000" format:"uuid"`
	// Timestamp when the operation log was created
	// example: 2021-01-01T00:00:00Z
	// format: date-time
	CreatedAt time.Time `json:"createdAt" example:"2021-01-01T00:00:00Z" format:"date-time"`
	// Additional custom attributes for audit tracking
	// example: {"audit_user": "system", "source": "api"}
	Metadata map[string]any `json:"metadata"`
} // @name OperationLog
    OperationLog is a struct designed to represent the operation data that should be stored in the audit log
@Description Immutable log entry for audit purposes representing a snapshot of operation state at a specific point in time.
type OperationResponse ¶
type OperationResponse struct {
	// in: body
	Body Operation
}
    OperationResponse represents a success response containing a single operation.
swagger:response OperationResponse @Description Successful response containing a single operation entity.
type OperationRoute ¶
type OperationRoute = mmodel.OperationRoute
OperationRoute is an alias for mmodel.OperationRoute to maintain compatibility while using midaz entities.
type OperationRouteInputType ¶
type OperationRouteInputType string
OperationRouteInputType represents the type for operation route input (different from response)
const ( OperationRouteInputTypeSource OperationRouteInputType = "source" OperationRouteInputTypeDestination OperationRouteInputType = "destination" )
type OperationRouteType ¶
type OperationRouteType string
OperationRouteType represents the type of operation route for backward compatibility
const ( OperationRouteTypeDebit OperationRouteType = "debit" OperationRouteTypeCredit OperationRouteType = "credit" // Response values that correspond to input values OperationRouteTypeSource OperationRouteType = "source" // Alternative name for source operations OperationRouteTypeDestination OperationRouteType = "destination" // Alternative name for destination operations )
type OperationType ¶
type OperationType string
OperationType represents the type of an operation. This is typically either a debit or credit in double-entry accounting.
const ( // OperationTypeDebit represents a debit operation. // In accounting, a debit typically increases asset and expense accounts, // and decreases liability, equity, and revenue accounts. OperationTypeDebit OperationType = "DEBIT" // OperationTypeCredit represents a credit operation. // In accounting, a credit typically increases liability, equity, and revenue accounts, // and decreases asset and expense accounts. OperationTypeCredit OperationType = "CREDIT" )
type Operations ¶
type Operations struct {
	// Array of operation records returned in this page
	Items []Operation `json:"items"`
	// Pagination information
	Pagination struct {
		Limit      int     `json:"limit"`
		NextCursor *string `json:"next_cursor,omitempty"`
		PrevCursor *string `json:"prev_cursor,omitempty"`
	} `json:"pagination"`
} // @name Operations
    Operations represents a paginated list of operations.
swagger:model Operations @Description Operations represents a paginated response containing a list of operations with pagination metadata.
type OperationsResponse ¶
type OperationsResponse struct {
	// in: body
	Body Operations
}
    OperationsResponse represents a success response containing a paginated list of operations.
swagger:response OperationsResponse @Description Successful response containing a paginated list of operations.
type Organization ¶
type Organization = mmodel.Organization
Organization is an alias for mmodel.Organization to maintain compatibility while using midaz entities.
type Pagination ¶
type Pagination struct {
	// Limit is the number of items per page
	Limit int `json:"limit"`
	// Offset is the starting position for the current page
	Offset int `json:"offset"`
	// Total is the total number of items available across all pages
	Total int `json:"total"`
	// PrevCursor is the cursor for the previous page (for cursor-based pagination)
	PrevCursor string `json:"prevCursor,omitempty"`
	// NextCursor is the cursor for the next page (for cursor-based pagination)
	NextCursor string `json:"nextCursor,omitempty"`
}
    Pagination represents pagination information for list operations. This structure is used in list responses to provide context about the pagination state and to help with navigating through paginated results.
func (*Pagination) CurrentPage ¶
func (p *Pagination) CurrentPage() int
CurrentPage returns the current page number (1-based). This is calculated based on the limit and offset values.
Returns:
- The current page number (starts from 1)
 
func (*Pagination) HasMorePages ¶
func (p *Pagination) HasMorePages() bool
HasMorePages returns true if there are more pages available. This is determined by checking if the offset plus limit is less than the total.
Returns:
- true if there are more pages available, false otherwise
 
func (*Pagination) HasNextPage ¶
func (p *Pagination) HasNextPage() bool
HasNextPage returns true if there is a next page available. This is determined by checking if there are more pages or if a next cursor is available.
Returns:
- true if there is a next page available, false otherwise
 
func (*Pagination) HasPrevPage ¶
func (p *Pagination) HasPrevPage() bool
HasPrevPage returns true if there is a previous page available. This is determined by checking if the offset is greater than 0 or if a previous cursor is available.
Returns:
- true if there is a previous page available, false otherwise
 
func (*Pagination) NextPageOptions ¶
func (p *Pagination) NextPageOptions() *ListOptions
NextPageOptions returns options for fetching the next page. This method uses the most appropriate pagination method (offset or cursor-based) based on what information is available.
Returns:
- A new ListOptions instance configured for the next page
 - nil if there is no next page available
 
func (*Pagination) PrevPageOptions ¶
func (p *Pagination) PrevPageOptions() *ListOptions
PrevPageOptions returns options for fetching the previous page. This method uses the most appropriate pagination method (offset or cursor-based) based on what information is available.
Returns:
- A new ListOptions instance configured for the previous page
 - nil if there is no previous page available
 
func (*Pagination) TotalPages ¶
func (p *Pagination) TotalPages() int
TotalPages returns the total number of pages available. This is calculated based on the total items and limit values.
Returns:
- The total number of pages
 
type Portfolio ¶
Portfolio is an alias for mmodel.Portfolio to maintain compatibility while using midaz entities.
type Queue ¶
type Queue struct {
	// OrganizationID is the unique identifier of the organization that owns this queue
	OrganizationID uuid.UUID `json:"organizationId"`
	// LedgerID is the identifier of the ledger associated with this queue
	LedgerID uuid.UUID `json:"ledgerId"`
	// AuditID is the identifier for audit tracking purposes
	AuditID uuid.UUID `json:"auditId"`
	// AccountID is the identifier of the account associated with this queue
	AccountID uuid.UUID `json:"accountId"`
	// QueueData contains the collection of data items in this queue
	QueueData []QueueData `json:"queueData"`
}
    Queue represents a transaction queue in the Midaz system. Queues are used to temporarily store transaction data before processing, allowing for batched or asynchronous transaction handling.
func FromMmodelQueue ¶
FromMmodelQueue converts an mmodel Queue to an SDK Queue. This function is used internally to convert between backend and SDK models.
Parameters:
- queue: The mmodel.Queue to convert
 
Returns:
- A models.Queue instance with the same values
 
func (*Queue) AddQueueData ¶
AddQueueData adds a new data item to the queue. This method appends a new data item with the provided ID and value.
Parameters:
- id: Unique identifier for the new queue data item
 - value: The data to store, as raw JSON
 
Returns:
- A pointer to the modified Queue for method chaining
 
func (*Queue) ToMmodelQueue ¶
ToMmodelQueue converts an SDK Queue to an mmodel Queue. This method is used internally to convert between SDK and backend models.
Returns:
- An mmodel.Queue instance with the same values
 
type QueueData ¶
type QueueData struct {
	// ID is the unique identifier for this queue data item
	ID uuid.UUID `json:"id"`
	// Value contains the actual data as raw JSON
	Value json.RawMessage `json:"value"`
}
    QueueData represents a single data item in a queue. Each item has a unique identifier and contains arbitrary JSON data.
type Rate ¶
type Rate struct {
	From       string `json:"from"`
	To         string `json:"to"`
	Value      string `json:"value"`
	ExternalID string `json:"externalId"`
}
    Rate represents an exchange rate configuration.
type Segment ¶
Segment is an alias for mmodel.Segment to maintain compatibility while using midaz entities.
type SendInput ¶
type SendInput struct {
	// Asset identifies the currency or asset type for this transaction
	Asset string `json:"asset"`
	// Value is the numeric value of the transaction as a decimal string
	Value string `json:"value"`
	// Source contains the source accounts for the transaction
	Source *SourceInput `json:"source"`
	// Distribute contains the destination accounts for the transaction
	Distribute *DistributeInput `json:"distribute"`
}
    SendInput represents the send information for a transaction. This structure contains the source and distribution details for a transaction.
type SortDirection ¶
type SortDirection string
SortDirection represents the direction for sorting results in list operations. This type is used to ensure consistent sort direction values across the SDK.
const ( // SortAscending indicates ascending sort order (A→Z, 0→9) SortAscending SortDirection = "asc" // SortDescending indicates descending sort order (Z→A, 9→0) SortDescending SortDirection = "desc" )
type Source ¶
type Source struct {
	// ID is the unique identifier for the source account
	ID string `json:"id"`
	// Alias is an optional human-readable name for the source account
	Alias *string `json:"alias,omitempty"`
	// Destination indicates if this source is also a destination
	Destination bool `json:"destination"`
}
    Source represents the source of an operation. This identifies where funds or assets are coming from in a transaction.
type SourceInput ¶
type SourceInput struct {
	// From contains the list of source accounts and amounts
	From []FromToInput `json:"from"`
}
    SourceInput represents the source information for a transaction. This structure contains the source accounts for a transaction.
func (*SourceInput) ToMap ¶
func (input *SourceInput) ToMap() map[string]any
ToMap converts a SourceInput to a map. This is used internally by the SDK to convert the input to the format expected by the backend.
func (*SourceInput) Validate ¶
func (input *SourceInput) Validate() error
Validate checks that the SourceInput meets all validation requirements. It returns an error if any of the validation checks fail.
type Status ¶
Status represents the status of an entity in the Midaz system. This is now an alias to mmodel.Status to avoid duplication while maintaining SDK-specific documentation and examples. Status is used across various models to indicate the current state of resources.
func NewStatus ¶
NewStatus creates a new Status with the given code. This is a convenience constructor for creating Status objects.
Parameters:
- code: The status code to set (e.g., "active", "pending", "closed")
 
Returns:
- A new Status instance with the specified code
 
func WithStatusDescription ¶
WithStatusDescription creates a new Status with a description.
type Timestamps ¶
type Timestamps struct {
	// CreatedAt is the timestamp when the resource was created
	CreatedAt time.Time `json:"createdAt"`
	// UpdatedAt is the timestamp when the resource was last updated
	UpdatedAt time.Time `json:"updatedAt"`
	// DeletedAt is the timestamp when the resource was deleted (if applicable)
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
}
    Timestamps represents common timestamp fields for resources. This structure is embedded in many models to provide standard creation, update, and deletion timestamps.
type Transaction ¶
type Transaction struct {
	// ID is the unique identifier for the transaction
	// This is a system-generated UUID that uniquely identifies the transaction
	ID string `json:"id"`
	// Template is an optional identifier for the transaction template used
	// Templates can be used to create standardized transactions with predefined
	// structures and validation rules
	Template string `json:"template,omitempty"`
	// Amount is the numeric value of the transaction as a decimal string
	// This represents the total value of the transaction (e.g., "100.50" for $100.50)
	Amount string `json:"amount"`
	// AssetCode identifies the currency or asset type for this transaction
	// Common examples include "USD", "EUR", "BTC", etc.
	AssetCode string `json:"assetCode"`
	// Route is the transaction route identifier that defines the overall flow
	// of the transaction, including the structure of operations to be executed
	Route string `json:"route,omitempty"`
	// Status indicates the current processing status of the transaction
	// See the Status enum for possible values (PENDING, COMPLETED, FAILED, CANCELED)
	Status Status `json:"status"`
	// ChartOfAccountsGroupName specifies the chart of accounts group to use
	// This categorizes the transaction under a specific group for accounting purposes
	ChartOfAccountsGroupName string `json:"chartOfAccountsGroupName,omitempty"`
	// Source contains the list of source account aliases used in this transaction
	// These are the accounts from which funds are debited
	Source []string `json:"source,omitempty"`
	// Destination contains the list of destination account aliases used in this transaction
	// These are the accounts to which funds are credited
	Destination []string `json:"destination,omitempty"`
	// Pending indicates whether the transaction is in a pending state
	// Pending transactions require explicit commitment before affecting account balances
	Pending bool `json:"pending,omitempty"`
	// LedgerID identifies the ledger this transaction belongs to
	// A ledger is a collection of accounts and transactions within an organization
	LedgerID string `json:"ledgerId"`
	// OrganizationID identifies the organization this transaction belongs to
	// An organization is the top-level entity that owns ledgers and accounts
	OrganizationID string `json:"organizationId"`
	// Operations contains the individual debit and credit operations
	// Each operation represents a single accounting entry (debit or credit)
	// The sum of all operations for each asset must balance to zero
	Operations []Operation `json:"operations,omitempty"`
	// Metadata contains additional custom data for the transaction
	// This can be used to store application-specific information
	// such as references to external systems, tags, or other contextual data
	Metadata map[string]any `json:"metadata,omitempty"`
	// CreatedAt is the timestamp when the transaction was created
	CreatedAt time.Time `json:"createdAt"`
	// UpdatedAt is the timestamp when the transaction was last updated
	UpdatedAt time.Time `json:"updatedAt"`
	// DeletedAt is the timestamp when the transaction was deleted, if applicable
	// This field is only set if the transaction has been soft-deleted
	DeletedAt *time.Time `json:"deletedAt,omitempty"`
	// ExternalID is an optional identifier for linking to external systems
	// This can be used to correlate transactions with records in other systems
	// and to prevent duplicate transactions
	ExternalID string `json:"externalId,omitempty"`
	// Description is a human-readable description of the transaction
	// This should provide context about the purpose or nature of the transaction
	Description string `json:"description,omitempty"`
}
    Transaction represents a transaction in the Midaz Ledger. A transaction is a financial event that affects one or more accounts through a series of operations (debits and credits).
Transactions are the core financial records in the Midaz system, representing the movement of assets between accounts. Each transaction consists of one or more operations (debits and credits) that must balance (sum to zero) for each asset type.
Transactions can be in different states as indicated by their Status field:
- PENDING: The transaction is created but not yet committed
 - COMPLETED: The transaction is committed and has affected account balances
 - FAILED: The transaction processing failed
 - CANCELED: The transaction was canceled before being committed
 
Example usage:
// Accessing transaction details
fmt.Printf("Transaction ID: %s\n", transaction.ID)
fmt.Printf("Amount: %d (scale: %d)\n", transaction.Amount, transaction.Scale)
fmt.Printf("Asset: %s\n", transaction.AssetCode)
fmt.Printf("Status: %s\n", transaction.Status)
fmt.Printf("Created: %s\n", transaction.CreatedAt.Format(time.RFC3339))
// Iterating through operations
for i, op := range transaction.Operations {
    fmt.Printf("Operation %d: %s %s %s on account %s\n",
        i+1, op.Type, op.AssetCode, op.Amount, op.AccountID)
}
// Accessing metadata
if reference, ok := transaction.Metadata["reference"].(string); ok {
    fmt.Printf("Reference: %s\n", reference)
}
func (*Transaction) ToTransactionMap ¶
func (t *Transaction) ToTransactionMap() map[string]any
ToTransactionMap converts an SDK Transaction to a map for API requests. This method is used internally to prepare data for the backend API.
type TransactionDSLInput ¶
type TransactionDSLInput struct {
	// ChartOfAccountsGroupName specifies the chart of accounts group to use
	ChartOfAccountsGroupName string `json:"chartOfAccountsGroupName,omitempty"`
	// Description provides a human-readable description of the transaction
	Description string `json:"description,omitempty"`
	// Send contains the sending configuration
	Send *DSLSend `json:"send,omitempty"`
	// Metadata contains additional custom data for the transaction
	Metadata map[string]any `json:"metadata,omitempty"`
	// Code is a custom transaction code for categorization
	Code string `json:"code,omitempty"`
	// Pending indicates whether the transaction requires explicit commitment
	Pending bool `json:"pending,omitempty"`
}
    TransactionDSLInput represents the input for creating a transaction using DSL. This is aligned with the lib-commons Transaction structure.
func FromTransactionMap ¶
func FromTransactionMap(data map[string]any) *TransactionDSLInput
FromTransactionMap converts a map from the API to a TransactionDSLInput. This replaces the previous direct lib-commons conversion.
func (*TransactionDSLInput) GetAsset ¶
func (input *TransactionDSLInput) GetAsset() string
GetAsset returns the asset code for the transaction
func (*TransactionDSLInput) GetDestinationAccounts ¶
func (input *TransactionDSLInput) GetDestinationAccounts() []validation.AccountReference
GetDestinationAccounts returns the destination accounts for the transaction
func (*TransactionDSLInput) GetMetadata ¶
func (input *TransactionDSLInput) GetMetadata() map[string]any
GetMetadata returns the metadata for the transaction
func (*TransactionDSLInput) GetSourceAccounts ¶
func (input *TransactionDSLInput) GetSourceAccounts() []validation.AccountReference
GetSourceAccounts returns the source accounts for the transaction
func (*TransactionDSLInput) GetValue ¶
func (input *TransactionDSLInput) GetValue() float64
GetValue returns the amount value for the transaction
func (*TransactionDSLInput) ToTransactionMap ¶
func (input *TransactionDSLInput) ToTransactionMap() map[string]any
ToTransactionMap converts a TransactionDSLInput to a map that can be used for API requests. This replaces the previous direct lib-commons conversion.
func (*TransactionDSLInput) Validate ¶
func (input *TransactionDSLInput) Validate() error
Validate checks if the TransactionDSLInput meets the validation requirements. It returns an error if any of the validation checks fail.
type TransactionRoute ¶
type TransactionRoute = mmodel.TransactionRoute
TransactionRoute is an alias for mmodel.TransactionRoute to maintain compatibility while using midaz entities.
type UpdateAccountInput ¶
type UpdateAccountInput struct {
	// Name is the human-readable name of the account.
	// Max length: 256 characters.
	Name string `json:"name"`
	// SegmentID is the optional ID of the segment this account belongs to.
	// Must be a valid UUID if provided.
	SegmentID *string `json:"segmentId,omitempty"`
	// PortfolioID is the optional ID of the portfolio this account belongs to.
	// Must be a valid UUID if provided.
	PortfolioID *string `json:"portfolioId,omitempty"`
	// Status represents the current status of the account (e.g., "ACTIVE", "CLOSED").
	Status Status `json:"status"`
	// Metadata contains additional custom data associated with the account.
	// Keys max length: 100 characters, Values max length: 2000 characters.
	Metadata map[string]any `json:"metadata,omitempty"`
}
    UpdateAccountInput is the input for updating an account. This structure contains the fields that can be modified when updating an existing account.
func NewUpdateAccountInput ¶
func NewUpdateAccountInput() *UpdateAccountInput
NewUpdateAccountInput creates a new UpdateAccountInput. This constructor initializes an empty update input that can be customized using the With* methods.
Returns:
- A pointer to the newly created UpdateAccountInput
 
func (UpdateAccountInput) ToMmodel ¶
func (input UpdateAccountInput) ToMmodel() mmodel.UpdateAccountInput
ToMmodel converts the SDK UpdateAccountInput to mmodel.UpdateAccountInput. This method is used internally to convert between SDK and backend models.
func (*UpdateAccountInput) Validate ¶
func (input *UpdateAccountInput) Validate() error
Validate checks if the UpdateAccountInput meets the validation requirements. It returns an error if any of the validation checks fail.
func (*UpdateAccountInput) WithMetadata ¶
func (input *UpdateAccountInput) WithMetadata(metadata map[string]any) *UpdateAccountInput
WithMetadata sets the metadata. This updates the custom metadata associated with the account.
Parameters:
- metadata: The new metadata map
 
Returns:
- A pointer to the modified UpdateAccountInput for method chaining
 
func (*UpdateAccountInput) WithName ¶
func (input *UpdateAccountInput) WithName(name string) *UpdateAccountInput
WithName sets the name. This updates the human-readable name of the account.
Parameters:
- name: The new name for the account
 
Returns:
- A pointer to the modified UpdateAccountInput for method chaining
 
func (*UpdateAccountInput) WithPortfolioID ¶
func (input *UpdateAccountInput) WithPortfolioID(portfolioID string) *UpdateAccountInput
WithPortfolioID sets the portfolio ID. This updates the portfolio association of the account.
Parameters:
- portfolioID: The new portfolio ID
 
Returns:
- A pointer to the modified UpdateAccountInput for method chaining
 
func (*UpdateAccountInput) WithSegmentID ¶
func (input *UpdateAccountInput) WithSegmentID(segmentID string) *UpdateAccountInput
WithSegmentID sets the segment ID. This updates the segment association of the account.
Parameters:
- segmentID: The new segment ID
 
Returns:
- A pointer to the modified UpdateAccountInput for method chaining
 
func (*UpdateAccountInput) WithStatus ¶
func (input *UpdateAccountInput) WithStatus(status Status) *UpdateAccountInput
WithStatus sets the status. This updates the status of the account.
Parameters:
- status: The new status for the account
 
Returns:
- A pointer to the modified UpdateAccountInput for method chaining
 
type UpdateAccountTypeInput ¶
type UpdateAccountTypeInput struct {
	mmodel.UpdateAccountTypeInput
}
    UpdateAccountTypeInput wraps mmodel.UpdateAccountTypeInput to maintain compatibility while using midaz entities.
func NewUpdateAccountTypeInput ¶
func NewUpdateAccountTypeInput() *UpdateAccountTypeInput
NewUpdateAccountTypeInput creates a new UpdateAccountTypeInput. This constructor initializes an empty update input that can be customized using the With* helper functions.
Returns:
- A pointer to the newly created UpdateAccountTypeInput
 
func WithUpdateAccountTypeDescription ¶
func WithUpdateAccountTypeDescription(input *UpdateAccountTypeInput, description string) *UpdateAccountTypeInput
WithUpdateAccountTypeDescription sets the description for UpdateAccountTypeInput. This updates the detailed description of the account type.
Parameters:
- input: The UpdateAccountTypeInput to modify
 - description: The new description for the account type
 
Returns:
- A pointer to the modified UpdateAccountTypeInput for method chaining
 
func WithUpdateAccountTypeMetadata ¶
func WithUpdateAccountTypeMetadata(input *UpdateAccountTypeInput, metadata map[string]any) *UpdateAccountTypeInput
WithUpdateAccountTypeMetadata sets the metadata for UpdateAccountTypeInput. This updates the custom metadata associated with the account type.
Parameters:
- input: The UpdateAccountTypeInput to modify
 - metadata: The new metadata map
 
Returns:
- A pointer to the modified UpdateAccountTypeInput for method chaining
 
func WithUpdateAccountTypeName ¶
func WithUpdateAccountTypeName(input *UpdateAccountTypeInput, name string) *UpdateAccountTypeInput
WithUpdateAccountTypeName sets the name for UpdateAccountTypeInput. This updates the human-readable name of the account type.
Parameters:
- input: The UpdateAccountTypeInput to modify
 - name: The new name for the account type
 
Returns:
- A pointer to the modified UpdateAccountTypeInput for method chaining
 
func (*UpdateAccountTypeInput) Validate ¶
func (input *UpdateAccountTypeInput) Validate() error
Validate validates the UpdateAccountTypeInput fields.
func (*UpdateAccountTypeInput) WithDescription ¶
func (input *UpdateAccountTypeInput) WithDescription(description string) *UpdateAccountTypeInput
WithDescription sets the description for UpdateAccountTypeInput (method on struct).
func (*UpdateAccountTypeInput) WithMetadata ¶
func (input *UpdateAccountTypeInput) WithMetadata(metadata map[string]any) *UpdateAccountTypeInput
WithMetadata sets the metadata for UpdateAccountTypeInput (method on struct).
func (*UpdateAccountTypeInput) WithName ¶
func (input *UpdateAccountTypeInput) WithName(name string) *UpdateAccountTypeInput
WithName sets the name for UpdateAccountTypeInput (method on struct).
type UpdateAssetInput ¶
type UpdateAssetInput struct {
	mmodel.UpdateAssetInput
}
    UpdateAssetInput wraps mmodel.UpdateAssetInput to maintain compatibility while using midaz entities.
func NewUpdateAssetInput ¶
func NewUpdateAssetInput() *UpdateAssetInput
NewUpdateAssetInput creates a new UpdateAssetInput.
func (*UpdateAssetInput) Validate ¶
func (input *UpdateAssetInput) Validate() error
Validate validates the UpdateAssetInput fields.
func (*UpdateAssetInput) WithMetadata ¶
func (input *UpdateAssetInput) WithMetadata(metadata map[string]any) *UpdateAssetInput
WithMetadata sets the metadata for UpdateAssetInput.
func (*UpdateAssetInput) WithName ¶
func (input *UpdateAssetInput) WithName(name string) *UpdateAssetInput
WithName sets the name for UpdateAssetInput.
func (*UpdateAssetInput) WithStatus ¶
func (input *UpdateAssetInput) WithStatus(status Status) *UpdateAssetInput
WithStatus sets the status for UpdateAssetInput.
type UpdateBalanceInput ¶
type UpdateBalanceInput struct {
	// Metadata contains additional custom data associated with the balance.
	Metadata map[string]any `json:"metadata,omitempty"`
}
    UpdateBalanceInput is the input for updating a balance. This structure contains the fields that can be modified when updating an existing balance.
func NewUpdateBalanceInput ¶
func NewUpdateBalanceInput() *UpdateBalanceInput
NewUpdateBalanceInput creates a new UpdateBalanceInput.
func (*UpdateBalanceInput) Validate ¶
func (input *UpdateBalanceInput) Validate() error
Validate validates the UpdateBalanceInput fields.
func (*UpdateBalanceInput) WithMetadata ¶
func (input *UpdateBalanceInput) WithMetadata(metadata map[string]any) *UpdateBalanceInput
WithMetadata sets the metadata for UpdateBalanceInput.
type UpdateLedgerInput ¶
type UpdateLedgerInput struct {
	mmodel.UpdateLedgerInput
}
    UpdateLedgerInput wraps mmodel.UpdateLedgerInput to maintain compatibility while using midaz entities.
func NewUpdateLedgerInput ¶
func NewUpdateLedgerInput() *UpdateLedgerInput
NewUpdateLedgerInput creates a new UpdateLedgerInput.
func (*UpdateLedgerInput) Validate ¶
func (input *UpdateLedgerInput) Validate() error
Validate validates the UpdateLedgerInput fields.
func (*UpdateLedgerInput) WithMetadata ¶
func (input *UpdateLedgerInput) WithMetadata(metadata map[string]any) *UpdateLedgerInput
WithMetadata sets the metadata for UpdateLedgerInput.
func (*UpdateLedgerInput) WithName ¶
func (input *UpdateLedgerInput) WithName(name string) *UpdateLedgerInput
WithName sets the name for UpdateLedgerInput.
func (*UpdateLedgerInput) WithStatus ¶
func (input *UpdateLedgerInput) WithStatus(status Status) *UpdateLedgerInput
WithStatus sets the status for UpdateLedgerInput.
type UpdateOperationInput ¶
type UpdateOperationInput struct {
	// Human-readable description of the operation
	// example: Credit card operation
	// maxLength: 256
	Description string `json:"description" validate:"max=256" example:"Credit card operation" maxLength:"256"`
	// Additional custom attributes
	// example: {"reason": "Purchase refund", "reference": "INV-12345"}
	Metadata map[string]any `json:"metadata" validate:"dive,keys,keymax=100,endkeys,omitempty,nonested,valuemax=2000"`
} // @name UpdateOperationInput
    UpdateOperationInput is a struct design to encapsulate payload data.
swagger:model UpdateOperationInput @Description UpdateOperationInput is the input payload to update an operation. Contains fields that can be modified after an operation is created.
type UpdateOperationRouteInput ¶
type UpdateOperationRouteInput struct {
	mmodel.UpdateOperationRouteInput
}
    UpdateOperationRouteInput wraps mmodel.UpdateOperationRouteInput to maintain compatibility while using midaz entities.
func NewUpdateOperationRouteInput ¶
func NewUpdateOperationRouteInput() *UpdateOperationRouteInput
NewUpdateOperationRouteInput creates a new UpdateOperationRouteInput.
Returns:
- A pointer to the newly created UpdateOperationRouteInput
 
func WithUpdateOperationRouteAccountAlias ¶
func WithUpdateOperationRouteAccountAlias(input *UpdateOperationRouteInput, alias string) *UpdateOperationRouteInput
WithAccountAlias sets the account rule to use alias-based selection for UpdateOperationRouteInput.
Parameters:
- input: The UpdateOperationRouteInput to modify
 - alias: The account alias to use for selection
 
Returns:
- A pointer to the modified UpdateOperationRouteInput for method chaining
 
func WithUpdateOperationRouteAccountType ¶
func WithUpdateOperationRouteAccountType(input *UpdateOperationRouteInput, accountTypes []string) *UpdateOperationRouteInput
WithAccountType sets the account rule to use account type-based selection for UpdateOperationRouteInput.
Parameters:
- input: The UpdateOperationRouteInput to modify
 - accountTypes: The account types to use for selection
 
Returns:
- A pointer to the modified UpdateOperationRouteInput for method chaining
 
func WithUpdateOperationRouteDescription ¶
func WithUpdateOperationRouteDescription(input *UpdateOperationRouteInput, description string) *UpdateOperationRouteInput
WithDescription sets the description for UpdateOperationRouteInput.
Parameters:
- input: The UpdateOperationRouteInput to modify
 - description: The new description for the operation route
 
Returns:
- A pointer to the modified UpdateOperationRouteInput for method chaining
 
func WithUpdateOperationRouteMetadata ¶
func WithUpdateOperationRouteMetadata(input *UpdateOperationRouteInput, metadata map[string]any) *UpdateOperationRouteInput
WithMetadata sets the metadata for UpdateOperationRouteInput.
Parameters:
- input: The UpdateOperationRouteInput to modify
 - metadata: A map of key-value pairs to store as metadata
 
Returns:
- A pointer to the modified UpdateOperationRouteInput for method chaining
 
func WithUpdateOperationRouteTitle ¶
func WithUpdateOperationRouteTitle(input *UpdateOperationRouteInput, title string) *UpdateOperationRouteInput
WithTitle sets the title for UpdateOperationRouteInput.
Parameters:
- input: The UpdateOperationRouteInput to modify
 - title: The new title for the operation route
 
Returns:
- A pointer to the modified UpdateOperationRouteInput for method chaining
 
func (*UpdateOperationRouteInput) Validate ¶
func (input *UpdateOperationRouteInput) Validate() error
Validate validates the UpdateOperationRouteInput fields.
func (*UpdateOperationRouteInput) WithAccountTypes ¶
func (input *UpdateOperationRouteInput) WithAccountTypes(accountTypes []string) *UpdateOperationRouteInput
WithAccountTypes sets the account rule to use account type-based selection for UpdateOperationRouteInput (method on struct).
func (*UpdateOperationRouteInput) WithDescription ¶
func (input *UpdateOperationRouteInput) WithDescription(description string) *UpdateOperationRouteInput
WithDescription sets the description for UpdateOperationRouteInput (method on struct).
func (*UpdateOperationRouteInput) WithMetadata ¶
func (input *UpdateOperationRouteInput) WithMetadata(metadata map[string]any) *UpdateOperationRouteInput
WithMetadata sets the metadata for UpdateOperationRouteInput (method on struct).
func (*UpdateOperationRouteInput) WithTitle ¶
func (input *UpdateOperationRouteInput) WithTitle(title string) *UpdateOperationRouteInput
WithTitle sets the title for UpdateOperationRouteInput (method on struct).
type UpdateOrganizationInput ¶
type UpdateOrganizationInput struct {
	mmodel.UpdateOrganizationInput
}
    UpdateOrganizationInput wraps mmodel.UpdateOrganizationInput to maintain compatibility while using midaz entities.
func NewUpdateOrganizationInput ¶
func NewUpdateOrganizationInput() *UpdateOrganizationInput
NewUpdateOrganizationInput creates a new UpdateOrganizationInput.
func (*UpdateOrganizationInput) ToMmodelUpdateOrganizationInput ¶
func (input *UpdateOrganizationInput) ToMmodelUpdateOrganizationInput() *mmodel.UpdateOrganizationInput
ToMmodelUpdateOrganizationInput converts the SDK UpdateOrganizationInput to mmodel UpdateOrganizationInput.
func (*UpdateOrganizationInput) Validate ¶
func (input *UpdateOrganizationInput) Validate() error
Validate validates the UpdateOrganizationInput fields.
func (*UpdateOrganizationInput) WithAddressUpdate ¶
func (input *UpdateOrganizationInput) WithAddressUpdate(address Address) *UpdateOrganizationInput
WithAddressUpdate sets the organization address for update.
func (*UpdateOrganizationInput) WithDoingBusinessAsUpdate ¶
func (input *UpdateOrganizationInput) WithDoingBusinessAsUpdate(dba string) *UpdateOrganizationInput
WithDoingBusinessAsUpdate sets the doing business as name for update.
func (*UpdateOrganizationInput) WithLegalName ¶
func (input *UpdateOrganizationInput) WithLegalName(legalName string) *UpdateOrganizationInput
WithLegalName sets the legal name for update.
func (*UpdateOrganizationInput) WithStatusUpdate ¶
func (input *UpdateOrganizationInput) WithStatusUpdate(status Status) *UpdateOrganizationInput
WithStatusUpdate sets the organization status for update.
func (*UpdateOrganizationInput) WithUpdateMetadata ¶
func (input *UpdateOrganizationInput) WithUpdateMetadata(metadata map[string]any) *UpdateOrganizationInput
WithUpdateMetadata sets the metadata for update.
type UpdatePortfolioInput ¶
type UpdatePortfolioInput struct {
	mmodel.UpdatePortfolioInput
}
    UpdatePortfolioInput wraps mmodel.UpdatePortfolioInput to maintain compatibility while using midaz entities.
func NewUpdatePortfolioInput ¶
func NewUpdatePortfolioInput() *UpdatePortfolioInput
NewUpdatePortfolioInput creates a new UpdatePortfolioInput.
func (*UpdatePortfolioInput) Validate ¶
func (input *UpdatePortfolioInput) Validate() error
Validate validates the UpdatePortfolioInput fields.
func (*UpdatePortfolioInput) WithMetadata ¶
func (input *UpdatePortfolioInput) WithMetadata(metadata map[string]any) *UpdatePortfolioInput
WithMetadata sets the metadata for UpdatePortfolioInput.
func (*UpdatePortfolioInput) WithName ¶
func (input *UpdatePortfolioInput) WithName(name string) *UpdatePortfolioInput
WithName sets the name for UpdatePortfolioInput.
func (*UpdatePortfolioInput) WithStatus ¶
func (input *UpdatePortfolioInput) WithStatus(status Status) *UpdatePortfolioInput
WithStatus sets the status for UpdatePortfolioInput.
type UpdateSegmentInput ¶
type UpdateSegmentInput struct {
	mmodel.UpdateSegmentInput
}
    UpdateSegmentInput wraps mmodel.UpdateSegmentInput to maintain compatibility while using midaz entities.
func NewUpdateSegmentInput ¶
func NewUpdateSegmentInput() *UpdateSegmentInput
NewUpdateSegmentInput creates a new UpdateSegmentInput.
func (*UpdateSegmentInput) Validate ¶
func (input *UpdateSegmentInput) Validate() error
Validate validates the UpdateSegmentInput fields.
func (*UpdateSegmentInput) WithMetadata ¶
func (input *UpdateSegmentInput) WithMetadata(metadata map[string]any) *UpdateSegmentInput
WithMetadata sets the metadata for UpdateSegmentInput.
func (*UpdateSegmentInput) WithName ¶
func (input *UpdateSegmentInput) WithName(name string) *UpdateSegmentInput
WithName sets the name for UpdateSegmentInput.
func (*UpdateSegmentInput) WithStatus ¶
func (input *UpdateSegmentInput) WithStatus(status Status) *UpdateSegmentInput
WithStatus sets the status for UpdateSegmentInput.
type UpdateTransactionInput ¶
type UpdateTransactionInput struct {
	// Metadata contains additional custom data for the transaction
	// This can be used to store application-specific information
	// such as references to external systems, tags, or other contextual data
	Metadata map[string]any `json:"metadata,omitempty"`
	// Description is a human-readable description of the transaction
	// This should provide context about the purpose or nature of the transaction
	Description string `json:"description,omitempty"`
	// ExternalID is an optional identifier for linking to external systems
	// This can be used to correlate transactions with records in other systems
	ExternalID string `json:"externalId,omitempty"`
}
    UpdateTransactionInput represents the input for updating a transaction. This structure contains the fields that can be updated on an existing transaction.
UpdateTransactionInput is used with the TransactionsService.UpdateTransaction method to update existing transactions. It allows for updating metadata and other mutable properties of a transaction.
Note that not all fields of a transaction can be updated after creation, especially for transactions that have already been committed. Typically, only metadata and certain status-related fields can be modified.
Example - Updating transaction metadata:
// Update a transaction's metadata
input := &models.UpdateTransactionInput{
    Metadata: map[string]any{
        "updated_by": "admin",
        "approval_status": "approved",
        "notes": "Verified and approved by finance team",
    },
}
updatedTx, err := client.Transactions.UpdateTransaction(
    ctx, orgID, ledgerID, transactionID, input,
)
func NewUpdateTransactionInput ¶
func NewUpdateTransactionInput() *UpdateTransactionInput
NewUpdateTransactionInput creates a new UpdateTransactionInput. This constructor initializes an empty update input that can be customized using the With* methods for a fluent API experience.
Returns:
- A pointer to the newly created UpdateTransactionInput
 
func (*UpdateTransactionInput) Validate ¶
func (input *UpdateTransactionInput) Validate() error
Validate checks if the UpdateTransactionInput meets the validation requirements. It returns an error if any of the validation checks fail.
Returns:
- error: An error if the input is invalid, nil otherwise
 
func (*UpdateTransactionInput) WithDescription ¶
func (input *UpdateTransactionInput) WithDescription(description string) *UpdateTransactionInput
WithDescription sets the description. This method allows updating the human-readable description of the transaction.
Parameters:
- description: The new description for the transaction
 
Returns:
- A pointer to the modified UpdateTransactionInput for method chaining
 
func (*UpdateTransactionInput) WithExternalID ¶
func (input *UpdateTransactionInput) WithExternalID(externalID string) *UpdateTransactionInput
WithExternalID sets the external ID. This method allows setting or updating the external system identifier for the transaction.
Parameters:
- externalID: The external identifier for linking to other systems
 
Returns:
- A pointer to the modified UpdateTransactionInput for method chaining
 
func (*UpdateTransactionInput) WithMetadata ¶
func (input *UpdateTransactionInput) WithMetadata(metadata map[string]any) *UpdateTransactionInput
WithMetadata sets the metadata. This method allows updating the custom metadata associated with the transaction.
Parameters:
- metadata: A map of key-value pairs to store as transaction metadata
 
Returns:
- A pointer to the modified UpdateTransactionInput for method chaining
 
type UpdateTransactionRouteInput ¶
type UpdateTransactionRouteInput struct {
	mmodel.UpdateTransactionRouteInput
}
    UpdateTransactionRouteInput wraps mmodel.UpdateTransactionRouteInput to maintain compatibility while using midaz entities.
func NewUpdateTransactionRouteInput ¶
func NewUpdateTransactionRouteInput() *UpdateTransactionRouteInput
NewUpdateTransactionRouteInput creates a new UpdateTransactionRouteInput.
Returns:
- A pointer to the newly created UpdateTransactionRouteInput
 
func WithUpdateTransactionRouteDescription ¶
func WithUpdateTransactionRouteDescription(input *UpdateTransactionRouteInput, description string) *UpdateTransactionRouteInput
WithUpdateTransactionRouteDescription sets the description for UpdateTransactionRouteInput.
Parameters:
- input: The UpdateTransactionRouteInput to modify
 - description: The new description for the transaction route
 
Returns:
- A pointer to the modified UpdateTransactionRouteInput for method chaining
 
func WithUpdateTransactionRouteMetadata ¶
func WithUpdateTransactionRouteMetadata(input *UpdateTransactionRouteInput, metadata map[string]any) *UpdateTransactionRouteInput
WithUpdateTransactionRouteMetadata sets the metadata for UpdateTransactionRouteInput.
Parameters:
- input: The UpdateTransactionRouteInput to modify
 - metadata: A map of key-value pairs to store as metadata
 
Returns:
- A pointer to the modified UpdateTransactionRouteInput for method chaining
 
func WithUpdateTransactionRouteTitle ¶
func WithUpdateTransactionRouteTitle(input *UpdateTransactionRouteInput, title string) *UpdateTransactionRouteInput
WithUpdateTransactionRouteTitle sets the title for UpdateTransactionRouteInput.
Parameters:
- input: The UpdateTransactionRouteInput to modify
 - title: The new title for the transaction route
 
Returns:
- A pointer to the modified UpdateTransactionRouteInput for method chaining
 
func (*UpdateTransactionRouteInput) Validate ¶
func (input *UpdateTransactionRouteInput) Validate() error
Validate validates the UpdateTransactionRouteInput fields.