@fragment-dev/node-client
Version:
[Fragment](https://fragment.dev) is the Ledger API for engineers that move money. Stop wrangling payment tables, debugging balance errors and hacking together data pipelines. Start shipping the features that make a difference.
1,125 lines (1,124 loc) • 185 kB
TypeScript
import { GraphQLClient, RequestOptions } from "graphql-request";
export type Maybe<T> = T | null;
export type InputMaybe<T> = Maybe<T>;
export type Exact<T extends {
[key: string]: unknown;
}> = {
[K in keyof T]: T[K];
};
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
[SubKey in K]?: Maybe<T[SubKey]>;
};
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
[SubKey in K]: Maybe<T[SubKey]>;
};
export type MakeEmpty<T extends {
[key: string]: unknown;
}, K extends keyof T> = {
[_ in K]?: never;
};
export type Incremental<T> = T | {
[P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never;
};
type GraphQLClientRequestHeaders = RequestOptions["requestHeaders"];
/** All built-in and custom scalars, mapped to their actual values */
export type Scalars = {
ID: {
input: string;
output: string;
};
String: {
input: string;
output: string;
};
Boolean: {
input: boolean;
output: boolean;
};
Int: {
input: number;
output: number;
};
Float: {
input: number;
output: number;
};
/** A string that must be alphanumeric */
AlphaNumericString: {
input: string;
output: string;
};
/** ISO 8601 Date e.g. `1969-07-21` */
Date: {
input: string;
output: string;
};
/** ISO 8601 DateTime e.g. `1969-07-16T13:32:00.000Z`. You can also provide a date e.g. `1969-01-01` and it will be converted to `1969-01-01T00:00:00.000Z` */
DateTime: {
input: string;
output: string;
};
/** The first moment of a specific year, month or day or hour e.g. 1969 or 1969-1 or 1969-1-1 or 1969-1-1T00. All of the previous examples are equivalent to `1969-1-1T00:00:00.000`. */
FirstMoment: {
input: string;
output: string;
};
/** A string representing integers up to 9,223,372,036,854,775,807 (i.e. 2^63-1) */
Int64: {
input: string;
output: string;
};
/** A string representing integers as big as 2^120-1. The number is signed so the range is from -1,329,227,995,784,915,872,903,807,060,280,344,575 to 1,329,227,995,784,915,872,903,807,060,280,344,575. */
Int96: {
input: string;
output: string;
};
/** The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */
JSON: {
input: Record<string, unknown>;
output: Record<string, unknown>;
};
/** The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */
JSONObject: {
input: string;
output: string;
};
/** The last moment of a specific year, month or day or hour e.g. 1969 or 1969-12 or 1969-12-31 or 1969-12-31T23. All of the previous examples are equivalent to `1969-12-31T23:59:59.999`. */
LastMoment: {
input: string;
output: string;
};
/** A string of non-zero length that can contain parameterized values via handlebars syntax. ex: `"Hello from {{country}}"`. */
ParameterizedString: {
input: string;
output: string;
};
/** A mapping of parameter keys to values. */
Parameters: {
input: string;
output: string;
};
/** A specific year ("2021"), quarter ("2021-Q1"), month ("2021-02"), day ("2021-02-03") or hour ("2021-02-03T04") */
Period: {
input: string;
output: string;
};
/** A string with delimiter characters `/`, `#`, and `:` disallowed, as well as parameters in {{handlebar}} syntax. */
SafeString: {
input: string;
output: string;
};
/** All hour-aligned offsets from -11:00 to +12:00 are supported, e.g. "-08:00" (PT), "-05:00" (ET), "+00:00" (UTC) */
UTCOffset: {
input: string;
output: string;
};
};
export type AddLedgerEntryResponse = AddLedgerEntryResult | BadRequestError | InternalError;
export type AddLedgerEntryResult = {
__typename?: "AddLedgerEntryResult";
/** The ledger entry that was posted */
entry: LedgerEntry;
/** True if this request successfully completed before and the previous response is being returned */
isIkReplay: Scalars["Boolean"]["output"];
/** The ledger lines that were created in that entry */
lines: Array<LedgerLine>;
};
/** Equivalent to an HTTP 400 - request either has missing or incorrect data */
export type BadRequestError = Error & {
__typename?: "BadRequestError";
/** The status code of error. For example, 'ledger_not_found'. */
code: Scalars["String"]["output"];
/** The error message */
message: Scalars["String"]["output"];
/** Whether or not the operation is retryable */
retryable: Scalars["Boolean"]["output"];
};
/** A single amount and the timestamp requested */
export type BalanceChangeDuring = {
__typename?: "BalanceChangeDuring";
/** The balance or balance change */
amount: CurrencyAmount;
/** The period of the requested balance change */
period: Scalars["Period"]["output"];
};
/** A paginated list of amounts and their periods */
export type BalanceChangeDuringConnection = {
__typename?: "BalanceChangeDuringConnection";
/** The end time of the period across which the balance changes are requested */
endTime: Scalars["LastMoment"]["output"];
/** The granularity of the return data */
granularity: Granularity;
/** The current page of results */
nodes: Array<BalanceChangeDuring>;
/** The [pagination info](https://fragment.dev/api-reference/api-types#connection-types-pageinfo) for this list */
pageInfo: PageInfo;
/** The start time of the period across which the balance changes are requested */
startTime: Scalars["FirstMoment"]["output"];
};
/** Used to configure the write-consistency of a Ledger Account's balance. See [Configure consistency](https://fragment.dev/docs/configure-consistency). */
export declare enum BalanceUpdateConsistencyMode {
Eventual = "eventual",
Strong = "strong"
}
/** The input for your Chart of Accounts in a Schema. */
export type ChartOfAccountsInput = {
/** The Ledger Accounts modeled by your Schema. Ledger Accounts may be nested up to a maximum depth of 10. */
accounts: Array<SchemaLedgerAccountInput>;
/**
* The default consistency configuration for all Ledger Accounts in this Schema.
* If a Ledger Account does not specify its own consistency configuration, it will use the default values provided here.
*
* See [Configure consistency](https://fragment.dev/docs/configure-consistency).
*/
defaultConsistencyConfig?: InputMaybe<LedgerAccountConsistencyConfigInput>;
/**
* The default currency of each Ledger Account in the Chart Of Accounts.
* It must be provided if `defaultCurrencyMode` is set to `single`.
* Additionally, `defaultCurrency` must be omitted if `defaultCurrencyMode` is set to `multi`.
*/
defaultCurrency?: InputMaybe<CurrencyMatchInput>;
/** The default currency mode of each Ledger Account in the Chart Of Accounts. */
defaultCurrencyMode?: InputMaybe<CurrencyMode>;
};
export type CreateCustomCurrencyInput = {
/** The currency code for custom currencies. It can be up to 36 characters long. This is used for display purposes. */
customCode: Scalars["String"]["input"];
/** The ID for a custom currency. This is specified when creating the custom currency using the [createCustomCurrency](https://fragment.dev/api-reference/api-mutations#createcustomcurrency) mutation. It can be up to 36 characters long. */
customCurrencyId: Scalars["SafeString"]["input"];
/** A human readable name for the currency (e.g. United States Dollar). This is used for display purposes. */
name: Scalars["String"]["input"];
/** The number of decimal places this currency goes to. For example, United States Dollars have a precision of 2 (i.e. 100 cents in a dollar), whereas the Jordanian Dinar has a precision of 3. This is used for display purposes. */
precision: Scalars["Int"]["input"];
};
export type CreateCustomCurrencyResponse = BadRequestError | CreateCustomCurrencyResult | InternalError;
export type CreateCustomCurrencyResult = {
__typename?: "CreateCustomCurrencyResult";
/** The Currency that was created. */
customCurrency: Currency;
};
export type CreateCustomLinkResponse = BadRequestError | CreateCustomLinkResult | InternalError;
export type CreateCustomLinkResult = {
__typename?: "CreateCustomLinkResult";
isIkReplay: Scalars["Boolean"]["output"];
/** The custom link that was created. Represents an instance of an external system. */
link: CustomLink;
};
export type CreateLedgerAccountInput = {
/** The consistency configuration for this Ledger Account. This defines how updates to this Ledger Account's balance are handled. */
consistencyConfig?: InputMaybe<LedgerAccountConsistencyConfigInput>;
/**
* The currency of this Ledger Account. If this is not set, and `currencyMode` is
* not set to `multi`, the workspace-level default is used.
*/
currency?: InputMaybe<CurrencyMatchInput>;
/** If set to `multi`, creates a multi-currency Ledger Account. If set to `single`, creates a single-currency Ledger Account. */
currencyMode?: InputMaybe<CurrencyMode>;
/** The External Account to link to this Ledger Account. */
linkedAccount?: InputMaybe<ExternalAccountMatchInput>;
/** The human-readable name of this Ledger Account. */
name: Scalars["String"]["input"];
/** The parent of this Ledger Account. */
parent?: InputMaybe<LedgerAccountMatchInput>;
/** The type of ledger account to create. Required if this is a top-level Ledger Account. If not provided, the type will be inferred from the parent. */
type?: InputMaybe<LedgerAccountTypes>;
};
export type CreateLedgerAccountResponse = BadRequestError | CreateLedgerAccountResult | InternalError;
export type CreateLedgerAccountResult = {
__typename?: "CreateLedgerAccountResult";
/** true if a previous request successfully created this ledger account */
isIkReplay: Scalars["Boolean"]["output"];
/** The ledger account that was created */
ledgerAccount: LedgerAccount;
};
export type CreateLedgerAccountsInput = {
/** Ledger Accounts to create as children of this Ledger Account. */
childLedgerAccounts?: InputMaybe<Array<CreateLedgerAccountsInput>>;
/** The consistency configuration for this ledger account. See [Configure consistency](https://fragment.dev/docs/configure-consistency). */
consistencyConfig?: InputMaybe<LedgerAccountConsistencyConfigInput>;
/** The currency of this Ledger Account. If this is not set, the workspace level default is used. */
currency?: InputMaybe<CurrencyMatchInput>;
/** The currency mode of this Ledger Account. If this is not set, the workspace level default is used. */
currencyMode?: InputMaybe<CurrencyMode>;
/** The idempotency key for creating this Ledger Account. */
ik: Scalars["SafeString"]["input"];
/** The External Account to link to this Ledger Account. This can only be specified on leaf Ledger Accounts. See [Reconcile payments](https://fragment.dev/docs/reconcile-payments). */
linkedAccount?: InputMaybe<ExternalAccountMatchInput>;
/** The name of the Ledger Account. */
name: Scalars["String"]["input"];
/** The parent of this Ledger Account. This is only valid on the top level Ledger Account in the payload. */
parent?: InputMaybe<LedgerAccountMatchInput>;
/** The type of this Ledger Account. This field is only required if this is a root Ledger Account. Otherwise, the type will get inherited from its parent. */
type?: InputMaybe<LedgerAccountTypes>;
};
export type CreateLedgerAccountsResponse = BadRequestError | CreateLedgerAccountsResult | InternalError;
export type CreateLedgerAccountsResult = {
__typename?: "CreateLedgerAccountsResult";
/** Whether the ledger accounts were successfully created by a previous request */
ikReplays: Array<IkReplay>;
/** The ledger accounts that were created */
ledgerAccounts: Array<LedgerAccount>;
};
export type CreateLedgerInput = {
/**
* Use this field to specify a timezone for queries to your Ledger.
*
* When aggregating balances, all transactions within a 24 hour period starting at midnight UTC are included in each day.
* You can specify a different starting hour for balances. For example, use "-08:00" to align balances with Pacific Standard Time.
* Balance queries would then consider the start of each local day to be at 8am UTC the next day in UTC.
* The default timezone is UTC.
*/
balanceUTCOffset?: InputMaybe<Scalars["UTCOffset"]["input"]>;
name: Scalars["String"]["input"];
type?: InputMaybe<LedgerTypes>;
};
export type CreateLedgerResponse = BadRequestError | CreateLedgerResult | InternalError;
export type CreateLedgerResult = {
__typename?: "CreateLedgerResult";
/** true if this request successfully completed before and the previous response is being returned */
isIkReplay: Scalars["Boolean"]["output"];
/** The Ledger that was created */
ledger: Ledger;
};
export type Currency = {
__typename?: "Currency";
/** The currency code. This is an [enum type](https://fragment.dev/api-reference/api-types#scalars-and-enums-currencycode) . */
code: CurrencyCode;
/** The currency code for custom currencies. This is only set if 'currency' is set to CUSTOM. It can be up to 36 characters long. */
customCode?: Maybe<Scalars["String"]["output"]>;
/** The ID for a custom currency. This is specified when creating the custom currency using the [createCustomCurrency](https://fragment.dev/api-reference/api-mutations#createcustomcurrency) mutation. */
customCurrencyId?: Maybe<Scalars["SafeString"]["output"]>;
/** A human readable name for the currency (e.g. United States Dollar). This is used for display purposes. */
name: Scalars["String"]["output"];
/** The number of decimal places this currency goes to. For example, United States Dollars have a precision of 2 (i.e. 100 cents in a dollar), whereas the Jordanian Dinar has a precision of 3. This is used for display purposes. */
precision: Scalars["Int"]["output"];
};
/** A single amount accompanied by its currency */
export type CurrencyAmount = {
__typename?: "CurrencyAmount";
/** Numerical integer value, serialized as a string */
amount: Scalars["Int96"]["output"];
/** The currency this amount is in */
currency: Currency;
};
/** A paginated list of amounts with their currencies */
export type CurrencyAmountConnection = {
__typename?: "CurrencyAmountConnection";
/** The current page of results */
nodes: Array<CurrencyAmount>;
/** The [pagination info](https://fragment.dev/api-reference/api-types#connection-types-pageinfo) for this list */
pageInfo: PageInfo;
};
export declare enum CurrencyCode {
Aave = "AAVE",
Ada = "ADA",
Aed = "AED",
Afn = "AFN",
All = "ALL",
Amd = "AMD",
Ang = "ANG",
Aoa = "AOA",
Ars = "ARS",
Aud = "AUD",
Awg = "AWG",
Azn = "AZN",
Bam = "BAM",
Bbd = "BBD",
Bch = "BCH",
Bdt = "BDT",
Bgn = "BGN",
Bhd = "BHD",
Bif = "BIF",
Bmd = "BMD",
Bnd = "BND",
Bob = "BOB",
Brl = "BRL",
Bsd = "BSD",
Btc = "BTC",
Btn = "BTN",
Bwp = "BWP",
Byr = "BYR",
Bzd = "BZD",
Cad = "CAD",
Cdf = "CDF",
Chf = "CHF",
Clp = "CLP",
Cny = "CNY",
Cop = "COP",
Crc = "CRC",
Cuc = "CUC",
Cup = "CUP",
Custom = "CUSTOM",
Cve = "CVE",
Czk = "CZK",
Dai = "DAI",
Djf = "DJF",
Dkk = "DKK",
Dop = "DOP",
Dzd = "DZD",
Egp = "EGP",
Ern = "ERN",
Etb = "ETB",
Eth = "ETH",
Eur = "EUR",
Fjd = "FJD",
Fkp = "FKP",
Gbp = "GBP",
Gel = "GEL",
Ggp = "GGP",
Ghs = "GHS",
Gip = "GIP",
Gmd = "GMD",
Gnf = "GNF",
Gtq = "GTQ",
Gyd = "GYD",
Hkd = "HKD",
Hnl = "HNL",
Hrk = "HRK",
Htg = "HTG",
Huf = "HUF",
Idr = "IDR",
Ils = "ILS",
Imp = "IMP",
Inr = "INR",
Iqd = "IQD",
Irr = "IRR",
Isk = "ISK",
Jmd = "JMD",
Jod = "JOD",
Jpy = "JPY",
Kes = "KES",
Kgs = "KGS",
Khr = "KHR",
Kmf = "KMF",
Kpw = "KPW",
Krw = "KRW",
Kwd = "KWD",
Kyd = "KYD",
Kzt = "KZT",
Lak = "LAK",
Lbp = "LBP",
Link = "LINK",
Lkr = "LKR",
Logical = "LOGICAL",
Lrd = "LRD",
Lsl = "LSL",
Ltc = "LTC",
Lyd = "LYD",
Mad = "MAD",
Matic = "MATIC",
Mdl = "MDL",
Mga = "MGA",
Mkd = "MKD",
Mmk = "MMK",
Mnt = "MNT",
Mop = "MOP",
Mur = "MUR",
Mvr = "MVR",
Mwk = "MWK",
Mxn = "MXN",
Myr = "MYR",
Mzn = "MZN",
Nad = "NAD",
Ngn = "NGN",
Nio = "NIO",
Nok = "NOK",
Npr = "NPR",
Nzd = "NZD",
Omr = "OMR",
Pab = "PAB",
Pen = "PEN",
Pgk = "PGK",
Php = "PHP",
Pkr = "PKR",
Pln = "PLN",
Pts = "PTS",
Pyg = "PYG",
Qar = "QAR",
Ron = "RON",
Rsd = "RSD",
Rub = "RUB",
Rwf = "RWF",
Sar = "SAR",
Sbd = "SBD",
Scr = "SCR",
Sdg = "SDG",
Sek = "SEK",
Sgd = "SGD",
Shp = "SHP",
Sll = "SLL",
Sol = "SOL",
Sos = "SOS",
Spl = "SPL",
Srd = "SRD",
Stn = "STN",
Svc = "SVC",
Syp = "SYP",
Szl = "SZL",
Thb = "THB",
Tjs = "TJS",
Tmt = "TMT",
Tnd = "TND",
Top = "TOP",
Try = "TRY",
Ttd = "TTD",
Tvd = "TVD",
Twd = "TWD",
Tzs = "TZS",
Uah = "UAH",
Ugx = "UGX",
Uni = "UNI",
Usd = "USD",
Usdc = "USDC",
Usdt = "USDT",
Uyu = "UYU",
Uzs = "UZS",
Vef = "VEF",
Vnd = "VND",
Vuv = "VUV",
Wst = "WST",
Xaf = "XAF",
Xcd = "XCD",
Xlm = "XLM",
Xof = "XOF",
Xpf = "XPF",
Yer = "YER",
Zar = "ZAR",
Zmw = "ZMW"
}
export type CurrencyFilter = {
/** Must match the value provided */
equalTo?: InputMaybe<CurrencyMatchInput>;
/** Must match one of the values provided. Limited to 100 items maximum. */
in?: InputMaybe<Array<CurrencyMatchInput>>;
};
export type CurrencyMatchInput = {
/** The currency code. This is an [enum type](https://fragment.dev/api-reference/api-types#scalars-and-enums-currencycode). */
code: CurrencyCode;
/** The ID for a custom currency. This is specified when creating the custom currency using the [createCustomCurrency](https://fragment.dev/api-reference/api-mutations#createcustomcurrency) mutation. */
customCurrencyId?: InputMaybe<Scalars["SafeString"]["input"]>;
};
/** Defines the currency handling of a LedgerAccount, which can either be restricted to a single currency or allow multiple currencies. */
export declare enum CurrencyMode {
Multi = "multi",
Single = "single"
}
export type CustomAccountInput = {
/** The currency of this external account. If this is not set, the workspace level default is used. 'currency' cannot be set if 'currencyMode' is 'multi'. */
currency?: InputMaybe<CurrencyMatchInput>;
/** The currency mode of this external account. If set to multi, creates a multi-currency account. */
currencyMode?: InputMaybe<CurrencyMode>;
/** The ID of this account at the external system. This is used as the idempotency key, within the scope of its Custom Link. */
externalId: Scalars["SafeString"]["input"];
/** The name of the account at the external system. */
name: Scalars["String"]["input"];
};
/** A paginated list of Custom Currencies */
export type CustomCurrenciesConnection = {
__typename?: "CustomCurrenciesConnection";
/** The current page of results */
nodes: Array<Currency>;
/** The [pagination info](https://fragment.dev/api-reference/api-types#connection-types-pageinfo) for this list */
pageInfo: PageInfo;
};
export type CustomLink = Link & {
__typename?: "CustomLink";
/** ISO-8601 timestamp when the Link was created. */
created: Scalars["String"]["output"];
/** URL to the Fragment Dashboard for this Link. */
dashboardUrl: Scalars["String"]["output"];
/** A list of External Accounts associated with this Link. */
externalAccounts: ExternalAccountsConnection;
/** FRAGMENT ID of the Custom Link. */
id: Scalars["ID"]["output"];
/** Name of the Link as it appears in the Fragment Dashboard. */
name: Scalars["String"]["output"];
};
export type CustomTxInput = {
account: ExternalAccountMatchInput;
amount: Scalars["Int96"]["input"];
/** The currency of this tx. Should be set for multi-currency accounts. */
currency?: InputMaybe<CurrencyMatchInput>;
description: Scalars["String"]["input"];
/** The ID of this tx at the external system. This is used as the idempotency key, within the scope of its Custom Account. */
externalId: Scalars["SafeString"]["input"];
posted: Scalars["DateTime"]["input"];
};
export type DateFilter = {
equalTo?: InputMaybe<Scalars["Date"]["input"]>;
/** Must match one of the values provided. Limited to 100 items maximum. */
in?: InputMaybe<Array<Scalars["Date"]["input"]>>;
};
/** Filters a timestamp field between two moments in time */
export type DateTimeFilter = {
/** The timestamp value must be after this moment. Specified in ISO 8601 format e.g "1968-01-01T16:45:00Z" */
after?: InputMaybe<Scalars["DateTime"]["input"]>;
/** The timestamp value must be before this moment. Specified in ISO 8601 format e.g "1968-01-01T16:45:00Z" */
before?: InputMaybe<Scalars["DateTime"]["input"]>;
};
export type DeleteCustomTxsResponse = BadRequestError | DeleteCustomTxsResult | InternalError;
export type DeleteCustomTxsResult = {
__typename?: "DeleteCustomTxsResult";
/** List of Txs deleted in this operation */
txs: Array<DeletedCustomTx>;
};
export type DeleteLedgerResponse = BadRequestError | DeleteLedgerResult | InternalError;
export type DeleteLedgerResult = {
__typename?: "DeleteLedgerResult";
success: Scalars["Boolean"]["output"];
};
export type DeleteSchemaResponse = BadRequestError | DeleteSchemaResult | InternalError;
export type DeleteSchemaResult = {
__typename?: "DeleteSchemaResult";
success: Scalars["Boolean"]["output"];
};
export type DeletedCustomTx = {
__typename?: "DeletedCustomTx";
/** A deleted Tx */
tx: Tx;
};
export type EntryGroupMatchInput = {
key: Scalars["SafeString"]["input"];
value: Scalars["SafeString"]["input"];
};
/** Base error interface */
export type Error = {
/** The status code of error. For example, 'ledger_not_found'. */
code: Scalars["String"]["output"];
/** The error message */
message: Scalars["String"]["output"];
/** Whether or not the operation is retryable */
retryable: Scalars["Boolean"]["output"];
};
export type ExternalAccount = {
__typename?: "ExternalAccount";
/** The currency of this external account. */
currency?: Maybe<Currency>;
/** Indicates if the account allows multiple currencies or is restricted to a single currency */
currencyMode: CurrencyMode;
/** ID used for the external account */
externalId: Scalars["ID"]["output"];
/** FRAGMENT ID of External Account */
id: Scalars["ID"]["output"];
/** Ledger Accounts linked to this External Account. Ledger Accounts are paginated and sorted in reverse-chronological order by created date. */
ledgerAccounts: LedgerAccountsConnection;
/** The Link that this External Account belongs to. */
link: CustomLink | IncreaseLink | StripeLink | UnitLink;
/** FRAGMENT ID of this transaction's external link */
linkId: Scalars["ID"]["output"];
name: Scalars["String"]["output"];
/** All Txs in this External Account. */
txs: TxsConnection;
};
export type ExternalAccountLedgerAccountsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
export type ExternalAccountTxsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
export type ExternalAccountFilter = {
/** Ledger Account must linked to the the specified external account */
equalTo?: InputMaybe<ExternalAccountMatchInput>;
/** Ledger Account can be linked to any of the specified external accounts. Limited to 100 items maximum. */
in?: InputMaybe<Array<ExternalAccountMatchInput>>;
};
/** Specify an External Account by using `id`, or `linkId` and `externalId`. */
export type ExternalAccountMatchInput = {
/** The external system's ID of the External Account. If this is specified, `linkId` is required. `id` is optional, but will be validated if provided. */
externalId?: InputMaybe<Scalars["ID"]["input"]>;
/** The FRAGMENT ID of the External Account. If this is specified, both `linkId` and `externalId` are optional, but will be validated if provided. */
id?: InputMaybe<Scalars["ID"]["input"]>;
/** The FRAGMENT ID of the Link the External Account is in. If this is specified, `externalId` is required. `id` is optional, but will be validated if provided. */
linkId?: InputMaybe<Scalars["ID"]["input"]>;
};
/** A paginated list of External Accounts */
export type ExternalAccountsConnection = {
__typename?: "ExternalAccountsConnection";
/** The current page of results */
nodes: Array<ExternalAccount>;
/** The [pagination info](https://fragment.dev/api-reference/api-types#connection-types-pageinfo) for this list */
pageInfo: PageInfo;
};
export declare enum ExternalTransferType {
Ach = "ach",
Card = "card",
Check = "check",
Internal = "internal",
Wire = "wire"
}
export declare enum ExternalTxSource {
Increase = "increase"
}
export declare enum Granularity {
Daily = "daily",
Hourly = "hourly",
Monthly = "monthly"
}
/** A filter to query balances of a specific subset of accounts */
export type GroupBalanceAccountFilter = {
/** A filter that must match the account ID */
id?: InputMaybe<StringFilter>;
/** A filter that must match the account path. Wildcards ('*') may be used only for template variables, and will only match a single variable each. */
path?: InputMaybe<StringMatchFilter>;
};
/** Filter for finding entries by group membership */
export type GroupFilter = {
/** Find groups that exactly match this group */
equalTo?: InputMaybe<GroupMatchInput>;
/** Find groups that match any of these groups */
in?: InputMaybe<Array<GroupMatchInput>>;
/** Find groups with a specific key */
keyEqualTo?: InputMaybe<Scalars["SafeString"]["input"]>;
/** Find groups with any of these keys */
keyIn?: InputMaybe<Array<Scalars["SafeString"]["input"]>>;
/**
* Find groups that do not match this predicate
* @deprecated not filter is deprecated. Use notKeyIn or notKeyEqualTo instead.
*/
not?: InputMaybe<GroupNotFilter>;
/** Find groups that do not exactly match this group */
notEqualTo?: InputMaybe<GroupMatchInput>;
/** Find groups that do not match any of these groups */
notIn?: InputMaybe<Array<GroupMatchInput>>;
/** Find groups that do not have a specific key */
notKeyEqualTo?: InputMaybe<Scalars["SafeString"]["input"]>;
/** Find groups that do not have any of these keys */
notKeyIn?: InputMaybe<Array<Scalars["SafeString"]["input"]>>;
};
/** A Group in a Schema. Group define sequences of Ledger Entries and can help with reconciliation tasks. */
export type GroupInput = {
/** Human-readable description of the Group. */
description?: InputMaybe<Scalars["ParameterizedString"]["input"]>;
/** The key of this Group. This combined with its value is a stable, unique identifier for this group. */
key: Scalars["SafeString"]["input"];
/** The parameters that are used to enable reconciliation abilities in a group. */
reconciliation?: InputMaybe<GroupReconciliationParametersInput>;
};
/** Input type for matching a specific group by key and value */
export type GroupMatchInput = {
/** The key of the group to match */
key: Scalars["SafeString"]["input"];
/** The value of the group to match */
value: Scalars["SafeString"]["input"];
};
/** DEPRECATED: Use GroupFilter and notKeyIn or notKeyEqualTo instead. Filter for finding entries that do not match this predicate */
export type GroupNotFilter = {
/** DEPRECATED: Find entries that are not members of all of these groups. This is an AND filter. */
keyIn?: InputMaybe<Array<Scalars["SafeString"]["input"]>>;
};
/** A set of parameters that are used to enable reconciliation abilities in a group */
export type GroupReconciliationParametersInput = {
/** The path to the clearing account for this group. A clearing account is an account that is used to indicate funds that are in transit. Also called a suspense account, pending account, or zero balance account. */
clearingAccountPath: SchemaLedgerAccountMatchInput;
};
/** A single amount and the timestamp requested */
export type HistoricalBalance = {
__typename?: "HistoricalBalance";
/** The balance or balance change */
amount: CurrencyAmount;
/** The timestamp of the requested balance */
at: Scalars["LastMoment"]["output"];
};
/** A paginated list of amounts and their periods */
export type HistoricalBalanceConnection = {
__typename?: "HistoricalBalanceConnection";
/** The end time of the period across which the balance changes are requested */
endTime: Scalars["LastMoment"]["output"];
/** The granularity of the return data */
granularity: Granularity;
/** The current page of results */
nodes: Array<HistoricalBalance>;
/** The [pagination info](https://fragment.dev/api-reference/api-types#connection-types-pageinfo) for this list */
pageInfo: PageInfo;
/** The start time of the period across which the balance changes are requested */
startTime: Scalars["FirstMoment"]["output"];
};
export type IkReplay = {
__typename?: "IkReplay";
ik: Scalars["SafeString"]["output"];
isIkReplay: Scalars["Boolean"]["output"];
};
export declare enum IncreaseEnv {
Production = "production",
Sandbox = "sandbox"
}
export type IncreaseLink = Link & {
__typename?: "IncreaseLink";
/** ISO-8601 timestamp when the Link was created. */
created: Scalars["String"]["output"];
/** URL to the Fragment Dashboard for this Link. */
dashboardUrl: Scalars["String"]["output"];
/** A list of External Accounts associated with this Link. */
externalAccounts: ExternalAccountsConnection;
/** FRAGMENT ID of the Increase Link. */
id: Scalars["ID"]["output"];
/** The environment of the Increase Link, either sandbox or production. */
increaseEnv: IncreaseEnv;
/** Name of the Link as it appears in the Dashboard. */
name: Scalars["String"]["output"];
};
/** A condition that must be met on an `Int96` field. */
export type Int96Condition = {
__typename?: "Int96Condition";
/** Amount must exactly match this value. You may not specify this alongside `gte` or `lte`. */
eq?: Maybe<Scalars["Int96"]["output"]>;
/** Amount must be greater than or equal to this value. */
gte?: Maybe<Scalars["Int96"]["output"]>;
/** Amount must be less than or equal to this value. */
lte?: Maybe<Scalars["Int96"]["output"]>;
};
/** A condition that must be met on an `Int96` field. */
export type Int96ConditionInput = {
/** Amount must exactly match this value. You may not specify this alongside `gte` or `lte`. */
eq?: InputMaybe<Scalars["Int96"]["input"]>;
/** Amount must be greater than or equal to this value. */
gte?: InputMaybe<Scalars["Int96"]["input"]>;
/** Amount must be less than or equal to this value. */
lte?: InputMaybe<Scalars["Int96"]["input"]>;
};
export type Int96Filter = {
/** Must exactly equal this Int96 value */
eq?: InputMaybe<Scalars["Int96"]["input"]>;
/** Must be greater than or equal to this Int96 value */
gte?: InputMaybe<Scalars["Int96"]["input"]>;
/** Must be less than or equal to this Int96 value */
lte?: InputMaybe<Scalars["Int96"]["input"]>;
/** Must not equal this Int96 value */
ne?: InputMaybe<Scalars["Int96"]["input"]>;
};
/** Equivalent to an HTTP 5XX - something went wrong with our API. */
export type InternalError = Error & {
__typename?: "InternalError";
/** The status code of error. For example, 'ledger_not_found'. */
code: Scalars["String"]["output"];
/** The error message */
message: Scalars["String"]["output"];
/** Whether or not the operation is retryable */
retryable: Scalars["Boolean"]["output"];
};
/** Ledgers are databases designed for managing money */
export type Ledger = {
__typename?: "Ledger";
/** When aggregating balances, all transactions within a 24 hour period starting at midnight UTC plus this offset are included in each day. */
balanceUTCOffset: Scalars["UTCOffset"]["output"];
created: Scalars["DateTime"]["output"];
/** URL to the Fragment Dashboard for this Ledger. */
dashboardUrl: Scalars["String"]["output"];
/** Entry statistics for this Ledger. */
entryStats: LedgerEntryStatsConnection;
id: Scalars["ID"]["output"];
/** The IK passed into the [createLedger](/api-reference/api-mutations#createledger) mutation. This is treated as a unique identifier for this Ledger. */
ik: Scalars["SafeString"]["output"];
/** Ledger Account data migrations affecting this Ledger. */
ledgerAccountDataMigrations: LedgerAccountDataMigrationConnection;
/** Query LedgerAccounts in Ledger. Ledger Accounts are paginated and returned in reverse-chronological order by their created date. */
ledgerAccounts: LedgerAccountsConnection;
/** Query Ledger Entries in a Ledger. Ledger Entries are paginated and sorted in reverse-chronological order by posted date. */
ledgerEntries: LedgerEntriesConnection;
/** Ledger Entry data migrations affecting this Ledger. */
ledgerEntryDataMigrations: LedgerEntryDataMigrationConnection;
/** Query a Ledger Entry Group for this Ledger given its key and value. */
ledgerEntryGroup: LedgerEntryGroup;
/** Query LedgerEntryGroups in Ledger. Ledger Entry Groups are paginated and returned in order lexigraphically key then inverse chronologically by created. */
ledgerEntryGroups: LedgerEntryGroupsConnection;
/** Schema migrations affecting this Ledger. */
migrations: LedgerMigrationConnection;
/** The name of the Ledger. Can be updated with the [updateLedger](/api-reference/api-mutations#updateledger) mutation. */
name: Scalars["String"]["output"];
/** Schema key associated with this Ledger. */
schema?: Maybe<Schema>;
type: LedgerTypes;
/** @deprecated Callers should not need to query or store this value. */
workspaceId: Scalars["ID"]["output"];
};
/** Ledgers are databases designed for managing money */
export type LedgerEntryStatsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** Ledgers are databases designed for managing money */
export type LedgerLedgerAccountDataMigrationsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
filter?: InputMaybe<LedgerAccountDataMigrationsFilterSet>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** Ledgers are databases designed for managing money */
export type LedgerLedgerAccountsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
filter?: InputMaybe<LedgerAccountsFilterSet>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** Ledgers are databases designed for managing money */
export type LedgerLedgerEntriesArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
filter?: InputMaybe<LedgerEntriesFilterSet>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** Ledgers are databases designed for managing money */
export type LedgerLedgerEntryDataMigrationsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
filter?: InputMaybe<LedgerEntryDataMigrationsFilterSet>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** Ledgers are databases designed for managing money */
export type LedgerLedgerEntryGroupArgs = {
ledgerEntryGroup: EntryGroupMatchInput;
};
/** Ledgers are databases designed for managing money */
export type LedgerLedgerEntryGroupsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
filter?: InputMaybe<LedgerEntryGroupsFilterSet>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** Ledgers are databases designed for managing money */
export type LedgerMigrationsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** A ledger account is a container for money */
export type LedgerAccount = {
__typename?: "LedgerAccount";
/** Total of all lines in this ledger account and child ledger accounts of the same currency as this ledger account */
balance: Scalars["Int96"]["output"];
/** How much did the this ledger account's balance change during the specified period. This query will include all child accounts in the same currency as this ledger account. */
balanceChange: Scalars["Int96"]["output"];
/** How much did the this ledger account's balances change during the specified period. This query will include all child accounts of all currencies. */
balanceChanges: CurrencyAmountConnection;
/**
* How much did the ledger account's balances change over a time period with a specified granularity.
* For example, if the period is 1969-07 and the granularity is daily, the query will return the balance changes for each day in the month.
*/
balanceChangesDuring: BalanceChangeDuringConnection;
/** Total of all lines in this ledger account and child ledger accounts in all currencies */
balances: CurrencyAmountConnection;
/**
* The ledger account's balances over a time period with a specified granularity.
* For example, if the period is 1969-07 and the granularity is daily, the query will return the balance for each day in the month.
*/
balancesDuring: HistoricalBalanceConnection;
/** Total of all lines in child ledger accounts of the same currency as this ledger account */
childBalance: Scalars["Int96"]["output"];
/** How much did the this ledger account's childBalance change during the specified period. This query will only include child accounts which are in the same currency as this one. See childBalanceChanges to include children of different currencies. */
childBalanceChange: Scalars["Int96"]["output"];
/** How much did the this ledger account's child accounts' balances change during the specified period. This query will include all child accounts of all currencies. */
childBalanceChanges: CurrencyAmountConnection;
/**
* How much did the ledger account's childBalances change over a time period with a specified granularity.
* For example, if the period is 1969-07 and the granularity is daily, the query will return the balance changes for each day in the month.
*/
childBalanceChangesDuring: BalanceChangeDuringConnection;
/** Total of all lines in child ledger accounts of this ledger in all currencies */
childBalances: CurrencyAmountConnection;
/**
* The ledger account's childBalances over a time period with a specified granularity.
* For example, if the period is 1969-07 and the granularity is daily, the query will return the balance for each day in the month.
*/
childBalancesDuring: HistoricalBalanceConnection;
/** The child Ledger Accounts of this Ledger Accountw */
childLedgerAccounts: LedgerAccountsConnection;
/**
* The clearing status of the Ledger Account.
*
* This field is null when the Ledger Account is not configured to be a Clearing account.
*/
clearingStatus?: Maybe<LedgerAccountClearingStatus>;
/** The consistency configuration for this Ledger Account. This defines how updates to this Ledger Account's ownBalance are handled. */
consistencyConfig: LedgerAccountConsistencyConfig;
created: Scalars["DateTime"]["output"];
/** Currency of this ledger account */
currency?: Maybe<Currency>;
/** Indicates if the account allows multiple currencies or is restricted to a single currency */
currencyMode: CurrencyMode;
/** URL to the Fragment Dashboard for this Ledger Account. */
dashboardUrl: Scalars["String"]["output"];
id: Scalars["ID"]["output"];
/** The idempotency key used to create this account */
ik: Scalars["String"]["output"];
/** Ledger this account is in */
ledger: Ledger;
/** All Ledger Entries that have posted to this Ledger Account. Ledger Entries are paginated and sorted in reverse-chronological order by posted date. */
ledgerEntries: LedgerEntriesConnection;
/** ID of the ledger this account is in */
ledgerId: Scalars["ID"]["output"];
/** List Ledger Lines in this account, sorted by `posted` in reverse chronological order. Does not include Ledger Lines from child Ledger Accounts. */
lines: LedgerLinesConnection;
/** The Link for the External Account that is linked to this ledger account */
link?: Maybe<CustomLink | IncreaseLink | StripeLink | UnitLink>;
/** External Account that is linked to this ledger account */
linkedAccount?: Maybe<ExternalAccount>;
/** The name of your Ledger Account */
name?: Maybe<Scalars["String"]["output"]>;
/** Total of all lines in this ledger account, excluding all child ledger accounts */
ownBalance: Scalars["Int96"]["output"];
/** How much did the this ledger account's ownBalance change during the specified period. This query will exclude all child accounts. */
ownBalanceChange: Scalars["Int96"]["output"];
/** How much did the this ledger account's ownBalance change during the specified period. This is the total of all lines in this ledger account, excluding all child ledger accounts */
ownBalanceChanges: CurrencyAmountConnection;
/**
* How much did the ledger account's ownBalances change over a time period with a specified granularity.
* For example, if the period is 1969-07 and the granularity is daily, the query will return the balance changes for each day in the month.
*/
ownBalanceChangesDuring: BalanceChangeDuringConnection;
/** Total of all lines across all currencies in this ledger account, excluding all child ledger accounts */
ownBalances: CurrencyAmountConnection;
/**
* The ledger account's ownBalances over a time period with a specified granularity.
* For example, if the period is 1969-07 and the granularity is daily, the query will return the balance for each day in the month.
*/
ownBalancesDuring: HistoricalBalanceConnection;
/** The parent ledger account of this ledger account */
parentLedgerAccount?: Maybe<LedgerAccount>;
/** ID of the parent ledger account of this ledger account */
parentLedgerAccountId?: Maybe<Scalars["ID"]["output"]>;
/**
* The unique Path of the ledger account. This is a slash-delimited string containing the location of an account in its chart of accounts.
* For accounts created with a schema, this will be composed of account keys. Else, for accounts created with the createLedgerAccounts API,
* this will be composed of the IKs of an account and its ancestors.
*/
path: Scalars["String"]["output"];
type: LedgerAccountTypes;
/** A list of external account transactions that haven't been reconciled to this ledger account yet. Only populated for linked ledger accounts. Transactions are sorted in reverse chronological order by posted date. */
unreconciledTxs: TxsConnection;
/** @deprecated Callers should not need to query or store this value. */
workspaceId: Scalars["ID"]["output"];
};
/** A ledger account is a container for money */
export type LedgerAccountBalanceArgs = {
at?: InputMaybe<Scalars["LastMoment"]["input"]>;
currency?: InputMaybe<CurrencyMatchInput>;
};
/** A ledger account is a container for money */
export type LedgerAccountBalanceChangeArgs = {
currency?: InputMaybe<CurrencyMatchInput>;
period: Scalars["Period"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountBalanceChangesArgs = {
period: Scalars["Period"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountBalanceChangesDuringArgs = {
currency?: InputMaybe<CurrencyMatchInput>;
duration: Scalars["Int"]["input"];
granularity: Granularity;
startTime: Scalars["FirstMoment"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountBalancesArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
at?: InputMaybe<Scalars["LastMoment"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** A ledger account is a container for money */
export type LedgerAccountBalancesDuringArgs = {
currency?: InputMaybe<CurrencyMatchInput>;
duration: Scalars["Int"]["input"];
granularity: Granularity;
startTime: Scalars["FirstMoment"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountChildBalanceArgs = {
at?: InputMaybe<Scalars["LastMoment"]["input"]>;
currency?: InputMaybe<CurrencyMatchInput>;
};
/** A ledger account is a container for money */
export type LedgerAccountChildBalanceChangeArgs = {
currency?: InputMaybe<CurrencyMatchInput>;
period: Scalars["Period"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountChildBalanceChangesArgs = {
period: Scalars["Period"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountChildBalanceChangesDuringArgs = {
currency?: InputMaybe<CurrencyMatchInput>;
duration: Scalars["Int"]["input"];
granularity: Granularity;
startTime: Scalars["FirstMoment"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountChildBalancesArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
at?: InputMaybe<Scalars["LastMoment"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** A ledger account is a container for money */
export type LedgerAccountChildBalancesDuringArgs = {
currency?: InputMaybe<CurrencyMatchInput>;
duration: Scalars["Int"]["input"];
granularity: Granularity;
startTime: Scalars["FirstMoment"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountChildLedgerAccountsArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** A ledger account is a container for money */
export type LedgerAccountLedgerEntriesArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** A ledger account is a container for money */
export type LedgerAccountLinesArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
before?: InputMaybe<Scalars["String"]["input"]>;
filter?: InputMaybe<LedgerLinesFilterSet>;
first?: InputMaybe<Scalars["Int"]["input"]>;
last?: InputMaybe<Scalars["Int"]["input"]>;
};
/** A ledger account is a container for money */
export type LedgerAccountOwnBalanceArgs = {
at?: InputMaybe<Scalars["LastMoment"]["input"]>;
consistencyMode?: InputMaybe<ReadBalanceConsistencyMode>;
currency?: InputMaybe<CurrencyMatchInput>;
};
/** A ledger account is a container for money */
export type LedgerAccountOwnBalanceChangeArgs = {
currency?: InputMaybe<CurrencyMatchInput>;
period: Scalars["Period"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountOwnBalanceChangesArgs = {
period: Scalars["Period"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountOwnBalanceChangesDuringArgs = {
currency?: InputMaybe<CurrencyMatchInput>;
duration: Scalars["Int"]["input"];
granularity: Granularity;
startTime: Scalars["FirstMoment"]["input"];
};
/** A ledger account is a container for money */
export type LedgerAccountOwnBalancesArgs = {
after?: InputMaybe<Scalars["String"]["input"]>;
at?: InputMaybe<Scalars["LastMoment"]["input"]>;