From d57050d375547a23e9588ef375ff4273285d7967 Mon Sep 17 00:00:00 2001 From: Leo Kewitz Date: Fri, 4 Oct 2024 15:40:04 +0200 Subject: [PATCH] wip --- package-lock.json | 301 + package.json | 3 +- src/graphql/schema.graphql | 154 +- src/graphql/schemaV2.graphql | 7631 ++++++++++------- .../controllers/account-transactions.ts | 10 +- src/server/controllers/hosted-collectives.ts | 288 + src/server/controllers/index.js | 2 + src/server/lib/formatting.ts | 19 + src/server/lib/{utils.js => utils.ts} | 12 +- src/server/routes.ts | 2 + 10 files changed, 5341 insertions(+), 3081 deletions(-) create mode 100644 src/server/controllers/hosted-collectives.ts create mode 100644 src/server/lib/formatting.ts rename src/server/lib/{utils.js => utils.ts} (81%) diff --git a/package-lock.json b/package-lock.json index 85aea1304..aeca4ffe8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,6 +36,7 @@ }, "devDependencies": { "@babel/cli": "^7.23.4", + "@babel/node": "^7.25.7", "@graphql-eslint/eslint-plugin": "^3.20.1", "@types/express": "^5.0.0", "@types/lodash": "^4.17.9", @@ -508,6 +509,38 @@ "node": ">=6.9.0" } }, + "node_modules/@babel/node": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/node/-/node-7.25.7.tgz", + "integrity": "sha512-SLrRogiTuneH3mZeZQtWBECyVRtznezYdnH4UjatZjHrk/QP+GH9bqsToCWp23pPeA20NO1/p8kECzWt5TTpUA==", + "dev": true, + "dependencies": { + "@babel/register": "^7.25.7", + "commander": "^6.2.0", + "core-js": "^3.30.2", + "node-environment-flags": "^1.0.5", + "regenerator-runtime": "^0.14.0", + "v8flags": "^3.1.1" + }, + "bin": { + "babel-node": "bin/babel-node.js" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/node/node_modules/commander": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", + "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, "node_modules/@babel/parser": { "version": "7.25.6", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.6.tgz", @@ -1728,6 +1761,25 @@ "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, + "node_modules/@babel/register": { + "version": "7.25.7", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.25.7.tgz", + "integrity": "sha512-qHTd2Rhn/rKhSUwdY6+n98FmwXN+N+zxSVx3zWqRe9INyvTpv+aQ5gDV2+43ACd3VtMBzPPljbb0gZb8u5ma6Q==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.6", + "source-map-support": "^0.5.16" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, "node_modules/@babel/regjsgen": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", @@ -4773,6 +4825,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/array.prototype.reduce": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/array.prototype.reduce/-/array.prototype.reduce-1.0.7.tgz", + "integrity": "sha512-mzmiUCVwtiD4lgxYP8g7IYy8El8p2CSMePvIbTS7gchKir/L1fgJrk0yDKmAX6mnRQFKNADYIk8nNlTris5H1Q==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-array-method-boxes-properly": "^1.0.0", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.0.0", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/array.prototype.tosorted": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.4.tgz", @@ -5571,6 +5644,20 @@ "node": ">=0.8" } }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/cloudflare-ip": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/cloudflare-ip/-/cloudflare-ip-0.0.7.tgz", @@ -5680,6 +5767,12 @@ "node": ">= 12" } }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", + "dev": true + }, "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -5740,6 +5833,17 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/core-js": { + "version": "3.38.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.38.1.tgz", + "integrity": "sha512-OP35aUorbU3Zvlx7pjsFdu1rGNnD4pgw/CWoYzRY3t2EzoVT7shKHY1dlAy3f41cGIO7ZDPQimhGFTlEYkG/Hw==", + "dev": true, + "hasInstallScript": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, "node_modules/core-js-compat": { "version": "3.38.1", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.38.1.tgz", @@ -6318,6 +6422,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es-array-method-boxes-properly": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz", + "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", + "dev": true + }, "node_modules/es-define-property": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.0.tgz", @@ -7419,6 +7529,20 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, "node_modules/find-node-modules": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-2.1.3.tgz", @@ -8769,6 +8893,18 @@ "node": ">=8" } }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -8947,6 +9083,15 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", @@ -10887,6 +11032,15 @@ "json-buffer": "3.0.1" } }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/kleur": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", @@ -11765,6 +11919,25 @@ "node": ">= 0.6" } }, + "node_modules/node-environment-flags": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/node-environment-flags/-/node-environment-flags-1.0.6.tgz", + "integrity": "sha512-5Evy2epuL+6TM0lCQGpFIj6KwiEsGh1SrHUhTbNX+sLbBtjidPZFAnVK9y5yU1+h//RitLbRHTIMyxQPtxMdHw==", + "dev": true, + "dependencies": { + "object.getownpropertydescriptors": "^2.0.3", + "semver": "^5.7.0" + } + }, + "node_modules/node-environment-flags/node_modules/semver": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -12085,6 +12258,27 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/object.getownpropertydescriptors": { + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.8.tgz", + "integrity": "sha512-qkHIGe4q0lSYMv0XI4SsBTJz3WaURhLvd0lKSgtVuOsJ2krg4SgMw3PIRQFMp07yi++UR3se2mkcLqsBNpBb/A==", + "dev": true, + "dependencies": { + "array.prototype.reduce": "^1.0.6", + "call-bind": "^1.0.7", + "define-properties": "^1.2.1", + "es-abstract": "^1.23.2", + "es-object-atoms": "^1.0.0", + "gopd": "^1.0.1", + "safe-array-concat": "^1.1.2" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/object.groupby": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", @@ -12493,6 +12687,79 @@ "node": ">= 6" } }, + "node_modules/pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/possible-typed-array-names": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.0.0.tgz", @@ -13322,6 +13589,18 @@ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==" }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", @@ -13485,6 +13764,16 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -14289,6 +14578,18 @@ "node": ">=10.12.0" } }, + "node_modules/v8flags": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.2.0.tgz", + "integrity": "sha512-mH8etigqMfiGWdeXpaaqGfs6BndypxusHHcv2qSHyZkGEznCd/qAXCWWRzeowtL54147cktFOC4P5y+kl8d8Jg==", + "dev": true, + "dependencies": { + "homedir-polyfill": "^1.0.1" + }, + "engines": { + "node": ">= 0.10" + } + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", diff --git a/package.json b/package.json index 867f68300..9f14eff2b 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "depcheck": "npx @opencollective/depcheck .", "deploy:production": "./scripts/pre-deploy.sh production && git push production main", "deploy:staging": "./scripts/pre-deploy.sh staging && git push -f staging main", - "dev": "nodemon src/server/index.js -x \"babel-node --extensions .js,.ts\" . -e js,ts", + "dev": "nodemon src/server/index.ts -x \"babel-node --extensions .js,.ts\" . -e js,ts", "git:clean": "./scripts/git_clean.sh", "graphql:update:local": "cp ../frontend/lib/graphql/*.graphql src/graphql/ && prettier src/graphql/*.graphql --write", "graphql:update": "npm-run-all graphql:updateV1 graphql:updateV2", @@ -66,6 +66,7 @@ }, "devDependencies": { "@babel/cli": "^7.23.4", + "@babel/node": "^7.25.7", "@graphql-eslint/eslint-plugin": "^3.20.1", "@types/express": "^5.0.0", "@types/lodash": "^4.17.9", diff --git a/src/graphql/schema.graphql b/src/graphql/schema.graphql index eb04f601e..37fabb623 100644 --- a/src/graphql/schema.graphql +++ b/src/graphql/schema.graphql @@ -32,11 +32,6 @@ interface CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -429,6 +424,7 @@ This represents an Tier """ type Tier { id: Int + idV2: String! slug: String type: String name: String @@ -1079,7 +1075,6 @@ type CollectiveFeatures { CONTACT_COLLECTIVE: CollectiveFeatureStatus CONTACT_FORM: CollectiveFeatureStatus CREATE_COLLECTIVE: CollectiveFeatureStatus - CROSS_CURRENCY_MANUAL_TRANSACTIONS: CollectiveFeatureStatus TRANSFERWISE: CollectiveFeatureStatus PAYPAL_PAYOUTS: CollectiveFeatureStatus PAYPAL_DONATIONS: CollectiveFeatureStatus @@ -1146,6 +1141,7 @@ type Policies { MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL: MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL EXPENSE_CATEGORIZATION: EXPENSE_CATEGORIZATION EXPENSE_PUBLIC_VENDORS: Boolean + COLLECTIVE_ADMINS_CAN_SEE_PAYOUT_METHODS: Boolean } type EXPENSE_AUTHOR_CANNOT_APPROVE { @@ -2145,11 +2141,6 @@ type Collective implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -2419,11 +2410,6 @@ type Event implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -2693,11 +2679,6 @@ type Fund implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -2967,11 +2948,6 @@ type Organization implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -3241,11 +3217,6 @@ type Project implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -3810,11 +3781,6 @@ type User implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -4086,11 +4052,6 @@ type Vendor implements CollectiveInterface { backgroundImage: String backgroundImageUrl(height: Int, format: ImageFormat): String settings: JSON! - - """ - Defines if a collective is pledged - """ - isPledged: Boolean @deprecated(reason: "2023-11-20: Pledged collectives do not exist anymore") data: JSON @deprecated(reason: "2020-10-08: This field is not provided anymore and will return an empty object") """ @@ -4595,45 +4556,25 @@ type Mutation { """ email: String! ): UserDetails - - """ - Confirm the new user email from confirmation token - """ - confirmUserEmail( - """ - User's emailConfirmationToken - """ - token: String! - ): UserDetails editConnectedAccount(connectedAccount: ConnectedAccountInputType!): ConnectedAccountType - """ - Update a single tier - """ - editTier( - """ - The tier to update - """ - tier: TierInputType! - ): Tier - editTiers(id: Int!, tiers: [TierInputType]): [Tier] - """ Updates all the core contributors (role = ADMIN or MEMBER) for this collective. """ editCoreContributors(collectiveId: Int!, members: [MemberInputType!]!): CollectiveInterface - @deprecated(reason: "2021-07-02: Please use inviteMember, editMember or removeMember mutations from GQLV2") + @deprecated(reason: "2021-07-02: Please use inviteMember, editMember or removeMember mutations from GraphQLV2") """ A mutation to edit the public message of all matching members. """ editPublicMessage(FromCollectiveId: Int!, CollectiveId: Int!, message: String): [Member] - @deprecated(reason: "2021-01-27: Please use editPublicMessage from GQLV2") + @deprecated(reason: "2021-01-27: Please use editPublicMessage from GraphQLV2") """ Update a payment method """ updatePaymentMethod(id: Int!, name: String, monthlyLimitPerMember: Int): PaymentMethodType + @deprecated(reason: "2024-07-16: Please use updateOrder from GraphQLV2") """ Replace a payment method @@ -4820,7 +4761,6 @@ input CollectiveInputType { image: String backgroundImage: String tags: [String] - tiers: [TierInputType] settings: JSON data: JSON @deprecated(reason: "2020-10-08: data cannot be edited. This field will be ignored.") @@ -4880,90 +4820,6 @@ input LocationInputType { structured: JSON } -""" -Input type for TierType -""" -input TierInputType { - id: Int - type: String - name: String - description: String - - """ - A long, html-formatted description. - """ - longDescription: String - - """ - Whether this tier has a standalone page - """ - useStandalonePage: Boolean - - """ - Link to a video (YouTube, Vimeo). - """ - videoUrl: String - - """ - amount in the lowest unit of the currency of the host (ie. in cents) - """ - amount: Int - - """ - Button text - """ - button: String - currency: String - presets: [Int] - interval: String - maxQuantity: Int - minimumAmount: Int - amountType: String - - """ - amount that you are trying to raise with this tier - """ - goal: Int - customFields: [CustomFieldsInputType] - - """ - Start of the campaign - """ - startsAt: String - - """ - End of the campaign - """ - endsAt: String - - """ - Invoice receipt template - """ - invoiceTemplate: String -} - -""" -Input for custom fields for order -""" -input CustomFieldsInputType { - type: CustomFieldType - name: String - label: String - required: Boolean -} - -""" -Type of custom field -""" -enum CustomFieldType { - number - text - email - date - radio - url -} - """ Input type for MemberType """ diff --git a/src/graphql/schemaV2.graphql b/src/graphql/schemaV2.graphql index e162e839b..117d6a19c 100644 --- a/src/graphql/schemaV2.graphql +++ b/src/graphql/schemaV2.graphql @@ -199,7 +199,11 @@ interface Account { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -207,11 +211,6 @@ interface Account { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -504,11 +503,31 @@ interface Account { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -554,6 +573,16 @@ interface Account { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -569,6 +598,7 @@ interface Account { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -611,7 +641,7 @@ interface Account { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -683,6 +713,16 @@ interface Account { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -777,6 +817,11 @@ interface Account { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -795,6 +840,7 @@ interface Account { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -836,6 +882,7 @@ interface Account { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -852,6 +899,31 @@ interface Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -878,6 +950,11 @@ interface Account { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports } """ @@ -931,1457 +1008,1418 @@ enum SocialLinkType { TWITCH } -enum ImageFormat { - txt - png - jpg - gif - svg -} - -""" -A collection of "Members" (ie: Organization backing a Collective) -""" -type MemberCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Member] -} - -""" -Collection interface shared by all collection types -""" -interface Collection { - offset: Int - limit: Int - totalCount: Int -} - -""" -All member roles -""" -enum MemberRole { - BACKER - ADMIN - CONTRIBUTOR - HOST - ATTENDEE - MEMBER - FUNDRAISER @deprecated(reason: "2022-09-12: This role does not exist anymore") - FOLLOWER - ACCOUNTANT - CONNECTED_ACCOUNT -} - -""" -A field whose value conforms to the standard internet email address format as specified in RFC822: https://www.w3.org/Protocols/rfc822/. -""" -scalar EmailAddress - """ -Input to order results chronologically +All supported currencies """ -input ChronologicalOrderInput { +enum Currency { """ - Field to chronologically order by. + US Dollar """ - field: DateTimeField! = CREATED_AT + USD """ - Ordering direction. + UAE Dirham """ - direction: OrderDirection! = DESC -} + AED -""" -All possible DateTime fields for a resource -""" -enum DateTimeField { """ - The creation time of a resource + Afghani """ - CREATED_AT -} - -""" -Possible directions in which to order a list of items -""" -enum OrderDirection { - ASC - DESC -} - -""" -An invitation to join the members of a collective -""" -type MemberInvitation { - id: String! + AFN """ - The person who invited the member, if any + Lek """ - inviter: Individual - createdAt: DateTime! - account: Account! - memberAccount: Account! - role: MemberRole! - description: String - tier: Tier - since: DateTime -} - -""" -Tier model -""" -type Tier { - id: String! - legacyId: Int! - slug: String - name: String - description: String + ALL """ - A long, html-formatted description. + Armenian Dram """ - longDescription: String + AMD """ - Link to a video (YouTube, Vimeo). + Netherlands Antillean Guilder """ - videoUrl: String + ANG """ - Get all orders + Kwanza """ - orders(limit: Int! = 100, offset: Int! = 0, status: [OrderStatus]): OrderCollection! - amount: Amount! - currency: String - button: String - goal: Amount! - type: TierType! - interval: TierInterval @deprecated(reason: "2020-08-24: Please use \"frequency\"") - frequency: TierFrequency! - presets: [Int] - maxQuantity: Int + AOA """ - Number of tickets available. Returns null if there is no limit. + Argentine Peso """ - availableQuantity: Int - customFields: JSON - amountType: TierAmountType! - minimumAmount: Amount! - endsAt: DateTime - invoiceTemplate: String - useStandalonePage: Boolean - singleTicket: Boolean - requireAddress: Boolean! + ARS """ - Returns a list of all the contributors for this tier + Australian Dollar """ - contributors( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 100 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - ): ContributorCollection! - stats: TierStats -} + AUD -""" -A collection of "Orders" -""" -type OrderCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Order] -} + """ + Aruban Florin + """ + AWG -""" -Order model -""" -type Order { - id: String! - legacyId: Int! - description: String + """ + Azerbaijanian Manat + """ + AZN """ - Base order amount (without platform tip) + Convertible Mark """ - amount: Amount! + BAM """ - Tax amount + Barbados Dollar """ - taxAmount: Amount + BBD """ - Total order amount, including all taxes and platform tip + Taka """ - totalAmount: Amount! - quantity: Int - status: OrderStatus - frequency: ContributionFrequency - nextChargeDate: DateTime - tier: Tier - fromAccount: Account - toAccount: Account + BDT """ - Transactions for this order ordered by createdAt ASC + Bulgarian Lev """ - transactions: [Transaction]! - createdAt: DateTime - updatedAt: DateTime + BGN """ - WARNING: Total amount donated between collectives, though there will be edge cases especially when looking on the Order level, as the order id is not used in calculating this. + Burundi Franc """ - totalDonations: Amount! - paymentMethod: PaymentMethod + BIF """ - Host fee percent attached to the Order. + Bermudian Dollar """ - hostFeePercent: Float + BMD """ - Platform Tip attached to the Order. + Brunei Dollar """ - platformTipAmount: Amount - platformTipEligible: Boolean - tags: [String]! - tax: TaxInfo - taxes: [OrderTax]! @deprecated(reason: "2023-04-13: Please use `tax` instead.") + BND """ - This represents a MemberOf relationship (ie: Collective backed by an Individual) attached to the Order. + Boliviano """ - membership: MemberOf + BOB """ - The permissions given to current logged in user for this order + Brazilian Real """ - permissions: OrderPermissions! + BRL """ - The accounting category attached to this order + Bahamian Dollar """ - accountingCategory: AccountingCategory + BSD """ - The list of activities (ie. approved, edited, etc) for this Order ordered by date ascending + Pula """ - activities: ActivityCollection! + BWP """ - Data related to the order + Belarussian Ruble """ - data: JSON + BYN """ - Custom data related to the order, based on the fields described by tier.customFields. Must be authenticated as an admin of the fromAccount or toAccount (returns null otherwise) + Belize Dollar """ - customData: JSON + BZD """ - Memo field which adds additional details about the order. For example in added funds this can be a note to mark what method (cheque, money order) the funds were received. + Canadian Dollar """ - memo: String + CAD """ - The account who created this order + Congolese Franc """ - createdByAccount: Account + CDF """ - Date the funds were received. + Swiss Franc """ - processedAt: DateTime + CHF """ - Data about the pending contribution + Chilean Peso """ - pendingContributionData: PendingOrderData + CLP """ - Whether the order needs confirmation (3DSecure/SCA) + Yuan Renminbi """ - needsConfirmation: Boolean + CNY """ - Returns the list of comments for this order, or `null` if user is not allowed to see them + Colombian Peso """ - comments( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } - ): CommentCollection -} - -""" -All order statuses -""" -enum OrderStatus { - NEW - REQUIRE_CLIENT_CONFIRMATION - PAID - ERROR - PROCESSING - REJECTED - ACTIVE - CANCELLED - PENDING - EXPIRED - DISPUTED - REFUNDED - PAUSED - IN_REVIEW -} - -enum ContributionFrequency { - MONTHLY - YEARLY - ONETIME -} - -""" -Transaction interface shared by all kind of transactions (Debit, Credit) -""" -interface Transaction { - id: String! - legacyId: Int! - uuid: String! @deprecated(reason: "2021-08-15: Use id instead.") - group: String! - type: TransactionType! - kind: TransactionKind - description( - """ - Wether to generate the description dynamically. - """ - dynamic: Boolean = false - - """ - Wether to generate the full description when using dynamic. - """ - full: Boolean = false - ): String - amount: Amount! - amountInHostCurrency: Amount! + COP """ - Exchange rate between the currency of the transaction and the currency of the host (transaction.amount * transaction.hostCurrencyFxRate = transaction.amountInHostCurrency) + Costa Rican Colon """ - hostCurrencyFxRate: Float - netAmount( - """ - Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. - """ - fetchHostFee: Boolean = false - - """ - Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. - """ - fetchPaymentProcessorFee: Boolean = false + CRC - """ - Fetch TAX transaction for retro-compatiblity. - """ - fetchTax: Boolean = false - ): Amount! - netAmountInHostCurrency( - """ - Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. - """ - fetchHostFee: Boolean = false + """ + Cabo Verde Escudo + """ + CVE - """ - Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. - """ - fetchPaymentProcessorFee: Boolean = false + """ + Czech Koruna + """ + CZK - """ - Fetch TAX transaction for retro-compatiblity. - """ - fetchTax: Boolean = false - ): Amount! - taxAmount( - """ - Fetch TAX transaction for retro-compatiblity. - """ - fetchTax: Boolean = false - ): Amount! + """ + Djibouti Franc + """ + DJF """ - If a tax is set, this field will contain more info about the tax + Danish Krone """ - taxInfo: TaxInfo - platformFee: Amount! - hostFee( - """ - Fetch HOST_FEE transaction for retro-compatiblity. - """ - fetchHostFee: Boolean = false - ): Amount - paymentProcessorFee( - """ - Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. - """ - fetchPaymentProcessorFee: Boolean = false - ): Amount - host: Account - account: Account - oppositeAccount: Account + DKK """ - The sender of a transaction (on CREDIT = oppositeAccount, DEBIT = account) + Dominican Peso """ - fromAccount: Account + DOP """ - The recipient of a transaction (on CREDIT = account, DEBIT = oppositeAccount) + Algerian Dinar """ - toAccount: Account - giftCardEmitterAccount: Account - createdAt: DateTime - updatedAt: DateTime - clearedAt: DateTime - expense: Expense - order: Order - isRefunded: Boolean - isRefund: Boolean - isDisputed: Boolean - isInReview: Boolean - paymentMethod: PaymentMethod - payoutMethod: PayoutMethod - permissions: TransactionPermissions - isOrderRejected: Boolean! - refundTransaction: Transaction + DZD """ - The opposite transaction (CREDIT -> DEBIT, DEBIT -> CREDIT) + Egyptian Pound """ - oppositeTransaction: Transaction - relatedTransactions( - """ - Filter by kind - """ - kind: [TransactionKind] - ): [Transaction]! + EGP """ - Merchant id related to the Transaction (Stripe, PayPal, Wise, Privacy) + Ethiopian Birr """ - merchantId: String + ETB """ - The balance after the Transaction has run. Only for financially active accounts. + Euro """ - balanceInHostCurrency: Amount - invoiceTemplate: String -} + EUR -""" -All transaction types -""" -enum TransactionType { - DEBIT - CREDIT -} - -enum TransactionKind { - ADDED_FUNDS - BALANCE_TRANSFER - CONTRIBUTION - EXPENSE - HOST_FEE - HOST_FEE_SHARE - HOST_FEE_SHARE_DEBT - PAYMENT_PROCESSOR_COVER - PAYMENT_PROCESSOR_DISPUTE_FEE - PAYMENT_PROCESSOR_FEE - PLATFORM_FEE - PLATFORM_TIP - PLATFORM_TIP_DEBT - PREPAID_PAYMENT_METHOD - TAX -} - -""" -Information about a tax -""" -type TaxInfo { """ - An unique identifier for this tax (GST, VAT, etc) + Fiji Dollar """ - id: String! + FJD """ - Identifier for this tax (GST, VAT, etc) + Falkland Islands Pound """ - type: OrderTaxType! + FKP """ - Percentage applied, between 0-100 + Pound Sterling """ - percentage: Int! @deprecated(reason: "Please use `rate` instead") + GBP """ - Percentage applied, between 0-1 + Lari """ - rate: Float! + GEL """ - Tax ID number of the 3rd party receiving/paying the tax + Gibraltar Pound """ - idNumber: String -} + GIP -""" -The type of a tax like GST, VAT, etc -""" -enum OrderTaxType { """ - European Value Added Tax + Dalasi """ - VAT + GMD """ - New Zealand Good and Services Tax + Guinea Franc """ - GST -} - -""" -This represents an Expense -""" -type Expense { - id: String! + GNF """ - Legacy ID as returned by API V1. Avoid relying on this field as it may be removed in the future. + Quetzal """ - legacyId: Int! + GTQ """ - Title/main description for this expense + Guyana Dollar """ - description: String! + GYD """ - Longer description for this expense + Hong Kong Dollar """ - longDescription: String + HKD """ - Total amount of the expense (sum of the item's amounts). + Lempira """ - amount: Int! @deprecated(reason: "2022-02-09: Please use amountV2") + HNL """ - Total amount of the expense + Kuna """ - amountV2( - """ - Source of the currency to express the amount. Defaults to the expense currency - """ - currencySource: ExpenseCurrencySource = EXPENSE - ): Amount + HRK """ - Taxes applied to this expense + Gourde """ - taxes: [TaxInfo]! + HTG """ - The exchange rate between the expense currency and the account currency + Forint """ - accountCurrencyFxRate: Float! @deprecated(reason: "2022-02-09: Please use amountV2") + HUF """ - The accounting category attached to this expense + Rupiah """ - accountingCategory: AccountingCategory + IDR """ - If available, this field will contain a breakdown of the expense values depending on who edited it + New Israeli Sheqel """ - valuesByRole: ExpenseValuesByRole + ILS """ - The time of creation + Indian Rupee """ - createdAt: DateTime! + INR """ - Currency that should be used for the payout + Iceland Krona """ - currency: Currency! + ISK """ - Whether this expense is a receipt or an invoice + Jamaican Dollar """ - type: ExpenseType! + JMD """ - The state of the expense (pending, approved, paid, rejected...etc) + Yen """ - status: ExpenseStatus! + JPY """ - The accounts who approved this expense + Kenyan Shilling """ - approvedBy: [Account]! + KES """ - The account who paid this expense + Som """ - paidBy: Account + KGS """ - Whether this expense is on hold + Riel """ - onHold: Boolean + KHR """ - Returns the list of comments for this expense, or `null` if user is not allowed to see them + Comoro Franc """ - comments( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 - - """ - The offset to use to fetch - """ - offset: Int! = 0 - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } - ): CommentCollection + KMF """ - The account where the expense was submitted + Won """ - account: Account! + KRW """ - The account being paid by this expense + Cayman Islands Dollar """ - payee: Account! + KYD """ - The address of the payee + Tenge """ - payeeLocation: Location + KZT """ - The account who created this expense + Kip """ - createdByAccount: Account + LAK """ - The account from where the expense was paid + Lebanese Pound """ - host: Host + LBP """ - The payout method to use for this expense + Sri Lanka Rupee """ - payoutMethod: PayoutMethod - paymentMethod: PaymentMethod + LKR """ - The virtual card used to pay for this charge + Liberian Dollar """ - virtualCard: VirtualCard + LRD """ - (Optional) files attached to the expense + Loti """ - attachedFiles: [ExpenseAttachedFile!] - items: [ExpenseItem] + LSL """ - Additional information about the payment as HTML. Only visible to user and admins. + Moroccan Dirham """ - privateMessage: String + MAD """ - Information to display on the invoice. Only visible to user and admins. + Moldovan Leu """ - invoiceInfo: String + MDL """ - The fees payer for this expense + Malagasy Ariary """ - feesPayer: FeesPayer! + MGA """ - The permissions given to current logged in user for this expense + Denar """ - permissions: ExpensePermissions! + MKD """ - The list of activities (ie. approved, edited, etc) for this expense ordered by date ascending + Kyat """ - activities: [Activity!]! - tags: [String]! + MMK """ - Returns the list of legal documents required from the payee before the expense can be payed. Must be logged in. + Tugrik """ - requiredLegalDocuments: [LegalDocumentType] + MNT """ - Drafted field values that were still not persisted + Pataca """ - draft: JSON + MOP """ - The account that requested this expense to be submitted + Mauritius Rupee """ - requestedByAccount: Account - quote: ExpenseQuote - validateTransferRequirements( - """ - Details of the transfer - """ - details: JSON - ): [TransferWiseRequiredField] - recurringExpense: RecurringExpense + MUR """ - [Admin only] Security checks for this expense. Only available to expenses under trusted hosts. + Rufiyaa """ - securityChecks: [SecurityCheck] + MVR """ - Custom data for this expense + Kwacha """ - customData: JSON + MWK """ - The merchant ID for this expense + Mexican Peso """ - merchantId: String -} + MXN -""" -All supported expense currency sources -""" -enum ExpenseCurrencySource { """ - The expense currency expressed as the host currency + Malaysian Ringgit """ - HOST + MYR """ - The expense currency expressed as the account currency + Mozambique Metical """ - ACCOUNT + MZN """ - The expense currency expressed as the expense currency + Namibia Dollar """ - EXPENSE + NAD """ - The expense currency expressed as the expense currency + Naira """ - CREATED_BY_ACCOUNT -} - -""" -Fields for an accounting category -""" -type AccountingCategory { - id: String! + NGN """ - The code of the accounting category + Cordoba Oro """ - code: String! + NIO """ - The technical name of the accounting category + Norwegian Krone """ - name: String! + NOK """ - A friendly name for non-accountants (i.e. expense submitters and collective admins) + Nepalese Rupee """ - friendlyName: String + NPR """ - Whether this category is only meant for the host admins + New Zealand Dollar """ - hostOnly: Boolean! + NZD """ - Instructions for the expense submitters + Balboa """ - instructions: String + PAB """ - The account this category belongs to + Nuevo Sol """ - account: Host! + PEN """ - If meant for expenses, the types of expenses this category applies to + Kina """ - expensesTypes: [ExpenseType] + PGK """ - The kind of transactions this category applies to + Philippine Peso """ - kind: AccountingCategoryKind + PHP """ - The time of creation of this accounting category + Pakistan Rupee """ - createdAt: DateTime! -} + PKR -""" -This represents an Host account -""" -type Host implements Account & AccountWithContributions { - id: String! - legacyId: Int! + """ + Zloty + """ + PLN """ - The slug identifying the account (ie: babel) + Guarani """ - slug: String! - type: AccountType! + PYG """ - Public name + Qatari Rial """ - name: String + QAR """ - Private, legal name. Used for expense receipts, taxes, etc. Scope: "account". + Romanian Leu """ - legalName: String - description: String - longDescription: String - tags: [String] - website: String @deprecated(reason: "2023-01-16: Please use socialLinks") - twitterHandle: String @deprecated(reason: "2023-01-16: Please use socialLinks") - githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") - repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") - socialLinks: [SocialLink!]! - currency: String - expensePolicy: String + RON """ - Defines if the contributors wants to be incognito (name not displayed) + Serbian Dinar """ - isIncognito: Boolean! - imageUrl(height: Int, format: ImageFormat): String + RSD """ - Returns whether this account has a custom image + Russian Ruble """ - hasImage: Boolean! - backgroundImageUrl(height: Int, format: ImageFormat): String + RUB """ - The time of creation + Rwanda Franc """ - createdAt: DateTime - updatedAt: DateTime + RWF """ - Returns whether this account is archived + Saudi Riyal """ - isArchived: Boolean! + SAR """ - Whether this account is frozen + Solomon Islands Dollar """ - isFrozen: Boolean! + SBD """ - Returns whether the account accepts financial contributions. + Seychelles Rupee """ - isActive: Boolean + SCR """ - Returns whether the account is setup to Host collectives. + Swedish Krona """ - isHost: Boolean! + SEK """ - Returns true if the remote user is an admin of this account + Singapore Dollar """ - isAdmin: Boolean! - parentAccount: Account @deprecated(reason: "2022-12-16: use parent on AccountWithParent instead") + SGD """ - Get all members (admins, members, backers, followers) + Saint Helena Pound """ - members( - limit: Int! = 100 - offset: Int! = 0 - role: [MemberRole] - accountType: [AccountType] + SHP - """ - Admin only. To filter on the email address of a member, useful to check if a member exists. - """ - email: EmailAddress + """ + Leone + """ + SLL - """ - Order of the results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: ASC } - includeInherited: Boolean = true - ): MemberCollection! + """ + Somali Shilling + """ + SOS """ - [AUTHENTICATED] Returns the pending invitations + Surinam Dollar """ - memberInvitations( - """ - A reference to an account (usually Individual). Will return invitations sent to the account to join as a member - """ - memberAccount: AccountReferenceInput + SRD - """ - A reference to an account (usually Collective, Fund or Organization). Will return invitations sent to join this account as a member. - """ - account: AccountReferenceInput + """ + Lilangeni + """ + SZL - """ - An array of Member roles to filter for - """ - role: [MemberRole] - ): [MemberInvitation] + """ + Baht + """ + THB """ - The legal documents associated with this account + Somoni """ - legalDocuments( - """ - Filter by type - """ - type: [LegalDocumentType] - ): [LegalDocument] - memberOf( - limit: Int! = 150 - offset: Int! = 0 - role: [MemberRole] - accountType: [AccountType] - account: AccountReferenceInput + TJS - """ - Filter on whether the account is a host or not - """ - isHostAccount: Boolean + """ + Pa’anga + """ + TOP - """ - Filter on (un)approved collectives - """ - isApproved: Boolean + """ + Turkish Lira + """ + TRY - """ - Filter on archived collectives - """ - isArchived: Boolean + """ + Trinidad and Tobago Dollar + """ + TTD - """ - Whether incognito profiles should be included in the result. Only works if requesting user is an admin of the account. - """ - includeIncognito: Boolean = true + """ + New Taiwan Dollar + """ + TWD - """ - A term to search membership. Searches in collective tags, name, slug, members description and role. - """ - searchTerm: String + """ + Tanzanian Shilling + """ + TZS - """ - Filters on the Host fees structure applied to this account - """ - hostFeesStructure: HostFeeStructure + """ + Hryvnia + """ + UAH - """ - Order of the results - """ - orderBy: OrderByInput! = { field: CREATED_AT, direction: DESC } + """ + Uganda Shilling + """ + UGX - """ - Order the query by requested role order - """ - orderByRoles: Boolean - ): MemberOfCollection! + """ + Peso Uruguayo + """ + UYU """ - Returns the emails of the account. Individuals only have one, but organizations can have multiple emails. + Uzbekistan Sum """ - emails: [EmailAddress!] - transactions( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 100 + UZS - """ - The offset to use to fetch - """ - offset: Int! = 0 + """ + Dong + """ + VND - """ - The transaction type (DEBIT or CREDIT) - """ - type: TransactionType + """ + Vatu + """ + VUV - """ - The payment method types. Can include `null` for transactions without a payment method - """ - paymentMethodType: [PaymentMethodType] + """ + Tala + """ + WST - """ - The payment method services. - """ - paymentMethodService: [PaymentMethodService] + """ + CFA Franc BEAC + """ + XAF - """ - Reference of the account(s) assigned to the main side of the transaction you want to EXCLUDE from the results - """ - excludeAccount: [AccountReferenceInput] + """ + East Caribbean Dollar + """ + XCD - """ - Reference of the account assigned to the other side of the transaction (CREDIT -> sender, DEBIT -> recipient). Avoid, favor account instead. - """ - fromAccount: AccountReferenceInput + """ + CFA Franc BCEAO + """ + XOF - """ - Reference of the host accounting the transaction - """ - host: AccountReferenceInput + """ + CFP Franc + """ + XPF - """ - NOT IMPLEMENTED. Only return transactions that match these tags. - """ - tags: [String] @deprecated(reason: "2020-08-09: Was never implemented.") + """ + Yemeni Rial + """ + YER - """ - The order of results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + """ + Rand + """ + ZAR - """ - Only return transactions where the amount is greater than or equal to this value (in cents) - """ - minAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") + """ + Zambian Kwacha + """ + ZMW +} + +enum ImageFormat { + txt + png + jpg + gif + svg +} + +""" +A collection of "Members" (ie: Organization backing a Collective) +""" +type MemberCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Member] +} + +""" +Collection interface shared by all collection types +""" +interface Collection { + offset: Int + limit: Int + totalCount: Int +} +""" +All member roles +""" +enum MemberRole { + BACKER + ADMIN + CONTRIBUTOR + HOST + ATTENDEE + MEMBER + FUNDRAISER @deprecated(reason: "2022-09-12: This role does not exist anymore") + FOLLOWER + ACCOUNTANT + CONNECTED_ACCOUNT +} + +""" +A field whose value conforms to the standard internet email address format as specified in RFC822: https://www.w3.org/Protocols/rfc822/. +""" +scalar EmailAddress + +""" +Input to order results chronologically +""" +input ChronologicalOrderInput { + """ + Field to chronologically order by. + """ + field: DateTimeField! = CREATED_AT + + """ + Ordering direction. + """ + direction: OrderDirection! = DESC +} + +""" +All possible DateTime fields for a resource +""" +enum DateTimeField { + """ + The creation time of a resource + """ + CREATED_AT + + """ + Transactions only: The date when a transaction was cleared by the payment processor + """ + EFFECTIVE_DATE +} + +""" +Possible directions in which to order a list of items +""" +enum OrderDirection { + ASC + DESC +} + +""" +An invitation to join the members of a collective +""" +type MemberInvitation { + id: String! + + """ + The person who invited the member, if any + """ + inviter: Individual + createdAt: DateTime! + account: Account! + memberAccount: Account! + role: MemberRole! + description: String + tier: Tier + since: DateTime +} + +""" +Tier model +""" +type Tier { + id: String! + legacyId: Int! + slug: String + name: String + description: String + + """ + A long, html-formatted description. + """ + longDescription: String + + """ + Link to a video (YouTube, Vimeo). + """ + videoUrl: String + + """ + Get all orders + """ + orders(limit: Int! = 100, offset: Int! = 0, status: [OrderStatus]): OrderCollection! + amount: Amount! + currency: String + button: String + goal: Amount! + type: TierType! + interval: TierInterval @deprecated(reason: "2020-08-24: Please use \"frequency\"") + frequency: TierFrequency! + presets: [Int] + maxQuantity: Int + + """ + Number of tickets available. Returns null if there is no limit. + """ + availableQuantity: Int + customFields: JSON + amountType: TierAmountType! + minimumAmount: Amount! + endsAt: DateTime + invoiceTemplate: String + useStandalonePage: Boolean + singleTicket: Boolean + requireAddress: Boolean! + + """ + Returns a list of all the contributors for this tier + """ + contributors( """ - Only return transactions where the amount is lower than or equal to this value (in cents) + The number of results to fetch (default 10, max 1000) """ - maxAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") + limit: Int! = 100 """ - Only return transactions that were created after this date + The offset to use to fetch """ - dateFrom: DateTime + offset: Int! = 0 + ): ContributorCollection! + stats: TierStats +} + +""" +A collection of "Orders" +""" +type OrderCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Order] +} + +""" +Order model +""" +type Order { + id: String! + legacyId: Int! + description: String + + """ + Base order amount (without platform tip) + """ + amount: Amount! + + """ + Tax amount + """ + taxAmount: Amount + + """ + Total order amount, including all taxes and platform tip + """ + totalAmount: Amount! + quantity: Int + status: OrderStatus + frequency: ContributionFrequency + nextChargeDate: DateTime + tier: Tier + fromAccount: Account + toAccount: Account + + """ + Transactions for this order ordered by createdAt ASC + """ + transactions: [Transaction]! + createdAt: DateTime + updatedAt: DateTime + + """ + WARNING: Total amount donated between collectives, though there will be edge cases especially when looking on the Order level, as the order id is not used in calculating this. + """ + totalDonations: Amount! + paymentMethod: PaymentMethod + paymentProcessorUrl: String + + """ + Host fee percent attached to the Order. + """ + hostFeePercent: Float + + """ + Payment processor fee attached to manually Added Funds. + """ + paymentProcessorFee: Amount + + """ + Platform Tip attached to the Order. + """ + platformTipAmount: Amount + platformTipEligible: Boolean + tags: [String]! + tax: TaxInfo + taxes: [OrderTax]! @deprecated(reason: "2023-04-13: Please use `tax` instead.") + + """ + This represents a MemberOf relationship (ie: Collective backed by an Individual) attached to the Order. + """ + membership: MemberOf + + """ + The permissions given to current logged in user for this order + """ + permissions: OrderPermissions! + + """ + The accounting category attached to this order + """ + accountingCategory: AccountingCategory - """ - Only return transactions that were created before this date - """ - dateTo: DateTime + """ + The list of activities (ie. approved, edited, etc) for this Order ordered by date ascending + """ + activities: ActivityCollection! - """ - Only return transactions that were cleared after this date - """ - clearedFrom: DateTime + """ + Data related to the order + """ + data: JSON - """ - Only return transactions that were cleared before this date - """ - clearedTo: DateTime + """ + Custom data related to the order, based on the fields described by tier.customFields. Must be authenticated as an admin of the fromAccount or toAccount (returns null otherwise) + """ + customData: JSON - """ - The term to search - """ - searchTerm: String + """ + Memo field which adds additional details about the order. For example in added funds this can be a note to mark what method (cheque, money order) the funds were received. + """ + memo: String - """ - Only return transactions with an Expense attached - """ - hasExpense: Boolean + """ + The account who created this order + """ + createdByAccount: Account - """ - Only return transactions with this Expense attached - """ - expense: ExpenseReferenceInput + """ + Date the funds were received. + """ + processedAt: DateTime - """ - Only return transactions that have an Expense of one of these expense types attached - """ - expenseType: [ExpenseType] + """ + Data about the pending contribution + """ + pendingContributionData: PendingOrderData - """ - Only return transactions with an Order attached - """ - hasOrder: Boolean + """ + Whether the order needs confirmation (3DSecure/SCA) + """ + needsConfirmation: Boolean + """ + Returns the list of comments for this order, or `null` if user is not allowed to see them + """ + comments( """ - Only return transactions for this order. + The number of results to fetch (default 10, max 1000) """ - order: OrderReferenceInput + limit: Int! = 10 """ - Used when filtering with the `host` argument to determine whether to include transactions on the fiscal host account (and children) + The offset to use to fetch """ - includeHost: Boolean! = true + offset: Int! = 0 + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } + ): CommentCollection +} - """ - Whether to include regular transactions from the account (turn false if you only want Incognito or Gift Card transactions) - """ - includeRegularTransactions: Boolean! = true +""" +All order statuses +""" +enum OrderStatus { + NEW + REQUIRE_CLIENT_CONFIRMATION + PAID + ERROR + PROCESSING + REJECTED + ACTIVE + CANCELLED + PENDING + EXPIRED + DISPUTED + REFUNDED + PAUSED + IN_REVIEW +} - """ - If the account is a user and this field is true, contributions from the incognito profile will be included too (admins only) - """ - includeIncognitoTransactions: Boolean! = false +enum ContributionFrequency { + MONTHLY + YEARLY + ONETIME +} +""" +Transaction interface shared by all kind of transactions (Debit, Credit) +""" +interface Transaction { + id: String! + legacyId: Int! + uuid: String! @deprecated(reason: "2021-08-15: Use id instead.") + group: String! + type: TransactionType! + kind: TransactionKind + description( """ - Whether to include transactions from children (Events and Projects) + Wether to generate the description dynamically. """ - includeChildrenTransactions: Boolean! = false + dynamic: Boolean = false """ - Whether to include transactions from Gift Cards issued by the account. + Wether to generate the full description when using dynamic. """ - includeGiftCardTransactions: Boolean! = false + full: Boolean = false + ): String + amount: Amount! + amountInHostCurrency: Amount! + """ + Exchange rate between the currency of the transaction and the currency of the host (transaction.amount * transaction.hostCurrencyFxRate = transaction.amountInHostCurrency) + """ + hostCurrencyFxRate: Float + netAmount( """ - Whether to include debt transactions + Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. """ - includeDebts: Boolean! = false + fetchHostFee: Boolean = false """ - To filter by transaction kind + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. """ - kind: [TransactionKind] + fetchPaymentProcessorFee: Boolean = false """ - The transactions group to filter by + Fetch TAX transaction for retro-compatiblity. """ - group: [String] - virtualCard: [VirtualCardReferenceInput] - + fetchTax: Boolean = false + ): Amount! + netAmountInHostCurrency( """ - Only return transactions that are refunds (or not refunds if false) + Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. """ - isRefund: Boolean + fetchHostFee: Boolean = false """ - Only return transactions that are associated with these external merchant IDs + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. """ - merchantId: [String] + fetchPaymentProcessorFee: Boolean = false """ - Only return transactions that are associated with these accounting categories - """ - accountingCategory: [String] - ): TransactionCollection! - orders( - """ - The number of results to fetch (default 10, max 1000) + Fetch TAX transaction for retro-compatiblity. """ - limit: Int! = 100 - + fetchTax: Boolean = false + ): Amount! + taxAmount( """ - The offset to use to fetch + Fetch TAX transaction for retro-compatiblity. """ - offset: Int! = 0 + fetchTax: Boolean = false + ): Amount! + """ + If a tax is set, this field will contain more info about the tax + """ + taxInfo: TaxInfo + platformFee: Amount! + hostFee( """ - If account is a host, also include hosted accounts orders + Fetch HOST_FEE transaction for retro-compatiblity. """ - includeHostedAccounts: Boolean - + fetchHostFee: Boolean = false + ): Amount + paymentProcessorFee( """ - Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. """ - paymentMethod: PaymentMethodReferenceInput + fetchPaymentProcessorFee: Boolean = false + ): Amount + paymentProcessorUrl: String + host: Account + account: Account + oppositeAccount: Account - """ - Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. - """ - includeIncognito: Boolean = false + """ + The sender of a transaction (on CREDIT = oppositeAccount, DEBIT = account) + """ + fromAccount: Account - """ - Account orders filter (INCOMING or OUTGOING) - """ - filter: AccountOrdersFilter + """ + The recipient of a transaction (on CREDIT = account, DEBIT = oppositeAccount) + """ + toAccount: Account + giftCardEmitterAccount: Account + createdAt: DateTime + updatedAt: DateTime + clearedAt: DateTime + expense: Expense + order: Order + isRefunded: Boolean + isRefund: Boolean + isDisputed: Boolean + isInReview: Boolean + paymentMethod: PaymentMethod + payoutMethod: PayoutMethod + permissions: TransactionPermissions + isOrderRejected: Boolean! + refundTransaction: Transaction + """ + The opposite transaction (CREDIT -> DEBIT, DEBIT -> CREDIT) + """ + oppositeTransaction: Transaction + relatedTransactions( """ - Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) + Filter by kind """ - frequency: ContributionFrequency + kind: [TransactionKind] + ): [Transaction]! - """ - Use this field to filter orders on their statuses - """ - status: [OrderStatus] + """ + Merchant id related to the Transaction (Stripe, PayPal, Wise, Privacy) + """ + merchantId: String - """ - The order of results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + """ + The balance after the Transaction has run. Only for financially active accounts. + """ + balanceInHostCurrency: Amount + invoiceTemplate: String +} - """ - Only return orders where the amount is greater than or equal to this value (in cents) - """ - minAmount: Int +""" +All transaction types +""" +enum TransactionType { + DEBIT + CREDIT +} - """ - Only return orders where the amount is lower than or equal to this value (in cents) - """ - maxAmount: Int +enum TransactionKind { + ADDED_FUNDS + BALANCE_TRANSFER + CONTRIBUTION + EXPENSE + HOST_FEE + HOST_FEE_SHARE + HOST_FEE_SHARE_DEBT + PAYMENT_PROCESSOR_COVER + PAYMENT_PROCESSOR_DISPUTE_FEE + PAYMENT_PROCESSOR_FEE + PLATFORM_FEE + PLATFORM_TIP + PLATFORM_TIP_DEBT + PREPAID_PAYMENT_METHOD + TAX +} - """ - Only return orders that were created after this date - """ - dateFrom: DateTime +""" +Information about a tax +""" +type TaxInfo { + """ + An unique identifier for this tax (GST, VAT, etc) + """ + id: String! - """ - Only return orders that were created before this date - """ - dateTo: DateTime + """ + Identifier for this tax (GST, VAT, etc) + """ + type: OrderTaxType! - """ - The term to search - """ - searchTerm: String - tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") + """ + Percentage applied, between 0-100 + """ + percentage: Int! @deprecated(reason: "Please use `rate` instead") - """ - Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. - """ - onlySubscriptions: Boolean + """ + Percentage applied, between 0-1 + """ + rate: Float! - """ - Same as onlySubscriptions, but returns only orders with active subscriptions - """ - onlyActiveSubscriptions: Boolean + """ + Tax ID number of the 3rd party receiving/paying the tax + """ + idNumber: String +} - """ - Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) - """ - oppositeAccount: AccountReferenceInput - ): OrderCollection! - expenses( - direction: ExpenseDirection +""" +The type of a tax like GST, VAT, etc +""" +enum OrderTaxType { + """ + European Value Added Tax + """ + VAT - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 + """ + New Zealand Good and Services Tax + """ + GST +} - """ - The offset to use to fetch - """ - offset: Int! = 0 +""" +This represents an Expense +""" +type Expense { + id: String! - """ - Reference of an account that is the payee of an expense - """ - fromAccount: AccountReferenceInput + """ + Legacy ID as returned by API V1. Avoid relying on this field as it may be removed in the future. + """ + legacyId: Int! - """ - Reference of an account that is the payer of an expense - """ - account: AccountReferenceInput + """ + Title/main description for this expense + """ + description: String! - """ - Return expenses only for this host - """ - host: AccountReferenceInput + """ + Longer description for this expense + """ + longDescription: String - """ - Return expenses only created by this INDIVIDUAL account - """ - createdByAccount: AccountReferenceInput + """ + User-provided reference number or any other identifier that references the invoice + """ + reference: String - """ - Use this field to filter expenses on their statuses - """ - status: ExpenseStatusFilter + """ + Total amount of the expense (sum of the item's amounts). + """ + amount: Int! @deprecated(reason: "2022-02-09: Please use amountV2") + """ + Total amount of the expense + """ + amountV2( """ - Use this field to filter expenses on their type (RECEIPT/INVOICE) + Source of the currency to express the amount. Defaults to the expense currency """ - type: ExpenseType - types: [ExpenseType] + currencySource: ExpenseCurrencySource = EXPENSE + ): Amount - """ - Only expenses that match these tags - """ - tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + """ + Taxes applied to this expense + """ + taxes: [TaxInfo]! - """ - Only expenses that match these tags - """ - tag: [String] + """ + The exchange rate between the expense currency and the account currency + """ + accountCurrencyFxRate: Float! @deprecated(reason: "2022-02-09: Please use amountV2") - """ - The order of results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + """ + The accounting category attached to this expense + """ + accountingCategory: AccountingCategory - """ - Only return expenses where the amount is greater than or equal to this value (in cents) - """ - minAmount: Int + """ + If available, this field will contain a breakdown of the expense values depending on who edited it + """ + valuesByRole: ExpenseValuesByRole - """ - Only return expenses where the amount is lower than or equal to this value (in cents) - """ - maxAmount: Int + """ + The time of creation + """ + createdAt: DateTime! - """ - Only return expenses that use the given type as payout method - """ - payoutMethodType: PayoutMethodType + """ + Currency that should be used for the payout + """ + currency: Currency! - """ - Only return expenses that were created after this date - """ - dateFrom: DateTime + """ + Whether this expense is a receipt or an invoice + """ + type: ExpenseType! - """ - Only return expenses that were created after this date - """ - dateTo: DateTime + """ + The state of the expense (pending, approved, paid, rejected...etc) + """ + status: ExpenseStatus! - """ - The term to search - """ - searchTerm: String + """ + The accounts who approved this expense + """ + approvedBy: [Account]! - """ - Whether to include expenses from children of the account (Events and Projects) - """ - includeChildrenExpenses: Boolean! = false + """ + The account who paid this expense + """ + paidBy: Account - """ - Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. - """ - customData: JSON + """ + Whether this expense is on hold + """ + onHold: Boolean + """ + Returns the list of comments for this expense, or `null` if user is not allowed to see them + """ + comments( """ - Filter expenses of type charges based on presence of receipts + The number of results to fetch (default 10, max 1000) """ - chargeHasReceipts: Boolean + limit: Int! = 10 """ - Filter expenses of type charges using these virtual cards + The offset to use to fetch """ - virtualCards: [VirtualCardReferenceInput] - ): ExpenseCollection! - settings: JSON! - conversations( - limit: Int! = 15 offset: Int! = 0 + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } + ): CommentCollection - """ - Only return conversations matching this tag - """ - tag: String - ): ConversationCollection! + """ + The account where the expense was submitted + """ + account: Account! """ - Returns conversation's tags for collective sorted by popularity + The account being paid by this expense """ - conversationsTags(limit: Int! = 30): [TagStat] + payee: Account! """ - Returns expense tags for collective sorted by popularity + The address of the payee """ - expensesTags(limit: Int! = 30): [TagStat] + payeeLocation: Location """ - The list of expense types supported by this account + The account who created this expense """ - supportedExpenseTypes: [ExpenseType!]! - transferwise: TransferWise + createdByAccount: Account """ - The list of payout methods that this collective can use to get paid. In most cases, admin only and scope: "expenses". + The account from where the expense was paid """ - payoutMethods: [PayoutMethod] + host: Host """ - The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". + The payout method to use for this expense """ - paymentMethods( - type: [PaymentMethodType] - enumType: [PaymentMethodType] @deprecated(reason: "2021-08-20: use type instead from now") - service: [PaymentMethodService] + payoutMethod: PayoutMethod + paymentMethod: PaymentMethod - """ - Whether to include expired payment methods. Payment methods expired since more than 6 months will never be returned. - """ - includeExpired: Boolean - ): [PaymentMethod] + """ + The virtual card used to pay for this charge + """ + virtualCard: VirtualCard """ - The list of payment methods for this account that are pending a client confirmation (3D Secure / SCA) + (Optional) files attached to the expense """ - paymentMethodsWithPendingConfirmation: [PaymentMethod] + attachedFiles: [ExpenseAttachedFile!] + items: [ExpenseItem] """ - The list of connected accounts (Stripe, Twitter, etc ...). Admin only. Scope: "connectedAccounts". + Additional information about the payment as HTML. Only visible to user and admins. """ - connectedAccounts: [ConnectedAccount] + privateMessage: String """ - The list of applications created by this account. Admin only. Scope: "applications". + Information to display on the invoice. Only visible to user and admins. """ - oAuthApplications( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 + invoiceInfo: String - """ - The offset to use to fetch - """ - offset: Int! = 0 - ): OAuthApplicationCollection + """ + The fees payer for this expense + """ + feesPayer: FeesPayer! """ - The address associated to this account. This field is always public for collectives and events. + The permissions given to current logged in user for this expense """ - location: Location - categories: [String]! - stats: AccountStats + permissions: ExpensePermissions! """ - Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". + The list of activities (ie. approved, edited, etc) for this expense ordered by date ascending """ - updates( + activities: [Activity!]! + tags: [String]! + + """ + Returns the list of legal documents required from the payee before the expense can be payed. Must be logged in. + """ + requiredLegalDocuments: [LegalDocumentType] + + """ + Returns the list of legal documents attached to this expense. Must be logged in as a host admin. + """ + legalDocuments( """ The number of results to fetch (default 10, max 1000) """ @@ -2393,287 +2431,289 @@ type Host implements Account & AccountWithContributions { offset: Int! = 0 """ - Only return published updates. + Filter by type of legal document """ - onlyPublishedUpdates: Boolean = false - onlyChangelogUpdates: Boolean - orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - searchTerm: String - ): UpdateCollection! + type: [LegalDocumentType] + + """ + Filter by status of legal document + """ + status: [LegalDocumentRequestStatus] + + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + ): LegalDocumentCollection """ - Describes the features enabled and available for this account + Drafted field values that were still not persisted """ - features: CollectiveFeatures! + draft: JSON """ - Virtual Cards attached to the account. Admin only. Scope: "virtualCards". + The account that requested this expense to be submitted """ - virtualCards( - limit: Int! = 100 - offset: Int! = 0 - state: String = null @deprecated(reason: "2023-11-06: Please use status.") - status: [VirtualCardStatus] - merchantAccount: AccountReferenceInput = null - - """ - Only return expenses that were created after this date - """ - dateFrom: DateTime = null - + requestedByAccount: Account + quote: ExpenseQuote + validateTransferRequirements( """ - Only return expenses that were created before this date + Details of the transfer """ - dateTo: DateTime = null - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } - ): VirtualCardCollection + details: JSON + ): [TransferWiseRequiredField] + recurringExpense: RecurringExpense """ - Virtual Cards Merchants used by the account. Admin only. Scope: "virtualCards". + [Admin only] Security checks for this expense. Only available to expenses under trusted hosts. """ - virtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection - childrenAccounts( - limit: Int! = 100 - offset: Int! = 0 - isActive: Boolean - accountType: [AccountType] - ): AccountCollection! + securityChecks: [SecurityCheck] """ - Policies for the account. To see non-public policies you need to be admin and have the scope: "account". + Custom data for this expense """ - policies: Policies! + customData: JSON """ - List of activities that the logged-in user is subscribed for this collective + The merchant ID for this expense """ - activitySubscriptions(channel: ActivityChannel): [ActivitySubscription] + merchantId: String +} +""" +All supported expense currency sources +""" +enum ExpenseCurrencySource { """ - Logged-in user permissions on an account + The expense currency expressed as the host currency """ - permissions: AccountPermissions! - feed( - """ - Only returns activities before this date - """ - dateTo: DateTime + HOST - """ - Number of activities to retrieve - """ - limit: Int + """ + The expense currency expressed as the account currency + """ + ACCOUNT - """ - The classes of activity types to filter for - """ - classes: [ActivityClassType] - ): [Activity] + """ + The expense currency expressed as the expense currency + """ + EXPENSE """ - If created by duplication, the account from which this one was duplicated + The expense currency expressed as the expense currency """ - duplicatedFromAccount: Account + CREATED_BY_ACCOUNT +} + +""" +Fields for an accounting category +""" +type AccountingCategory { + id: String! """ - If this account was duplicated, the accounts that were created from it + The code of the accounting category """ - duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! - webhooks( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 + code: String! - """ - The offset to use to fetch - """ - offset: Int! = 0 - account: AccountReferenceInput! - ): WebhookCollection! + """ + The technical name of the accounting category + """ + name: String! """ - Number of unique financial contributors. + A friendly name for non-accountants (i.e. expense submitters and collective admins) """ - totalFinancialContributors( - """ - Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) - """ - accountType: AccountType - ): Int! - tiers( - """ - The number of results to fetch - """ - limit: Int! = 100 + friendlyName: String - """ - The offset to use to fetch - """ - offset: Int! = 0 - ): TierCollection! + """ + Whether this category is only meant for the host admins + """ + hostOnly: Boolean! """ - All the persons and entities that contribute to this account + Instructions for the expense submitters """ - contributors( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 10 + instructions: String - """ - The offset to use to fetch - """ - offset: Int! = 0 - roles: [MemberRole] - ): ContributorCollection! + """ + The account this category belongs to + """ + account: Host! """ - How much platform fees are charged for this account + If meant for expenses, the types of expenses this category applies to """ - platformFeePercent: Float! + expensesTypes: [ExpenseType] """ - Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account + The kind of transactions this category applies to """ - platformContributionAvailable: Boolean! - contributionPolicy: String + kind: AccountingCategoryKind """ - Returns true if the remote user can start the process to resume contributions for account + The time of creation of this accounting category """ - canStartResumeContributionsProcess: Boolean! + createdAt: DateTime! """ - Returns true if the account has started the process to resume contributions + If the category is applicable to the Host or Hosted Collectives """ - hasResumeContributionsProcessStarted: Boolean! + appliesTo: AccountingCategoryAppliesTo! +} + +""" +This represents an Host account +""" +type Host implements Account & AccountWithContributions { + id: String! + legacyId: Int! """ - List of accounting categories for this host + The slug identifying the account (ie: babel) """ - accountingCategories( - """ - Filter accounting categories by kind - """ - kind: [AccountingCategoryKind!] - ): AccountingCategoryCollection! - hostFeePercent: Float - totalHostedCollectives: Int @deprecated(reason: "2023-03-20: Renamed to totalHostedAccounts") - totalHostedAccounts: Int - isOpenToApplications: Boolean - termsUrl: URL - plan: HostPlan! - hostTransactionsReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): HostTransactionReports - transactionsReport(dateFrom: DateTime, dateTo: DateTime): [TransactionSum] - hostMetrics( - """ - A collection of accounts for which the metrics should be returned. - """ - account: [AccountReferenceInput!] + slug: String! + type: AccountType! - """ - The start date of the time series - """ - dateFrom: DateTime + """ + Public name + """ + name: String - """ - The end date of the time series - """ - dateTo: DateTime - ): HostMetrics! - hostMetricsTimeSeries( - """ - A collection of accounts for which the metrics should be returned. - """ - account: [AccountReferenceInput!] + """ + Private, legal name. Used for expense receipts, taxes, etc. Scope: "account". + """ + legalName: String + description: String + longDescription: String + tags: [String] + website: String @deprecated(reason: "2023-01-16: Please use socialLinks") + twitterHandle: String @deprecated(reason: "2023-01-16: Please use socialLinks") + githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") + repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") + socialLinks: [SocialLink!]! - """ - The start date of the time series - """ - dateFrom: DateTime + """ + The currency of the account + """ + currency: Currency! + expensePolicy: String - """ - The end date of the time series - """ - dateTo: DateTime + """ + Defines if the contributors wants to be incognito (name not displayed) + """ + isIncognito: Boolean! + imageUrl(height: Int, format: ImageFormat): String + backgroundImageUrl(height: Int, format: ImageFormat): String - """ - The time unit of the time series (such as MONTH, YEAR, WEEK etc). If no value is provided this is calculated using the dateFrom and dateTo values. - """ - timeUnit: TimeUnit - ): HostMetricsTimeSeries! + """ + The time of creation + """ + createdAt: DateTime + updatedAt: DateTime """ - The list of payment methods (Stripe, Paypal, manual bank transfer, etc ...) the Host can accept for its Collectives + Returns whether this account is archived """ - supportedPaymentMethods: [PaymentMethodLegacyType] - bankAccount: PayoutMethod + isArchived: Boolean! """ - Paypal preapproval info. Returns null if PayPal account is not connected. + Whether this account is frozen """ - paypalPreApproval: PaymentMethod + isFrozen: Boolean! """ - If the host supports PayPal, this will contain the client ID to use in the frontend + Returns whether the account accepts financial contributions. """ - paypalClientId: String + isActive: Boolean """ - The list of payout methods this Host accepts for its expenses + Returns whether the account is setup to Host collectives. """ - supportedPayoutMethods: [PayoutMethodType] + isHost: Boolean! """ - Stripe connected account + Returns true if the remote user is an admin of this account """ - stripe: StripeConnectedAccount + isAdmin: Boolean! + parentAccount: Account @deprecated(reason: "2022-12-16: use parent on AccountWithParent instead") """ - Applications for this host + Get all members (admins, members, backers, followers) """ - hostApplications( + members( + limit: Int! = 100 + offset: Int! = 0 + role: [MemberRole] + accountType: [AccountType] + """ - The number of results to fetch (default 10, max 1000) + Admin only. To filter on the email address of a member, useful to check if a member exists. """ - limit: Int! = 10 + email: EmailAddress """ - The offset to use to fetch + Order of the results """ - offset: Int! = 0 + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: ASC } + includeInherited: Boolean = true + ): MemberCollection! + """ + [AUTHENTICATED] Returns the pending invitations + """ + memberInvitations( """ - Search term for collective tags, id, name, slug and description. + A reference to an account (usually Individual). Will return invitations sent to the account to join as a member """ - searchTerm: String + memberAccount: AccountReferenceInput """ - Order of the results + A reference to an account (usually Collective, Fund or Organization). Will return invitations sent to join this account as a member. """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + account: AccountReferenceInput """ - Filter applications by status + An array of Member roles to filter for """ - status: HostApplicationStatus - ): HostApplicationCollection! + role: [MemberRole] + ): [MemberInvitation] """ - Pending applications for this host + The legal documents associated with this account """ - pendingApplications( + legalDocuments( """ - The number of results to fetch (default 10, max 1000) + Filter by type """ - limit: Int! = 10 + type: [LegalDocumentType] + ): [LegalDocument] + memberOf( + limit: Int! = 150 + offset: Int! = 0 + role: [MemberRole] + accountType: [AccountType] + account: AccountReferenceInput """ - The offset to use to fetch + Filter on whether the account is a host or not """ - offset: Int! = 0 + isHostAccount: Boolean + + """ + Filter on (un)approved collectives + """ + isApproved: Boolean + + """ + Filter on archived collectives + """ + isArchived: Boolean + + """ + Whether incognito profiles should be included in the result. Only works if requesting user is an admin of the account. + """ + includeIncognito: Boolean = true """ A term to search membership. Searches in collective tags, name, slug, members description and role. @@ -2681,237 +2721,195 @@ type Host implements Account & AccountWithContributions { searchTerm: String """ - Order of the results + Filters on the Host fees structure applied to this account """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - ): HostApplicationCollection! - @deprecated(reason: "2023-08-25: Deprecated in favour of host.hostApplications(status: PENDING).") - hostedVirtualCards( + hostFeesStructure: HostFeeStructure + """ - Search term (card name, card last four digits) + Order of the results """ - searchTerm: String - limit: Int! = 100 - offset: Int! = 0 - state: String = null @deprecated(reason: "2023-06-12: Please use status.") - status: [VirtualCardStatus] - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } - merchantAccount: AccountReferenceInput = null - collectiveAccountIds: [AccountReferenceInput] = null + orderBy: OrderByInput! = { field: CREATED_AT, direction: DESC } """ - Returns virtual cards with expenses from this date. + Order the query by requested role order """ - withExpensesDateFrom: DateTime + orderByRoles: Boolean + ): MemberOfCollection! + """ + Returns the emails of the account. Individuals only have one, but organizations can have multiple emails. + """ + emails: [EmailAddress!] + transactions( """ - Returns virtual cards with expenses to this date. + The number of results to fetch (default 10, max 1000) """ - withExpensesDateTo: DateTime + limit: Int! = 100 """ - Filter virtual cards with at least this amount in cents charged + The offset to use to fetch """ - spentAmountFrom: AmountInput + offset: Int! = 0 """ - Filter virtual cards with up to this amount in cents charged + The transaction type (DEBIT or CREDIT) """ - spentAmountTo: AmountInput + type: TransactionType """ - Filter virtual cards by whether they are missing receipts for any charges + The payment method types. Can include `null` for transactions without a payment method """ - hasMissingReceipts: Boolean - ): VirtualCardCollection! - hostedVirtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection! - hostedVirtualCardCollectives(limit: Int! = 100, offset: Int! = 0): AccountCollection! - contributionStats( + paymentMethodType: [PaymentMethodType] + """ - A collection of accounts for which the contribution stats should be returned. + The payment method services. """ - account: [AccountReferenceInput!] + paymentMethodService: [PaymentMethodService] """ - Calculate contribution statistics beginning from this date. + Reference of the account(s) assigned to the main side of the transaction you want to EXCLUDE from the results """ - dateFrom: DateTime + excludeAccount: [AccountReferenceInput] """ - Calculate contribution statistics until this date. + Reference of the account assigned to the other side of the transaction (CREDIT -> sender, DEBIT -> recipient). Avoid, favor account instead. """ - dateTo: DateTime + fromAccount: AccountReferenceInput """ - The time unit of the time series + Reference of the host accounting the transaction """ - timeUnit: TimeUnit - ): ContributionStats! - expenseStats( + host: AccountReferenceInput + """ - A collection of accounts for which the expense stats should be returned. + NOT IMPLEMENTED. Only return transactions that match these tags. """ - account: [AccountReferenceInput!] + tags: [String] @deprecated(reason: "2020-08-09: Was never implemented.") """ - Calculate expense statistics beginning from this date. + The order of results """ - dateFrom: DateTime + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } """ - Calculate expense statistics until this date. + Only return transactions where the amount is greater than or equal to this value (in cents) """ - dateTo: DateTime + minAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") """ - The time unit of the time series (such as MONTH, YEAR, WEEK etc). If no value is provided this is calculated using the dateFrom and dateTo values. + Only return transactions where the amount is lower than or equal to this value (in cents) """ - timeUnit: TimeUnit - ): ExpenseStats! - - """ - Returns whether the host is trusted or not - """ - isTrustedHost: Boolean! + maxAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") - """ - Returns whether the host has any Stripe disputed orders - """ - hasDisputedOrders: Boolean + """ + Only return transactions that were created after this date + """ + dateFrom: DateTime - """ - Returns whether the host has any Stripe in review orders - """ - hasInReviewOrders: Boolean + """ + Only return transactions that were created before this date + """ + dateTo: DateTime - """ - Returns agreements with Hosted Accounts - """ - hostedAccountAgreements( """ - The number of results to fetch (default 10, max 1000) + Only return transactions that were cleared after this date """ - limit: Int! = 10 + clearedFrom: DateTime """ - The offset to use to fetch + Only return transactions that were cleared before this date """ - offset: Int! = 0 + clearedTo: DateTime """ - Filter by accounts participating in the agreement + The term to search """ - accounts: [AccountReferenceInput] - ): AgreementCollection! + searchTerm: String - """ - Returns a list of vendors that works with this host - """ - vendors( """ - The number of results to fetch (default 10, max 1000) + Only return transactions with an Expense attached """ - limit: Int! = 100 + hasExpense: Boolean """ - The offset to use to fetch + Only return transactions with this Expense attached """ - offset: Int! = 0 + expense: ExpenseReferenceInput """ - Rank vendors based on their relationship with this account + Only return transactions that have an Expense of one of these expense types attached """ - forAccount: AccountReferenceInput + expenseType: [ExpenseType] """ - Filter on archived vendors + Only return transactions with an Order attached """ - isArchived: Boolean + hasOrder: Boolean """ - Search vendors related to this term based on name, description, tags, slug, and location + Only return transactions for this order. """ - searchTerm: String - ): VendorCollection! + order: OrderReferenceInput - """ - Returns a list of organizations that only transacted with this host and all its admins are also admins of this host. - """ - potentialVendors( """ - The number of results to fetch (default 10, max 1000) + Used when filtering with the `host` argument to determine whether to include transactions on the fiscal host account (and children) """ - limit: Int! = 100 + includeHost: Boolean! = true """ - The offset to use to fetch + Whether to include regular transactions from the account (turn false if you only want Incognito or Gift Card transactions) """ - offset: Int! = 0 - ): AccountCollection! + includeRegularTransactions: Boolean! = true - """ - Returns a list of accounts hosted by this host - """ - hostedAccounts( """ - The number of results to fetch (default 10, max 1000) + If the account is a user and this field is true, contributions from the incognito profile will be included too (admins only) """ - limit: Int! = 100 + includeIncognitoTransactions: Boolean! = false """ - The offset to use to fetch + Whether to include transactions from children (Events and Projects) """ - offset: Int! = 0 - accountType: [AccountType] + includeChildrenTransactions: Boolean! = false """ - Filter on (un)approved collectives + Whether to include transactions from Gift Cards issued by the account. """ - isApproved: Boolean = true + includeGiftCardTransactions: Boolean! = false """ - Filter on frozen accounts + Whether to include debt transactions """ - isFrozen: Boolean + includeDebts: Boolean! = false """ - Filter on unhosted accounts + To filter by transaction kind """ - isUnhosted: Boolean = false + kind: [TransactionKind] """ - Filters on the Host fees structure applied to this account + The transactions group to filter by """ - hostFeesStructure: HostFeeStructure + group: [String] + virtualCard: [VirtualCardReferenceInput] """ - A term to search membership. Searches in collective tags, name, slug, members description and role. + Only return transactions that are refunds (or not refunds if false) """ - searchTerm: String + isRefund: Boolean """ - Order of the results + Only return transactions that are associated with these external merchant IDs """ - orderBy: OrderByInput - ): AccountCollection! -} + merchantId: [String] -""" -An account that can receive financial contributions -""" -interface AccountWithContributions { - """ - Number of unique financial contributors. - """ - totalFinancialContributors( """ - Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) + Only return transactions that are associated with these accounting categories """ - accountType: AccountType - ): Int! - tiers( + accountingCategory: [String] + ): TransactionCollection! + orders( """ - The number of results to fetch + The number of results to fetch (default 10, max 1000) """ limit: Int! = 100 @@ -2919,1143 +2917,1517 @@ interface AccountWithContributions { The offset to use to fetch """ offset: Int! = 0 - ): TierCollection! - """ - All the persons and entities that contribute to this account - """ - contributors( """ - The number of results to fetch (default 10, max 1000) + If account is a host, also include hosted accounts orders """ - limit: Int! = 10 + includeHostedAccounts: Boolean """ - The offset to use to fetch + Include orders from children events/projects """ - offset: Int! = 0 - roles: [MemberRole] - ): ContributorCollection! - - """ - How much platform fees are charged for this account - """ - platformFeePercent: Float! - - """ - Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account - """ - platformContributionAvailable: Boolean! - contributionPolicy: String - - """ - Returns true if the remote user can start the process to resume contributions for account - """ - canStartResumeContributionsProcess: Boolean! - - """ - Returns true if the account has started the process to resume contributions - """ - hasResumeContributionsProcessStarted: Boolean! -} - -""" -A collection of "Tiers" -""" -type TierCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Tier] -} - -""" -A collection of "Contributor" -""" -type ContributorCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Contributor] -} - -"\n A person or an entity that contributes financially or by any other mean to the mission\n of the collective. While \"Member\" is dedicated to permissions, this type is meant\n to surface all the public contributors.\n " -type Contributor { - """ - A unique identifier for this member - """ - id: String! - - """ - Name of the contributor - """ - name: String! - - """ - All the roles for a given contributor - """ - roles: [MemberRole] + includeChildrenAccounts: Boolean! = false - """ - True if the contributor is a collective admin - """ - isAdmin: Boolean! + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] - """ - True if the contributor is a core contributor - """ - isCore: Boolean! + """ + Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. + """ + paymentMethod: PaymentMethodReferenceInput - """ - True if the contributor is a financial contributor - """ - isBacker: Boolean! + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] - """ - Member join date - """ - since: DateTime! + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] - """ - How much money the user has contributed for this (in cents, using collective currency) - """ - totalAmountDonated: Int! + """ + Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. + """ + includeIncognito: Boolean = false - """ - Whether the contributor is an individual, an organization... - """ - type: String! + """ + Account orders filter (INCOMING or OUTGOING) + """ + filter: AccountOrdersFilter - """ - Defines if the contributors wants to be incognito (name not displayed) - """ - isIncognito: Boolean! + """ + Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) + """ + frequency: ContributionFrequency - """ - Description of how the member contribute. Will usually be a tier name, or "design" or "code". - """ - description: String + """ + Use this field to filter orders on their statuses + """ + status: [OrderStatus] - """ - If the contributor has a page on Open Collective, this is the slug to link to it - """ - collectiveSlug: String + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Contributor avatar or logo - """ - image(height: Int, format: ImageFormat): String + """ + Only return orders where the amount is greater than or equal to this value (in cents) + """ + minAmount: Int - """ - A public message from contributors to describe their contributions - """ - publicMessage: String -} + """ + Only return orders where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int -input AccountReferenceInput { - """ - The public id identifying the account (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) - """ - id: String + """ + Only return orders that were created after this date + """ + dateFrom: DateTime - """ - The internal id of the account (ie: 580) - """ - legacyId: Int @deprecated(reason: "2020-01-01: should only be used during the transition to GraphQL API v2.") + """ + Only return orders that were created before this date + """ + dateTo: DateTime - """ - The slug identifying the account (ie: babel for https://opencollective.com/babel) - """ - slug: String -} + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime -""" -A legal document (e.g. W9, W8BEN, W8BEN-E) -""" -type LegalDocument { - """ - Unique identifier for this legal document - """ - id: String! + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime - """ - The year this legal document is for - """ - year: Int! + """ + The term to search + """ + searchTerm: String + tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") - """ - The type of legal document - """ - type: LegalDocumentType! + """ + Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + """ + onlySubscriptions: Boolean - """ - The status of the request for this legal document - """ - status: LegalDocumentRequestStatus! + """ + Same as onlySubscriptions, but returns only orders with active subscriptions + """ + onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter - """ - The service that provided this legal document - """ - service: LegalDocumentService! + """ + Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) + """ + oppositeAccount: AccountReferenceInput + ): OrderCollection! + expenses( + direction: ExpenseDirection - """ - The date and time the request for this legal document was created - """ - requestedAt: DateTime! + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - The date and time this legal document was last updated - """ - updatedAt: DateTime! + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - The account this legal document is for - """ - account: Account! + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput - """ - URL to download the file. Must be logged in as an account admin. The returned URL will be protected by authentication + 2FA. - """ - documentLink: URL -} + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput -""" -Type for a required legal document -""" -enum LegalDocumentType { - """ - US tax form (W9, W8BEN, W8BEN-E) - """ - US_TAX_FORM -} + """ + Return expenses only for this host + """ + host: AccountReferenceInput -""" -Status for a legal document -""" -enum LegalDocumentRequestStatus { - NOT_REQUESTED - REQUESTED - RECEIVED - ERROR -} + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput -""" -Type for a required legal document -""" -enum LegalDocumentService { - DROPBOX_FORMS - OPENCOLLECTIVE -} + """ + Use this field to filter expenses on their statuses + """ + status: [ExpenseStatusFilter] -""" -A collection of "MemberOf" (ie: Collective backed by an Organization) -""" -type MemberOfCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [MemberOf] - roles: [MemberOfCollectionRoles] -} + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + types: [ExpenseType] -""" -An existing member role and account type combination used used to filter collections -""" -type MemberOfCollectionRoles { - type: AccountType! - role: MemberRole! -} + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") -""" -All supported expense types -""" -enum HostFeeStructure { - """ - Use global host fees - """ - DEFAULT + """ + Only expenses that match these tags + """ + tag: [String] - """ - Custom fee for this Collective only - """ - CUSTOM_FEE + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Only return expenses where the amount is greater than or equal to this value (in cents) + """ + minAmount: Int - """ - Set a monthly retainer for this Collective - """ - MONTHLY_RETAINER -} + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int -""" -Input to order results -""" -input OrderByInput { - """ - Field to order by. - """ - field: OrderByFieldType! + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType - """ - Ordering direction. - """ - direction: OrderDirection! -} + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime -""" -Possible fields you can use to order by -""" -enum OrderByFieldType { - CREATED_AT - MEMBER_COUNT - TOTAL_CONTRIBUTED + """ + Only return expenses that were created after this date + """ + dateTo: DateTime - """ - The financial activity of the collective (number of transactions) - """ - ACTIVITY - RANK -} + """ + The term to search + """ + searchTerm: String -""" -A collection of Transactions (Debit or Credit) -""" -type TransactionCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Transaction] - kinds: [TransactionKind] + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false - """ - The types of payment methods used in this collection, regardless of the pagination - """ - paymentMethodTypes: [PaymentMethodType]! -} + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON -enum PaymentMethodType { - alipay @deprecated(reason: "Please use uppercase values") - creditcard @deprecated(reason: "Please use uppercase values") - prepaid @deprecated(reason: "Please use uppercase values") - payment @deprecated(reason: "Please use uppercase values") - subscription @deprecated(reason: "Please use uppercase values") - collective @deprecated(reason: "Please use uppercase values") - host @deprecated(reason: "Please use uppercase values") - adaptive @deprecated(reason: "Please use uppercase values") - giftcard @deprecated(reason: "Please use uppercase values") - manual @deprecated(reason: "Please use uppercase values") - crypto @deprecated(reason: "Please use uppercase values") - paymentintent @deprecated(reason: "Please use uppercase values") - us_bank_account @deprecated(reason: "Please use uppercase values") - sepa_debit @deprecated(reason: "Please use uppercase values") - bacs_debit @deprecated(reason: "Please use uppercase values") - bancontact @deprecated(reason: "Please use uppercase values") - link @deprecated(reason: "Please use uppercase values") - bank_transfer @deprecated(reason: "Please use uppercase values") - payout @deprecated(reason: "Please use uppercase values") - virtual_card @deprecated(reason: "Please use uppercase values") - ALIPAY - CREDITCARD - PREPAID - PAYMENT - SUBSCRIPTION - COLLECTIVE - HOST - ADAPTIVE - GIFTCARD - MANUAL - CRYPTO - PAYMENT_INTENT - US_BANK_ACCOUNT - SEPA_DEBIT - BACS_DEBIT - BANCONTACT - LINK - BANK_TRANSFER - PAYOUT - VIRTUAL_CARD -} + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean -enum PaymentMethodService { - PAYPAL - STRIPE - OPENCOLLECTIVE - PREPAID - THEGIVINGBLOCK - WISE -} + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] -input ExpenseReferenceInput { - """ - The public id identifying the expense (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) - """ - id: String + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] - """ - The internal id of the expense (ie: 580) - """ - legacyId: Int -} + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] + ): ExpenseCollection! + settings: JSON! + conversations( + limit: Int! = 15 + offset: Int! = 0 -""" -All supported expense types -""" -enum ExpenseType { - """ - Invoice: Charge for your time or get paid in advance. - """ - INVOICE + """ + Only return conversations matching this tag + """ + tag: String + ): ConversationCollection! """ - Receipt: Get paid back for a purchase already made. + Returns conversation's tags for collective sorted by popularity """ - RECEIPT + conversationsTags(limit: Int! = 30): [TagStat] """ - Funding Request: Request funding for a project or initiative. + Returns expense tags for collective sorted by popularity """ - FUNDING_REQUEST + expensesTags(limit: Int! = 30): [TagStat] """ - Grant: Request funding for a project or initiative. + The list of expense types supported by this account """ - GRANT + supportedExpenseTypes: [ExpenseType!]! + transferwise: TransferWise """ - Unclassified expense + The list of payout methods that this collective can use to get paid. In most cases, admin only and scope: "expenses". """ - UNCLASSIFIED + payoutMethods: [PayoutMethod] """ - Credit Card Charge: Payment done using an issued (virtual) credit card issued by your Fiscal Host. + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ - CHARGE + paymentMethods( + type: [PaymentMethodType] + enumType: [PaymentMethodType] @deprecated(reason: "2021-08-20: use type instead from now") + service: [PaymentMethodService] - """ - Settlement: expense generated by Open Collective to collect money owed by Fiscal Hosts. - """ - SETTLEMENT -} + """ + Whether to include expired payment methods. Payment methods expired since more than 6 months will never be returned. + """ + includeExpired: Boolean + ): [PaymentMethod] -input OrderReferenceInput { """ - The public id identifying the order (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + The list of payment methods for this account that are pending a client confirmation (3D Secure / SCA) """ - id: String + paymentMethodsWithPendingConfirmation: [PaymentMethod] """ - The legacy public id identifying the order (ie: 4242) + The list of connected accounts (Stripe, Twitter, etc ...). Admin only. Scope: "connectedAccounts". """ - legacyId: Int -} - -input VirtualCardReferenceInput { - id: String -} + connectedAccounts: [ConnectedAccount] -input PaymentMethodReferenceInput { """ - The id assigned to the payment method + The list of applications created by this account. Admin only. Scope: "applications". """ - id: String -} - -""" -Account orders filter (INCOMING or OUTGOING) -""" -enum AccountOrdersFilter { - INCOMING - OUTGOING -} - -""" -A collection of "Expenses" -""" -type ExpenseCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Expense] - totalAmount: ExpenseCollectionTotalAmount -} - -type ExpenseCollectionTotalAmount { - amount(currency: Currency = USD): Amount - amountsByCurrency: [Amount] -} + oAuthApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 -""" -All supported currencies -""" -enum Currency { - """ - US Dollar - """ - USD + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): OAuthApplicationCollection """ - UAE Dirham + The address associated to this account. This field is always public for collectives and events. """ - AED + location: Location + categories: [String]! + stats: AccountStats """ - Afghani + Whether this account can have changelog updates """ - AFN + canHaveChangelogUpdates: Boolean! """ - Lek + Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ - ALL + updates( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Armenian Dram - """ - AMD + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Netherlands Antillean Guilder - """ - ANG + """ + Only return published updates. + """ + onlyPublishedUpdates: Boolean = false + isDraft: Boolean + onlyChangelogUpdates: Boolean + orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + searchTerm: String + ): UpdateCollection! """ - Kwanza + Describes the features enabled and available for this account """ - AOA + features: CollectiveFeatures! """ - Argentine Peso + Virtual Cards attached to the account. Admin only. Scope: "virtualCards". """ - ARS + virtualCards( + limit: Int! = 100 + offset: Int! = 0 + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] + merchantAccount: AccountReferenceInput = null + + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime = null + + """ + Only return expenses that were created before this date + """ + dateTo: DateTime = null + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } + ): VirtualCardCollection """ - Australian Dollar + Virtual Cards Merchants used by the account. Admin only. Scope: "virtualCards". """ - AUD + virtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection + childrenAccounts( + limit: Int! = 100 + offset: Int! = 0 + isActive: Boolean + accountType: [AccountType] + searchTerm: String + ): AccountCollection! """ - Aruban Florin + Policies for the account. To see non-public policies you need to be admin and have the scope: "account". """ - AWG + policies: Policies! """ - Azerbaijanian Manat + List of activities that the logged-in user is subscribed for this collective """ - AZN + activitySubscriptions(channel: ActivityChannel): [ActivitySubscription] """ - Convertible Mark + Logged-in user permissions on an account """ - BAM + permissions: AccountPermissions! """ - Barbados Dollar + Host application requests """ - BBD + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! + feed( + """ + Only returns activities before this date + """ + dateTo: DateTime + + """ + Number of activities to retrieve + """ + limit: Int + + """ + The classes of activity types to filter for + """ + classes: [ActivityClassType] + ): [Activity] """ - Taka + If created by duplication, the account from which this one was duplicated """ - BDT + duplicatedFromAccount: Account """ - Bulgarian Lev + If this account was duplicated, the accounts that were created from it """ - BGN + duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! """ - Burundi Franc + EXPERIMENTAL (this may change or be removed) """ - BIF + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports + webhooks( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + account: AccountReferenceInput! + ): WebhookCollection! """ - Bermudian Dollar + Number of unique financial contributors. """ - BMD + totalFinancialContributors( + """ + Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) + """ + accountType: AccountType + ): Int! + tiers( + """ + The number of results to fetch + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): TierCollection! """ - Brunei Dollar + All the persons and entities that contribute to this account """ - BND + contributors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + roles: [MemberRole] + ): ContributorCollection! """ - Boliviano + How much platform fees are charged for this account """ - BOB + platformFeePercent: Float! """ - Brazilian Real + Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account """ - BRL + platformContributionAvailable: Boolean! + contributionPolicy: String """ - Bahamian Dollar + Returns true if the remote user can start the process to resume contributions for account """ - BSD + canStartResumeContributionsProcess: Boolean! """ - Pula + Returns true if the account has started the process to resume contributions """ - BWP + hasResumeContributionsProcessStarted: Boolean! """ - Belarussian Ruble + List of accounting categories for this host """ - BYN + accountingCategories( + """ + Filter accounting categories by kind + """ + kind: [AccountingCategoryKind!] + + """ + Filter by accounting category applicable to this account + """ + account: AccountReferenceInput + ): AccountingCategoryCollection! + hostFeePercent: Float + totalHostedCollectives: Int @deprecated(reason: "2023-03-20: Renamed to totalHostedAccounts") + totalHostedAccounts: Int + isOpenToApplications: Boolean + termsUrl: URL + plan: HostPlan! """ - Belize Dollar + EXPERIMENTAL (this may change or be removed) """ - BZD + hostTransactionsReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): HostTransactionReports + hostMetrics( + """ + A collection of accounts for which the metrics should be returned. + """ + account: [AccountReferenceInput!] + + """ + The start date of the time series + """ + dateFrom: DateTime + + """ + The end date of the time series + """ + dateTo: DateTime + ): HostMetrics! + hostMetricsTimeSeries( + """ + A collection of accounts for which the metrics should be returned. + """ + account: [AccountReferenceInput!] + + """ + The start date of the time series + """ + dateFrom: DateTime + + """ + The end date of the time series + """ + dateTo: DateTime + + """ + The time unit of the time series (such as MONTH, YEAR, WEEK etc). If no value is provided this is calculated using the dateFrom and dateTo values. + """ + timeUnit: TimeUnit + ): HostMetricsTimeSeries! """ - Canadian Dollar + EXPERIMENTAL (this may change or be removed) """ - CAD + hostExpensesReport(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): HostExpensesReports """ - Congolese Franc + The list of payment methods (Stripe, Paypal, manual bank transfer, etc ...) the Host can accept for its Collectives """ - CDF + supportedPaymentMethods: [PaymentMethodLegacyType] + bankAccount: PayoutMethod """ - Swiss Franc + Paypal preapproval info. Returns null if PayPal account is not connected. """ - CHF + paypalPreApproval: PaymentMethod """ - Chilean Peso + If the host supports PayPal, this will contain the client ID to use in the frontend """ - CLP + paypalClientId: String """ - Yuan Renminbi + The list of payout methods this Host accepts for its expenses """ - CNY + supportedPayoutMethods: [PayoutMethodType] """ - Colombian Peso + Stripe connected account """ - COP + stripe: StripeConnectedAccount """ - Costa Rican Colon + Applications for this host """ - CRC + hostApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Cabo Verde Escudo - """ - CVE + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Czech Koruna - """ - CZK + """ + Search term for collective tags, id, name, slug and description. + """ + searchTerm: String - """ - Djibouti Franc - """ - DJF + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Danish Krone - """ - DKK + """ + Filter applications by status + """ + status: HostApplicationStatus - """ - Dominican Peso - """ - DOP + """ + Filter host applications by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + ): HostApplicationCollection! """ - Algerian Dinar + Pending applications for this host """ - DZD + pendingApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Egyptian Pound - """ - EGP + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Ethiopian Birr - """ - ETB + """ + A term to search membership. Searches in collective tags, name, slug, members description and role. + """ + searchTerm: String + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + ): HostApplicationCollection! + @deprecated(reason: "2023-08-25: Deprecated in favour of host.hostApplications(status: PENDING).") + hostedVirtualCards( + """ + Search term (card name, card last four digits) + """ + searchTerm: String + limit: Int! = 100 + offset: Int! = 0 + state: String = null @deprecated(reason: "2023-06-12: Please use status.") + status: [VirtualCardStatus] + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } + merchantAccount: AccountReferenceInput = null + collectiveAccountIds: [AccountReferenceInput] = null + + """ + Returns virtual cards with expenses from this date. + """ + withExpensesDateFrom: DateTime + + """ + Returns virtual cards with expenses to this date. + """ + withExpensesDateTo: DateTime + + """ + Filter virtual cards with at least this amount in cents charged + """ + spentAmountFrom: AmountInput + + """ + Filter virtual cards with up to this amount in cents charged + """ + spentAmountTo: AmountInput + + """ + Filter virtual cards by whether they are missing receipts for any charges + """ + hasMissingReceipts: Boolean + ): VirtualCardCollection! + hostedVirtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection! + hostedVirtualCardCollectives(limit: Int! = 100, offset: Int! = 0): AccountCollection! + contributionStats( + """ + A collection of accounts for which the contribution stats should be returned. + """ + account: [AccountReferenceInput!] + + """ + Calculate contribution statistics beginning from this date. + """ + dateFrom: DateTime + + """ + Calculate contribution statistics until this date. + """ + dateTo: DateTime + + """ + The time unit of the time series + """ + timeUnit: TimeUnit + ): ContributionStats! + expenseStats( + """ + A collection of accounts for which the expense stats should be returned. + """ + account: [AccountReferenceInput!] + + """ + Calculate expense statistics beginning from this date. + """ + dateFrom: DateTime + + """ + Calculate expense statistics until this date. + """ + dateTo: DateTime + + """ + The time unit of the time series (such as MONTH, YEAR, WEEK etc). If no value is provided this is calculated using the dateFrom and dateTo values. + """ + timeUnit: TimeUnit + ): ExpenseStats! """ - Euro + Returns whether the host is trusted or not """ - EUR + isTrustedHost: Boolean! """ - Fiji Dollar + Returns whether the host has any Stripe disputed orders """ - FJD + hasDisputedOrders: Boolean """ - Falkland Islands Pound + Returns whether the host has any Stripe in review orders """ - FKP + hasInReviewOrders: Boolean """ - Pound Sterling + Returns agreements with Hosted Accounts """ - GBP + hostedAccountAgreements( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Filter by accounts participating in the agreement + """ + accounts: [AccountReferenceInput] + ): AgreementCollection! """ - Lari + Returns a list of vendors that works with this host """ - GEL + vendors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Rank vendors based on their relationship with this account + """ + forAccount: AccountReferenceInput + + """ + Filter on archived vendors + """ + isArchived: Boolean + + """ + Search vendors related to this term based on name, description, tags, slug, and location + """ + searchTerm: String + ): VendorCollection! """ - Gibraltar Pound + Returns a list of organizations that only transacted with this host and all its admins are also admins of this host. """ - GIP + potentialVendors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): AccountCollection! """ - Dalasi + Returns a list of accounts hosted by this host """ - GMD + hostedAccounts( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 - """ - Guinea Franc - """ - GNF + """ + The offset to use to fetch + """ + offset: Int! = 0 + accountType: [AccountType] - """ - Quetzal - """ - GTQ + """ + Filter on (un)approved collectives + """ + isApproved: Boolean = true - """ - Guyana Dollar - """ - GYD + """ + Filter on frozen accounts + """ + isFrozen: Boolean - """ - Hong Kong Dollar - """ - HKD + """ + Filter on unhosted accounts + """ + isUnhosted: Boolean = false - """ - Lempira - """ - HNL + """ + Filters on the Host fees structure applied to this account + """ + hostFeesStructure: HostFeeStructure - """ - Kuna - """ - HRK + """ + A term to search membership. Searches in collective tags, name, slug, members description and role. + """ + searchTerm: String - """ - Gourde - """ - HTG + """ + Order of the results + """ + orderBy: OrderByInput - """ - Forint - """ - HUF + """ + Filter by the balance of the account + """ + balance: AmountRangeInput - """ - Rupiah - """ - IDR + """ + Filter by the balance of the account and its children accounts (events and projects) + """ + consolidatedBalance: AmountRangeInput - """ - New Israeli Sheqel - """ - ILS + """ + Filter by specific Account currencies + """ + currencies: [String] + ): HostedAccountCollection! """ - Indian Rupee + Returns the legal documents required by this host """ - INR + requiredLegalDocuments: [LegalDocumentType!]! """ - Iceland Krona + Returns legal documents hosted by this host """ - ISK + hostedLegalDocuments( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Jamaican Dollar - """ - JMD + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Yen - """ - JPY + """ + Filter by type of legal document + """ + type: [LegalDocumentType] - """ - Kenyan Shilling - """ - KES + """ + Filter by status of legal document + """ + status: [LegalDocumentRequestStatus] - """ - Som - """ - KGS + """ + Filter by accounts + """ + account: [AccountReferenceInput] - """ - Riel - """ - KHR + """ + Search term (name, description, ...) + """ + searchTerm: String - """ - Comoro Franc - """ - KMF + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Won - """ - KRW + """ + Filter by requested date from + """ + requestedAtFrom: DateTime - """ - Cayman Islands Dollar - """ - KYD + """ + Filter by requested date to + """ + requestedAtTo: DateTime + ): LegalDocumentCollection! """ - Tenge + Returns a list of transactions imports for this host """ - KZT + transactionsImports( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Kip - """ - LAK + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Lebanese Pound - """ - LBP + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + ): TransactionsImportsCollection! """ - Sri Lanka Rupee + Returns a list of transactions imports sources for this host """ - LKR + transactionsImportsSources: [NonEmptyString]! +} +""" +An account that can receive financial contributions +""" +interface AccountWithContributions { """ - Liberian Dollar + Number of unique financial contributors. """ - LRD + totalFinancialContributors( + """ + Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) + """ + accountType: AccountType + ): Int! + tiers( + """ + The number of results to fetch + """ + limit: Int! = 100 - """ - Loti - """ - LSL + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): TierCollection! """ - Moroccan Dirham + All the persons and entities that contribute to this account """ - MAD + contributors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + roles: [MemberRole] + ): ContributorCollection! """ - Moldovan Leu + How much platform fees are charged for this account """ - MDL + platformFeePercent: Float! """ - Malagasy Ariary + Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account """ - MGA + platformContributionAvailable: Boolean! + contributionPolicy: String """ - Denar + Returns true if the remote user can start the process to resume contributions for account """ - MKD + canStartResumeContributionsProcess: Boolean! """ - Kyat + Returns true if the account has started the process to resume contributions """ - MMK + hasResumeContributionsProcessStarted: Boolean! +} + +""" +A collection of "Tiers" +""" +type TierCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Tier] +} + +""" +A collection of "Contributor" +""" +type ContributorCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Contributor] +} +"\n A person or an entity that contributes financially or by any other mean to the mission\n of the collective. While \"Member\" is dedicated to permissions, this type is meant\n to surface all the public contributors and properly groups contributors who are part of\n multiple tiers.\n " +type Contributor { """ - Tugrik + A unique identifier for this member """ - MNT + id: String! """ - Pataca + Name of the contributor """ - MOP + name: String! @deprecated(reason: "2024-08-26: Use account.name instead") """ - Mauritius Rupee + All the roles for a given contributor """ - MUR + roles: [MemberRole] """ - Rufiyaa + True if the contributor is a collective admin """ - MVR + isAdmin: Boolean! """ - Kwacha + True if the contributor is a core contributor """ - MWK + isCore: Boolean! """ - Mexican Peso + True if the contributor is a financial contributor """ - MXN + isBacker: Boolean! """ - Malaysian Ringgit + Member join date """ - MYR + since: DateTime! """ - Mozambique Metical + How much money the user has contributed for this (in cents, using collective currency) """ - MZN + totalAmountDonated: Int! @deprecated(reason: "2024-08-26: Use totalAmountContributed instead") """ - Namibia Dollar + How much money the user has contributed """ - NAD + totalAmountContributed: Amount! """ - Naira + Whether the contributor is an individual, an organization... """ - NGN + type: String! @deprecated(reason: "2024-08-26: Use account.type instead") """ - Cordoba Oro + Defines if the contributors wants to be incognito (name not displayed) """ - NIO + isIncognito: Boolean! @deprecated(reason: "2024-08-26: Use account.isIncognito instead") """ - Norwegian Krone + Description of how the member contribute. Will usually be a tier name, or "design" or "code". """ - NOK + description: String """ - Nepalese Rupee + If the contributor has a page on Open Collective, this is the slug to link to it. Always null for incognito contributors """ - NPR + collectiveSlug: String @deprecated(reason: "2024-08-26: Use account.slug instead") + account: String """ - New Zealand Dollar + Contributor avatar or logo """ - NZD + image(height: Int, format: ImageFormat): String @deprecated(reason: "2024-08-26: Use account.image instead") """ - Balboa + A public message from contributors to describe their contributions """ - PAB + publicMessage: String +} +input AccountReferenceInput { """ - Nuevo Sol + The public id identifying the account (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) """ - PEN + id: String """ - Kina + The internal id of the account (ie: 580) """ - PGK + legacyId: Int @deprecated(reason: "2020-01-01: should only be used during the transition to GraphQL API v2.") """ - Philippine Peso + The slug identifying the account (ie: babel for https://opencollective.com/babel) """ - PHP + slug: String +} +""" +A legal document (e.g. W9, W8BEN, W8BEN-E) +""" +type LegalDocument { """ - Pakistan Rupee + Unique identifier for this legal document """ - PKR + id: String! """ - Zloty + The year this legal document is for """ - PLN + year: Int! """ - Guarani + The type of legal document """ - PYG + type: LegalDocumentType! """ - Qatari Rial + The status of the request for this legal document """ - QAR + status: LegalDocumentRequestStatus! """ - Romanian Leu + The service that provided this legal document """ - RON + service: LegalDocumentService! """ - Serbian Dinar + Whether this legal document is expired """ - RSD + isExpired: Boolean! """ - Russian Ruble + The date and time the request for this legal document was created """ - RUB + requestedAt: DateTime! """ - Rwanda Franc + The date and time this legal document was last updated """ - RWF + updatedAt: DateTime! """ - Saudi Riyal + The account this legal document is for """ - SAR + account: Account! """ - Solomon Islands Dollar + URL to download the file. Must be logged in as a host with access to the document. The returned URL will be protected by authentication + 2FA. """ - SBD + documentLink: URL +} +""" +Type for a required legal document +""" +enum LegalDocumentType { """ - Seychelles Rupee + US tax form (W9, W8BEN, W8BEN-E) """ - SCR + US_TAX_FORM +} + +""" +Status for a legal document +""" +enum LegalDocumentRequestStatus { + NOT_REQUESTED + REQUESTED + RECEIVED + ERROR + INVALID +} + +""" +Type for a required legal document +""" +enum LegalDocumentService { + DROPBOX_FORMS + OPENCOLLECTIVE +} + +""" +A collection of "MemberOf" (ie: Collective backed by an Organization) +""" +type MemberOfCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [MemberOf] + roles: [MemberOfCollectionRoles] +} +""" +An existing member role and account type combination used used to filter collections +""" +type MemberOfCollectionRoles { + type: AccountType! + role: MemberRole! +} + +""" +All supported expense types +""" +enum HostFeeStructure { """ - Swedish Krona + Use global host fees """ - SEK + DEFAULT """ - Singapore Dollar + Custom fee for this Collective only """ - SGD + CUSTOM_FEE """ - Saint Helena Pound + Set a monthly retainer for this Collective """ - SHP + MONTHLY_RETAINER +} +""" +Input to order collection +""" +input OrderByInput { """ - Leone + Field to order by. """ - SLL + field: OrderByFieldType! """ - Somali Shilling + Ordering direction. """ - SOS + direction: OrderDirection! +} + +""" +Possible fields you can use to order by +""" +enum OrderByFieldType { + CREATED_AT """ - Surinam Dollar + The financial activity of the collective (number of transactions) """ - SRD + ACTIVITY + HOST_RANK + HOSTED_COLLECTIVES_COUNT + RANK + BALANCE + MEMBER_COUNT + TOTAL_CONTRIBUTED + NAME +} + +""" +A collection of Transactions (Debit or Credit) +""" +type TransactionCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Transaction] + kinds: [TransactionKind] """ - Lilangeni + The types of payment methods used in this collection, regardless of the pagination """ - SZL + paymentMethodTypes: [PaymentMethodType]! +} + +enum PaymentMethodType { + default @deprecated(reason: "Please use uppercase values") + alipay @deprecated(reason: "Please use uppercase values") + creditcard @deprecated(reason: "Please use uppercase values") + prepaid @deprecated(reason: "Please use uppercase values") + payment @deprecated(reason: "Please use uppercase values") + subscription @deprecated(reason: "Please use uppercase values") + collective @deprecated(reason: "Please use uppercase values") + host @deprecated(reason: "Please use uppercase values") + adaptive @deprecated(reason: "Please use uppercase values") + giftcard @deprecated(reason: "Please use uppercase values") + manual @deprecated(reason: "Please use uppercase values") + crypto @deprecated(reason: "Please use uppercase values") + paymentintent @deprecated(reason: "Please use uppercase values") + us_bank_account @deprecated(reason: "Please use uppercase values") + sepa_debit @deprecated(reason: "Please use uppercase values") + bacs_debit @deprecated(reason: "Please use uppercase values") + bancontact @deprecated(reason: "Please use uppercase values") + link @deprecated(reason: "Please use uppercase values") + bank_transfer @deprecated(reason: "Please use uppercase values") + payout @deprecated(reason: "Please use uppercase values") + virtual_card @deprecated(reason: "Please use uppercase values") + swish @deprecated(reason: "Please use uppercase values") + DEFAULT + ALIPAY + CREDITCARD + PREPAID + PAYMENT + SUBSCRIPTION + COLLECTIVE + HOST + ADAPTIVE + GIFTCARD + MANUAL + CRYPTO + PAYMENT_INTENT + US_BANK_ACCOUNT + SEPA_DEBIT + BACS_DEBIT + BANCONTACT + LINK + BANK_TRANSFER + PAYOUT + VIRTUAL_CARD + SWISH +} + +enum PaymentMethodService { + PAYPAL + STRIPE + OPENCOLLECTIVE + THEGIVINGBLOCK + WISE +} +input ExpenseReferenceInput { """ - Baht + The public id identifying the expense (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) """ - THB + id: String """ - Somoni + The internal id of the expense (ie: 580) """ - TJS + legacyId: Int +} +""" +All supported expense types +""" +enum ExpenseType { """ - Pa’anga + Invoice: Charge for your time or get paid in advance. """ - TOP + INVOICE """ - Turkish Lira + Receipt: Get paid back for a purchase already made. """ - TRY + RECEIPT """ - Trinidad and Tobago Dollar + Funding Request: Request funding for a project or initiative. """ - TTD + FUNDING_REQUEST """ - New Taiwan Dollar + Grant: Request funding for a project or initiative. """ - TWD + GRANT """ - Tanzanian Shilling + Unclassified expense """ - TZS + UNCLASSIFIED """ - Hryvnia + Credit Card Charge: Payment done using an issued (virtual) credit card issued by your Fiscal Host. """ - UAH + CHARGE """ - Uganda Shilling + Settlement: expense generated by Open Collective to collect money owed by Fiscal Hosts. """ - UGX + SETTLEMENT +} +input OrderReferenceInput { """ - Peso Uruguayo + The public id identifying the order (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) """ - UYU + id: String """ - Uzbekistan Sum + The legacy public id identifying the order (ie: 4242) """ - UZS + legacyId: Int +} - """ - Dong - """ - VND +input VirtualCardReferenceInput { + id: String +} +""" +The user or system that paused the order +""" +enum OrderPausedBy { """ - Vatu + Individual who administers the account for this contribution """ - VUV + USER """ - Tala + The host of the collective """ - WST + HOST """ - CFA Franc BEAC + The platform """ - XAF + PLATFORM """ - East Caribbean Dollar + The collective """ - XCD + COLLECTIVE +} +input PaymentMethodReferenceInput { """ - CFA Franc BCEAO + The id assigned to the payment method """ - XOF + id: String +} - """ - CFP Franc - """ - XPF +""" +Account orders filter (INCOMING or OUTGOING) +""" +enum AccountOrdersFilter { + INCOMING + OUTGOING +} - """ - Yemeni Rial - """ - YER +""" +Expected funds filter (ALL_EXPECTED_FUNDS, ONLY_PENDING, ONLY_MANUAL) +""" +enum ExpectedFundsFilter { + ALL_EXPECTED_FUNDS + ONLY_PENDING + ONLY_MANUAL +} - """ - Rand - """ - ZAR +""" +A collection of "Expenses" +""" +type ExpenseCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Expense] + totalAmount: ExpenseCollectionTotalAmount +} - """ - Zambian Kwacha - """ - ZMW +type ExpenseCollectionTotalAmount { + amount(currency: Currency = USD): Amount + amountsByCurrency: [Amount] } """ @@ -4089,6 +4461,7 @@ enum ExpenseStatusFilter { SCHEDULED_FOR_PAYMENT SPAM CANCELED + INVITE_DECLINED """ Only expenses that are ready to be paid (must be approved, have the sufficiant balance and have the tax forms completed) @@ -4114,6 +4487,26 @@ The `JSON` scalar type represents JSON values as specified by [ECMA-404](http:// """ scalar JSON +""" +Defines role of the last comment author +""" +enum LastCommentBy { + """ + Expense Submitter + """ + USER + + """ + Fiscal Host Admin + """ + HOST_ADMIN + + """ + Collective Admin + """ + COLLECTIVE_ADMIN +} + """ A collection of "Conversations" """ @@ -4330,6 +4723,26 @@ type PaymentMethod { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -4375,6 +4788,16 @@ type PaymentMethod { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -4390,6 +4813,7 @@ type PaymentMethod { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -4850,11 +5274,6 @@ type AccountStats { """ frequency: ContributionFrequency - """ - Filter contributions on whether they can be ported to another fiscal host directly - """ - hasPortability: Boolean - """ Include contributions to children accounts (Projects and Events) """ @@ -5233,7 +5652,6 @@ type CollectiveFeatures { CONTACT_COLLECTIVE: CollectiveFeatureStatus CONTACT_FORM: CollectiveFeatureStatus CREATE_COLLECTIVE: CollectiveFeatureStatus - CROSS_CURRENCY_MANUAL_TRANSACTIONS: CollectiveFeatureStatus TRANSFERWISE: CollectiveFeatureStatus PAYPAL_PAYOUTS: CollectiveFeatureStatus PAYPAL_DONATIONS: CollectiveFeatureStatus @@ -5298,6 +5716,7 @@ type Policies { MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL: MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL EXPENSE_CATEGORIZATION: EXPENSE_CATEGORIZATION EXPENSE_PUBLIC_VENDORS: Boolean + COLLECTIVE_ADMINS_CAN_SEE_PAYOUT_METHODS: Boolean } type EXPENSE_AUTHOR_CANNOT_APPROVE { @@ -5411,6 +5830,66 @@ type Permission { reasonDetails: JSON } +""" +A collection of "HostApplication" +""" +type HostApplicationCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [HostApplication] +} + +type HostApplication { + id: String! + + """ + The account who applied to this host + """ + account: Account! + + """ + The host the collective applied to + """ + host: Host! + + """ + The date on which the item was created + """ + createdAt: DateTime! + + """ + The date on which the item was updated + """ + updatedAt: DateTime! + status: HostApplicationStatus + message: String + customData: JSON + + """ + Returns the list of comments for this host application, or `null` if user is not allowed to see them + """ + comments( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: ASC } + ): CommentCollection +} + +enum HostApplicationStatus { + PENDING + APPROVED + REJECTED + EXPIRED +} + """ An activity describing something that happened on the platform """ @@ -5526,10 +6005,12 @@ enum ActivityType { COLLECTIVE_EXPENSE_UNSCHEDULED_FOR_PAYMENT COLLECTIVE_EXPENSE_ERROR COLLECTIVE_EXPENSE_INVITE_DRAFTED + COLLECTIVE_EXPENSE_INVITE_DECLINED COLLECTIVE_EXPENSE_RECURRING_DRAFTED COLLECTIVE_EXPENSE_MISSING_RECEIPT TAXFORM_REQUEST TAXFORM_RECEIVED + TAXFORM_INVALIDATED COLLECTIVE_VIRTUAL_CARD_ADDED COLLECTIVE_VIRTUAL_CARD_MISSING_RECEIPTS COLLECTIVE_VIRTUAL_CARD_RESUMED @@ -5549,10 +6030,12 @@ enum ActivityType { COLLECTIVE_CORE_MEMBER_REMOVED COLLECTIVE_CORE_MEMBER_EDITED COLLECTIVE_TRANSACTION_CREATED + TRANSACTIONS_IMPORT_CREATED COLLECTIVE_UPDATE_CREATED COLLECTIVE_UPDATE_PUBLISHED COLLECTIVE_CONTACT HOST_APPLICATION_CONTACT + HOST_APPLICATION_COMMENT_CREATED CONTRIBUTION_REJECTED SUBSCRIPTION_ACTIVATED SUBSCRIPTION_CANCELED @@ -5566,14 +6049,20 @@ enum ActivityType { ORDER_PENDING_CONTRIBUTION_REMINDER ORDER_PROCESSING ORDER_PAYMENT_FAILED + ORDER_REVIEW_OPENED + ORDER_REVIEW_CLOSED + ORDER_DISPUTE_CREATED + ORDER_DISPUTE_CLOSED ORDER_THANKYOU ORDER_UPDATED + ADDED_FUNDS_EDITED VENDOR_CREATED VENDOR_EDITED VENDOR_DELETED ORDER_PENDING_CREATED ORDER_PENDING_FOLLOWUP ORDER_PENDING_RECEIVED + ORDER_PENDING_EXPIRED ORDERS_SUSPICIOUS PAYMENT_FAILED PAYMENT_CREDITCARD_CONFIRMATION @@ -5621,6 +6110,55 @@ enum ActivityClassType { REPORTS } +""" +EXPERIMENTAL (this may change or be deleted): Host transaction report +""" +type TransactionReports { + """ + The start date of the time series + """ + dateFrom: DateTime + + """ + The end date of the time series + """ + dateTo: DateTime + + """ + The interval between two data points + """ + timeUnit: TimeUnit! + nodes: [TransactionReport!] +} + +""" +EXPERIMENTAL (this may change or be deleted) +""" +type TransactionReport { + date: DateTime + startingBalance: Amount! + endingBalance: Amount! + totalChange: Amount! + groups: [TransactionsAmountGroup]! +} + +""" +EXPERIMENTAL (this may change or be deleted): Transaction amounts grouped by type, kind, isRefund, isHost, expenseType +""" +type TransactionsAmountGroup { + netAmount: Amount + amount: Amount + platformFee: Amount + paymentProcessorFee: Amount + hostFee: Amount + taxAmount: Amount + type: TransactionType + kind: TransactionKind + isRefund: Boolean + isHost: Boolean + expenseType: ExpenseType +} + """ A collection of webhooks """ @@ -5765,47 +6303,8 @@ type HostTransactionReports { type HostTransactionReportNode { date: DateTime! - managedFunds: TransactionsReport! - operationalFunds: TransactionsReport! -} - -""" -Transactions report -""" -type TransactionsReport { - startingBalance: Amount! - endingBalance: Amount! - totalChange: Amount! - groups: [TransactionsAmountGroup]! -} - -""" -EXPERIMENTAL (this may change or be deleted): Transaction amounts grouped by type, kind, isRefund, isHost, expenseType -""" -type TransactionsAmountGroup { - netAmount: Amount - amount: Amount - platformFee: Amount - paymentProcessorFee: Amount - hostFee: Amount - taxAmount: Amount - type: TransactionType - kind: TransactionKind - isRefund: Boolean - isHost: Boolean - expenseType: ExpenseType -} - -""" -EXPERIMENTAL (this may change or be deleted): Transaction amounts grouped by type, kind, isRefund, isHost, expenseType -""" -type TransactionSum { - amount: Amount - type: TransactionType - kind: TransactionKind - isRefund: Boolean - isHost: Boolean - expenseType: ExpenseType + managedFunds: TransactionReport! + operationalFunds: TransactionReport! } """ @@ -5981,6 +6480,35 @@ type TimeSeriesAmountWithKindNode { kind: TransactionKind! } +""" +EXPERIMENTAL (this may change or be deleted): Host expenses report +""" +type HostExpensesReports { + """ + The start date of the time series + """ + dateFrom: DateTime + + """ + The end date of the time series + """ + dateTo: DateTime + + """ + The interval between two data points + """ + timeUnit: TimeUnit! + nodes: [HostExpensesReportNode!] +} + +type HostExpensesReportNode { + date: DateTime! + isHost: Boolean! + accountingCategory: AccountingCategory + amount: Amount! + count: Int! +} + """ Stripe connected account properties """ @@ -5990,207 +6518,382 @@ type StripeConnectedAccount { } """ -A collection of "HostApplication" +Input type for an amount with the value and currency """ -type HostApplicationCollection implements Collection { +input AmountInput { + """ + The value in plain + """ + value: Float + + """ + The currency string + """ + currency: Currency + + """ + The value in cents + """ + valueInCents: Int + + """ + If the amount was generated from a currency conversion, this field can be used to provide details about the conversion + """ + exchangeRate: CurrencyExchangeRateInput +} + +""" +Fields for a currency exchange rate +""" +input CurrencyExchangeRateInput { + """ + Where does the FX rate comes from + """ + source: CurrencyExchangeRateSourceType! + fromCurrency: Currency! + toCurrency: Currency! + + """ + Date of the FX rate + """ + date: DateTime! + + """ + Exchange rate value as a float (e.g 1.15 or 0.86) + """ + value: Float! +} + +""" +Where does the FX rate come from +""" +enum CurrencyExchangeRateSourceType { + """ + Open Collective internal system, relying on caching and 3rd party APIs + """ + OPENCOLLECTIVE + + """ + PayPal API + """ + PAYPAL + + """ + Wise API + """ + WISE + + """ + User-provided exchange rate + """ + USER +} + +""" +Contribution statistics related to the given accounts +""" +type ContributionStats { + """ + The total number of contributions + """ + contributionsCount: Int! + + """ + Number of one time contributions + """ + oneTimeContributionsCount: Int! + + """ + Number of recurring contributions + """ + recurringContributionsCount: Int! + + """ + The daily average income + """ + dailyAverageIncomeAmount: Amount! +} + +""" +Expense statistics related to the given accounts +""" +type ExpenseStats { + """ + The total number of expenses + """ + expensesCount: Int! + + """ + The daily average paid in expenses + """ + dailyAverageAmount: Amount! + + """ + Number of invoices + """ + invoicesCount: Int! + + """ + Number of reimbursements + """ + reimbursementsCount: Int! + + """ + Number of grants + """ + grantsCount: Int! +} + +""" +A collection of "Agreement" +""" +type AgreementCollection implements Collection { offset: Int limit: Int totalCount: Int - nodes: [HostApplication] + nodes: [Agreement!] } -type HostApplication { - id: String! +""" +An agreement +""" +type Agreement { + id: String + title: String! """ - The account who applied to this host + Additional notes about the agreement for the host admins """ - account: Account! + notes: String """ - The date on which the item was created + The time of creation of this agreement """ createdAt: DateTime! - status: HostApplicationStatus - message: String - customData: JSON + createdBy: Account + account: Account! + host: Host! + expiresAt: DateTime + attachment: FileInfo } -enum HostApplicationStatus { - PENDING - APPROVED - REJECTED - EXPIRED +""" +A collection of Vendors +""" +type VendorCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Vendor!] +} + +""" +A collection of hosted "Accounts" +""" +type HostedAccountCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Account] + currencies: [String] +} + +""" +Input type for an amount range with the value and currency +""" +input AmountRangeInput { + """ + The minimum amount (inclusive) + """ + gte: AmountInput + + """ + The maximum amount (inclusive) + """ + lte: AmountInput +} + +""" +A collection of "LegalDocument" +""" +type LegalDocumentCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [LegalDocument] } """ -Input type for an amount with the value and currency +A collection of "TransactionsImports" """ -input AmountInput { - """ - The value in plain - """ - value: Float +type TransactionsImportsCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [TransactionsImport!] +} +type TransactionsImport { """ - The currency string + The public id of the import """ - currency: Currency + id: String! """ - The value in cents + Account that holds the import """ - valueInCents: Int + account: Account! """ - If the amount was generated from a currency conversion, this field can be used to provide details about the conversion + URL of the import (e.g. link to the CSV file) """ - exchangeRate: CurrencyExchangeRateInput -} + file: FileInfo -""" -Fields for a currency exchange rate -""" -input CurrencyExchangeRateInput { """ - Where does the FX rate comes from + Source of the import (e.g. "Bank of America", "Eventbrite", etc...) """ - source: CurrencyExchangeRateSourceType! - fromCurrency: Currency! - toCurrency: Currency! + source: NonEmptyString! """ - Date of the FX rate + Name of the import (e.g. "Contributions May 2021", "Tickets for Mautic Conference 2024") """ - date: DateTime! + name: NonEmptyString! """ - Exchange rate value as a float (e.g 1.15 or 0.86) + Type of the import """ - value: Float! -} + type: TransactionsImportType! -""" -Where does the FX rate come from -""" -enum CurrencyExchangeRateSourceType { """ - Open Collective internal system, relying on caching and 3rd party APIs + Configuration for the CSV import """ - OPENCOLLECTIVE + csvConfig: JSON """ - PayPal API + When the import was created """ - PAYPAL + createdAt: DateTime! """ - Wise API + When the import was last updated """ - WISE + updatedAt: DateTime! """ - User-provided exchange rate + List of rows in the import """ - USER + rows: TransactionsImportRowCollection! + stats: TransactionsImportStats } """ -Contribution statistics related to the given accounts +A string that cannot be passed as an empty value """ -type ContributionStats { +scalar NonEmptyString + +""" +Type of the import +""" +enum TransactionsImportType { + CSV + MANUAL +} + +""" +A collection of "TransactionsImportRow" +""" +type TransactionsImportRowCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [TransactionsImportRow!] +} + +""" +A row in a transactions import +""" +type TransactionsImportRow { """ - The total number of contributions + The public id of the imported row """ - contributionsCount: Int! + id: String! """ - Number of one time contributions + The source id of the row """ - oneTimeContributionsCount: Int! + sourceId: NonEmptyString! """ - Number of recurring contributions + Whether the row has been dismissed """ - recurringContributionsCount: Int! + isDismissed: Boolean! """ - The daily average income + The description of the row """ - dailyAverageIncomeAmount: Amount! -} + description: String! -""" -Expense statistics related to the given accounts -""" -type ExpenseStats { """ - The total number of expenses + The date of the row """ - expensesCount: Int! + date: DateTime! """ - The daily average paid in expenses + The amount of the row """ - dailyAverageAmount: Amount! + amount: Amount! """ - Number of invoices + The expense associated with the row """ - invoicesCount: Int! + expense: Expense """ - Number of reimbursements + The raw data of the row """ - reimbursementsCount: Int! + rawValue: JSONObject """ - Number of grants + The order associated with the row """ - grantsCount: Int! + order: Order } """ -A collection of "Agreement" +The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). """ -type AgreementCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Agreement!] -} +scalar JSONObject -""" -An agreement -""" -type Agreement { - id: String - title: String! +type TransactionsImportStats { + """ + Total number of rows in the import + """ + total: Int! """ - Additional notes about the agreement for the host admins + Number of rows that have been ignored """ - notes: String + ignored: Int! """ - The time of creation of this agreement + Number of rows that have been converted to expenses """ - createdAt: DateTime! - createdBy: Account - account: Account! - host: Host! - expiresAt: DateTime - attachment: FileInfo + expenses: Int! + + """ + Number of rows that have been converted to orders + """ + orders: Int! + + """ + Number of rows that have been processed (either dismissed or converted to expenses or orders) + """ + processed: Int! } -""" -A collection of Vendors -""" -type VendorCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Vendor!] +enum AccountingCategoryAppliesTo { + HOST + HOSTED_COLLECTIVES } type ExpenseValuesByRole { @@ -6212,11 +6915,6 @@ type ExpenseValuesByRole { hostAdmin: ExpenseValuesRoleDetails } -""" -A string that cannot be passed as an empty value -""" -scalar NonEmptyString - type ExpenseValuesRoleDetails { accountingCategory: AccountingCategory } @@ -6234,6 +6932,7 @@ enum ExpenseStatus { SCHEDULED_FOR_PAYMENT SPAM CANCELED + INVITE_DECLINED } """ @@ -6401,6 +7100,16 @@ type ExpensePermissions { """ canReject: Boolean! + """ + Whether the user or the given draft key is allowed decline the expense invite + """ + canDeclineExpenseInvite( + """ + Key for draft expense + """ + draftKey: String + ): Boolean! + """ Whether the current user can mark this expense as spam """ @@ -6433,6 +7142,12 @@ type ExpensePermissions { canUsePrivateNote: Boolean! canHold: Boolean! canRelease: Boolean! + canDownloadTaxForm: Boolean! + + """ + Whether the current user can see the private details of the payout method of this expense + """ + canSeePayoutMethodPrivateDetails: Boolean! edit: Permission! """ @@ -6454,6 +7169,7 @@ type ExpensePermissions { verifyDraftExpense: Permission! hold: Permission! release: Permission! + downloadTaxForm: Permission! } """ @@ -6777,7 +7493,11 @@ type Bot implements Account { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -6785,11 +7505,6 @@ type Bot implements Account { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -7109,11 +7824,31 @@ type Bot implements Account { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -7159,6 +7894,16 @@ type Bot implements Account { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -7174,6 +7919,7 @@ type Bot implements Account { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -7216,7 +7962,7 @@ type Bot implements Account { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -7288,6 +8034,16 @@ type Bot implements Account { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -7367,6 +8123,11 @@ type Bot implements Account { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -7385,6 +8146,7 @@ type Bot implements Account { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -7426,6 +8188,7 @@ type Bot implements Account { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -7442,6 +8205,31 @@ type Bot implements Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -7468,6 +8256,11 @@ type Bot implements Account { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -7512,7 +8305,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -7520,11 +8317,6 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -7844,11 +8636,31 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -7885,14 +8697,24 @@ type Collective implements Account & AccountWithHost & AccountWithContributions maxAmount: Int """ - Only return orders that were created after this date + Only return orders that were created after this date + """ + dateFrom: DateTime + + """ + Only return orders that were created before this date + """ + dateTo: DateTime + + """ + Only return pending orders that were expected after this date """ - dateFrom: DateTime + expectedDateFrom: DateTime """ - Only return orders that were created before this date + Only return pending orders that were expected before this date """ - dateTo: DateTime + expectedDateTo: DateTime """ The term to search @@ -7909,6 +8731,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -7951,7 +8774,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -8023,6 +8846,16 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -8102,6 +8935,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -8120,6 +8958,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -8161,6 +9000,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -8177,6 +9017,31 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -8203,6 +9068,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -8231,6 +9101,11 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ How much platform fees are charged for this account """ @@ -8334,6 +9209,11 @@ interface AccountWithHost { """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ Fees percentage that the platform takes for this collective """ @@ -8458,6 +9338,7 @@ type Credit implements Transaction { """ fetchPaymentProcessorFee: Boolean = false ): Amount! + paymentProcessorUrl: String host: Account """ @@ -8602,6 +9483,7 @@ type Debit implements Transaction { """ fetchPaymentProcessorFee: Boolean = false ): Amount! + paymentProcessorUrl: String host: Account """ @@ -8688,7 +9570,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -8696,11 +9582,6 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -9020,11 +9901,31 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -9070,6 +9971,16 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -9085,6 +9996,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -9127,7 +10039,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -9199,6 +10111,16 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -9278,6 +10200,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -9296,6 +10223,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -9337,6 +10265,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -9353,6 +10282,31 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -9379,6 +10333,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -9407,6 +10366,11 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ How much platform fees are charged for this account """ @@ -9653,7 +10617,11 @@ type Individual implements Account { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -9661,11 +10629,6 @@ type Individual implements Account { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -9985,11 +10948,31 @@ type Individual implements Account { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -10035,6 +11018,16 @@ type Individual implements Account { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -10050,6 +11043,7 @@ type Individual implements Account { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -10092,7 +11086,7 @@ type Individual implements Account { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -10164,6 +11158,16 @@ type Individual implements Account { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -10241,6 +11245,11 @@ type Individual implements Account { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -10259,6 +11268,7 @@ type Individual implements Account { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -10300,6 +11310,7 @@ type Individual implements Account { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -10316,6 +11327,31 @@ type Individual implements Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -10342,6 +11378,11 @@ type Individual implements Account { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -10594,7 +11635,11 @@ type Organization implements Account & AccountWithContributions { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -10602,11 +11647,6 @@ type Organization implements Account & AccountWithContributions { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -10926,11 +11966,31 @@ type Organization implements Account & AccountWithContributions { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -10976,6 +12036,16 @@ type Organization implements Account & AccountWithContributions { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -10991,6 +12061,7 @@ type Organization implements Account & AccountWithContributions { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -11033,7 +12104,7 @@ type Organization implements Account & AccountWithContributions { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -11105,6 +12176,16 @@ type Organization implements Account & AccountWithContributions { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -11182,6 +12263,11 @@ type Organization implements Account & AccountWithContributions { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -11200,6 +12286,7 @@ type Organization implements Account & AccountWithContributions { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -11241,6 +12328,7 @@ type Organization implements Account & AccountWithContributions { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -11257,6 +12345,31 @@ type Organization implements Account & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -11283,6 +12396,11 @@ type Organization implements Account & AccountWithContributions { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -11391,13 +12509,8 @@ type TransferWise { Transferwise balances. Returns null if Transferwise account is not connected. """ balances: [Amount] - amountBatched: Amount -} - -""" -The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). -""" -scalar JSONObject + amountBatched: Amount +} """ This represents a Vendor account @@ -11429,7 +12542,11 @@ type Vendor implements Account & AccountWithContributions { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -11437,11 +12554,6 @@ type Vendor implements Account & AccountWithContributions { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -11761,11 +12873,31 @@ type Vendor implements Account & AccountWithContributions { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -11811,6 +12943,16 @@ type Vendor implements Account & AccountWithContributions { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -11826,6 +12968,7 @@ type Vendor implements Account & AccountWithContributions { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -11868,7 +13011,7 @@ type Vendor implements Account & AccountWithContributions { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -11940,6 +13083,16 @@ type Vendor implements Account & AccountWithContributions { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -12019,6 +13172,11 @@ type Vendor implements Account & AccountWithContributions { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -12037,6 +13195,7 @@ type Vendor implements Account & AccountWithContributions { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -12078,6 +13237,7 @@ type Vendor implements Account & AccountWithContributions { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -12094,6 +13254,31 @@ type Vendor implements Account & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -12120,6 +13305,11 @@ type Vendor implements Account & AccountWithContributions { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -12394,6 +13584,11 @@ type Query { Include vendors for this host """ includeVendorsForHost: AccountReferenceInput + + """ + Filter by the balance of the account and its children accounts (events and projects) + """ + consolidatedBalance: AmountRangeInput ): AccountCollection! activities( """ @@ -12570,7 +13765,7 @@ type Query { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -12642,6 +13837,16 @@ type Query { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! expenseTagStats( """ @@ -12828,11 +14033,31 @@ type Query { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -12878,6 +14103,16 @@ type Query { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -12893,6 +14128,7 @@ type Query { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -12978,7 +14214,12 @@ type Query { """ The public id identifying the transaction (ie: rvelja97-pkzqbgq7-bbzyx6wd-50o8n4rm) """ - id: String + id: String @deprecated(reason: "2024-05-07: Please use the `transaction` field.") + + """ + Identifiers to retrieve the transaction. + """ + transaction: TransactionReferenceInput ): Transaction transactions( """ @@ -13152,6 +14393,16 @@ type Query { """ accountingCategory: [String] ): TransactionCollection! + + """ + Fetch a transactions import + """ + transactionsImport( + """ + The public id identifying the import (ie: rvelja97-pkzqbgq7-bbzyx6wd-50o8n4rm) + """ + id: String! + ): TransactionsImport update( """ Public identifier @@ -13168,6 +14419,10 @@ type Query { """ account: AccountReferenceInput ): Update + + """ + This query currently returns only published updates + """ updates( """ The number of results to fetch (default 10, max 1000) @@ -13193,6 +14448,8 @@ type Query { Host for the accounts for which to get updates """ host: [AccountReferenceInput] + onlyChangelogUpdates: Boolean + orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } ): UpdateCollection! paypalPlan( """ @@ -13271,6 +14528,7 @@ type Query { status: [VirtualCardRequestStatus] collective: [AccountReferenceInput] ): VirtualCardRequestCollection! + hostApplication(hostApplication: HostApplicationReferenceInput): HostApplication loggedInAccount: Individual me: Individual } @@ -13287,30 +14545,40 @@ enum TagSearchOperator { Two-letters country code following ISO3166_1 """ enum CountryISO { + """ + Andorra + """ + AD + + """ + The United Arab Emirates + """ + AE + """ Afghanistan """ AF """ - Åland Islands + Antigua and Barbuda """ - AX + AG """ - Albania + Anguilla """ - AL + AI """ - Algeria + Albania """ - DZ + AL """ - Andorra + Armenia """ - AD + AM """ Angola @@ -13318,9 +14586,9 @@ enum CountryISO { AO """ - Antigua and Barbuda + Antarctica """ - AG + AQ """ Argentina @@ -13328,9 +14596,14 @@ enum CountryISO { AR """ - Armenia + American Samoa """ - AM + AS + + """ + Austria + """ + AT """ Australia @@ -13338,9 +14611,14 @@ enum CountryISO { AU """ - Austria + Aruba """ - AT + AW + + """ + Åland Islands + """ + AX """ Azerbaijan @@ -13348,14 +14626,14 @@ enum CountryISO { AZ """ - The Bahamas + Bosnia and Herzegovina """ - BS + BA """ - Bahrain + Barbados """ - BH + BB """ Bangladesh @@ -13363,24 +14641,29 @@ enum CountryISO { BD """ - Barbados + Belgium """ - BB + BE """ - Belarus + Burkina """ - BY + BF """ - Belgium + Bulgaria """ - BE + BG """ - Belize + Bahrain """ - BZ + BH + + """ + Burundi + """ + BI """ Benin @@ -13388,24 +14671,29 @@ enum CountryISO { BJ """ - Bhutan + Saint Barthélemy """ - BT + BL """ - Bolivia + Bermuda """ - BO + BM """ - Bosnia and Herzegovina + Brunei """ - BA + BN """ - Botswana + Bolivia """ - BW + BO + + """ + Bonaire, Sint Eustatius and Saba + """ + BQ """ Brazil @@ -13413,34 +14701,34 @@ enum CountryISO { BR """ - Brunei + The Bahamas """ - BN + BS """ - Bulgaria + Bhutan """ - BG + BT """ - Burkina + Bouvet Island """ - BF + BV """ - Burundi + Botswana """ - BI + BW """ - Cambodia + Belarus """ - KH + BY """ - Cameroon + Belize """ - CM + BZ """ Canada @@ -13448,25 +14736,50 @@ enum CountryISO { CA """ - Cape Verde + Cocos Islands + """ + CC + + """ + The Democratic Republic of the Congo + """ + CD + + """ + The Central African Republic + """ + CF + + """ + The Congo + """ + CG + + """ + Switzerland """ - CV + CH """ - The Central African Republic + Côte d'Ivoire """ - CF + CI """ - Chad + Cook Islands """ - TD + CK """ Chile """ CL + """ + Cameroon + """ + CM + """ China """ @@ -13478,39 +14791,29 @@ enum CountryISO { CO """ - The Comoros - """ - KM - - """ - The Congo - """ - CG - - """ - The Democratic Republic of the Congo + Costa Rica """ - CD + CR """ - Costa Rica + Cuba """ - CR + CU """ - Côte d'Ivoire + Cape Verde """ - CI + CV """ - Croatia + Curaçao """ - HR + CW """ - Cuba + Christmas Island """ - CU + CX """ Cyprus @@ -13523,15 +14826,20 @@ enum CountryISO { CZ """ - Denmark + Germany """ - DK + DE """ Djibouti """ DJ + """ + Denmark + """ + DK + """ Dominica """ @@ -13543,9 +14851,9 @@ enum CountryISO { DO """ - Timor-Leste + Algeria """ - TL + DZ """ Ecuador @@ -13553,19 +14861,19 @@ enum CountryISO { EC """ - Egypt + Estonia """ - EG + EE """ - El Salvador + Egypt """ - SV + EG """ - Equatorial Guinea + Western Sahara """ - GQ + EH """ Eritrea @@ -13573,59 +14881,54 @@ enum CountryISO { ER """ - Estonia + Spain """ - EE + ES """ Ethiopia """ ET - """ - Fiji - """ - FJ - """ Finland """ FI """ - France + Fiji """ - FR + FJ """ - Gabon + Falkland Islands """ - GA + FK """ - The Gambia + Micronesia """ - GM + FM """ - Georgia + Faroe Islands """ - GE + FO """ - Germany + France """ - DE + FR """ - Ghana + Gabon """ - GH + GA """ - Greece + The United Kingdom """ - GR + GB """ Grenada @@ -13633,719 +14936,689 @@ enum CountryISO { GD """ - Guatemala - """ - GT - - """ - Guernsey - """ - GG - - """ - Guinea - """ - GN - - """ - Guinea-Bissau - """ - GW - - """ - Guyana - """ - GY - - """ - Haiti - """ - HT - - """ - The Holy See + Georgia """ - VA + GE """ - Honduras + French Guiana """ - HN + GF """ - Hungary + Guernsey """ - HU + GG """ - Iceland + Ghana """ - IS + GH """ - India + Gibraltar """ - IN + GI """ - Indonesia + Greenland """ - ID + GL """ - Iran + The Gambia """ - IR + GM """ - Iraq + Guinea """ - IQ + GN """ - Ireland + Guadeloupe """ - IE + GP """ - Isle of Man + Equatorial Guinea """ - IM + GQ """ - Israel + Greece """ - IL + GR """ - Italy + South Georgia and The South Sandwich Islands """ - IT + GS """ - Jamaica + Guatemala """ - JM + GT """ - Japan + Guam """ - JP + GU """ - Jersey + Guinea-Bissau """ - JE + GW """ - Jordan + Guyana """ - JO + GY """ - Kazakhstan + Hong Kong """ - KZ + HK """ - Kenya + Heard Island and McDonald Islands """ - KE + HM """ - Kiribati + Honduras """ - KI + HN """ - The Democratic People's Republic of Korea + Croatia """ - KP + HR """ - The Republic of Korea + Haiti """ - KR + HT """ - Kuwait + Hungary """ - KW + HU """ - Kyrgyzstan + Indonesia """ - KG + ID """ - Laos + Ireland """ - LA + IE """ - Latvia + Israel """ - LV + IL """ - Lebanon + Isle of Man """ - LB + IM """ - Lesotho + India """ - LS + IN """ - Liberia + The British Indian Ocean Territory """ - LR + IO """ - Libya + Iraq """ - LY + IQ """ - Liechtenstein + Iran """ - LI + IR """ - Lithuania + Iceland """ - LT + IS """ - Luxembourg + Italy """ - LU + IT """ - Madagascar + Jersey """ - MG + JE """ - Malawi + Jamaica """ - MW + JM """ - Malaysia + Jordan """ - MY + JO """ - Maldives + Japan """ - MV + JP """ - Mali + Kenya """ - ML + KE """ - Malta + Kyrgyzstan """ - MT + KG """ - The Marshall Islands + Cambodia """ - MH + KH """ - Mauritania + Kiribati """ - MR + KI """ - Mauritius + The Comoros """ - MU + KM """ - Mexico + Saint Kitts and Nevis """ - MX + KN """ - Micronesia + The Democratic People's Republic of Korea """ - FM + KP """ - Moldova + The Republic of Korea """ - MD + KR """ - Monaco + Kuwait """ - MC + KW """ - Mongolia + Cayman Islands """ - MN + KY """ - Montenegro + Kazakhstan """ - ME + KZ """ - Morocco + Laos """ - MA + LA """ - Mozambique + Lebanon """ - MZ + LB """ - Myanmar + Saint Lucia """ - MM + LC """ - Namibia + Liechtenstein """ - NA + LI """ - Nauru + Sri Lanka """ - NR + LK """ - Nepal + Liberia """ - NP + LR """ - The Netherlands + Lesotho """ - NL + LS """ - New Zealand + Lithuania """ - NZ + LT """ - Nicaragua + Luxembourg """ - NI + LU """ - The Niger + Latvia """ - NE + LV """ - Nigeria + Libya """ - NG + LY """ - Norway + Morocco """ - NO + MA """ - Oman + Monaco """ - OM + MC """ - Pakistan + Moldova """ - PK + MD """ - Palau + Montenegro """ - PW + ME """ - Panama + Saint Martin """ - PA + MF """ - Papua New Guinea + Madagascar """ - PG + MG """ - Paraguay + The Marshall Islands """ - PY + MH """ - Peru + Macedonia """ - PE + MK """ - The Philippines + Mali """ - PH + ML """ - Poland + Myanmar """ - PL + MM """ - Portugal + Mongolia """ - PT + MN """ - Qatar + Macao """ - QA + MO """ - Romania + Northern Mariana Islands """ - RO + MP """ - Russia + Martinique """ - RU + MQ """ - Rwanda + Mauritania """ - RW + MR """ - Saint Kitts and Nevis + Montserrat """ - KN + MS """ - Saint Lucia + Malta """ - LC + MT """ - Saint Vincent and The Grenadines + Mauritius """ - VC + MU """ - Samoa + Maldives """ - WS + MV """ - San Marino + Malawi """ - SM + MW """ - Sao Tome and Principe + Mexico """ - ST + MX """ - Saudi Arabia + Malaysia """ - SA + MY """ - Senegal + Mozambique """ - SN + MZ """ - Serbia + Namibia """ - RS + NA """ - Seychelles + New Caledonia """ - SC + NC """ - Sierra Leone + The Niger """ - SL + NE """ - Singapore + Norfolk Island """ - SG + NF """ - Slovakia + Nigeria """ - SK + NG """ - Slovenia + Nicaragua """ - SI + NI """ - Solomon Islands + The Netherlands """ - SB + NL """ - Somalia + Norway """ - SO + NO """ - South Africa + Nepal """ - ZA + NP """ - Spain + Nauru """ - ES + NR """ - Sri Lanka + Niue """ - LK + NU """ - The Sudan + New Zealand """ - SD + NZ """ - Suriname + Oman """ - SR + OM """ - Swaziland + Panama """ - SZ + PA """ - Sweden + Peru """ - SE + PE """ - Switzerland + French Polynesia """ - CH + PF """ - Syria + Papua New Guinea """ - SY + PG """ - Tajikistan + The Philippines """ - TJ + PH """ - Tanzania + Pakistan """ - TZ + PK """ - Thailand + Poland """ - TH + PL """ - Macedonia + Saint Pierre and Miquelon """ - MK + PM """ - Togo + Pitcairn """ - TG + PN """ - Tonga + Puerto Rico """ - TO + PR """ - Trinidad and Tobago + The Occupied Palestinian Territory """ - TT + PS """ - Tunisia + Portugal """ - TN + PT """ - Turkey + Palau """ - TR + PW """ - Turkmenistan + Paraguay """ - TM + PY """ - Tuvalu + Qatar """ - TV + QA """ - Uganda + Réunion """ - UG + RE """ - Ukraine + Romania """ - UA + RO """ - The United Arab Emirates + Serbia """ - AE + RS """ - The United Kingdom + Russia """ - GB + RU """ - The United States + Rwanda """ - US + RW """ - Uruguay + Saudi Arabia """ - UY + SA """ - Uzbekistan + Solomon Islands """ - UZ + SB """ - Vanuatu + Seychelles """ - VU + SC """ - Venezuela + The Sudan """ - VE + SD """ - Viet Nam + Sweden """ - VN + SE """ - Yemen + Singapore """ - YE + SG """ - Zambia + Saint Helena """ - ZM + SH """ - Zimbabwe + Slovenia """ - ZW + SI """ - American Samoa + Svalbard and Jan Mayen """ - AS + SJ """ - Anguilla + Slovakia """ - AI + SK """ - Antarctica + Sierra Leone """ - AQ + SL """ - Aruba + San Marino """ - AW + SM """ - Bermuda + Senegal """ - BM + SN """ - Bouvet Island + Somalia """ - BV + SO """ - The British Indian Ocean Territory + Suriname """ - IO + SR """ - Cayman Islands + South Sudan """ - KY + SS """ - Christmas Island + Sao Tome and Principe """ - CX + ST """ - Cocos Islands + El Salvador """ - CC + SV """ - Cook Islands + Sint Maarten """ - CK + SX """ - Falkland Islands + Syria """ - FK + SY """ - Faroe Islands + Swaziland """ - FO + SZ """ - French Guiana + Turks and Caicos Islands """ - GF + TC """ - French Polynesia + Chad """ - PF + TD """ The French Southern Territories @@ -14353,169 +15626,169 @@ enum CountryISO { TF """ - Gibraltar + Togo """ - GI + TG """ - Greenland + Thailand """ - GL + TH """ - Guadeloupe + Tajikistan """ - GP + TJ """ - Guam + Tokelau """ - GU + TK """ - Heard Island and McDonald Islands + Timor-Leste """ - HM + TL """ - Hong Kong + Turkmenistan """ - HK + TM """ - Macao + Tunisia """ - MO + TN """ - Martinique + Tonga """ - MQ + TO """ - Mayotte + Turkey """ - YT + TR """ - Montserrat + Trinidad and Tobago """ - MS + TT """ - Netherlands Antilles + Tuvalu """ - AN + TV """ - New Caledonia + Taiwan """ - NC + TW """ - Niue + Tanzania """ - NU + TZ """ - Norfolk Island + Ukraine """ - NF + UA """ - Northern Mariana Islands + Uganda """ - MP + UG """ - The Occupied Palestinian Territory + United States Minor Outlying Islands """ - PS + UM """ - Pitcairn + The United States """ - PN + US """ - Puerto Rico + Uruguay """ - PR + UY """ - Réunion + Uzbekistan """ - RE + UZ """ - Saint Barthélemy + The Holy See """ - BL + VA """ - Saint Helena + Saint Vincent and The Grenadines """ - SH + VC """ - Saint Martin + Venezuela """ - MF + VE """ - Saint Pierre and Miquelon + British Virgin Islands """ - PM + VG """ - South Georgia and The South Sandwich Islands + US Virgin Islands """ - GS + VI """ - Svalbard and Jan Mayen + Viet Nam """ - SJ + VN """ - Taiwan + Vanuatu """ - TW + VU """ - Tokelau + Wallis and Futuna """ - TK + WF """ - Turks and Caicos Islands + Samoa """ - TC + WS """ - United States Minor Outlying Islands + Yemen """ - UM + YE """ - British Virgin Islands + Mayotte """ - VG + YT """ - US Virgin Islands + South Africa """ - VI + ZA """ - Wallis and Futuna + Zambia """ - WF + ZM """ - Western Sahara + Zimbabwe """ - EH + ZW } enum ActivityAndClassesType { @@ -14558,10 +15831,12 @@ enum ActivityAndClassesType { COLLECTIVE_EXPENSE_UNSCHEDULED_FOR_PAYMENT COLLECTIVE_EXPENSE_ERROR COLLECTIVE_EXPENSE_INVITE_DRAFTED + COLLECTIVE_EXPENSE_INVITE_DECLINED COLLECTIVE_EXPENSE_RECURRING_DRAFTED COLLECTIVE_EXPENSE_MISSING_RECEIPT TAXFORM_REQUEST TAXFORM_RECEIVED + TAXFORM_INVALIDATED COLLECTIVE_VIRTUAL_CARD_ADDED COLLECTIVE_VIRTUAL_CARD_MISSING_RECEIPTS COLLECTIVE_VIRTUAL_CARD_RESUMED @@ -14581,10 +15856,12 @@ enum ActivityAndClassesType { COLLECTIVE_CORE_MEMBER_REMOVED COLLECTIVE_CORE_MEMBER_EDITED COLLECTIVE_TRANSACTION_CREATED + TRANSACTIONS_IMPORT_CREATED COLLECTIVE_UPDATE_CREATED COLLECTIVE_UPDATE_PUBLISHED COLLECTIVE_CONTACT HOST_APPLICATION_CONTACT + HOST_APPLICATION_COMMENT_CREATED CONTRIBUTION_REJECTED SUBSCRIPTION_ACTIVATED SUBSCRIPTION_CANCELED @@ -14598,14 +15875,20 @@ enum ActivityAndClassesType { ORDER_PENDING_CONTRIBUTION_REMINDER ORDER_PROCESSING ORDER_PAYMENT_FAILED + ORDER_REVIEW_OPENED + ORDER_REVIEW_CLOSED + ORDER_DISPUTE_CREATED + ORDER_DISPUTE_CLOSED ORDER_THANKYOU ORDER_UPDATED + ADDED_FUNDS_EDITED VENDOR_CREATED VENDOR_EDITED VENDOR_DELETED ORDER_PENDING_CREATED ORDER_PENDING_FOLLOWUP ORDER_PENDING_RECEIVED + ORDER_PENDING_EXPIRED ORDERS_SUSPICIOUS PAYMENT_FAILED PAYMENT_CREDITCARD_CONFIRMATION @@ -14710,7 +15993,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -14718,11 +16005,6 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -15042,11 +16324,31 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -15092,6 +16394,16 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -15107,6 +16419,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -15149,7 +16462,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -15221,6 +16534,16 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -15300,6 +16623,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -15318,6 +16646,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -15359,6 +16688,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -15375,6 +16705,31 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -15401,6 +16756,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -15429,6 +16789,11 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ How much platform fees are charged for this account """ @@ -15553,7 +16918,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - currency: String + + """ + The currency of the account + """ + currency: Currency! expensePolicy: String """ @@ -15561,11 +16930,6 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ isIncognito: Boolean! imageUrl(height: Int, format: ImageFormat): String - - """ - Returns whether this account has a custom image - """ - hasImage: Boolean! backgroundImageUrl(height: Int, format: ImageFormat): String """ @@ -15885,11 +17249,31 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ includeHostedAccounts: Boolean + """ + Include orders from children events/projects + """ + includeChildrenAccounts: Boolean! = false + + """ + Only return orders that were paused by these roles. status must be set to PAUSED. + """ + pausedBy: [OrderPausedBy] + """ Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. """ paymentMethod: PaymentMethodReferenceInput + """ + Only return orders that match these payment method services + """ + paymentMethodService: [PaymentMethodService] + + """ + Only return orders that match these payment method types + """ + paymentMethodType: [PaymentMethodType] + """ Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ @@ -15935,6 +17319,16 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ dateTo: DateTime + """ + Only return pending orders that were expected after this date + """ + expectedDateFrom: DateTime + + """ + Only return pending orders that were expected before this date + """ + expectedDateTo: DateTime + """ The term to search """ @@ -15950,6 +17344,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Same as onlySubscriptions, but returns only orders with active subscriptions """ onlyActiveSubscriptions: Boolean + expectedFundsFilter: ExpectedFundsFilter """ Return only orders made from/to that opposite account (only works when orders are already filtered with a main account) @@ -15992,7 +17387,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ Use this field to filter expenses on their statuses """ - status: ExpenseStatusFilter + status: [ExpenseStatusFilter] """ Use this field to filter expenses on their type (RECEIPT/INVOICE) @@ -16064,6 +17459,16 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Filter expenses of type charges using these virtual cards """ virtualCards: [VirtualCardReferenceInput] + + """ + Filter expenses by the last user-role who replied to them + """ + lastCommentBy: [LastCommentBy] + + """ + Only return expenses that match these accounting categories + """ + accountingCategory: [String] ): ExpenseCollection! settings: JSON! conversations( @@ -16143,6 +17548,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A categories: [String]! stats: AccountStats + """ + Whether this account can have changelog updates + """ + canHaveChangelogUpdates: Boolean! + """ Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ @@ -16161,6 +17571,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Only return published updates. """ onlyPublishedUpdates: Boolean = false + isDraft: Boolean onlyChangelogUpdates: Boolean orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } searchTerm: String @@ -16202,6 +17613,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A offset: Int! = 0 isActive: Boolean accountType: [AccountType] + searchTerm: String ): AccountCollection! """ @@ -16218,6 +17630,31 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Logged-in user permissions on an account """ permissions: AccountPermissions! + + """ + Host application requests + """ + hostApplicationRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! feed( """ Only returns activities before this date @@ -16244,6 +17681,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A If this account was duplicated, the accounts that were created from it """ duplicatedAccounts(limit: Int! = 100, offset: Int! = 0): AccountCollection! + + """ + EXPERIMENTAL (this may change or be removed) + """ + transactionReports(timeUnit: TimeUnit = MONTH, dateFrom: DateTime, dateTo: DateTime): TransactionReports webhooks( """ The number of results to fetch (default 10, max 1000) @@ -16272,6 +17714,11 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float + """ + Returns the Fiscal Host application + """ + hostApplication: HostApplication + """ How much platform fees are charged for this account """ @@ -16378,6 +17825,18 @@ input TierReferenceInput { isCustom: Boolean } +input TransactionReferenceInput { + """ + The public id identifying the transaction (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + """ + id: String + + """ + The internal id of the transaction (ie: 580) + """ + legacyId: Int +} + """ A PayPal plan to associate with a contribution """ @@ -16397,73 +17856,20 @@ type VirtualCardRequestCollection implements Collection { offset: Int limit: Int totalCount: Int - nodes: [VirtualCardRequest!] -} - -""" -This is the root mutation -""" -type Mutation { - """ - Add funds to the given account. Scope: "host". - """ - addFunds( - """ - The account that will be used as the source of the funds - """ - fromAccount: AccountReferenceInput! - - """ - The account that will receive the funds - """ - account: AccountReferenceInput! - - """ - The tier to which the funds will be added - """ - tier: TierReferenceInput - - """ - The total amount of the order, including taxes - """ - amount: AmountInput! - - """ - The host fee percent to apply to the order, as a float between 0 and 100 - """ - hostFeePercent: Float - - """ - A short description of the contribution - """ - description: String! - - """ - A private note for the host - """ - memo: String - - """ - The date at which the order was processed - """ - processedAt: DateTime - - """ - The invoice template to use for this order - """ - invoiceTemplate: String - - """ - The tax to apply to the order - """ - tax: TaxInput - - """ - The accounting category of this order - """ - accountingCategory: AccountingCategoryReferenceInput - ): Order! + nodes: [VirtualCardRequest!] +} + +input HostApplicationReferenceInput { + """ + The public id identifying the host application (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + """ + id: String +} +""" +This is the root mutation +""" +type Mutation { """ Create a Collective. Scope: "account". """ @@ -16662,7 +18068,22 @@ type Mutation { """ Message to send by email to the admins of the account """ - message: String + message: String @deprecated(reason: "2024-08-23: Use messageForAccountAdmins instead") + + """ + Message to send by email to the admins of the account + """ + messageForAccountAdmins: String + + """ + Message to send by email to the contributors when pausing their contributions (with PayPal) or unpausing + """ + messageForContributors: String + + """ + Whether to pause recurring contributions + """ + pauseExistingRecurringContributions: Boolean! = false ): Account! """ @@ -16806,6 +18227,146 @@ type Mutation { """ categories: [AccountingCategoryInput!]! ): Account! + + """ + Add funds to the given account. Scope: "host". + """ + addFunds( + """ + The account that will be used as the source of the funds + """ + fromAccount: AccountReferenceInput! + + """ + The account that will receive the funds + """ + account: AccountReferenceInput! + + """ + The tier to which the funds will be added + """ + tier: TierReferenceInput + + """ + The total amount of the order, including fees and taxes + """ + amount: AmountInput! + + """ + The payment processor fee amount + """ + paymentProcessorFee: AmountInput + + """ + The host fee percent to apply to the order, as a float between 0 and 100 + """ + hostFeePercent: Float + + """ + A short description of the contribution + """ + description: String! + + """ + A private note for the host + """ + memo: String + + """ + The date at which the order was processed + """ + processedAt: DateTime + + """ + The invoice template to use for this order + """ + invoiceTemplate: String + + """ + The tax to apply to the order + """ + tax: TaxInput + + """ + The accounting category of this order + """ + accountingCategory: AccountingCategoryReferenceInput + + """ + The transaction import row to associate with this order + """ + transactionsImportRow: TransactionsImportRowReferenceInput + ): Order! + + """ + Add funds to the given account. Scope: "host". + """ + editAddedFunds( + """ + The order to edit + """ + order: OrderReferenceInput! + + """ + The account that will be used as the source of the funds + """ + fromAccount: AccountReferenceInput! + + """ + The account that will receive the funds + """ + account: AccountReferenceInput! + + """ + The tier to which the funds will be added + """ + tier: TierReferenceInput + + """ + The total amount of the order, including fees and taxes + """ + amount: AmountInput! + + """ + The payment processor fee amount + """ + paymentProcessorFee: AmountInput + + """ + The host fee percent to apply to the order, as a float between 0 and 100 + """ + hostFeePercent: Float + + """ + A short description of the contribution + """ + description: String! + + """ + A private note for the host + """ + memo: String + + """ + The date at which the order was processed + """ + processedAt: DateTime + + """ + The invoice template to use for this order + """ + invoiceTemplate: String + + """ + The tax to apply to the order + """ + tax: TaxInput + + """ + The accounting category of this order + """ + accountingCategory: AccountingCategoryReferenceInput + ): Order! createApplication(application: ApplicationCreateInput!): Application updateApplication(application: ApplicationUpdateInput!): Application deleteApplication(application: ApplicationReferenceInput!): Application @@ -16958,6 +18519,11 @@ type Mutation { Recurring Expense information """ recurring: RecurringExpenseInput + + """ + If the expense was imported, this is the reference to the row + """ + transactionsImportRow: TransactionsImportRowReferenceInput ): Expense! """ @@ -16994,6 +18560,11 @@ type Mutation { """ expense: ExpenseReferenceInput! + """ + Expense draft key if its action by invited user without account + """ + draftKey: String + """ The action to trigger """ @@ -17097,12 +18668,17 @@ type Mutation { """ The account that applied to the host """ - account: AccountReferenceInput! + account: AccountReferenceInput @deprecated(reason: "2024-07-24: Please use hostApplication") + + """ + The host application + """ + hostApplication: HostApplicationReferenceInput """ The host concerned by the application """ - host: AccountReferenceInput! + host: AccountReferenceInput @deprecated(reason: "2024-07-24: Please use hostApplication") """ What to do with the application @@ -17165,6 +18741,16 @@ type Mutation { currentPassword: String ): SetPasswordResponse! + """ + Confirm email for Individual. Scope: "account". + """ + confirmEmail( + """ + The token to confirm the email. + """ + token: NonEmptyString! + ): IndividualConfirmEmailResponse! + """ Submit a legal document """ @@ -17185,6 +18771,36 @@ type Mutation { formData: JSON! ): LegalDocument! + """ + Edit the status of a legal document + """ + editLegalDocumentStatus( + """ + The ID of the legal document + """ + id: String! + + """ + The new status of the legal document + """ + status: LegalDocumentRequestStatus! + + """ + The host of the legal document + """ + host: AccountReferenceInput! + + """ + A message to explain the change in status. Will be sent to the legal document submitter + """ + message: String + + """ + The new document link for the legal document. Must pass status=RECEIVED. + """ + file: Upload + ): LegalDocument! + """ Invite a new member to the Collective. Scope: "account". """ @@ -17444,7 +19060,17 @@ type Mutation { """ A mutation for the host to approve or reject an order. Scope: "orders". """ - processPendingOrder(order: OrderUpdateInput!, action: ProcessOrderAction!): Order! + processPendingOrder( + """ + The order to process + """ + order: OrderUpdateInput! + + """ + The action to take on the order + """ + action: ProcessOrderAction! + ): Order! """ [Root only] A mutation to move orders from one account to another @@ -17623,93 +19249,138 @@ type Mutation { """ Account to merge to """ - toAccount: AccountReferenceInput! + toAccount: AccountReferenceInput! + + """ + If true, the result will be simulated and summarized in the response message + """ + dryRun: Boolean! = true + ): MergeAccountsResponse! + + """ + [Root only] Ban accounts + """ + banAccount( + """ + Account(s) to ban + """ + account: [AccountReferenceInput!]! + + """ + If true, the associated accounts will also be banned + """ + includeAssociatedAccounts: Boolean! + + """ + If true, the result will be simulated and summarized in the response message + """ + dryRun: Boolean! + ): BanAccountResponse! + + """ + [Root only] A mutation to move expenses from one account to another + """ + moveExpenses( + """ + The orders to move + """ + expenses: [ExpenseReferenceInput!]! + + """ + The account to move the expenses to. This must be a non USER account. + """ + destinationAccount: AccountReferenceInput! + ): [Expense]! + + """ + Refunds a transaction. Scope: "transactions". + """ + refundTransaction( + """ + Reference of the transaction to refund + """ + transaction: TransactionReferenceInput! + ): Transaction + + """ + Rejects transaction, removes member from Collective, and sends a message to the contributor. Scope: "transactions". + """ + rejectTransaction( + """ + Reference of the transaction to refund + """ + transaction: TransactionReferenceInput! """ - If true, the result will be simulated and summarized in the response message + Message to send to the contributor whose contribution has been rejected """ - dryRun: Boolean! = true - ): MergeAccountsResponse! + message: String + ): Transaction! """ - [Root only] Ban accounts + Create a new import. To manually add transactions to it, use `importTransactions`. """ - banAccount( - """ - Account(s) to ban - """ - account: [AccountReferenceInput!]! - + createTransactionsImport( """ - If true, the associated accounts will also be banned + Account that will hold the import (usually the host) """ - includeAssociatedAccounts: Boolean! + account: AccountReferenceInput! """ - If true, the result will be simulated and summarized in the response message + Source of the import (e.g. "Bank of America", "Eventbrite", etc...) """ - dryRun: Boolean! - ): BanAccountResponse! + source: NonEmptyString! - """ - [Root only] A mutation to move expenses from one account to another - """ - moveExpenses( """ - The orders to move + Name of the import (e.g. "Contributions May 2021", "Tickets for Mautic Conference 2024") """ - expenses: [ExpenseReferenceInput!]! + name: NonEmptyString! """ - The account to move the expenses to. This must be a non USER account. + Type of the import """ - destinationAccount: AccountReferenceInput! - ): [Expense]! + type: TransactionsImportType! + ): TransactionsImport! """ - [Root only] A mutation to set the tax from for an account. + Import transactions, manually or from a CSV file """ - setTaxForm( + importTransactions( """ - Reference to the Account the tax form should be set. + ID of the import to add transactions to """ - account: AccountReferenceInput! + id: NonEmptyString! """ - The tax from link. + Raw file from which the data was extracted """ - taxFormLink: URL! + file: Upload """ - The tax form year. + Configuration of the CSV file """ - year: Int! - ): SetTaxFormResult + csvConfig: JSONObject - """ - Refunds a transaction. Scope: "transactions". - """ - refundTransaction( """ - Reference of the transaction to refund + Data to import """ - transaction: TransactionReferenceInput! - ): Transaction + data: [TransactionsImportRowCreateInput!]! + ): TransactionsImport! """ - Rejects transaction, removes member from Collective, and sends a message to the contributor. Scope: "transactions". + Update transactions import rows to set new values or mark them as dismissed """ - rejectTransaction( + updateTransactionsImportRows( """ - Reference of the transaction to refund + ID of the import to add transactions to """ - transaction: TransactionReferenceInput! + id: NonEmptyString! """ - Message to send to the contributor whose contribution has been rejected + Rows to update """ - message: String - ): Transaction! + rows: [TransactionsImportRowUpdateInput!]! + ): TransactionsImport! """ Create update. Scope: "updates". @@ -18114,61 +19785,6 @@ type Mutation { sendSurveyResponse(surveyKey: String!, responseId: String!, score: Int!, text: String, okToContact: Boolean): Boolean } -""" -Input to set taxes for an expense -""" -input TaxInput { - """ - Tax type - """ - type: TaxType! - - """ - Tax rate as a float number between 0 and 1 - """ - rate: Float! - - """ - Tax identification number, if any - """ - idNumber: String - - """ - Country ISO code of the entity paying the tax - """ - country: CountryISO - - """ - An optional tax amount to make sure the tax displayed in your frontend matches the one calculated by the API - """ - amount: AmountInput -} - -""" -The type of a tax like GST, VAT, etc -""" -enum TaxType { - """ - European Value Added Tax - """ - VAT - - """ - New Zealand Good and Services Tax - """ - GST -} - -""" -Reference to an accounting category -""" -input AccountingCategoryReferenceInput { - """ - The ID of the accounting category - """ - id: NonEmptyString! -} - input CollectiveCreateInput { name: String! slug: String! @@ -18342,6 +19958,7 @@ input PoliciesInput { COLLECTIVE_MINIMUM_ADMINS: PoliciesCollectiveMinimumAdminsInput EXPENSE_CATEGORIZATION: PoliciesExpenseCategorizationInput EXPENSE_PUBLIC_VENDORS: Boolean + COLLECTIVE_ADMINS_CAN_SEE_PAYOUT_METHODS: Boolean } input PoliciesCollectiveExpenseAuthorCannotApprove { @@ -18401,6 +20018,73 @@ input AccountingCategoryInput { If meant for expenses, the types of expenses this category applies to """ expensesTypes: [ExpenseType] + + """ + If the category is applicable to the Host or Hosted Collectives + """ + appliesTo: AccountingCategoryAppliesTo! = HOSTED_COLLECTIVES +} + +""" +Input to set taxes for an expense +""" +input TaxInput { + """ + Tax type + """ + type: TaxType! + + """ + Tax rate as a float number between 0 and 1 + """ + rate: Float! + + """ + Tax identification number, if any + """ + idNumber: String + + """ + Country ISO code of the entity paying the tax + """ + country: CountryISO + + """ + An optional tax amount to make sure the tax displayed in your frontend matches the one calculated by the API + """ + amount: AmountInput +} + +""" +The type of a tax like GST, VAT, etc +""" +enum TaxType { + """ + European Value Added Tax + """ + VAT + + """ + New Zealand Good and Services Tax + """ + GST +} + +""" +Reference to an accounting category +""" +input AccountingCategoryReferenceInput { + """ + The ID of the accounting category + """ + id: NonEmptyString! +} + +input TransactionsImportRowReferenceInput { + """ + The id of the row + """ + id: NonEmptyString! } """ @@ -18464,7 +20148,7 @@ input CommentUpdateInput { } """ -Input to create a comment. You can only specify one entity type: expense, conversation or update +Input to create a comment. You can only specify one entity type: expense, conversation, update or host application """ input CommentCreateInput { html: String @@ -18474,6 +20158,11 @@ input CommentCreateInput { """ expense: ExpenseReferenceInput + """ + If your comment is linked to an host application, set it here + """ + hostApplication: HostApplicationReferenceInput + """ If your comment is linked to an order, set it here """ @@ -18598,7 +20287,7 @@ input ExpenseCreateInput { type: ExpenseType! """ - A private note that will be attached to your invoice, as HTML + A private note that will be attached to your invoice, as HTML. Only visible to the payee and the collective/host admins. """ privateMessage: String @@ -18646,6 +20335,11 @@ input ExpenseCreateInput { The accounting category this expense belongs to """ accountingCategory: AccountingCategoryReferenceInput + + """ + User-provided reference number or any other identifier that references the invoice + """ + reference: String } input PayoutMethodInput { @@ -18749,6 +20443,11 @@ input ExpenseUpdateInput { """ longDescription: String + """ + User-provided reference number or any other identifier that references the invoice + """ + reference: String + """ Currency that should be used for the payout. Defaults to the account currency """ @@ -18945,6 +20644,11 @@ enum ExpenseProcessAction { To release the expense from hold """ RELEASE + + """ + To decline an invited expense + """ + DECLINE_INVITED_EXPENSE } """ @@ -19044,7 +20748,7 @@ input ExpenseInviteDraftInput { type: ExpenseType! """ - A private note that will be attached to your invoice, as HTML + A private note that will be attached to your invoice, as HTML. Only visible to the payee and the collective/host admins. """ privateMessage: String @@ -19093,6 +20797,11 @@ input ExpenseInviteDraftInput { """ accountingCategory: AccountingCategoryReferenceInput + """ + User-provided reference number or any other identifier that references the invoice + """ + reference: String + """ Note to be sent to the invited user through email. """ @@ -19141,6 +20850,7 @@ type ProcessHostApplicationResponse { When sending a public message, this field will have the info about the conversation created """ conversation: Conversation + hostApplication: HostApplication } """ @@ -19173,6 +20883,23 @@ type SetPasswordResponse { token: String } +type IndividualConfirmEmailResponse { + """ + The account that was confirmed + """ + individual: Individual! + + """ + A new session token to use for the account. Only returned if user is signed in already. + """ + sessionToken: String +} + +""" +The `Upload` scalar type represents a file upload. +""" +scalar Upload + input MemberInvitationReferenceInput { """ The public id identifying the member invitation (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) @@ -19517,6 +21244,11 @@ input OrderUpdateInput { Date the funds were received """ processedAt: DateTime + + """ + Reference to the transaction import row to link the order to + """ + transactionsImportRow: TransactionsImportRowReferenceInput } """ @@ -19551,6 +21283,7 @@ input PaymentIntentInput { amount: AmountInput! fromAccount: AccountReferenceInput toAccount: AccountReferenceInput! + frequency: ContributionFrequency } """ @@ -19768,20 +21501,73 @@ type BanAccountResponse { accounts: [Account!]! } -type SetTaxFormResult { - success: Boolean! +input TransactionsImportRowCreateInput { + """ + The source id of the row + """ + sourceId: NonEmptyString! + + """ + The description of the row + """ + description: String + + """ + The date of the row + """ + date: DateTime! + + """ + The amount of the row + """ + amount: AmountInput! + + """ + The raw value of the row + """ + rawValue: JSONObject + + """ + Whether the row is dismissed + """ + isDismissed: Boolean! = false } -input TransactionReferenceInput { +input TransactionsImportRowUpdateInput { """ - The public id identifying the transaction (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + The id of the row """ - id: String + id: NonEmptyString! """ - The internal id of the transaction (ie: 580) + The source id of the row """ - legacyId: Int + sourceId: NonEmptyString + + """ + The description of the row + """ + description: String + + """ + The date of the row + """ + date: DateTime + + """ + The amount of the row + """ + amount: AmountInput + + """ + Whether the row is dismissed + """ + isDismissed: Boolean = false + + """ + The order associated with the row + """ + order: OrderReferenceInput } """ @@ -19795,6 +21581,7 @@ input UpdateCreateInput { html: String! fromAccount: AccountReferenceInput account: AccountReferenceInput! + notificationAudience: UpdateAudience } """ @@ -19805,9 +21592,11 @@ input UpdateUpdateInput { slug: String title: String isPrivate: Boolean + isChangelog: Boolean makePublicOn: DateTime html: String fromAccount: AccountReferenceInput + notificationAudience: UpdateAudience } type UploadFileResult { @@ -19879,11 +21668,6 @@ input UploadFileInput { parsingOptions: OCRParsingOptionsInput = null } -""" -The `Upload` scalar type represents a file upload. -""" -scalar Upload - """ The kind of file that was uploaded """ @@ -19892,6 +21676,7 @@ enum UploadedFileKind { ACCOUNT_BANNER EXPENSE_ATTACHED_FILE EXPENSE_ITEM + TRANSACTIONS_IMPORT ACCOUNT_LONG_DESCRIPTION UPDATE COMMENT @@ -19973,6 +21758,8 @@ input TierUpdateInput { amount: AmountInput name: NonEmptyString description: String + longDescription: String + videoUrl: URL button: String goal: AmountInput type: TierType diff --git a/src/server/controllers/account-transactions.ts b/src/server/controllers/account-transactions.ts index 6de5528e1..c30a7324e 100644 --- a/src/server/controllers/account-transactions.ts +++ b/src/server/controllers/account-transactions.ts @@ -595,17 +595,17 @@ const accountTransactions: RequestHandler = async (req, res) => { variables.includeHost = parseToBooleanDefaultTrue(variables.includeHost); } - variables.fetchHostFee = parseToBooleanDefaultFalse(req.query.flattenHostFee); + variables.fetchHostFee = parseToBooleanDefaultFalse(req.query.flattenHostFee as string); if (variables.fetchHostFee) { variables.kind = difference(variables.kind || allKinds, ['HOST_FEE']); } - variables.fetchPaymentProcessorFee = parseToBooleanDefaultFalse(req.query.flattenPaymentProcessorFee); + variables.fetchPaymentProcessorFee = parseToBooleanDefaultFalse(req.query.flattenPaymentProcessorFee as string); if (variables.fetchPaymentProcessorFee) { variables.kind = difference(variables.kind || allKinds, ['PAYMENT_PROCESSOR_FEE']); } - variables.fetchTax = parseToBooleanDefaultFalse(req.query.flattenTax); + variables.fetchTax = parseToBooleanDefaultFalse(req.query.flattenTax as string); if (variables.fetchTax) { variables.kind = difference(variables.kind || allKinds, ['TAX']); } @@ -628,7 +628,7 @@ const accountTransactions: RequestHandler = async (req, res) => { } if (req.query.fullDescription) { - variables.fullDescription = parseToBooleanDefaultFalse(req.query.fullDescription); + variables.fullDescription = parseToBooleanDefaultFalse(req.query.fullDescription as string); } else { variables.fullDescription = req.params.reportType === 'hostTransactions' ? true : false; } @@ -671,7 +671,7 @@ const accountTransactions: RequestHandler = async (req, res) => { fields = difference(intersection(baseAllFields, [...baseDefaultFields, ...add]), remove); } - const fetchAll = variables.offset ? false : parseToBooleanDefaultFalse(req.query.fetchAll); + const fetchAll = variables.offset ? false : parseToBooleanDefaultFalse(req.query.fetchAll as string); // Add fields info to the query, to prevent fetching what's not needed variables.hasAccountingCategoryField = fields.some((field) => field.startsWith('accountingCategory')); diff --git a/src/server/controllers/hosted-collectives.ts b/src/server/controllers/hosted-collectives.ts new file mode 100644 index 000000000..013adf423 --- /dev/null +++ b/src/server/controllers/hosted-collectives.ts @@ -0,0 +1,288 @@ +import assert from 'assert'; + +import { Parser } from '@json2csv/plainjs'; +import type { RequestHandler } from 'express'; +import gqlV2 from 'graphql-tag'; +import { get, last, pick, toNumber, trim } from 'lodash'; +import moment from 'moment'; + +import { amountAsString } from '../lib/formatting'; +import { graphqlRequest } from '../lib/graphql'; +import { parseToBooleanDefaultTrue, splitEnums } from '../lib/utils'; +import { logger } from '../logger'; + +function json2csv(data, opts) { + const parser = new Parser(opts); + return parser.parse(data); +} + +export const hostedCollectivesQuery = gqlV2` + query HostedCollectives( + $hostSlug: String! + $limit: Int! + $offset: Int! + $sort: OrderByInput + $hostFeesStructure: HostFeeStructure + $searchTerm: String + $type: [AccountType] + $isApproved: Boolean + $isFrozen: Boolean + $isUnhosted: Boolean + $balance: AmountRangeInput + $consolidatedBalance: AmountRangeInput + $currencies: [String] + ) { + host(slug: $hostSlug) { + id + legacyId + slug + name + currency + isHost + type + settings + hostFeePercent + hostedAccounts( + limit: $limit + offset: $offset + searchTerm: $searchTerm + hostFeesStructure: $hostFeesStructure + accountType: $type + orderBy: $sort + isApproved: $isApproved + isFrozen: $isFrozen + isUnhosted: $isUnhosted + balance: $balance + consolidatedBalance: $consolidatedBalance + currencies: $currencies + ) { + offset + limit + totalCount + nodes { + id + legacyId + name + legalName + slug + website + type + currency + imageUrl(height: 96) + isFrozen + isHost + tags + settings + createdAt + stats { + id + balance { + value + currency + } + totalAmountSpent { + value + currency + } + totalAmountReceived(net: true) { + value + currency + } + contributorsCount + } + policies { + id + COLLECTIVE_ADMINS_CAN_SEE_PAYOUT_METHODS + } + ... on AccountWithHost { + hostFeesStructure + hostFeePercent + approvedAt + hostAgreements { + totalCount + nodes { + id + title + attachment { + id + url + name + type + } + } + } + } + admins: members(role: [ADMIN]) { + totalCount + nodes { + id + account { + id + name + legalName + emails + } + } + } + ... on AccountWithParent { + parent { + id + slug + name + } + } + } + } + } + } +`; + +const csvMapping = { + name: 'name', + slug: 'slug', + type: 'type', + legalName: 'legalName', + description: 'description', + website: 'website', + currency: 'currency', + approvedAt: 'approvedAt', + balance: (account) => amountAsString(account.stats.balance), + hostFeePercent: 'hostFeePercent', + adminEmails: (account) => account.admins?.nodes.map((admin) => admin.account?.emails?.join(',')).join(','), + adminCount: (account) => account.admins?.totalCount, + firstContributionDate: (account) => account.stats.contributionsAmount?.firstRecordDate, + lastContributionDate: (account) => account.stats.contributionsAmount?.lastRecordDate, + totalAmountOfContributions: (account) => + account.stats.totalAmountReceived && amountAsString(account.stats.totalAmountReceived), + totalNumberOfContributions: (account) => account.stats.contributorsCount, + // Last freeze end + // First expense submit date + // Latest expense submit date + // Number of expenses all time +}; + +const applyMapping = (mapping, row) => { + const res = {}; + Object.keys(mapping).map((key) => { + const val = mapping[key]; + if (typeof val === 'function') { + return (res[key] = val(row)); + } else { + return (res[key] = get(row, val)); + } + }); + return res; +}; + +const hostedCollectives: RequestHandler<{ slug: string; format: 'csv' | 'json' }> = async (req, res) => { + if (!['HEAD', 'GET'].includes(req.method)) { + res.status(405).send({ error: { message: 'Method not allowed' } }); + return; + } + + try { + // Forward Api Key or Authorization header + const headers = {}; + const apiKey = req.get('Api-Key') || req.query.apiKey; + const personalToken = req.get('Personal-Token') || req.query.personalToken; + // Support Cookies for direct-download capability + const authorization = req.get('Authorization') || req.cookies?.authorization; + + if (authorization) { + headers['Authorization'] = authorization; + } else if (apiKey) { + headers['Api-Key'] = apiKey; + } else if (personalToken) { + headers['Personal-Token'] = personalToken; + } + + const hostSlug = req.params.slug; + assert(hostSlug, 'Please provide a slug'); + + const variables = { + hostSlug, + limit: req.method === 'HEAD' ? 0 : req.query.limit ? toNumber(req.query.limit) : 1000, + offset: req.query.offset ? toNumber(req.query.offset) : 0, + sort: req.query.sort, + hostFeesStructure: req.query.hostFeesStructure, + searchTerm: req.query.searchTerm, + type: splitEnums(req.query.type as string), + isApproved: req.query.isApproved ? parseToBooleanDefaultTrue(req.query.isApproved as string) : undefined, + isFrozen: req.query.isFrozen ? parseToBooleanDefaultTrue(req.query.isFrozen as string) : undefined, + isUnhosted: req.query.isUnhosted ? parseToBooleanDefaultTrue(req.query.isUnhosted as string) : undefined, + currencies: splitEnums(req.query.currencies as string), + }; + + const fields = (get(req.query, 'fields', '') as string) + .split(',') + .map(trim) + .filter((v) => !!v); + + let result = await graphqlRequest(hostedCollectivesQuery, variables, { version: 'v2', headers }); + + switch (req.params.format) { + case 'csv': { + // don't cache at CDN level as the result may contain private information + if (authorization || apiKey || personalToken) { + res.append('Cache-Control', 'no-cache'); + } + if (req.params.format === 'csv') { + res.append('Content-Type', `text/csv;charset=utf-8`); + } else { + res.append('Content-Type', `text/plain;charset=utf-8`); + } + const filename = `hosted-collectives-${hostSlug}-${moment.utc().format('YYYYMMDD')}.${req.params.format}`; + res.append('Content-Disposition', `attachment; filename="${filename}"`); + res.append('Access-Control-Expose-Headers', 'X-Exported-Rows'); + res.append('X-Exported-Rows', result.host.hostedAccounts.totalCount); + if (req.method === 'HEAD') { + res.status(200).end(); + return; + } + + if (result.host.hostedAccounts.totalCount === 0) { + res.status(404).send('No transaction found.'); + break; + } + + const mapping = pick(csvMapping, fields); + const mappedTransactions = result.host.hostedAccounts.nodes.map((t) => applyMapping(mapping, t)); + res.write(json2csv(mappedTransactions, null)); + res.write(`\n`); + + if (result.host.hostedAccounts.totalCount > result.host.hostedAccounts.limit) { + do { + variables.offset += result.host.hostedAccounts.limit; + result = await graphqlRequest(hostedCollectivesQuery, variables, { version: 'v2', headers }); + const mappedTransactions = result.host.hostedAccounts.nodes.map((t) => applyMapping(mapping, t)); + res.write(json2csv(mappedTransactions, { header: false })); + res.write(`\n`); + } while ( + result.host.hostedAccounts.totalCount > + result.host.hostedAccounts.limit + result.host.hostedAccounts.offset + ); + } + + res.end(); + break; + } + default: + res.send(result.host.hostedAccounts); + break; + } + } catch (err) { + if (err.message.match(/not found/i)) { + res.status(404).send(err.message); + } else { + logger.error(`Error while fetching hosted collectives: ${err.message}`); + logger.debug(err); + if (res.headersSent) { + res.end(`\nError while fetching hosted collectives.`); + } else { + res.status(400).send(`Error while fetching hosted collectives.`); + } + } + } +}; + +export default hostedCollectives; diff --git a/src/server/controllers/index.js b/src/server/controllers/index.js index ba2e6b3ca..0b08fb0a0 100644 --- a/src/server/controllers/index.js +++ b/src/server/controllers/index.js @@ -3,6 +3,7 @@ import accountOrders from './account-orders'; import accountTransactions from './account-transactions'; import * as collectives from './collectives'; import * as events from './events'; +import hostedCollectives from './hosted-collectives'; import * as members from './members'; import * as transactions from './transactions'; @@ -14,4 +15,5 @@ export default { accountContributors, accountOrders, accountTransactions, + hostedCollectives, }; diff --git a/src/server/lib/formatting.ts b/src/server/lib/formatting.ts new file mode 100644 index 000000000..b24be7207 --- /dev/null +++ b/src/server/lib/formatting.ts @@ -0,0 +1,19 @@ +export const amountAsString = (amount: { currency: string; value: number }) => { + const amountAsString = new Intl.NumberFormat('en-US', { style: 'currency', currency: amount.currency }).format( + amount.value, + ); + + return `${amountAsString} ${amount.currency}`; +}; + +export const accountNameAndLegalName = (account: { name?: string; legalName?: string }) => { + const legalName = account?.legalName; + const name = account?.name; + if (!legalName && !name) { + return ''; + } else if (legalName && name && legalName !== name) { + return `${legalName} (${name})`; + } else { + return legalName || name; + } +}; diff --git a/src/server/lib/utils.js b/src/server/lib/utils.ts similarity index 81% rename from src/server/lib/utils.js rename to src/server/lib/utils.ts index 105e1365c..e00364b7a 100644 --- a/src/server/lib/utils.js +++ b/src/server/lib/utils.ts @@ -1,10 +1,10 @@ -import { isNaN } from 'lodash'; +import { isNaN, toUpper, trim } from 'lodash'; export const getBaseApiUrl = () => { return process.env.API_URL; }; -export const getGraphqlUrl = ({ apiKey, version } = {}) => { +export const getGraphqlUrl = ({ apiKey, version }: { apiKey?: string; version?: string } = {}) => { if (apiKey) { return `${getBaseApiUrl()}/graphql/${version || 'v1'}?apiKey=${apiKey}`; } else { @@ -72,7 +72,7 @@ export function idOrUuid(req, res, next, idOrUuid) { .catch(next); } -export const parseToBooleanDefaultFalse = (value) => { +export const parseToBooleanDefaultFalse = (value: null | undefined | string | boolean) => { if (value === null || value === undefined || value === '') { return false; } @@ -80,10 +80,14 @@ export const parseToBooleanDefaultFalse = (value) => { return ['on', 'enabled', '1', 'true', 'yes', 1].includes(string); }; -export const parseToBooleanDefaultTrue = (value) => { +export const parseToBooleanDefaultTrue = (value: null | undefined | string | boolean) => { if (value === null || value === undefined || value === '') { return true; } const string = value.toString().trim().toLowerCase(); return !['off', 'disabled', '0', 'false', 'no', 0].includes(string); }; + +export const splitIds = (str?: string) => str?.split(',').map(trim) || []; + +export const splitEnums = (str?: string) => splitIds(str).map(toUpper); diff --git a/src/server/routes.ts b/src/server/routes.ts index fccf07023..bfc79c33e 100644 --- a/src/server/routes.ts +++ b/src/server/routes.ts @@ -71,4 +71,6 @@ export const loadRoutes = (app: Express) => { ); app.get('/v2/:slug/contributors.:format(json|csv)', controllers.accountContributors); + + app.all('/v2/:slug/hosted-collectives.:format(json|csv)', controllers.hostedCollectives); };