Documentation
¶
Overview ¶
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2024 Blnk Finance Authors.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func HasFilters(c *gin.Context) bool
- func ParseFiltersFromBody(c *gin.Context, table string) (*filter.QueryFilterSet, *filter.QueryOptions, int, int, error)
- func ParseFiltersFromContext(c *gin.Context, opts *filter.ParseOptions) (*filter.QueryFilterSet, []filter.ParseError)
- func ParseQueryOptions(c *gin.Context, table string) *filter.QueryOptions
- type Api
- func (a Api) BackupDB(c *gin.Context)
- func (a Api) BackupDBS3(c *gin.Context)
- func (a Api) CreateAPIKey(c *gin.Context)
- func (a Api) CreateAccount(c *gin.Context)
- func (a Api) CreateBalance(c *gin.Context)
- func (a Api) CreateBalanceMonitor(c *gin.Context)
- func (a Api) CreateBulkTransactions(c *gin.Context)
- func (a Api) CreateIdentity(c *gin.Context)
- func (a Api) CreateLedger(c *gin.Context)
- func (a Api) CreateMatchingRule(c *gin.Context)
- func (a Api) DeleteBalanceMonitor(c *gin.Context)
- func (a *Api) DeleteHook(c *gin.Context)
- func (a Api) DeleteIdentity(c *gin.Context)
- func (a Api) DeleteMatchingRule(c *gin.Context)
- func (a Api) DetokenizeIdentity(c *gin.Context)
- func (a Api) DetokenizeIdentityField(c *gin.Context)
- func (a Api) FilterAccounts(c *gin.Context)
- func (a Api) FilterBalances(c *gin.Context)
- func (a Api) FilterIdentities(c *gin.Context)
- func (a Api) FilterLedgers(c *gin.Context)
- func (a Api) FilterTransactions(c *gin.Context)
- func (a Api) GetAccount(c *gin.Context)
- func (a Api) GetAllAccounts(c *gin.Context)
- func (a Api) GetAllBalanceMonitors(c *gin.Context)
- func (a Api) GetAllIdentities(c *gin.Context)
- func (a Api) GetAllLedgers(c *gin.Context)
- func (a Api) GetAllTransactions(c *gin.Context)
- func (a Api) GetBalance(c *gin.Context)
- func (a Api) GetBalanceAtTime(c *gin.Context)
- func (a Api) GetBalanceByIndicator(c *gin.Context)
- func (a Api) GetBalanceLineage(c *gin.Context)
- func (a Api) GetBalanceMonitor(c *gin.Context)
- func (a Api) GetBalanceMonitorsByBalanceID(c *gin.Context)
- func (a Api) GetBalances(c *gin.Context)
- func (a *Api) GetHook(c *gin.Context)
- func (a Api) GetIdentity(c *gin.Context)
- func (a Api) GetLedger(c *gin.Context)
- func (a Api) GetReconciliation(c *gin.Context)
- func (a Api) GetReindexProgress(c *gin.Context)
- func (a Api) GetTokenizedFields(c *gin.Context)
- func (a Api) GetTransaction(c *gin.Context)
- func (a Api) GetTransactionByRef(c *gin.Context)
- func (a Api) GetTransactionLineage(c *gin.Context)
- func (a Api) InstantReconciliation(c *gin.Context)
- func (a Api) ListAPIKeys(c *gin.Context)
- func (a *Api) ListHooks(c *gin.Context)
- func (a Api) MultiSearch(c *gin.Context)
- func (a Api) QueueTransaction(c *gin.Context)
- func (a Api) RecordTransaction(c *gin.Context)
- func (a Api) RecoverQueuedTransactions(c *gin.Context)
- func (a Api) RefundTransaction(c *gin.Context)
- func (a *Api) RegisterHook(c *gin.Context)
- func (a Api) RevokeAPIKey(c *gin.Context)
- func (a Api) Router() *gin.Engine
- func (a Api) Search(c *gin.Context)
- func (a Api) StartReconciliation(c *gin.Context)
- func (a Api) StartReindex(c *gin.Context)
- func (a Api) TakeBalanceSnapshots(c *gin.Context)
- func (a Api) TokenizeIdentity(c *gin.Context)
- func (a Api) TokenizeIdentityField(c *gin.Context)
- func (a Api) UpdateBalanceIdentity(c *gin.Context)
- func (a Api) UpdateBalanceMonitor(c *gin.Context)
- func (a *Api) UpdateHook(c *gin.Context)
- func (a Api) UpdateIdentity(c *gin.Context)
- func (a Api) UpdateInflightStatus(c *gin.Context)
- func (a Api) UpdateLedger(c *gin.Context)
- func (a Api) UpdateMatchingRule(c *gin.Context)
- func (a Api) UpdateMetadata(c *gin.Context)
- func (a Api) UploadExternalData(c *gin.Context)
- type FilterRequest
- type FilterResponse
- type MetadataRequest
- type ReindexRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasFilters ¶ added in v0.13.2
HasFilters checks if the request contains any filter parameters. It returns true if filters were provided, false otherwise.
func ParseFiltersFromBody ¶ added in v0.13.2
func ParseFiltersFromBody(c *gin.Context, table string) (*filter.QueryFilterSet, *filter.QueryOptions, int, int, error)
ParseFiltersFromBody parses filters from a JSON request body. The table parameter is used to validate sort fields against the allowed fields for that table. Returns the QueryFilterSet, QueryOptions, limit, offset, and any error.
func ParseFiltersFromContext ¶ added in v0.13.2
func ParseFiltersFromContext(c *gin.Context, opts *filter.ParseOptions) (*filter.QueryFilterSet, []filter.ParseError)
ParseFiltersFromContext parses query parameters into a QueryFilterSet using the filter package. It handles all filter parameters in the format: field_operator=value
Supported operators:
- eq: Equal (e.g., status_eq=APPLIED)
- ne: Not equal (e.g., status_ne=VOID)
- gt: Greater than (e.g., amount_gt=1000)
- gte: Greater than or equal (e.g., amount_gte=1000)
- lt: Less than (e.g., amount_lt=5000)
- lte: Less than or equal (e.g., amount_lte=5000)
- in: In set (e.g., currency_in=USD,EUR,GBP)
- between: Between range (e.g., created_at_between=2024-01-01|2024-12-31)
- like: Pattern match (e.g., name_like=%USD%)
- ilike: Case-insensitive pattern match (e.g., name_ilike=%usd%)
- isnull: Is null (e.g., identity_id_isnull=true)
- isnotnull: Is not null (e.g., identity_id_isnotnull=true)
Parameters: - c: The gin context containing the request - opts: Optional parse options to limit filters, values, etc.
Returns: - *filter.QueryFilterSet: The parsed filters, or nil if no filters found - []filter.ParseError: Any errors encountered during parsing
func ParseQueryOptions ¶ added in v0.13.2
func ParseQueryOptions(c *gin.Context, table string) *filter.QueryOptions
ParseQueryOptions extracts sorting options from query parameters. The table parameter is used to validate sort fields against the allowed fields for that table. Used for GET endpoints with query param filters.
Types ¶
type Api ¶
type Api struct {
// contains filtered or unexported fields
}
Api represents the API structure for handling requests.
func NewAPI ¶
NewAPI creates a new Api instance with the provided Blnk service and sets up the router.
Parameters: - b: The Blnk service used to interact with business logic.
Returns: - *Api: A new instance of the Api with the configured router.
func (Api) BackupDB ¶
BackupDB creates a backup of the database and stores it on disk. It initializes a BackupManager and performs the backup operation. If any error occurs during backup creation, it responds with an error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in creating the backup or initializing the BackupManager. - 200 OK: If the backup is successfully created and stored on disk.
func (Api) BackupDBS3 ¶
BackupDBS3 creates a backup of the database and stores it in S3. It initializes a BackupManager and performs the backup operation to S3. If any error occurs during backup creation, it responds with an error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in creating the backup or initializing the BackupManager. - 200 OK: If the backup is successfully created and stored in S3.
func (Api) CreateAPIKey ¶
CreateAPIKey creates a new API key for the authenticated user
Parameters: - c: The Gin context containing the request and response
Responses: - 400 Bad Request: If there's an error in the request body - 201 Created: If the API key is successfully created
func (Api) CreateAccount ¶
CreateAccount handles the creation of a new account. It binds the incoming JSON request body to a CreateAccount model, validates it, and creates the account if the input is valid.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding the JSON or validation fails. - 201 Created: If the account is successfully created. - 500 Internal Server Error: If there's an error in account creation.
func (Api) CreateBalance ¶
CreateBalance creates a new balance record in the system. It binds the incoming JSON request to a CreateBalance object, validates it, and then creates the balance record. If any errors occur during validation or creation, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON or validating the balance. - 201 Created: If the balance is successfully created.
func (Api) CreateBalanceMonitor ¶
CreateBalanceMonitor creates a new balance monitor record in the system. It binds the incoming JSON request to a CreateBalanceMonitor object, validates it, and then creates the monitor record. If any errors occur during validation or creation, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON or validating the balance monitor. - 201 Created: If the balance monitor is successfully created.
func (Api) CreateBulkTransactions ¶
CreateBulkTransactions handles the creation of multiple transactions in a batch. It parses the request, calls the Blnk service to handle the core logic, and returns the appropriate HTTP response based on the result.
func (Api) CreateIdentity ¶
CreateIdentity creates a new identity record in the system. It binds the incoming JSON request to an Identity object, validates it, and then creates the identity record. If any errors occur during validation or creation, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON or creating the identity. - 201 Created: If the identity is successfully created.
func (Api) CreateLedger ¶
CreateLedger creates a new ledger record in the system. It binds the incoming JSON request to a CreateLedger object, validates it, and then creates the ledger record. If any errors occur during validation or creation, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON or validating the ledger. - 201 Created: If the ledger is successfully created.
func (Api) CreateMatchingRule ¶
CreateMatchingRule creates a new matching rule based on the provided rule details. It returns the created matching rule.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the request body is invalid. - 500 Internal Server Error: If there is an error creating the matching rule. - 201 Created: If the matching rule is successfully created.
func (Api) DeleteBalanceMonitor ¶
DeleteBalanceMonitor deletes an existing balance monitor record by its ID. It extracts the ID from the route parameters and deletes the record. If the ID is missing or there's an error deleting the monitor, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing or there's an error deleting the balance monitor. - 200 OK: If the balance monitor is successfully deleted.
func (*Api) DeleteHook ¶
DeleteHook removes a webhook by ID.
func (Api) DeleteIdentity ¶
DeleteIdentity deletes an existing identity record by its ID. It extracts the ID from the route parameters and deletes the record. If the ID is missing or there's an error deleting the identity, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing or there's an error deleting the identity. - 200 OK: If the identity is successfully deleted.
func (Api) DeleteMatchingRule ¶
DeleteMatchingRule deletes a matching rule identified by its ID. It confirms the deletion with a success message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the Matching Rule ID is missing. - 500 Internal Server Error: If there is an error deleting the matching rule. - 200 OK: If the matching rule is successfully deleted.
func (Api) DetokenizeIdentity ¶
DetokenizeIdentity detokenizes multiple fields in an identity. It binds the incoming JSON request containing the list of fields to detokenize, detokenizes each field, and responds with the original values.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing, there's an error binding JSON, or there's an error detokenizing fields. - 200 OK: If the fields are successfully detokenized, returning the original values.
func (Api) DetokenizeIdentityField ¶
DetokenizeIdentityField detokenizes a specific field in an identity. It extracts the identity ID and field name from the route parameters, detokenizes the field, and responds with the original value.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID or field is missing, or there's an error detokenizing the field. - 200 OK: If the field is successfully detokenized, returning the original value.
func (Api) FilterAccounts ¶ added in v0.13.2
FilterAccounts filters accounts using a JSON request body. This endpoint accepts a POST request with filters specified in JSON format.
Request body format:
{
"filters": [
{"field": "currency", "operator": "eq", "value": "USD"},
{"field": "name", "operator": "ilike", "value": "%main%"}
],
"limit": 20,
"offset": 0
}
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error parsing the filters or retrieving accounts. - 200 OK: If the accounts are successfully retrieved.
func (Api) FilterBalances ¶ added in v0.13.2
FilterBalances filters balances using a JSON request body. This endpoint accepts a POST request with filters specified in JSON format.
Request body format:
{
"filters": [
{"field": "currency", "operator": "eq", "value": "USD"},
{"field": "ledger_id", "operator": "in", "values": ["ldg_123", "ldg_456"]}
],
"limit": 20,
"offset": 0
}
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error parsing the filters or retrieving balances. - 200 OK: If the balances are successfully retrieved.
func (Api) FilterIdentities ¶ added in v0.13.2
FilterIdentities filters identities using a JSON request body. This endpoint accepts a POST request with filters specified in JSON format.
Request body format:
{
"filters": [
{"field": "first_name", "operator": "eq", "value": "John"},
{"field": "category", "operator": "in", "values": ["individual", "corporate"]}
],
"limit": 20,
"offset": 0
}
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error parsing the filters or retrieving identities. - 200 OK: If the identities are successfully retrieved.
func (Api) FilterLedgers ¶ added in v0.13.2
FilterLedgers filters ledgers using a JSON request body. This endpoint accepts a POST request with filters specified in JSON format.
Request body format:
{
"filters": [
{"field": "name", "operator": "ilike", "value": "%savings%"}
],
"limit": 20,
"offset": 0
}
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error parsing the filters or retrieving ledgers. - 200 OK: If the ledgers are successfully retrieved.
func (Api) FilterTransactions ¶ added in v0.13.2
FilterTransactions filters transactions using a JSON request body. This endpoint accepts a POST request with filters specified in JSON format, providing more flexibility than query parameter filters.
Request body format:
{
"filters": [
{"field": "status", "operator": "eq", "value": "APPLIED"},
{"field": "amount", "operator": "gte", "value": 1000},
{"field": "currency", "operator": "in", "values": ["USD", "EUR"]}
],
"limit": 20,
"offset": 0
}
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error parsing the filters or retrieving transactions. - 200 OK: If the transactions are successfully retrieved.
func (Api) GetAccount ¶
GetAccount retrieves an account by its ID. It uses the provided account ID and optional query parameters to fetch the account.
Parameters: - c: The Gin context containing the request and response. - id: The unique identifier of the account to retrieve. - includes: Optional query parameters to include related data.
Responses: - 400 Bad Request: If there's an error in fetching the account. - 200 OK: If the account is successfully retrieved.
func (Api) GetAllAccounts ¶
GetAllAccounts retrieves all accounts. It fetches a list of all accounts in the system. Supports advanced filtering via query parameters in the format: field_operator=value Example filters:
- name_eq=Main Account
- currency_in=USD,EUR
- created_at_gte=2024-01-01
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in fetching the accounts or invalid filters. - 200 OK: If the accounts are successfully retrieved.
func (Api) GetAllBalanceMonitors ¶
GetAllBalanceMonitors retrieves all balance monitor records in the system. It fetches the monitor records and responds with the list of monitors. If there's an error retrieving the monitors, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error retrieving the balance monitors. - 200 OK: If the balance monitors are successfully retrieved.
func (Api) GetAllIdentities ¶
GetAllIdentities retrieves all identity records in the system. It fetches the identity records and responds with the list of identities. Supports advanced filtering via query parameters in the format: field_operator=value Example filters:
- first_name_eq=John
- category_in=individual,corporate
- created_at_gte=2024-01-01
If there's an error retrieving the identities, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error retrieving the identities or invalid filters. - 200 OK: If the identities are successfully retrieved.
func (Api) GetAllLedgers ¶
GetAllLedgers retrieves all ledger records in the system. It fetches the ledger records and responds with the list of ledgers. Supports advanced filtering via query parameters in the format: field_operator=value Example filters:
- name_eq=USD Ledger
- created_at_gte=2024-01-01
- name_ilike=%savings%
If there's an error retrieving the ledgers, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error retrieving the ledger records or invalid filters. - 200 OK: If the ledger records are successfully retrieved.
func (Api) GetAllTransactions ¶ added in v0.13.2
GetAllTransactions retrieves all transactions with pagination and optional filtering. Supports advanced filtering via query parameters in the format: field_operator=value Example filters:
- status_eq=APPLIED
- currency_in=USD,EUR
- amount_gte=1000
- created_at_between=2024-01-01|2024-12-31
- source_eq=bln_123
- destination_eq=bln_456
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error retrieving the transactions or invalid filters. - 200 OK: If the transactions are successfully retrieved.
func (Api) GetBalance ¶
GetBalance retrieves a balance record by its ID. It extracts the ID from the route parameters and the 'include' query parameter to fetch additional related information. If the ID is missing or there's an error retrieving the balance, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing or there's an error retrieving the balance. - 200 OK: If the balance is successfully retrieved.
func (Api) GetBalanceAtTime ¶
GetBalanceAtTime retrieves a balance's state at a specific point in time. It extracts the balance ID from the route parameters and the timestamp from query parameters. The timestamp should be provided in ISO 8601 format (e.g., "2024-01-01T15:04:05Z"). Optionally accepts a "from_source" query parameter to calculate balance from all transactions.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the balance ID is missing, timestamp is invalid, or there's an error retrieving the balance. - 200 OK: If the historical balance state is successfully retrieved.
func (Api) GetBalanceByIndicator ¶
GetBalanceByIndicator retrieves a balance by its indicator and currency. It extracts the indicator and currency from the route parameters. If either parameter is missing or there's an error retrieving the balance, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If indicator or currency is missing or there's an error retrieving the balance. - 200 OK: If the balance is successfully retrieved.
func (Api) GetBalanceLineage ¶ added in v0.13.0
func (Api) GetBalanceMonitor ¶
GetBalanceMonitor retrieves a balance monitor record by its ID. It extracts the ID from the route parameters. If the ID is missing or there's an error retrieving the monitor, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing or there's an error retrieving the balance monitor. - 200 OK: If the balance monitor is successfully retrieved.
func (Api) GetBalanceMonitorsByBalanceID ¶
GetBalanceMonitorsByBalanceID retrieves all balance monitors associated with a specific balance ID. It extracts the balance ID from the route parameters. If the balance ID is missing or there's an error retrieving the monitors, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the balance ID is missing or there's an error retrieving the balance monitors. - 200 OK: If the balance monitors are successfully retrieved.
func (Api) GetBalances ¶
GetBalances retrieves a list of balance records with pagination. It extracts the 'limit' and 'offset' query parameters to control pagination, and the 'include' query parameter to fetch additional related information. Supports advanced filtering via query parameters in the format: field_operator=value Example filters:
- currency_eq=USD
- ledger_id_in=ldg_123,ldg_456
- created_at_gte=2024-01-01
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error retrieving the balances or invalid query parameters. - 200 OK: If the balances are successfully retrieved.
func (Api) GetIdentity ¶
GetIdentity retrieves an identity record by its ID. It extracts the ID from the route parameters and fetches the identity record. If the ID is missing or there's an error retrieving the identity, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing or there's an error retrieving the identity. - 200 OK: If the identity is successfully retrieved.
func (Api) GetLedger ¶
GetLedger retrieves a ledger record by its ID. It extracts the ID from the route parameters and fetches the ledger record. If the ID is missing or there's an error retrieving the ledger, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing or there's an error retrieving the ledger. - 200 OK: If the ledger is successfully retrieved.
func (Api) GetReconciliation ¶
GetReconciliation retrieves details about a specific reconciliation by its ID.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the reconciliation ID is missing. - 404 Not Found: If the reconciliation cannot be found. - 500 Internal Server Error: If there is an error retrieving the reconciliation. - 200 OK: If the reconciliation is successfully retrieved.
func (Api) GetReindexProgress ¶ added in v0.13.1
GetReindexProgress returns the current progress of the reindex operation.
Parameters: - c: The Gin context containing the request and response.
Responses: - 200 OK: Returns current progress. - 404 Not Found: If no reindex operation has been started.
func (Api) GetTokenizedFields ¶
GetTokenizedFields returns a list of fields that are currently tokenized for an identity.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing or there's an error retrieving the identity. - 200 OK: Returns the list of tokenized fields.
func (Api) GetTransaction ¶
GetTransaction retrieves a transaction by its ID. It returns the transaction details if found. If the ID is not provided or an error occurs while retrieving the transaction, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in retrieving the transaction or the ID is missing. - 200 OK: If the transaction is successfully retrieved.
func (Api) GetTransactionByRef ¶
GetTransactionByRef retrieves a transaction by its reference. It returns the transaction details if found. If the reference is not provided or an error occurs while retrieving the transaction, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in retrieving the transaction or the reference is missing. - 200 OK: If the transaction is successfully retrieved.
func (Api) GetTransactionLineage ¶ added in v0.13.0
func (Api) InstantReconciliation ¶
InstantReconciliation initiates a reconciliation process with externally provided transactions without requiring a prior file upload. It processes the transactions directly and returns the reconciliation ID.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the request body is invalid or required fields are missing. - 500 Internal Server Error: If there is an error starting the reconciliation process. - 200 OK: If the reconciliation process is successfully started.
func (Api) ListAPIKeys ¶
ListAPIKeys lists all API keys for the authenticated user
Parameters: - c: The Gin context containing the request and response
Responses: - 200 OK: Returns the list of API keys - 500 Internal Server Error: If there's an error retrieving the keys
func (Api) MultiSearch ¶
MultiSearch performs a multi-search query. It binds the incoming JSON request to a MultiSearchParameter object, executes the multi-search query, and responds with the search results.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON or performing the search. - 200 OK: If the multi-search query is successfully executed and results are returned.
func (Api) QueueTransaction ¶
QueueTransaction handles queuing a new transaction for later processing. It binds the incoming JSON request to a RecordTransaction object, validates it, and then queues the transaction. If any errors occur during validation or queuing, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON or validating the transaction. - 201 Created: If the transaction is successfully queued.
func (Api) RecordTransaction ¶
RecordTransaction handles the recording of a new transaction. It binds the incoming JSON request to a RecordTransaction object, validates it, and then records the transaction. If any errors occur during validation or recording, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON or validating the transaction. - 201 Created: If the transaction is successfully recorded.
func (Api) RecoverQueuedTransactions ¶ added in v0.13.2
RecoverQueuedTransactions triggers manual recovery of stuck queued transactions. Accepts an optional "threshold" query parameter (e.g. "5m", "10m") specifying the minimum age of transactions to recover. Defaults to 2 minutes, which is also the enforced minimum.
func (Api) RefundTransaction ¶
RefundTransaction processes a refund for a transaction based on the given ID. It retrieves the transaction to be refunded and processes it in batches. If any errors occur during retrieval or processing, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in retrieving the transaction or no transaction is found to refund. - 201 Created: If the refund is successfully processed.
func (*Api) RegisterHook ¶
RegisterHook handles the registration of a new webhook.
func (Api) RevokeAPIKey ¶
RevokeAPIKey revokes an API key
Parameters: - c: The Gin context containing the request and response
Responses: - 204 No Content: If the API key is successfully revoked - 404 Not Found: If the API key is not found - 403 Forbidden: If the user doesn't own the API key
func (Api) Router ¶
Router sets up the routes for the API and returns the router instance.
Responses: - 200 OK: When the router is successfully set up.
func (Api) Search ¶
Search performs a search query on a specified collection. It binds the incoming JSON request to a SearchCollectionParams object, executes the search query, and responds with the search results.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON or performing the search. - 201 Created: If the search query is successfully executed and results are returned.
func (Api) StartReconciliation ¶
StartReconciliation initiates a new reconciliation process based on the provided parameters. It starts the reconciliation process and returns the reconciliation ID.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the request body is invalid or required fields are missing. - 500 Internal Server Error: If there is an error starting the reconciliation process. - 200 OK: If the reconciliation process is successfully started.
func (Api) StartReindex ¶ added in v0.13.1
StartReindex triggers a full reindex of all data from the database to Typesense. The reindex runs asynchronously to avoid HTTP timeouts.
Parameters: - c: The Gin context containing the request and response.
Responses: - 202 Accepted: Reindex started successfully, returns initial progress. - 409 Conflict: If a reindex is already in progress.
func (Api) TakeBalanceSnapshots ¶
TakeBalanceSnapshots creates daily snapshots of balances in batches. It accepts an optional 'batch_size' query parameter to control the batch processing size.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in the batch size parameter or during snapshot creation. - 200 OK: If the snapshots are successfully created, returns the total number of snapshots created.
func (Api) TokenizeIdentity ¶
TokenizeIdentity tokenizes multiple fields in an identity. It binds the incoming JSON request containing the list of fields to tokenize, tokenizes each field, and responds with a success message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID is missing, there's an error binding JSON, or there's an error tokenizing fields. - 200 OK: If the fields are successfully tokenized.
func (Api) TokenizeIdentityField ¶
TokenizeIdentityField tokenizes a specific field in an identity. It extracts the identity ID and field name from the route parameters, tokenizes the field, and responds with a success message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the ID or field is missing, or there's an error tokenizing the field. - 200 OK: If the field is successfully tokenized.
func (Api) UpdateBalanceIdentity ¶
UpdateBalanceIdentity updates only the identity_id field of a balance. Expected JSON payload: {"identity_id": "id_123"}
func (Api) UpdateBalanceMonitor ¶
UpdateBalanceMonitor updates an existing balance monitor record by its ID. It binds the incoming JSON request to a BalanceMonitor object, updates the record, and responds with a success message. If any errors occur during binding, validation, or update, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON, validating the balance monitor, or updating the record. - 200 OK: If the balance monitor is successfully updated.
func (*Api) UpdateHook ¶
UpdateHook handles updating an existing webhook.
func (Api) UpdateIdentity ¶
UpdateIdentity updates an existing identity record by its ID. It binds the incoming JSON request to an Identity object, updates the record, and responds with a success message. If any errors occur during binding, validation, or update, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON, updating the identity, or missing ID. - 200 OK: If the identity is successfully updated.
func (Api) UpdateInflightStatus ¶
UpdateInflightStatus updates the status of an inflight transaction based on the provided ID and status. It processes the transaction in batches according to the specified status (commit or void). If any errors occur during processing or if the status is unsupported, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in updating the status or if the ID or status is missing or unsupported. - 200 OK: If the inflight transaction status is successfully updated.
func (Api) UpdateLedger ¶
UpdateLedger updates an existing ledger's name. It binds the incoming JSON request to an UpdateLedger object, validates it, and then updates the ledger record. If any errors occur during validation or update, it responds with an appropriate error message.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If there's an error in binding JSON, validating the ledger, or if the ID is missing. - 200 OK: If the ledger is successfully updated.
func (Api) UpdateMatchingRule ¶
UpdateMatchingRule updates an existing matching rule identified by its ID. It returns the updated matching rule.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the Matching Rule ID is missing or the request body is invalid. - 500 Internal Server Error: If there is an error updating the matching rule. - 200 OK: If the matching rule is successfully updated.
func (Api) UpdateMetadata ¶
UpdateMetadata handles HTTP requests to update metadata for various entity types. It processes requests to update metadata for ledgers, transactions, balances, and identities. The entity type is determined automatically from the entity ID prefix.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the entity ID is missing or the request body is invalid. - 404 Not Found: If the specified entity doesn't exist. - 200 OK: If the metadata is successfully updated.
func (Api) UploadExternalData ¶
UploadExternalData handles the upload of external transaction data. It receives the file and source details from the request, processes the upload, and returns an upload ID along with the record count and source information.
Parameters: - c: The Gin context containing the request and response.
Responses: - 400 Bad Request: If the file upload fails. - 500 Internal Server Error: If there is an error processing the upload. - 200 OK: If the upload is successful.
type FilterRequest ¶ added in v0.13.2
type FilterRequest struct {
Filters []filter.QueryFilter `json:"filters"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
SortBy string `json:"sort_by,omitempty"`
SortOrder string `json:"sort_order,omitempty"` // "asc" or "desc"
IncludeCount bool `json:"include_count,omitempty"`
}
FilterRequest represents the JSON body for filter endpoints. It allows clients to pass filters directly as JSON instead of query parameters.
type FilterResponse ¶ added in v0.13.2
type FilterResponse struct {
Data interface{} `json:"data"`
TotalCount *int64 `json:"total_count,omitempty"`
}
FilterResponse wraps the response with optional count.
type MetadataRequest ¶
type MetadataRequest struct {
Metadata map[string]interface{} `json:"meta_data" binding:"required"`
}
MetadataRequest represents the structure for metadata update requests. It contains a required metadata field that holds key-value pairs for updating entity metadata.
type ReindexRequest ¶ added in v0.13.1
type ReindexRequest struct {
BatchSize int `json:"batch_size"`
}
ReindexRequest represents the request body for starting a reindex operation.