diff --git a/docs/transactions.md b/docs/transactions.md index ad24294f..97283d0e 100644 --- a/docs/transactions.md +++ b/docs/transactions.md @@ -48,32 +48,32 @@ The URL should be: https://opencollective.com/{slug}/admin/for-developers ## Fields -| Name | GraphQL v2 | Description | Included? | -| -------------------- | -------------------------------- | --------------------------------------------------------- | ------------------------------- | +| Name | GraphQL v2 | Description | Included? | +| -------------------- | -------------------------------- | --------------------------------------------------------- | ------------------------------------------- | | date | createdAt | UTC date (ISO 8601) | -| datetime | createdAt | UTC date and time with a second precision (ISO 8601) | Yes | +| datetime | createdAt | UTC date and time with a second precision (ISO 8601) | Yes | | id | id | unique identifier for the transaction | -| shortId | id | first 8 characters of the `id` | Yes | +| shortId | id | first 8 characters of the `id` | Yes | | legacyId | legacyId | auto-increment identifier for the transaction | | group | group | group identifier of the transaction | -| shortGroup | group | first 8 characters of the `group` | Yes | -| description | description | human readable description of the transaction | Yes | -| type | type | `CREDIT` or `DEBIT` | Yes | -| kind | kind | `CONTRIBUTION`, `ADDED_FUNDS`, `EXPENSE`, etc ... | Yes | -| isRefund | isRefund | `REFUND` if it's a refund, empty if not | Yes | -| isRefunded | isRefunded | `REFUNDED` if it was refunded, empty if not | Yes | -| displayAmount | amount | user facing amount and currency as a string | Yes | -| amount | amountInHostCurrency.value | accounted amount | Yes | -| paymentProcessorFee | paymentProcessorFee.value | accounted payment processor fee | Yes | -| hostFee | hostFee.value | accounted host fee | Yes (if flattenHostFee is used) | -| netAmount | netAmountInHostCurrency.value | accounted amount after payment processor fees | Yes | -| balance | balanceInHostCurrency.value | balance of the account after the transaction | Yes (not for hostTransactions) | -| currency | netAmountInHostCurrency.currency | accounted currency | Yes | -| accountSlug | account.slug | slug of the account on the main side of the transaction | Yes | -| accountName | account.name | name of the account on the main side of the transaction | Yes | +| shortGroup | group | first 8 characters of the `group` | Yes | +| description | description | human readable description of the transaction | Yes | +| type | type | `CREDIT` or `DEBIT` | Yes | +| kind | kind | `CONTRIBUTION`, `ADDED_FUNDS`, `EXPENSE`, etc ... | Yes | +| isRefund | isRefund | `REFUND` if it's a refund, empty if not | Yes | +| isRefunded | isRefunded | `REFUNDED` if it was refunded, empty if not | Yes | +| displayAmount | amount | user facing amount and currency as a string | Yes | +| amount | amountInHostCurrency.value | accounted amount | Yes | +| paymentProcessorFee | paymentProcessorFee.value | accounted payment processor fee | Yes (if flattenPaymentProcessorFee is used) | +| hostFee | hostFee.value | accounted host fee | Yes (if flattenHostFee is used) | +| netAmount | netAmountInHostCurrency.value | accounted amount after payment processor fees | Yes | +| balance | balanceInHostCurrency.value | balance of the account after the transaction | Yes (not for hostTransactions) | +| currency | netAmountInHostCurrency.currency | accounted currency | Yes | +| accountSlug | account.slug | slug of the account on the main side of the transaction | Yes | +| accountName | account.name | name of the account on the main side of the transaction | Yes | | accountType | account.type | type of the account on the main side of the transaction | -| oppositeAccountSlug | oppositeAccount.slug | slug of the account on the opposite side | Yes | -| oppositeAccountName | oppositeAccount.name | name of the account on the opposite side | Yes | +| oppositeAccountSlug | oppositeAccount.slug | slug of the account on the opposite side | Yes | +| oppositeAccountName | oppositeAccount.name | name of the account on the opposite side | Yes | | oppositeAccountType | oppositeAccount.type | type of the account on the opposite side | | hostSlug | host.slug | slug of the host accounting the transaction | | oppositeAccountName | oppositeAccount.name | name of the host accounting the transaction | @@ -81,12 +81,12 @@ The URL should be: https://opencollective.com/{slug}/admin/for-developers | orderId | order.id | unique identifier for the order | | orderLegacyId | order.legacyId | auto-increment identifier for the order | | orderFrequency | order.frequency | frequency of the order (`ONETIME`, `MONTHLY` or `YEARLY`) | -| paymentMethodService | paymentMethod.service | service of the payment method ( `STRIPE`, etc ...) | Yes | -| paymentMethodType | paymentMethod.type | type of the payment method (`CREDITCARD`, etc ...) | Yes | +| paymentMethodService | paymentMethod.service | service of the payment method ( `STRIPE`, etc ...) | Yes | +| paymentMethodType | paymentMethod.type | type of the payment method (`CREDITCARD`, etc ...) | Yes | | expenseId | expense.id | unique identifier for the expense | | expenseLegacyId | expense.legacyId | auto-increment identifier for the expense | -| expenseType | expense.type | type of the expense (`INVOICE`, `RECEIPT`, etc ...) | Yes | -| payoutMethodType | payoutMethod.type | type of the payout method (`PAYPAL`, etc ...) | Yes | +| expenseType | expense.type | type of the expense (`INVOICE`, `RECEIPT`, etc ...) | Yes | +| payoutMethodType | payoutMethod.type | type of the payout method (`PAYPAL`, etc ...) | Yes | ### Adding fields diff --git a/src/graphql/schema.graphql b/src/graphql/schema.graphql index 14cb2997..215bc044 100644 --- a/src/graphql/schema.graphql +++ b/src/graphql/schema.graphql @@ -1,35 +1,3 @@ -""" -Input type for Application -""" -input ApplicationInput { - type: ApplicationType! - name: String - description: String - callbackUrl: String -} - -""" -All application types -""" -enum ApplicationType { - API_KEY - OAUTH -} - -""" -Application model -""" -type Application { - id: Int - type: ApplicationType - name: String - description: String - apiKey: String - clientId: String - clientSecret: String - callbackUrl: String -} - """ Collective interface """ @@ -98,8 +66,8 @@ interface CollectiveInterface { List of all collectives that are related to this collective with their membership relationship. Can filter by role (BACKER/MEMBER/ADMIN/HOST/FOLLOWER) """ members( - limit: Int - offset: Int + limit: Int = 100 + offset: Int = 0 """ Type of User: USER/ORGANIZATION @@ -180,8 +148,6 @@ interface CollectiveInterface { repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") website: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - updates(limit: Int, offset: Int, onlyPublishedUpdates: Boolean): [UpdateType] - @deprecated(reason: "2022-09-09: Updates moved to GQLV2") events( limit: Int offset: Int @@ -269,7 +235,6 @@ type UserDetails { id: Int CollectiveId: Int collective: CollectiveInterface - username: String @deprecated(reason: "2022-01-13: Not used anymore. Will be ignored") name: String @deprecated(reason: "2022-06-02: Please use collective.name") image: String email: String @@ -287,7 +252,7 @@ type UserDetails { Returns true if user account is limited (user can't use any feature) """ isLimited: Boolean - hasSeenLatestChangelogEntry: Boolean! + hasSeenLatestChangelogEntry: Boolean hasTwoFactorAuth: Boolean """ @@ -547,11 +512,6 @@ type Contributor { """ isBacker: Boolean! - """ - True if the contributor is a fundraiser - """ - isFundraiser: Boolean @deprecated(reason: "2022-09-12: This role does not exist anymore") - """ A list of tier ids that this contributors is a member of. A null value indicates that a membership without tier. """ @@ -804,15 +764,10 @@ type LocationType { id: String """ - A short name for the location (eg. Google Headquarters) + A short name for the location (eg. Open Collective Headquarters) """ name: String - """ - Postal address without country (eg. 12 opensource avenue, 7500 Paris) - """ - address: String - """ Two letters country code (eg. FR, BE...etc) """ @@ -828,6 +783,11 @@ type LocationType { """ long: Float + """ + Postal address without country (eg. 12 opensource avenue, 7500 Paris) + """ + address: String + """ Structured JSON address """ @@ -1021,6 +981,7 @@ enum SocialLinkType { GHOST PEERTUBE TIKTOK + TWITCH } """ @@ -1033,61 +994,6 @@ A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `dat """ scalar DateTime -""" -This represents an Update -""" -type UpdateType { - id: Int - views: Int - slug: String - image: String - isPrivate: Boolean - isChangelog: Boolean! - notificationAudience: UpdateAudienceTypeEnum - makePublicOn: IsoDateString - - """ - Indicates whether or not the user is allowed to see the content of this update - """ - userCanSeeUpdate: Boolean - title: String - createdAt: DateString - updatedAt: DateString - publishedAt: DateString - summary: String - html: String - tags: [String] - createdByUser: UserDetails - fromCollective: CollectiveInterface - collective: CollectiveInterface - tier: Tier -} - -""" -Defines targets for an update -""" -enum UpdateAudienceTypeEnum { - """ - Will be sent to collective admins and financial contributors - """ - ALL - - """ - Will be sent to collective admins - """ - COLLECTIVE_ADMINS - - """ - Will be sent to financial contributors - """ - FINANCIAL_CONTRIBUTORS - - """ - Will be sent to no one - """ - NO_ONE -} - """ Properties by which PaymenMethods can be ordered """ @@ -1222,10 +1128,14 @@ type PlanType { } type Policies { + id: String EXPENSE_AUTHOR_CANNOT_APPROVE: EXPENSE_AUTHOR_CANNOT_APPROVE REQUIRE_2FA_FOR_ADMINS: Boolean + COLLECTIVE_ADMINS_CAN_REFUND: Boolean COLLECTIVE_MINIMUM_ADMINS: COLLECTIVE_MINIMUM_ADMINS MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL: MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL + EXPENSE_CATEGORIZATION: EXPENSE_CATEGORIZATION + EXPENSE_PUBLIC_VENDORS: Boolean } type EXPENSE_AUTHOR_CANNOT_APPROVE { @@ -1994,6 +1904,11 @@ enum CurrencyExchangeRateSourceType { WISE } +type EXPENSE_CATEGORIZATION { + requiredForExpenseSubmitters: Boolean + requiredForCollectiveAdmins: Boolean +} + """ The results from searching for collectives with pagination info """ @@ -2082,7 +1997,6 @@ type CollectiveStatsType { """ totalNetAmountReceived: Int yearlyBudget: Int - yearlyBudgetManaged: Int activeRecurringContributions: JSON } @@ -2299,7 +2213,15 @@ type Collective implements CollectiveInterface { """ Get all the members of this collective (admins, members, backers, followers) """ - members(limit: Int, offset: Int, type: String, role: String, TierId: Int, tierSlug: String, roles: [String]): [Member] + members( + limit: Int = 100 + offset: Int = 0 + type: String + role: String + TierId: Int + tierSlug: String + roles: [String] + ): [Member] """ Get all the collective this collective is a member of (as a member, backer, follower, etc.) @@ -2373,8 +2295,6 @@ type Collective implements CollectiveInterface { repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") website: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - updates(limit: Int, offset: Int, onlyPublishedUpdates: Boolean): [UpdateType] - @deprecated(reason: "2022-09-09: Updates moved to GQLV2") events( limit: Int offset: Int @@ -2557,7 +2477,15 @@ type Event implements CollectiveInterface { """ Get all the members of this collective (admins, members, backers, followers) """ - members(limit: Int, offset: Int, type: String, role: String, TierId: Int, tierSlug: String, roles: [String]): [Member] + members( + limit: Int = 100 + offset: Int = 0 + type: String + role: String + TierId: Int + tierSlug: String + roles: [String] + ): [Member] """ Get all the collective this collective is a member of (as a member, backer, follower, etc.) @@ -2631,8 +2559,6 @@ type Event implements CollectiveInterface { repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") website: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - updates(limit: Int, offset: Int, onlyPublishedUpdates: Boolean): [UpdateType] - @deprecated(reason: "2022-09-09: Updates moved to GQLV2") events( limit: Int offset: Int @@ -2815,7 +2741,15 @@ type Fund implements CollectiveInterface { """ Get all the members of this collective (admins, members, backers, followers) """ - members(limit: Int, offset: Int, type: String, role: String, TierId: Int, tierSlug: String, roles: [String]): [Member] + members( + limit: Int = 100 + offset: Int = 0 + type: String + role: String + TierId: Int + tierSlug: String + roles: [String] + ): [Member] """ Get all the collective this collective is a member of (as a member, backer, follower, etc.) @@ -2889,8 +2823,6 @@ type Fund implements CollectiveInterface { repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") website: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - updates(limit: Int, offset: Int, onlyPublishedUpdates: Boolean): [UpdateType] - @deprecated(reason: "2022-09-09: Updates moved to GQLV2") events( limit: Int offset: Int @@ -3073,7 +3005,15 @@ type Organization implements CollectiveInterface { """ Get all the members of this collective (admins, members, backers, followers) """ - members(limit: Int, offset: Int, type: String, role: String, TierId: Int, tierSlug: String, roles: [String]): [Member] + members( + limit: Int = 100 + offset: Int = 0 + type: String + role: String + TierId: Int + tierSlug: String + roles: [String] + ): [Member] """ Get all the collective this collective is a member of (as a member, backer, follower, etc.) @@ -3147,8 +3087,6 @@ type Organization implements CollectiveInterface { repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") website: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - updates(limit: Int, offset: Int, onlyPublishedUpdates: Boolean): [UpdateType] - @deprecated(reason: "2022-09-09: Updates moved to GQLV2") events( limit: Int offset: Int @@ -3212,7 +3150,6 @@ type Organization implements CollectiveInterface { contributionPolicy: String categories: [String]! policies: Policies! - email: String @deprecated(reason: "2022-07-18: This field is deprecated and will return null") } """ @@ -3332,7 +3269,15 @@ type Project implements CollectiveInterface { """ Get all the members of this collective (admins, members, backers, followers) """ - members(limit: Int, offset: Int, type: String, role: String, TierId: Int, tierSlug: String, roles: [String]): [Member] + members( + limit: Int = 100 + offset: Int = 0 + type: String + role: String + TierId: Int + tierSlug: String + roles: [String] + ): [Member] """ Get all the collective this collective is a member of (as a member, backer, follower, etc.) @@ -3406,8 +3351,6 @@ type Project implements CollectiveInterface { repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") website: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - updates(limit: Int, offset: Int, onlyPublishedUpdates: Boolean): [UpdateType] - @deprecated(reason: "2022-09-09: Updates moved to GQLV2") events( limit: Int offset: Int @@ -3480,6 +3423,7 @@ type Expense implements Transaction { id: Int idV2: String refundTransaction: Transaction + isRefund: Boolean uuid: String type: String kind: String @@ -3510,7 +3454,12 @@ type Expense implements Transaction { """ Fee kept by the payment processor in the lowest unit of the currency of the host (ie. in cents) """ - paymentProcessorFeeInHostCurrency: Int + paymentProcessorFeeInHostCurrency( + """ + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. + """ + fetchPaymentProcessorFee: Boolean = false + ): Int """ The amount paid in tax (for example VAT) for this transaction @@ -3530,6 +3479,11 @@ type Expense implements Transaction { 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 ): Int amountInHostCurrency: Int host: User @@ -3565,7 +3519,7 @@ type TaxInfo { percentage: Int! @deprecated(reason: "Please use `rate` instead") """ - Percentage applied, between 0-100 + Percentage applied, between 0-1 """ rate: Float! @@ -3607,9 +3561,14 @@ interface Transaction { """ netAmountInCollectiveCurrency( """ - Fetch HOST_FEE transaction and integrate in calculation for retro-compatiblity. + Fetch HOST_FEE transaction and integrate in calculation for retro-compatibility. """ fetchHostFee: Boolean = false + + """ + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. + """ + fetchPaymentProcessorFee: Boolean = false ): Int amountInHostCurrency: Int @@ -3618,12 +3577,17 @@ interface Transaction { """ hostFeeInHostCurrency( """ - Fetch HOST_FEE transaction for retro-compatiblity. + Fetch HOST_FEE transaction for retro-compatibility. """ fetchHostFee: Boolean = false ): Int platformFeeInHostCurrency: Int - paymentProcessorFeeInHostCurrency: Int + paymentProcessorFeeInHostCurrency( + """ + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. + """ + fetchPaymentProcessorFee: Boolean = false + ): Int taxAmount: Int taxInfo: TaxInfo createdByUser: UserDetails @@ -3638,6 +3602,7 @@ interface Transaction { createdAt: DateString updatedAt: DateString refundTransaction: Transaction + isRefund: Boolean invoiceTemplate: String } @@ -3648,6 +3613,7 @@ type Order implements Transaction { id: Int idV2: String refundTransaction: Transaction + isRefund: Boolean uuid: String type: String kind: String @@ -3678,7 +3644,12 @@ type Order implements Transaction { """ Fee kept by the payment processor in the lowest unit of the currency of the host (ie. in cents) """ - paymentProcessorFeeInHostCurrency: Int + paymentProcessorFeeInHostCurrency( + """ + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. + """ + fetchPaymentProcessorFee: Boolean = false + ): Int """ The amount paid in tax (for example VAT) for this transaction @@ -3698,6 +3669,11 @@ type Order implements Transaction { 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 ): Int amountInHostCurrency: Int host: User @@ -3832,7 +3808,15 @@ type User implements CollectiveInterface { """ Get all the members of this collective (admins, members, backers, followers) """ - members(limit: Int, offset: Int, type: String, role: String, TierId: Int, tierSlug: String, roles: [String]): [Member] + members( + limit: Int = 100 + offset: Int = 0 + type: String + role: String + TierId: Int + tierSlug: String + roles: [String] + ): [Member] """ Get all the collective this collective is a member of (as a member, backer, follower, etc.) @@ -3906,8 +3890,6 @@ type User implements CollectiveInterface { repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") website: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - updates(limit: Int, offset: Int, onlyPublishedUpdates: Boolean): [UpdateType] - @deprecated(reason: "2022-09-09: Updates moved to GQLV2") events( limit: Int offset: Int @@ -3972,7 +3954,6 @@ type User implements CollectiveInterface { categories: [String]! policies: Policies! email: String - applications: [Application] } """ @@ -4092,7 +4073,15 @@ type Vendor implements CollectiveInterface { """ Get all the members of this collective (admins, members, backers, followers) """ - members(limit: Int, offset: Int, type: String, role: String, TierId: Int, tierSlug: String, roles: [String]): [Member] + members( + limit: Int = 100 + offset: Int = 0 + type: String + role: String + TierId: Int + tierSlug: String + roles: [String] + ): [Member] """ Get all the collective this collective is a member of (as a member, backer, follower, etc.) @@ -4166,8 +4155,6 @@ type Vendor implements CollectiveInterface { repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") website: String @deprecated(reason: "2023-01-16: Please use socialLinks") socialLinks: [SocialLink!]! - updates(limit: Int, offset: Int, onlyPublishedUpdates: Boolean): [UpdateType] - @deprecated(reason: "2022-09-09: Updates moved to GQLV2") events( limit: Int offset: Int @@ -4246,15 +4233,9 @@ type Query { """ throwIfMissing: Boolean = true ): CollectiveInterface - Tier(id: Int!): Tier + Tier(id: Int!): Tier @deprecated(reason: "2023-05-04: Please use GraphQL V2") LoggedInUser: UserDetails allInvoices(fromCollectiveSlug: String!): [InvoiceType] - TransactionInvoice( - """ - Slug of the transaction. - """ - transactionUuid: String! - ): InvoiceType "\n Given a collective, returns all its transactions:\n - Debit transactions made by collective without using a gift card\n - Debit transactions made using a gift card from collective\n - Credit transactions made to collective\n " allTransactions( @@ -4271,74 +4252,9 @@ type Query { If false, only the transactions not linked to an expense (orders/refunds) will be returned """ includeExpenseTransactions: Boolean - fetchDataFromLedger: Boolean - @deprecated( - reason: "2023-01-11: Removed support for this in 2019 (https://github.com/opencollective/opencollective-api/pull/2384)" - ) includeHostedCollectivesTransactions: Boolean ): [Transaction] - Application(id: Int): Application @deprecated(reason: "2023-01-03: Please use PersonalToken from GQLV2") Transaction(id: Int, uuid: String): Transaction - allCollectives( - """ - Fetch collectives with a list of collective slug - """ - slugs: [String] - - """ - Fetch all collectives that match at least one of the tags - """ - tags: [String] - - """ - COLLECTIVE, USER, ORGANIZATION, EVENT - """ - type: TypeOfCollective - - """ - Fetch all collectives hosted by HostCollectiveId - """ - HostCollectiveId: Int - - """ - Fetch all collectives hosted by hostCollectiveSlug - """ - hostCollectiveSlug: String - - """ - Only return active collectives - """ - isActive: Boolean - - """ - Only return pledged or non-pledged collectives - """ - isPledged: Boolean - - """ - Fetch all collectives that `memberOfCollectiveSlug` is a member of - """ - memberOfCollectiveSlug: String - - """ - Filter collectives with this minimum number of backers - """ - minBackerCount: Int - - """ - Only fetch the collectives where `memberOfCollectiveSlug` has the specified role - """ - role: String - - """ - Fetch all collectives that are a child of `ParentCollectiveId`. Used for "SuperCollectives" - """ - ParentCollectiveId: Int - orderBy: CollectiveOrderField = name - orderDirection: OrderDirection = ASC - limit: Int = 10 - offset: Int = 0 - ): CollectiveSearchResults """ Returns all public hosts that are open for applications @@ -4360,7 +4276,6 @@ type Query { onlyOpenHosts: Boolean = true minNbCollectivesHosted: Int! = 0 ): CollectiveSearchResults - allCollectiveTags: [String] allMembers( CollectiveId: Int collectiveSlug: String @@ -4379,24 +4294,6 @@ type Query { limit: Int offset: Int ): [Member] - - """ - [AUTHENTICATED] Returns the pending invitations - """ - memberInvitations(CollectiveId: Int, MemberCollectiveId: Int): [MemberInvitation] - allEvents( - """ - Slug of the parent collective - """ - slug: String - limit: Int - offset: Int - - """ - If null, returns all events, if false returns only events that are not archived, if true only returns events that have been archived - """ - isArchived: Boolean - ): [CollectiveInterface] PaymentMethod(id: Int, code: String): PaymentMethodType """ @@ -4433,6 +4330,11 @@ type Query { """ includeArchived: Boolean + """ + Included vendors for specific host ID + """ + includeVendorsForHostId: Int + """ Whether to skip recent accounts (48h) """ @@ -4489,17 +4391,6 @@ type InvoiceType { transactions: [Transaction] } -enum TypeOfCollective { - COLLECTIVE - EVENT - ORGANIZATION - USER - BOT - PROJECT - FUND - VENDOR -} - """ Properties by which hosts can be ordered. """ @@ -4525,18 +4416,15 @@ enum HostCollectiveOrderFieldType { updatedAt } -""" -An invitation to join the members of a collective -""" -type MemberInvitation { - id: Int - createdAt: DateString - collective: CollectiveInterface - member: CollectiveInterface - role: String - description: String - tier: Tier - since: DateString +enum TypeOfCollective { + COLLECTIVE + EVENT + ORGANIZATION + USER + BOT + PROJECT + FUND + VENDOR } """ @@ -4630,11 +4518,6 @@ type Mutation { """ editPublicMessage(FromCollectiveId: Int!, CollectiveId: Int!, message: String): [Member] @deprecated(reason: "2021-01-27: Please use editPublicMessage from GQLV2") - createOrder(order: OrderInputType!): OrderType - @deprecated(reason: "2020-10-13: This mutation has been moved to GQLV2") - createApplication(application: ApplicationInput!): Application - @deprecated(reason: "2023-01-03: Please use createPersonalToken from GQLV2") - deleteApplication(id: Int!): Application @deprecated(reason: "2023-01-03: Please use deletePersonalToken from GQLV2") """ Update a payment method @@ -4758,7 +4641,6 @@ type Mutation { """ id: Int! ): NotificationType - backyourstackDispatchOrder(id: Int!): BackYourStackDispatchState """ Activate a collective as Host. @@ -4856,7 +4738,7 @@ Input type for Location """ input LocationInputType { """ - A short name for the location (eg. Google Headquarters) + A short name for the location (eg. Open Collective Headquarters) """ name: String @@ -4879,6 +4761,11 @@ input LocationInputType { Longitude """ long: Float + + """ + Structured JSON address + """ + structured: JSON } """ @@ -5029,7 +4916,6 @@ input UserInputType { name: String company: String image: String - username: String @deprecated(reason: "2022-01-13: Not used anymore. Will be ignored") description: String twitterHandle: String @deprecated(reason: "2023-01-16: Please use socialLinks") githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") @@ -5049,126 +4935,6 @@ input ConnectedAccountInputType { settings: JSON } -""" -Input type for OrderType -""" -input OrderInputType { - id: Int - quantity: Int = 1 - totalAmount: Int - hostFeePercent: Float - platformFeePercent: Float - platformFee: Int - isFeesOnTop: Boolean - currency: String - interval: String - description: String - publicMessage: String - privateMessage: String - paymentMethod: PaymentMethodInputType - user: UserInputType @deprecated(reason: "2020-10-13: This field is now ignored") - fromCollective: CollectiveAttributesInputType - collective: CollectiveAttributesInputType! - tier: TierInputType - customData: JSON - recaptchaToken: String - - """ - Use this when fromAccount is null to pass the guest info - """ - guestInfo: GuestInfoInput - - """ - The amount of taxes that were included in totalAmount - """ - taxAmount: Int = 0 - - """ - User country, to know which tax applies - """ - countryISO: String - - """ - User tax ID number - """ - taxIDNumber: String -} - -""" -Input type for PaymentMethod (paypal/stripe) -""" -input PaymentMethodInputType { - id: Int - uuid: String - token: String - service: String - - """ - creditcard, giftcard, prepaid, manual... - """ - type: String - customerId: String - data: JSON - name: String - primary: Boolean - monthlyLimitPerMember: Int - currency: String - save: Boolean -} - -""" -Input type for guest contributions -""" -input GuestInfoInput { - """ - Contributor's email - """ - email: String - - """ - Display name of the user - """ - name: String - - """ - Legal name of the user - """ - legalName: String - - """ - The unique guest token - """ - token: String - - """ - Captcha validation for creating an order - """ - captcha: CaptchaInput -} - -""" -Captcha related information -""" -input CaptchaInput { - """ - Captcha validation token - """ - token: String! - - """ - Catpcha provider - """ - provider: CaptchaProvider! -} - -""" -Implemented Captcha Providers -""" -enum CaptchaProvider { - HCAPTCHA - RECAPTCHA -} - """ Input for stripe credit card data """ @@ -5181,7 +4947,3 @@ input StripeCreditCardDataInputType { funding: String zip: String } - -type BackYourStackDispatchState { - dispatching: Boolean -} diff --git a/src/graphql/schemaV2.graphql b/src/graphql/schemaV2.graphql index 62b48de4..c37996c6 100644 --- a/src/graphql/schemaV2.graphql +++ b/src/graphql/schemaV2.graphql @@ -19,6 +19,11 @@ type Application { redirectUri: URL account: Account! oAuthAuthorization: OAuthAuthorization + + """ + Whether this application is allowed to directly use operations that would normally require 2FA + """ + preAuthorize2FA: Boolean! } """ @@ -66,6 +71,11 @@ type OAuthAuthorization { The attached scopes. """ scope: [OAuthScope] + + """ + Whether this OAuth token is allowed to directly use operations that would normally require 2FA + """ + preAuthorize2FA: Boolean! } """ @@ -197,6 +207,11 @@ 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 """ @@ -401,6 +416,7 @@ interface Account { The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! orders( """ @@ -464,7 +480,7 @@ interface Account { dateFrom: DateTime """ - Only return orders that were created after this date + Only return orders that were created before this date """ dateTo: DateTime @@ -484,6 +500,114 @@ interface Account { """ onlyActiveSubscriptions: Boolean ): OrderCollection! + expenses( + direction: ExpenseDirection + + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput + + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput + + """ + Return expenses only for this host + """ + host: AccountReferenceInput + + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput + + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter + + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] + + """ + 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 + + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime + + """ + Only return expenses that were created after this date + """ + dateTo: DateTime + + """ + The term to search + """ + searchTerm: String + + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false + + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -611,7 +735,8 @@ interface Account { virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -646,6 +771,22 @@ interface Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] } """ @@ -696,6 +837,7 @@ enum SocialLinkType { GHOST PEERTUBE TIKTOK + TWITCH } enum ImageFormat { @@ -775,11 +917,22 @@ type Tier { 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! @@ -799,6 +952,23 @@ type Tier { invoiceTemplate: String useStandalonePage: Boolean singleTicket: Boolean + requireAddress: Boolean! + + """ + Returns a list of all the contributors for this tier + """ + 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 } """ @@ -824,6 +994,11 @@ type Order { """ amount: Amount! + """ + Tax amount + """ + taxAmount: Amount + """ Total order amount, including all taxes and platform tip """ @@ -860,7 +1035,8 @@ type Order { platformTipAmount: Amount platformTipEligible: Boolean tags: [String]! - taxes: [OrderTax]! + 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. @@ -872,6 +1048,11 @@ type Order { """ permissions: OrderPermissions! + """ + The list of activities (ie. approved, edited, etc) for this Order ordered by date ascending + """ + activities: ActivityCollection! + """ Data related to the order """ @@ -906,6 +1087,22 @@ type Order { 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( + """ + 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 } """ @@ -967,12 +1164,22 @@ interface Transaction { 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 ): Amount! netAmountInHostCurrency( """ 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 ): Amount! taxAmount: Amount! @@ -987,7 +1194,12 @@ interface Transaction { """ fetchHostFee: Boolean = false ): Amount - paymentProcessorFee: Amount + paymentProcessorFee( + """ + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. + """ + fetchPaymentProcessorFee: Boolean = false + ): Amount host: Account account: Account oppositeAccount: Account @@ -1015,6 +1227,11 @@ interface Transaction { permissions: TransactionPermissions isOrderRejected: Boolean! refundTransaction: Transaction + + """ + The opposite transaction (CREDIT -> DEBIT, DEBIT -> CREDIT) + """ + oppositeTransaction: Transaction relatedTransactions( """ Filter by kind @@ -1079,7 +1296,7 @@ type TaxInfo { percentage: Int! @deprecated(reason: "Please use `rate` instead") """ - Percentage applied, between 0-100 + Percentage applied, between 0-1 """ rate: Float! @@ -1150,6 +1367,16 @@ type Expense { """ accountCurrencyFxRate: Float! @deprecated(reason: "2022-02-09: Please use amountV2") + """ + The accounting category attached to this expense + """ + accountingCategory: AccountingCategory + + """ + If available, this field will contain a breakdown of the expense values depending on who edited it + """ + valuesByRole: ExpenseValuesByRole + """ The time of creation """ @@ -1170,6 +1397,16 @@ type Expense { """ status: ExpenseStatus! + """ + The accounts who approved this expense + """ + approvedBy: [Account!]! + + """ + 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 """ @@ -1209,7 +1446,7 @@ type Expense { """ The account from where the expense was paid """ - host: Account + host: Host """ The payout method to use for this expense @@ -1269,7 +1506,21 @@ type Expense { requestedByAccount: Account quote: ExpenseQuote recurringExpense: RecurringExpense + + """ + [Admin only] Security checks for this expense. Only available to expenses under trusted hosts. + """ securityChecks: [SecurityCheck] + + """ + Custom data for this expense + """ + customData: JSON + + """ + The merchant ID for this expense + """ + merchantId: String } """ @@ -1298,1383 +1549,1665 @@ enum ExpenseCurrencySource { } """ -All supported currencies +Fields for an accounting category """ -enum Currency { - """ - US Dollar - """ - USD +type AccountingCategory { + id: String! """ - UAE Dirham + The code of the accounting category """ - AED + code: String! """ - Afghani + The technical name of the accounting category """ - AFN + name: String! """ - Lek + A friendly name for non-accountants (i.e. expense submitters and collective admins) """ - ALL + friendlyName: String """ - Armenian Dram + The account this category belongs to """ - AMD + account: Host! +} + +""" +This represents an Host account +""" +type Host implements Account & AccountWithContributions { + id: String! + legacyId: Int! """ - Netherlands Antillean Guilder + The slug identifying the account (ie: babel) """ - ANG + slug: String! + type: AccountType! """ - Kwanza + Public name """ - AOA + name: String """ - Argentine Peso + Private, legal name. Used for expense receipts, taxes, etc. Scope: "account". """ - ARS + 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 """ - Australian Dollar + Defines if the contributors wants to be incognito (name not displayed) """ - AUD + isIncognito: Boolean! + imageUrl(height: Int, format: ImageFormat): String """ - Aruban Florin + Returns whether this account has a custom image """ - AWG + hasImage: Boolean! + backgroundImageUrl(height: Int, format: ImageFormat): String """ - Azerbaijanian Manat + The time of creation """ - AZN + createdAt: DateTime + updatedAt: DateTime """ - Convertible Mark + Returns whether this account is archived """ - BAM + isArchived: Boolean! """ - Barbados Dollar + Whether this account is frozen """ - BBD + isFrozen: Boolean! """ - Taka + Returns whether the account accepts financial contributions. """ - BDT + isActive: Boolean """ - Bulgarian Lev + Returns whether the account is setup to Host collectives. """ - BGN + isHost: Boolean! """ - Burundi Franc + Returns true if the remote user is an admin of this account """ - BIF + isAdmin: Boolean! + parentAccount: Account @deprecated(reason: "2022-12-16: use parent on AccountWithParent instead") """ - Bermudian Dollar + Get all members (admins, members, backers, followers) """ - BMD + members( + limit: Int! = 100 + offset: Int! = 0 + role: [MemberRole] + accountType: [AccountType] - """ - Brunei Dollar - """ - BND + """ + Admin only. To filter on the email address of a member, useful to check if a member exists. + """ + email: EmailAddress - """ - Boliviano - """ - BOB + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: ASC } + includeInherited: Boolean = true + ): MemberCollection! """ - Brazilian Real + [AUTHENTICATED] Returns the pending invitations """ - BRL + memberInvitations( + """ + A reference to an account (usually Individual). Will return invitations sent to the account to join as a member + """ + memberAccount: AccountReferenceInput - """ - Bahamian Dollar - """ - BSD + """ + A reference to an account (usually Collective, Fund or Organization). Will return invitations sent to join this account as a member. + """ + account: AccountReferenceInput - """ - Pula - """ - BWP + """ + An array of Member roles to filter for + """ + role: [MemberRole] + ): [MemberInvitation] + memberOf( + limit: Int! = 150 + offset: Int! = 0 + role: [MemberRole] + accountType: [AccountType] + account: AccountReferenceInput - """ - Belarussian Ruble - """ - BYN + """ + Filter on whether the account is a host or not + """ + isHostAccount: Boolean - """ - Belize Dollar - """ - BZD + """ + Filter on (un)approved collectives + """ + isApproved: Boolean - """ - Canadian Dollar - """ - CAD + """ + Filter on archived collectives + """ + isArchived: Boolean - """ - Congolese Franc - """ - CDF + """ + Whether incognito profiles should be included in the result. Only works if requesting user is an admin of the account. + """ + includeIncognito: Boolean = true - """ - Swiss Franc - """ - CHF + """ + A term to search membership. Searches in collective tags, name, slug, members description and role. + """ + searchTerm: String - """ - Chilean Peso - """ - CLP + """ + Filters on the Host fees structure applied to this account + """ + hostFeesStructure: HostFeeStructure - """ - Yuan Renminbi - """ - CNY + """ + Order of the results + """ + orderBy: OrderByInput! = { field: CREATED_AT, direction: DESC } - """ - Colombian Peso - """ - COP + """ + Order the query by requested role order + """ + orderByRoles: Boolean + ): MemberOfCollection! """ - Costa Rican Colon + Returns the emails of the account. Individuals only have one, but organizations can have multiple emails. """ - CRC + emails: [EmailAddress!] + transactions( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 - """ - Cabo Verde Escudo - """ - CVE + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Czech Koruna - """ - CZK + """ + The transaction type (DEBIT or CREDIT) + """ + type: TransactionType - """ - Djibouti Franc - """ - DJF + """ + The payment method types. Can include `null` for transactions without a payment method + """ + paymentMethodType: [PaymentMethodType] - """ - Danish Krone - """ - DKK + """ + Reference of the account assigned to the other side of the transaction (CREDIT -> sender, DEBIT -> recipient). Avoid, favor account instead. + """ + fromAccount: AccountReferenceInput - """ - Dominican Peso - """ - DOP + """ + Reference of the host accounting the transaction + """ + host: AccountReferenceInput - """ - Algerian Dinar - """ - DZD + """ + NOT IMPLEMENTED. Only return transactions that match these tags. + """ + tags: [String] @deprecated(reason: "2020-08-09: Was never implemented.") - """ - Egyptian Pound - """ - EGP + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Ethiopian Birr - """ - ETB + """ + 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.") - """ - Euro - """ - EUR + """ + Only return transactions where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") - """ - Fiji Dollar - """ - FJD + """ + Only return transactions that were created after this date + """ + dateFrom: DateTime - """ - Falkland Islands Pound - """ - FKP + """ + Only return transactions that were created before this date + """ + dateTo: DateTime - """ - Pound Sterling - """ - GBP + """ + The term to search + """ + searchTerm: String - """ - Lari - """ - GEL - - """ - Gibraltar Pound - """ - GIP - - """ - Dalasi - """ - GMD - - """ - Guinea Franc - """ - GNF - - """ - Quetzal - """ - GTQ - - """ - Guyana Dollar - """ - GYD - - """ - Hong Kong Dollar - """ - HKD - - """ - Lempira - """ - HNL - - """ - Kuna - """ - HRK - - """ - Gourde - """ - HTG - - """ - Forint - """ - HUF - - """ - Rupiah - """ - IDR - - """ - New Israeli Sheqel - """ - ILS - - """ - Indian Rupee - """ - INR - - """ - Iceland Krona - """ - ISK - - """ - Jamaican Dollar - """ - JMD - - """ - Yen - """ - JPY - - """ - Kenyan Shilling - """ - KES - - """ - Som - """ - KGS + """ + Only return transactions with an Expense attached + """ + hasExpense: Boolean - """ - Riel - """ - KHR + """ + Only return transactions with an Order attached + """ + hasOrder: Boolean - """ - Comoro Franc - """ - KMF + """ + Whether to include regular transactions from the account (turn false if you only want Incognito or Gift Card transactions) + """ + includeRegularTransactions: Boolean! = true - """ - Won - """ - KRW + """ + 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 - """ - Cayman Islands Dollar - """ - KYD + """ + Whether to include transactions from children (Events and Projects) + """ + includeChildrenTransactions: Boolean! = false - """ - Tenge - """ - KZT + """ + Whether to include transactions from Gift Cards issued by the account. + """ + includeGiftCardTransactions: Boolean! = false - """ - Kip - """ - LAK + """ + Whether to include debt transactions + """ + includeDebts: Boolean! = false - """ - Lebanese Pound - """ - LBP + """ + To filter by transaction kind + """ + kind: [TransactionKind] - """ - Sri Lanka Rupee - """ - LKR + """ + The transactions group to filter by + """ + group: String + virtualCard: [VirtualCardReferenceInput] + ): TransactionCollection! + orders( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 - """ - Liberian Dollar - """ - LRD + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Loti - """ - LSL + """ + If account is a host, also include hosted accounts orders + """ + includeHostedAccounts: Boolean - """ - Moroccan Dirham - """ - MAD + """ + Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. + """ + paymentMethod: PaymentMethodReferenceInput - """ - Moldovan Leu - """ - MDL + """ + Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. + """ + includeIncognito: Boolean = false - """ - Malagasy Ariary - """ - MGA + """ + Account orders filter (INCOMING or OUTGOING) + """ + filter: AccountOrdersFilter - """ - Denar - """ - MKD + """ + Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) + """ + frequency: ContributionFrequency - """ - Kyat - """ - MMK + """ + Use this field to filter orders on their statuses + """ + status: [OrderStatus] - """ - Tugrik - """ - MNT + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Pataca - """ - MOP + """ + Only return orders where the amount is greater than or equal to this value (in cents) + """ + minAmount: Int - """ - Mauritius Rupee - """ - MUR + """ + Only return orders where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int - """ - Rufiyaa - """ - MVR + """ + Only return orders that were created after this date + """ + dateFrom: DateTime - """ - Kwacha - """ - MWK + """ + Only return orders that were created before this date + """ + dateTo: DateTime - """ - Mexican Peso - """ - MXN + """ + The term to search + """ + searchTerm: String + tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") - """ - Malaysian Ringgit - """ - MYR + """ + Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + """ + onlySubscriptions: Boolean - """ - Mozambique Metical - """ - MZN + """ + Same as onlySubscriptions, but returns only orders with active subscriptions + """ + onlyActiveSubscriptions: Boolean + ): OrderCollection! + expenses( + direction: ExpenseDirection - """ - Namibia Dollar - """ - NAD + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Naira - """ - NGN + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Cordoba Oro - """ - NIO + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput - """ - Norwegian Krone - """ - NOK + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput - """ - Nepalese Rupee - """ - NPR + """ + Return expenses only for this host + """ + host: AccountReferenceInput - """ - New Zealand Dollar - """ - NZD + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput - """ - Balboa - """ - PAB + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter - """ - Nuevo Sol - """ - PEN + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType - """ - Kina - """ - PGK + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") - """ - Philippine Peso - """ - PHP + """ + Only expenses that match these tags + """ + tag: [String] - """ - Pakistan Rupee - """ - PKR + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Zloty - """ - PLN + """ + Only return expenses where the amount is greater than or equal to this value (in cents) + """ + minAmount: Int - """ - Guarani - """ - PYG + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int - """ - Qatari Rial - """ - QAR + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType - """ - Romanian Leu - """ - RON + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime - """ - Serbian Dinar - """ - RSD + """ + Only return expenses that were created after this date + """ + dateTo: DateTime - """ - Russian Ruble - """ - RUB + """ + The term to search + """ + searchTerm: String - """ - Rwanda Franc - """ - RWF + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false - """ - Saudi Riyal - """ - SAR + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON - """ - Solomon Islands Dollar - """ - SBD + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean - """ - Seychelles Rupee - """ - SCR + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! + settings: JSON! + conversations( + limit: Int! = 15 + offset: Int! = 0 - """ - Swedish Krona - """ - SEK + """ + Only return conversations matching this tag + """ + tag: String + ): ConversationCollection! """ - Singapore Dollar + Returns conversation's tags for collective sorted by popularity """ - SGD + conversationsTags(limit: Int! = 30): [TagStat] """ - Saint Helena Pound + Returns expense tags for collective sorted by popularity """ - SHP + expensesTags(limit: Int! = 30): [TagStat] """ - Leone + The list of expense types supported by this account """ - SLL + supportedExpenseTypes: [ExpenseType!]! + transferwise: TransferWise """ - Somali Shilling + The list of payout methods that this collective can use to get paid. In most cases, admin only and scope: "expenses". """ - SOS + payoutMethods: [PayoutMethod] """ - Surinam Dollar + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ - SRD + paymentMethods( + type: [PaymentMethodType] + enumType: [PaymentMethodType] @deprecated(reason: "2021-08-20: use type instead from now") + service: [PaymentMethodService] - """ - Lilangeni - """ - SZL + """ + Whether to include expired payment methods. Payment methods expired since more than 6 months will never be returned. + """ + includeExpired: Boolean + ): [PaymentMethod] """ - Baht + The list of payment methods for this account that are pending a client confirmation (3D Secure / SCA) """ - THB + paymentMethodsWithPendingConfirmation: [PaymentMethod] """ - Somoni + The list of connected accounts (Stripe, Twitter, etc ...). Admin only. Scope: "connectedAccounts". """ - TJS + connectedAccounts: [ConnectedAccount] """ - Pa’anga + The list of applications created by this account. Admin only. Scope: "applications". """ - TOP + oAuthApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Turkish Lira - """ - TRY + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): OAuthApplicationCollection """ - Trinidad and Tobago Dollar + The address associated to this account. This field is always public for collectives and events. """ - TTD + location: Location + categories: [String]! + stats: AccountStats """ - New Taiwan Dollar + Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". """ - TWD + updates( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 - """ - Tanzanian Shilling - """ - TZS + """ + The offset to use to fetch + """ + offset: Int! = 0 - """ - Hryvnia - """ - UAH + """ + Only return published updates. + """ + onlyPublishedUpdates: Boolean = false + onlyChangelogUpdates: Boolean + orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + searchTerm: String + ): UpdateCollection! """ - Uganda Shilling + Describes the features enabled and available for this account """ - UGX + features: CollectiveFeatures! """ - Peso Uruguayo + Virtual Cards attached to the account. Admin only. Scope: "virtualCards". """ - UYU + virtualCards( + limit: Int! = 100 + offset: Int! = 0 + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] + merchantAccount: AccountReferenceInput = null - """ - Uzbekistan Sum - """ - UZS + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime = null - """ - Dong - """ - VND + """ + Only return expenses that were created before this date + """ + dateTo: DateTime = null + orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } + ): VirtualCardCollection """ - Vatu + Virtual Cards Merchants used by the account. Admin only. Scope: "virtualCards". """ - VUV + virtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection + childrenAccounts(limit: Int! = 100, offset: Int! = 0, accountType: [AccountType]): AccountCollection! """ - Tala + Policies for the account. To see non-public policies you need to be admin and have the scope: "account". """ - WST + policies: Policies! """ - CFA Franc BEAC + List of activities that the logged-in user is subscribed for this collective """ - XAF + activitySubscriptions(channel: ActivityChannel): [ActivitySubscription] """ - East Caribbean Dollar + Logged-in user permissions on an account """ - XCD + permissions: AccountPermissions! + feed( + """ + Only returns activities before this date + """ + dateTo: DateTime - """ - CFA Franc BCEAO - """ - XOF + """ + Number of activities to retrieve + """ + limit: Int + + """ + The classes of activity types to filter for + """ + classes: [ActivityClassType] + ): [Activity] + 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! """ - CFP Franc + Number of unique financial contributors. """ - XPF + 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! """ - Yemeni Rial + All the persons and entities that contribute to this account """ - YER + 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! """ - Rand + How much platform fees are charged for this account """ - ZAR + platformFeePercent: Float! """ - Zambian Kwacha + Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account """ - ZMW -} + platformContributionAvailable: Boolean! + contributionPolicy: String -""" -All supported expense types -""" -enum ExpenseType { """ - Invoice: Charge for your time or get paid in advance. + List of accounting categories for this host """ - INVOICE + accountingCategories: AccountingCategoryCollection! + hostFeePercent: Float + totalHostedCollectives: Int @deprecated(reason: "2023-03-20: Renamed to totalHostedAccounts") + totalHostedAccounts: Int + isOpenToApplications: Boolean + termsUrl: URL + plan: HostPlan! + 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! """ - Receipt: Get paid back for a purchase already made. + The list of payment methods (Stripe, Paypal, manual bank transfer, etc ...) the Host can accept for its Collectives """ - RECEIPT + supportedPaymentMethods: [PaymentMethodLegacyType] + bankAccount: PayoutMethod """ - Funding Request: Request funding for a project or initiative. + Paypal preapproval info. Returns null if PayPal account is not connected. """ - FUNDING_REQUEST + paypalPreApproval: PaymentMethod """ - Grant: Request funding for a project or initiative. + If the host supports PayPal, this will contain the client ID to use in the frontend """ - GRANT + paypalClientId: String """ - Unclassified expense + The list of payout methods this Host accepts for its expenses """ - UNCLASSIFIED + supportedPayoutMethods: [PayoutMethodType] """ - Credit Card Charge: Payment done using an issued (virtual) credit card issued by your Fiscal Host. + Stripe connected account """ - CHARGE + stripe: StripeConnectedAccount """ - Settlement: expense generated by Open Collective to collect money owed by Fiscal Hosts. + Applications for this host """ - SETTLEMENT -} + hostApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 -enum ExpenseStatus { - DRAFT - UNVERIFIED - PENDING - INCOMPLETE - APPROVED - REJECTED - PROCESSING - ERROR - PAID - SCHEDULED_FOR_PAYMENT - SPAM - CANCELED -} + """ + The offset to use to fetch + """ + offset: Int! = 0 -""" -A collection of "Comments" -""" -type CommentCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Comment] -} + """ + Search term for collective tags, id, name, slug and description. + """ + searchTerm: String -""" -This represents an Comment -""" -type Comment { - id: String - createdAt: DateTime - html: String - fromAccount: Account - account: Account + """ + Order of the results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - """ - Returns a map of reactions counts for this comment - """ - reactions: JSON + """ + Filter applications by status + """ + status: HostApplicationStatus + ): HostApplicationCollection! """ - Returns the list of reactions added to this comment by logged in user + Pending applications for this host """ - userReactions: [String] -} + pendingApplications( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 -""" -The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). -""" -scalar JSON + """ + The offset to use to fetch + """ + offset: Int! = 0 -""" -Input to order results chronologically -""" -input ChronologicalOrderInput { - """ - Field to chronologically order by. - """ - field: DateTimeField! = CREATED_AT + """ + A term to search membership. Searches in collective tags, name, slug, members description and role. + """ + searchTerm: String - """ - Ordering direction. - """ - direction: OrderDirection! = DESC -} + """ + 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 -""" -All possible DateTime fields for a resource -""" -enum DateTimeField { - """ - The creation time of a resource - """ - CREATED_AT -} + """ + Returns virtual cards with expenses from this date. + """ + withExpensesDateFrom: DateTime -""" -Possible directions in which to order a list of items -""" -enum OrderDirection { - ASC - DESC -} + """ + Returns virtual cards with expenses to this date. + """ + withExpensesDateTo: DateTime -""" -Type for Geographic location -""" -type Location { - """ - Unique identifier for this location - """ - id: String + """ + 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! """ - A short name for the location (eg. Open Collective Headquarters) + Returns whether the host is trusted or not """ - name: String + isTrustedHost: Boolean! """ - Postal address without country (eg. 12 opensource avenue, 7500 Paris) + Returns whether the host has any Stripe disputed orders """ - address: String + hasDisputedOrders: Boolean """ - Two letters country code (eg. FR, BE...etc) + Returns whether the host has any Stripe in review orders """ - country: String + hasInReviewOrders: Boolean """ - Latitude + Returns agreements with Hosted Accounts """ - lat: Float + 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! """ - Longitude + Returns a list of vendors that works with this host """ - long: Float + 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! """ - Structured JSON address + Returns a list of organizations that only transacted with this host and all its admins are also admins of this host. """ - structured: JSON + potentialVendors( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): AccountCollection! } """ -A payout method +An account that can receive financial contributions """ -type PayoutMethod { +interface AccountWithContributions { """ - Unique identifier for this payout method + Number of unique financial contributors. """ - id: String! + totalFinancialContributors( + """ + Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) + """ + accountType: AccountType + ): Int! + tiers( + """ + The number of results to fetch + """ + limit: Int! = 100 - """ - The type of this payout method (usually the payment provider) - """ - type: PayoutMethodType + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): TierCollection! """ - A friendly name for users to easily find their payout methods + All the persons and entities that contribute to this account """ - name: String + 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! """ - Whether this payout method has been saved to be used for future payouts + How much platform fees are charged for this account """ - isSaved: Boolean + platformFeePercent: Float! """ - The actual data for this payout method. Content depends on the type. + Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account """ - data: JSON + platformContributionAvailable: Boolean! + contributionPolicy: String } -enum PayoutMethodType { - OTHER - PAYPAL - BANK_ACCOUNT - ACCOUNT_BALANCE - CREDIT_CARD +""" +A collection of "Tiers" +""" +type TierCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Tier] } """ -Fields for an expense's attached file +A collection of "Contributor" """ -type ExpenseAttachedFile { +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 { """ - Unique identifier for this file + A unique identifier for this member """ id: String! - url: URL """ - The file info associated with this item (if any) + Name of the contributor """ - info: FileInfo + name: String! """ - The original filename + All the roles for a given contributor """ - name: String @deprecated(reason: "2023-01-23: We're moving this field to \"file.name\"") -} + roles: [MemberRole] -""" -Fields for an expense item -""" -type ExpenseItem { """ - Unique identifier for this expense item + True if the contributor is a collective admin """ - id: String! + isAdmin: Boolean! """ - Amount of this item + True if the contributor is a core contributor """ - amount: Int! + isCore: Boolean! """ - The date on which the item was created + True if the contributor is a financial contributor """ - createdAt: DateTime! + isBacker: Boolean! """ - The date on which the item was last updated + Member join date """ - updatedAt: DateTime! + since: DateTime! """ - The date on which the expense took place + How much money the user has contributed for this (in cents, using collective currency) """ - incurredAt: DateTime! + totalAmountDonated: Int! """ - A description for this item. Enforced for new items, but old expenses may not have one. + Whether the contributor is an individual, an organization... """ - description: String - url: URL + type: String! """ - The file associated with this item (if any) + Defines if the contributors wants to be incognito (name not displayed) """ - file: FileInfo -} + isIncognito: Boolean! -""" -All supported expense types -""" -enum FeesPayer { """ - The collective will be responsible for paying the fees + Description of how the member contribute. Will usually be a tier name, or "design" or "code". """ - COLLECTIVE + description: String """ - The payee will be responsible for paying the fees (they'll be deduced from the total amount) + If the contributor has a page on Open Collective, this is the slug to link to it """ - PAYEE -} - -""" -Fields for the user permissions on an expense -""" -type ExpensePermissions { - id: String! + collectiveSlug: String """ - Whether the current user can edit the expense + Contributor avatar or logo """ - canEdit: Boolean! + image(height: Int, format: ImageFormat): String """ - Tags permissions are a bit different, and can be edited by admins even if the expense has already been paid + A public message from contributors to describe their contributions """ - canEditTags: Boolean! + publicMessage: String +} +""" +Input to order results chronologically +""" +input ChronologicalOrderInput { """ - Whether the current user can edit the expense + Field to chronologically order by. """ - canDelete: Boolean! + field: DateTimeField! = CREATED_AT """ - Whether the current user can the the invoice info for this expense + Ordering direction. """ - canSeeInvoiceInfo: Boolean! + direction: OrderDirection! = DESC +} +""" +All possible DateTime fields for a resource +""" +enum DateTimeField { """ - Whether the current user can trigger the payment for this expense + The creation time of a resource """ - canPay: Boolean! + CREATED_AT +} - """ - Whether the current user can approve this expense - """ - canApprove: Boolean! +""" +Possible directions in which to order a list of items +""" +enum OrderDirection { + ASC + DESC +} +input AccountReferenceInput { """ - Whether the current user can unapprove this expense + The public id identifying the account (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) """ - canUnapprove: Boolean! + id: String """ - Whether the current user can reject this expense + The internal id of the account (ie: 580) """ - canReject: Boolean! + legacyId: Int @deprecated(reason: "2020-01-01: should only be used during the transition to GraphQL API v2.") """ - Whether the current user can mark this expense as spam + The slug identifying the account (ie: babel for https://opencollective.com/babel) """ - canMarkAsSpam: Boolean! + slug: String +} - """ - Whether the current user can mark this expense as unpaid - """ - canMarkAsUnpaid: Boolean! +""" +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 { """ - Whether the current user can mark this expense as incomplete + Use global host fees """ - canMarkAsIncomplete: Boolean! + DEFAULT """ - Whether the current user can comment and see comments for this expense + Custom fee for this Collective only """ - canComment: Boolean! + CUSTOM_FEE """ - Whether the current user can unschedule this expense payment + Set a monthly retainer for this Collective """ - canUnschedulePayment: Boolean! - edit: Permission! - editTags: Permission! - delete: Permission! - seeInvoiceInfo: Permission! - pay: Permission! - approve: Permission! - unapprove: Permission! - reject: Permission! - markAsSpam: Permission! - markAsUnpaid: Permission! - comment: Permission! - unschedulePayment: Permission! -} - -type Permission { - allowed: Boolean! - reason: String - reasonDetails: JSON + MONTHLY_RETAINER } """ -An activity describing something that happened on the platform +Input to order results """ -type Activity { +input OrderByInput { """ - Unique identifier for this activity + Field to order by. """ - id: String! + field: OrderByFieldType! """ - The type of the activity + Ordering direction. """ - type: ActivityType! + direction: OrderDirection! +} + +""" +Possible fields you can use to order by +""" +enum OrderByFieldType { + CREATED_AT + MEMBER_COUNT + TOTAL_CONTRIBUTED """ - The date on which the ConnectedAccount was created + The financial activity of the collective (number of transactions) """ - createdAt: DateTime! + ACTIVITY + RANK +} + +""" +A collection of Transactions (Debit or Credit) +""" +type TransactionCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Transaction] + kinds: [TransactionKind] """ - The account that authored by this activity, if any + The types of payment methods used in this collection, regardless of the pagination """ - fromAccount: Account + paymentMethodTypes: [PaymentMethodType]! +} + +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") + ALIPAY + CREDITCARD + PREPAID + PAYMENT + SUBSCRIPTION + COLLECTIVE + HOST + ADAPTIVE + GIFTCARD + MANUAL + CRYPTO + PAYMENT_INTENT + US_BANK_ACCOUNT + SEPA_DEBIT + BACS_DEBIT + BANCONTACT + LINK +} + +input VirtualCardReferenceInput { + id: String +} +input PaymentMethodReferenceInput { """ - The account targeted by this activity, if any + The id assigned to the payment method """ - account: Account + 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] +} + +""" +Describes the role in which an account is involved in an expense. This is used to filter +""" +enum ExpenseDirection { """ - The host under which this activity happened, if any + Submitted: The account is the one who submitted the expense and possibly the beneficiary. """ - host: Host + SUBMITTED """ - The person who triggered the action, if any + Received: The account is the one who received the expense and the one who's paying for it. """ - individual: Individual + RECEIVED +} + +""" +Describes the values allowed to filter expenses, namely all the expense statuses and the special "READY_TO_PAY" value. +""" +enum ExpenseStatusFilter { + DRAFT + UNVERIFIED + PENDING + INCOMPLETE + APPROVED + REJECTED + PROCESSING + ERROR + PAID + SCHEDULED_FOR_PAYMENT + SPAM + CANCELED """ - The expense related to this activity, if any + Only expenses that are ready to be paid (must be approved, have the sufficiant balance and have the tax forms completed) """ - expense: Expense + READY_TO_PAY """ - The order related to this activity, if any + Only expenses that are on hold """ - order: Order + ON_HOLD +} +""" +All supported expense types +""" +enum ExpenseType { """ - The transaction related to this activity, if any + Invoice: Charge for your time or get paid in advance. """ - transaction: Transaction + INVOICE """ - Data attached to this activity (if any) + Receipt: Get paid back for a purchase already made. """ - data: JSON! + RECEIPT """ - Specifies whether this is a system generated activity + Funding Request: Request funding for a project or initiative. """ - isSystem: Boolean! -} + FUNDING_REQUEST -enum ActivityType { - ACTIVITY_ALL - CONNECTED_ACCOUNT_CREATED - CONNECTED_ACCOUNT_ERROR - COLLECTIVE_CREATED_GITHUB - COLLECTIVE_APPLY - COLLECTIVE_APPROVED - COLLECTIVE_REJECTED - COLLECTIVE_CREATED - COLLECTIVE_EDITED - COLLECTIVE_DELETED - COLLECTIVE_UNHOSTED - ORGANIZATION_COLLECTIVE_CREATED - COLLECTIVE_FROZEN - COLLECTIVE_UNFROZEN - COLLECTIVE_CONVERSATION_CREATED - UPDATE_COMMENT_CREATED - EXPENSE_COMMENT_CREATED - CONVERSATION_COMMENT_CREATED - COLLECTIVE_EXPENSE_CREATED - COLLECTIVE_EXPENSE_DELETED - COLLECTIVE_EXPENSE_UPDATED - COLLECTIVE_EXPENSE_REJECTED - COLLECTIVE_EXPENSE_APPROVED - COLLECTIVE_EXPENSE_UNAPPROVED - COLLECTIVE_EXPENSE_MOVED - COLLECTIVE_EXPENSE_PAID - COLLECTIVE_EXPENSE_MARKED_AS_UNPAID - COLLECTIVE_EXPENSE_MARKED_AS_SPAM - COLLECTIVE_EXPENSE_MARKED_AS_INCOMPLETE - COLLECTIVE_EXPENSE_PROCESSING - COLLECTIVE_EXPENSE_SCHEDULED_FOR_PAYMENT - COLLECTIVE_EXPENSE_UNSCHEDULED_FOR_PAYMENT - COLLECTIVE_EXPENSE_ERROR - COLLECTIVE_EXPENSE_INVITE_DRAFTED - COLLECTIVE_EXPENSE_RECURRING_DRAFTED - COLLECTIVE_EXPENSE_MISSING_RECEIPT - TAXFORM_REQUEST - COLLECTIVE_VIRTUAL_CARD_ADDED - COLLECTIVE_VIRTUAL_CARD_MISSING_RECEIPTS - COLLECTIVE_VIRTUAL_CARD_SUSPENDED - COLLECTIVE_VIRTUAL_CARD_DELETED - VIRTUAL_CARD_REQUESTED - VIRTUAL_CARD_CHARGE_DECLINED - VIRTUAL_CARD_PURCHASE - COLLECTIVE_MEMBER_INVITED - COLLECTIVE_MEMBER_CREATED - COLLECTIVE_CORE_MEMBER_ADDED - COLLECTIVE_CORE_MEMBER_INVITED - COLLECTIVE_CORE_MEMBER_INVITATION_DECLINED - COLLECTIVE_CORE_MEMBER_REMOVED - COLLECTIVE_CORE_MEMBER_EDITED - COLLECTIVE_TRANSACTION_CREATED - COLLECTIVE_UPDATE_CREATED - COLLECTIVE_UPDATE_PUBLISHED - COLLECTIVE_CONTACT - HOST_APPLICATION_CONTACT - CONTRIBUTION_REJECTED - SUBSCRIPTION_ACTIVATED - SUBSCRIPTION_CANCELED - TICKET_CONFIRMED - ORDER_CANCELED_ARCHIVED_COLLECTIVE - ORDER_PENDING - ORDER_PENDING_CRYPTO - ORDER_PENDING_CONTRIBUTION_NEW - ORDER_PENDING_CONTRIBUTION_REMINDER - ORDER_PROCESSING - ORDER_PAYMENT_FAILED - ORDER_THANKYOU - ORDER_PENDING_CREATED - ORDER_PENDING_FOLLOWUP - ORDER_PENDING_RECEIVED - ORDERS_SUSPICIOUS - BACKYOURSTACK_DISPATCH_CONFIRMED - PAYMENT_FAILED - PAYMENT_CREDITCARD_CONFIRMATION - PAYMENT_CREDITCARD_EXPIRING - USER_CREATED - USER_NEW_TOKEN - USER_SIGNIN - USER_RESET_PASSWORD - OAUTH_APPLICATION_AUTHORIZED - TWO_FACTOR_CODE_ADDED - TWO_FACTOR_CODE_DELETED - USER_CHANGE_EMAIL - USER_PAYMENT_METHOD_CREATED - USER_PASSWORD_SET - USER_CARD_CLAIMED - USER_CARD_INVITED - WEBHOOK_STRIPE_RECEIVED - WEBHOOK_PAYPAL_RECEIVED - COLLECTIVE_MONTHLY_REPORT - ACTIVATED_COLLECTIVE_AS_HOST - ACTIVATED_COLLECTIVE_AS_INDEPENDENT - DEACTIVATED_COLLECTIVE_AS_HOST - ADDED_FUND_TO_ORG - COLLECTIVE_TRANSACTION_PAID - COLLECTIVE_USER_ADDED - COLLECTIVE_VIRTUAL_CARD_ASSIGNED - COLLECTIVE_VIRTUAL_CARD_CREATED - SUBSCRIPTION_CONFIRMED - COLLECTIVE_COMMENT_CREATED + """ + Grant: Request funding for a project or initiative. + """ + GRANT + + """ + Unclassified expense + """ + UNCLASSIFIED + + """ + Credit Card Charge: Payment done using an issued (virtual) credit card issued by your Fiscal Host. + """ + CHARGE + + """ + Settlement: expense generated by Open Collective to collect money owed by Fiscal Hosts. + """ + SETTLEMENT +} + +enum PayoutMethodType { + OTHER + PAYPAL + BANK_ACCOUNT + ACCOUNT_BALANCE + CREDIT_CARD } """ -This represents an Host account +The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). """ -type Host implements Account & AccountWithContributions { +scalar JSON + +""" +A collection of "Conversations" +""" +type ConversationCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Conversation] +} + +""" +A conversation thread +""" +type Conversation { id: String! - legacyId: Int! + slug: String! + title: String! + createdAt: DateTime! + updatedAt: DateTime! + tags: [String] + summary: String! + account: Account + fromAccount: Account """ - The slug identifying the account (ie: babel) + The root comment / starter for this conversation """ - slug: String! - type: AccountType! + body: Comment """ - Public name + List the comments for this conversation. Not backed by a loader, don't use this in lists. """ - name: String + comments(limit: Int! = 150, offset: Int! = 0): CommentCollection! + followers(limit: Int! = 10, offset: Int! = 0): AccountCollection! + stats: ConversationStats +} + +""" +This represents an Comment +""" +type Comment { + id: String + createdAt: DateTime + html: String + fromAccount: Account + account: Account """ - Private, legal name. Used for expense receipts, taxes, etc. Scope: "account". + The type of this comment """ - 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 + type: CommentType! """ - Defines if the contributors wants to be incognito (name not displayed) + Returns a map of reactions counts for this comment """ - isIncognito: Boolean! - imageUrl(height: Int, format: ImageFormat): String - backgroundImageUrl(height: Int, format: ImageFormat): String + reactions: JSON """ - The time of creation + Returns the list of reactions added to this comment by logged in user """ - createdAt: DateTime - updatedAt: DateTime + userReactions: [String] +} +""" +All supported comment contexts +""" +enum CommentType { """ - Returns whether this account is archived + Default regular comment """ - isArchived: Boolean! + COMMENT """ - Whether this account is frozen + Comment is visible only to host admins """ - isFrozen: Boolean! + PRIVATE_NOTE +} + +""" +A collection of "Comments" +""" +type CommentCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Comment] +} + +""" +A collection of "Accounts" +""" +type AccountCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Account] +} + +type ConversationStats { + id: String! """ - Returns whether the account accepts financial contributions. + Total number of comments for this conversation """ - isActive: Boolean + commentsCount: Int +} +""" +Statistics for a given tag +""" +type TagStat { """ - Returns whether the account is setup to Host collectives. + An unique identifier for this tag """ - isHost: Boolean! + id: String! """ - Returns true if the remote user is an admin of this account + Name/Label of the tag """ - isAdmin: Boolean! - parentAccount: Account @deprecated(reason: "2022-12-16: use parent on AccountWithParent instead") + tag: String! """ - Get all members (admins, members, backers, followers) + Number of entries for this tag """ - members( - limit: Int! = 100 - offset: Int! = 0 - role: [MemberRole] - accountType: [AccountType] - - """ - Admin only. To filter on the email address of a member, useful to check if a member exists. - """ - email: EmailAddress - - """ - Order of the results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: ASC } - includeInherited: Boolean = true - ): MemberCollection! + count: Int! """ - [AUTHENTICATED] Returns the pending invitations + Total amount for this tag """ - memberInvitations( - """ - A reference to an account (usually Individual). Will return invitations sent to the account to join as a member - """ - memberAccount: AccountReferenceInput + amount: Amount +} - """ - A reference to an account (usually Collective, Fund or Organization). Will return invitations sent to join this account as a member. - """ - account: AccountReferenceInput +""" +A payout method +""" +type PayoutMethod { + """ + Unique identifier for this payout method + """ + id: String! - """ - An array of Member roles to filter for - """ - role: [MemberRole] - ): [MemberInvitation] - memberOf( - limit: Int! = 150 - offset: Int! = 0 - role: [MemberRole] - accountType: [AccountType] - account: AccountReferenceInput + """ + The type of this payout method (usually the payment provider) + """ + type: PayoutMethodType - """ - Filter on whether the account is a host or not - """ - isHostAccount: Boolean + """ + A friendly name for users to easily find their payout methods + """ + name: String - """ - Filter on (un)approved collectives - """ - isApproved: Boolean + """ + Whether this payout method has been saved to be used for future payouts + """ + isSaved: Boolean - """ - Filter on archived collectives - """ - isArchived: Boolean + """ + The actual data for this payout method. Content depends on the type. + """ + data: JSON +} - """ - Whether incognito profiles should be included in the result. Only works if requesting user is an admin of the account. - """ - includeIncognito: Boolean = true +""" +PaymentMethod model +""" +type PaymentMethod { + id: String + legacyId: Int + name: String + service: PaymentMethodService + type: PaymentMethodType - """ - A term to search membership. Searches in collective tags, name, slug, members description and role. - """ - searchTerm: String + """ + Defines the type of the payment method. Meant to be moved to "type" in the future. + """ + providerType: PaymentMethodLegacyType @deprecated(reason: "2021-03-02: Please use service + type") - """ - Filters on the Host fees structure applied to this account - """ - hostFeesStructure: HostFeeStructure + """ + Returns the balance amount and the currency of this paymentMethod + """ + balance: Amount! + account: Account - """ - Order of the results - """ - orderBy: OrderByInput! = { field: CREATED_AT, direction: DESC } + """ + For gift cards, this field will return to the source payment method + """ + sourcePaymentMethod: PaymentMethod + data: JSON + limitedToHosts: [Host] + expiryDate: DateTime + createdAt: DateTime - """ - Order the query by requested role order - """ - orderByRoles: Boolean - ): MemberOfCollection! + """ + For monthly gift cards, this field will return the monthly limit + """ + monthlyLimit: Amount """ - Returns the emails of the account. Individuals only have one, but organizations can have multiple emails. + Get all the orders associated with this payment method """ - emails: [EmailAddress!] - transactions( + orders( """ The number of results to fetch (default 10, max 1000) """ @@ -2686,29 +3219,29 @@ type Host implements Account & AccountWithContributions { offset: Int! = 0 """ - The transaction type (DEBIT or CREDIT) + If account is a host, also include hosted accounts orders """ - type: TransactionType + includeHostedAccounts: Boolean """ - The payment method types. Can include `null` for transactions without a payment method + Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. """ - paymentMethodType: [PaymentMethodType] + includeIncognito: Boolean = false """ - Reference of the account assigned to the other side of the transaction (CREDIT -> sender, DEBIT -> recipient). Avoid, favor account instead. + Account orders filter (INCOMING or OUTGOING) """ - fromAccount: AccountReferenceInput + filter: AccountOrdersFilter """ - Reference of the host accounting the transaction + Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) """ - host: AccountReferenceInput + frequency: ContributionFrequency """ - NOT IMPLEMENTED. Only return transactions that match these tags. + Use this field to filter orders on their statuses """ - tags: [String] @deprecated(reason: "2020-08-09: Was never implemented.") + status: [OrderStatus] """ The order of results @@ -2716,22 +3249,22 @@ type Host implements Account & AccountWithContributions { orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } """ - Only return transactions where the amount is greater than or equal to this value (in cents) + Only return orders 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.") + minAmount: Int """ - Only return transactions where the amount is lower than or equal to this value (in cents) + Only return orders where the amount is lower than or equal to this value (in cents) """ - maxAmount: Int @deprecated(reason: "2020-08-09: GraphQL v2 should not expose amounts as integer.") + maxAmount: Int """ - Only return transactions that were created after this date + Only return orders that were created after this date """ dateFrom: DateTime """ - Only return transactions that were created before this date + Only return orders that were created before this date """ dateTo: DateTime @@ -2739,368 +3272,452 @@ type Host implements Account & AccountWithContributions { The term to search """ searchTerm: String + tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") """ - Only return transactions with an Expense attached + Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. """ - hasExpense: Boolean + onlySubscriptions: Boolean """ - Only return transactions with an Order attached + Same as onlySubscriptions, but returns only orders with active subscriptions """ - hasOrder: Boolean + onlyActiveSubscriptions: Boolean + ): OrderCollection +} + +enum PaymentMethodService { + PAYPAL + STRIPE + OPENCOLLECTIVE + PREPAID + THEGIVINGBLOCK +} + +enum PaymentMethodLegacyType { + ALIPAY + CREDIT_CARD + GIFT_CARD + PREPAID_BUDGET + ACCOUNT_BALANCE + PAYPAL + BANK_TRANSFER + ADDED_FUNDS + CRYPTO + PAYMENT_INTENT + US_BANK_ACCOUNT + SEPA_DEBIT + BACS_DEBIT + BANCONTACT +} + +""" +This represents a Connected Account +""" +type ConnectedAccount { + """ + Unique identifier for this connected account + """ + id: String! + + """ + The internal database identifier of the Connected Account (ie: 580) + """ + legacyId: Int @deprecated(reason: "2020-05-01: should only be used during the transition to GraphQL API v2.") + + """ + The date on which the ConnectedAccount was created + """ + createdAt: DateTime! + + """ + The date on which the ConnectedAccount was last updated + """ + updatedAt: DateTime! + settings: JSON + service: ConnectedAccountService! +} + +""" +All supported services a user can connect with +""" +enum ConnectedAccountService { + paypal + stripe + stripe_customer + github + twitter + transferwise + privacy @deprecated(reason: "Not using this service anymore") + thegivingblock + meetup @deprecated(reason: "Not using this service anymore") +} + +""" +A collection of "Application" +""" +type OAuthApplicationCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Application] +} + +""" +Type for Geographic location +""" +type Location { + """ + Unique identifier for this location + """ + id: String + + """ + A short name for the location (eg. Open Collective Headquarters) + """ + name: String + + """ + Postal address without country (eg. 12 opensource avenue, 7500 Paris) + """ + address: String + + """ + Two letters country code (eg. FR, BE...etc) + """ + country: String + + """ + Latitude + """ + lat: Float + + """ + Longitude + """ + long: Float + + """ + Structured JSON address + """ + structured: JSON +} + +""" +Stats for the Account +""" +type AccountStats { + id: String + """ + Amount of money in cents in the currency of the collective currently available to spend + """ + balanceWithBlockedFunds: Amount! @deprecated(reason: "2022-12-13: Use balance + withBlockedFunds instead") + + """ + Amount of money in cents in the currency of the collective + """ + balance( """ - Whether to include regular transactions from the account (turn false if you only want Incognito or Gift Card transactions) + Calculate amount before this date """ - includeRegularTransactions: Boolean! = true + dateTo: DateTime """ - If the account is a user and this field is true, contributions from the incognito profile will be included too (admins only) + Include transactions from children (Projects and Events) """ - includeIncognitoTransactions: Boolean! = false + includeChildren: Boolean = false """ - Whether to include transactions from children (Events and Projects) + An optional currency. If not provided, will use the collective currency. """ - includeChildrenTransactions: Boolean! = false + currency: Currency """ - Whether to include transactions from Gift Cards issued by the account. + Remove blocked funds from the balance """ - includeGiftCardTransactions: Boolean! = false + withBlockedFunds: Boolean = false + ): Amount! + + """ + The consolidated amount of all the events and projects combined. + """ + consolidatedBalance: Amount! @deprecated(reason: "2022-09-02: Use balance + includeChildren instead") + + """ + Average amount spent per month based on the last 90 days + """ + monthlySpending: Amount! + """ + Total amount spent + """ + totalAmountSpent( """ - Whether to include debt transactions + Return the net amount (with payment processor fees removed) """ - includeDebts: Boolean! = false + net: Boolean = false """ - To filter by transaction kind + Filter by kind """ kind: [TransactionKind] """ - The transactions group to filter by + Calculate amount after this date """ - group: String - ): TransactionCollection! - orders( + dateFrom: DateTime + """ - The number of results to fetch (default 10, max 1000) + Calculate amount before this date + """ + dateTo: DateTime + + """ + Calculate amount for the last x months. Cannot be used with startDate/endDate + """ + periodInMonths: Int + + """ + Include transactions from children (Projects and Events) """ - limit: Int! = 100 + includeChildren: Boolean = false """ - The offset to use to fetch + An optional currency. If not provided, will use the collective currency. """ - offset: Int! = 0 + currency: Currency """ - If account is a host, also include hosted accounts orders + Include transactions using Gift Cards (not working together with includeChildren) """ - includeHostedAccounts: Boolean + includeGiftCards: Boolean = false + ): Amount! + """ + Total amount received + """ + totalAmountReceived( """ - Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. + Return the net amount (with payment processor fees removed) """ - paymentMethod: PaymentMethodReferenceInput + net: Boolean = false """ - Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. + Filter by kind """ - includeIncognito: Boolean = false + kind: [TransactionKind] """ - Account orders filter (INCOMING or OUTGOING) + Calculate amount after this date """ - filter: AccountOrdersFilter + dateFrom: DateTime """ - Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) + Calculate amount before this date """ - frequency: ContributionFrequency + dateTo: DateTime """ - Use this field to filter orders on their statuses + Calculate amount for the last x months. Cannot be used with startDate/endDate """ - status: [OrderStatus] + periodInMonths: Int """ - The order of results + Include transactions from children (Projects and Events) """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + includeChildren: Boolean = false """ - Only return orders where the amount is greater than or equal to this value (in cents) + An optional currency. If not provided, will use the collective currency. """ - minAmount: Int + currency: Currency """ - Only return orders where the amount is lower than or equal to this value (in cents) + Set this to true to use cached data """ - maxAmount: Int + useCache: Boolean! = false + @deprecated(reason: "2022-12-14: this is not used anymore as results should be fast by default") + ): Amount! + """ + Total amount received time series + """ + totalAmountReceivedTimeSeries( """ - Only return orders that were created after this date + The start date of the time series """ dateFrom: DateTime """ - Only return orders that were created after this date + The end date of the time series """ dateTo: DateTime """ - The term to search + 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. """ - searchTerm: String - tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") + timeUnit: TimeUnit """ - Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + Return the net amount (with payment processor fees removed) """ - onlySubscriptions: Boolean + net: Boolean = false """ - Same as onlySubscriptions, but returns only orders with active subscriptions + Filter by kind """ - onlyActiveSubscriptions: Boolean - ): OrderCollection! - settings: JSON! - conversations( - limit: Int! = 15 - offset: Int! = 0 + kind: [TransactionKind] """ - Only return conversations matching this tag + Calculate amount for the last x months. Cannot be used with startDate/endDate """ - tag: String - ): ConversationCollection! - - """ - Returns conversation's tags for collective sorted by popularity - """ - conversationsTags(limit: Int! = 30): [TagStat] - - """ - Returns expense tags for collective sorted by popularity - """ - expensesTags(limit: Int! = 30): [TagStat] - - """ - The list of expense types supported by this account - """ - supportedExpenseTypes: [ExpenseType!]! - transferwise: TransferWise - - """ - The list of payout methods that this collective can use to get paid. In most cases, admin only and scope: "expenses". - """ - payoutMethods: [PayoutMethod] - - """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". - """ - paymentMethods( - type: [PaymentMethodType] - enumType: [PaymentMethodType] @deprecated(reason: "2021-08-20: use type instead from now") - service: [PaymentMethodService] + periodInMonths: Int """ - Whether to include expired payment methods. Payment methods expired since more than 6 months will never be returned. + Include transactions from children (Projects and Events) """ - includeExpired: Boolean - ): [PaymentMethod] + includeChildren: Boolean = false - """ - The list of payment methods for this account that are pending a client confirmation (3D Secure / SCA) - """ - paymentMethodsWithPendingConfirmation: [PaymentMethod] + """ + An optional currency. If not provided, will use the collective currency. + """ + currency: Currency + ): TimeSeriesAmount! """ - The list of connected accounts (Stripe, Twitter, etc ...). Admin only. Scope: "connectedAccounts". + Total of paid expenses to the account, filter per expense type """ - connectedAccounts: [ConnectedAccount] + totalPaidExpenses( + """ + Calculate amount after this date + """ + dateFrom: DateTime - """ - The list of applications created by this account. Admin only. Scope: "applications". - """ - oAuthApplications( """ - The number of results to fetch (default 10, max 1000) + Calculate amount before this date """ - limit: Int! = 10 + dateTo: DateTime """ - The offset to use to fetch + An optional currency. If not provided, will use the collective currency. """ - offset: Int! = 0 - ): OAuthApplicationCollection + currency: Currency - """ - The address associated to this account. This field is always public for collectives and events. - """ - location: Location - categories: [String]! - stats: AccountStats + """ + Filter by ExpenseType + """ + expenseType: [ExpenseType] + ): Amount! + yearlyBudget: Amount! + yearlyBudgetManaged: Amount! + @deprecated(reason: "2023-03-01: This field will be removed soon, please use totalMoneyManaged") """ - Updates published by the account. To see unpublished updates, you need to be an admin and have the scope "updates". + Total net amount received """ - updates( + totalNetAmountReceived( """ - The number of results to fetch (default 10, max 1000) + Filter by kind """ - limit: Int! = 10 + kind: [TransactionKind] """ - The offset to use to fetch + Calculate amount after this date """ - offset: Int! = 0 + dateFrom: DateTime """ - Only return published updates. + Calculate amount before this date """ - onlyPublishedUpdates: Boolean = false - onlyChangelogUpdates: Boolean - orderBy: UpdateChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - searchTerm: String - ): UpdateCollection! - - """ - Describes the features enabled and available for this account - """ - features: CollectiveFeatures! - - """ - Virtual Cards attached to the account. Admin only. Scope: "virtualCards". - """ - virtualCards( - limit: Int! = 100 - offset: Int! = 0 - state: String = null - merchantAccount: AccountReferenceInput = null + dateTo: DateTime """ - Only return expenses that were created after this date + Calculate amount for the last x months. Cannot be used with startDate/endDate """ - dateFrom: DateTime = null + periodInMonths: Int """ - Only return expenses that were created before this date + Include transactions from children (Projects and Events) """ - dateTo: DateTime = null - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } - ): VirtualCardCollection - - """ - Virtual Cards Merchants used by the account. Admin only. Scope: "virtualCards". - """ - virtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection - childrenAccounts(limit: Int! = 100, offset: Int! = 0, accountType: [AccountType]): AccountCollection! - - """ - Policies for the account. To see non-public policies you need to be admin and have the scope: "account". - """ - policies: Policies! - - """ - List of activities that the logged-in user is subscribed for this collective - """ - activitySubscriptions(channel: ActivityChannel): [ActivitySubscription] + includeChildren: Boolean = false + ): Amount! @deprecated(reason: "2022-12-13: Use totalAmountReceived + net=true instead") """ - Logged-in user permissions on an account + Total net amount received time series """ - permissions: AccountPermissions! - webhooks( + totalNetAmountReceivedTimeSeries( """ - The number of results to fetch (default 10, max 1000) + The start date of the time series """ - limit: Int! = 10 + dateFrom: DateTime """ - The offset to use to fetch + The end date of the time series """ - offset: Int! = 0 - account: AccountReferenceInput! - ): WebhookCollection! + dateTo: DateTime - """ - Number of unique financial contributors. - """ - totalFinancialContributors( - """ - Type of account (COLLECTIVE/EVENT/ORGANIZATION/INDIVIDUAL) - """ - accountType: AccountType - ): Int! - tiers( """ - The number of results to fetch + 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. """ - limit: Int! = 100 + timeUnit: TimeUnit """ - The offset to use to fetch + Filter by kind """ - offset: Int! = 0 - ): TierCollection! + kind: [TransactionKind] - """ - All the persons and entities that contribute to this account - """ - contributors( """ - The number of results to fetch (default 10, max 1000) + Calculate amount for the last x months. Cannot be used with startDate/endDate """ - limit: Int! = 10 + periodInMonths: Int """ - The offset to use to fetch + Include transactions from children (Projects and Events) """ - offset: Int! = 0 - roles: [MemberRole] - ): ContributorCollection! + includeChildren: Boolean = false - """ - How much platform fees are charged for this account - """ - platformFeePercent: Float! + """ + An optional currency. If not provided, will use the collective currency. + """ + currency: Currency + ): TimeSeriesAmount! @deprecated(reason: "2022-12-13: Use totalAmountReceivedTimeSeries + net=true instead") + activeRecurringContributions: JSON + @deprecated(reason: "2022-10-21: Use activeRecurringContributionsV2 while we migrate to better semantics.") + activeRecurringContributionsV2( + """ + The frequency of the recurring contribution (MONTHLY or YEARLY) + """ + frequency: ContributionFrequency! = MONTHLY + ): Amount """ - Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account + Returns expense tags for collective sorted by popularity """ - platformContributionAvailable: Boolean! - contributionPolicy: String - hostFeePercent: Float - totalHostedCollectives: Int - isOpenToApplications: Boolean - termsUrl: URL - plan: HostPlan! - hostMetrics( - """ - A collection of accounts for which the metrics should be returned. - """ - account: [AccountReferenceInput!] + expensesTags( + limit: Int! = 100 + truncate: Int = 7 """ - The start date of the time series + Calculate amount after this date """ dateFrom: DateTime """ - The end date of the time series + Calculate amount before this date """ dateTo: DateTime - ): HostMetrics! - hostMetricsTimeSeries( + """ - A collection of accounts for which the metrics should be returned. + Include transactions from children (Projects and Events) """ - account: [AccountReferenceInput!] + includeChildren: Boolean = false + ): [AmountStats] + """ + History of the expense tags used by this collective. + """ + expensesTagsTimeSeries( """ The start date of the time series """ @@ -3115,102 +3732,76 @@ type Host implements Account & AccountWithContributions { 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 list of payment methods (Stripe, Paypal, manual bank transfer, etc ...) the Host can accept for its Collectives - """ - supportedPaymentMethods: [PaymentMethodLegacyType] - bankAccount: PayoutMethod - """ - Paypal preapproval info. Returns null if PayPal account is not connected. - """ - paypalPreApproval: PaymentMethod - - """ - If the host supports PayPal, this will contain the client ID to use in the frontend - """ - paypalClientId: String - - """ - The list of payout methods this Host accepts for its expenses - """ - supportedPayoutMethods: [PayoutMethodType] - - """ - Transferwise balances. Returns null if Transferwise account is not connected. - """ - transferwiseBalances: [Amount] - - """ - Pending applications for this host - """ - pendingApplications( """ - The number of results to fetch (default 10, max 1000) + Include transactions from children (Projects and Events) """ - limit: Int! = 10 + includeChildren: Boolean = false + ): TimeSeriesAmount! + contributionsCount( + """ + Calculate amount after this date + """ + dateFrom: DateTime """ - The offset to use to fetch + Calculate amount before this date """ - offset: Int! = 0 + dateTo: DateTime """ - A term to search membership. Searches in collective tags, name, slug, members description and role. + Include transactions from children (Projects and Events) """ - searchTerm: String + includeChildren: Boolean = false + ): Int! + contributorsCount( + """ + Calculate amount after this date + """ + dateFrom: DateTime """ - Order of the results + Calculate amount before this date """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } - ): HostApplicationCollection! - hostedVirtualCards( - limit: Int! = 100 - offset: Int! = 0 - state: String = null - orderBy: ChronologicalOrderInput = { field: CREATED_AT, direction: DESC } - merchantAccount: AccountReferenceInput = null - collectiveAccountIds: [AccountReferenceInput] = null - ): VirtualCardCollection! - hostedVirtualCardMerchants(limit: Int! = 100, offset: Int! = 0): AccountCollection! - hostedVirtualCardCollectives(limit: Int! = 100, offset: Int! = 0): AccountCollection! - contributionStats( + dateTo: DateTime + """ - A collection of accounts for which the contribution stats should be returned. + Include transactions from children (Projects and Events) """ - account: [AccountReferenceInput!] + includeChildren: Boolean = false + ): Int! + """ + Return amount stats for contributions (default, and only for now: one-time vs recurring) + """ + contributionsAmount( """ - Calculate contribution statistics beginning from this date. + Calculate amount after this date """ dateFrom: DateTime """ - Calculate contribution statistics until this date. + Calculate amount before 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. + Include transactions from children (Projects and Events) """ - account: [AccountReferenceInput!] + includeChildren: Boolean = false + ): [AmountStats] + """ + Return amount time series for contributions (default, and only for now: one-time vs recurring) + """ + contributionsAmountTimeSeries( """ - Calculate expense statistics beginning from this date. + The start date of the time series """ dateFrom: DateTime """ - Calculate expense statistics until this date. + The end date of the time series """ dateTo: DateTime @@ -3218,1022 +3809,687 @@ type Host implements Account & AccountWithContributions { 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! + """ + Include transactions from children (Projects and Events) + """ + includeChildren: Boolean = false + ): TimeSeriesAmount! +} + +""" +All supported currencies +""" +enum Currency { """ - Returns whether the host is trusted or not + US Dollar """ - isTrustedHost: Boolean! + USD """ - Returns whether the host has any Stripe disputed orders + UAE Dirham """ - hasDisputedOrders: Boolean! + AED """ - Returns whether the host has any Stripe in review orders + Afghani """ - hasInReviewOrders: Boolean! -} + AFN -""" -An account that can receive financial contributions -""" -interface AccountWithContributions { """ - Number of unique financial contributors. + Lek """ - 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! + ALL """ - All the persons and entities that contribute to this account + Armenian Dram """ - 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! + AMD """ - How much platform fees are charged for this account + Netherlands Antillean Guilder """ - platformFeePercent: Float! + ANG """ - Returns true if a custom contribution to Open Collective can be submitted for contributions made to this account + Kwanza """ - platformContributionAvailable: Boolean! - contributionPolicy: String -} - -""" -A collection of "Tiers" -""" -type TierCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Tier] -} + AOA -""" -A collection of "Contributor" -""" -type ContributorCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Contributor] -} + """ + Argentine Peso + """ + ARS -"\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 + Australian Dollar """ - id: String! + AUD """ - Name of the contributor + Aruban Florin """ - name: String! + AWG """ - All the roles for a given contributor + Azerbaijanian Manat """ - roles: [ContributorRole] + AZN """ - True if the contributor is a collective admin + Convertible Mark """ - isAdmin: Boolean! + BAM """ - True if the contributor is a core contributor + Barbados Dollar """ - isCore: Boolean! + BBD """ - True if the contributor is a financial contributor + Taka """ - isBacker: Boolean! + BDT """ - Member join date + Bulgarian Lev """ - since: DateTime! + BGN """ - How much money the user has contributed for this (in cents, using collective currency) + Burundi Franc """ - totalAmountDonated: Int! + BIF """ - Whether the contributor is an individual, an organization... + Bermudian Dollar """ - type: String! + BMD """ - Defines if the contributors wants to be incognito (name not displayed) + Brunei Dollar """ - isIncognito: Boolean! + BND """ - Description of how the member contribute. Will usually be a tier name, or "design" or "code". + Boliviano """ - description: String + BOB """ - If the contributor has a page on Open Collective, this is the slug to link to it + Brazilian Real """ - collectiveSlug: String + BRL """ - Contributor avatar or logo + Bahamian Dollar """ - image(height: Int, format: ImageFormat): String + BSD """ - A public message from contributors to describe their contributions + Pula """ - publicMessage: String -} - -""" -Possible roles for a contributor. Extends `Member.Role`. -""" -enum ContributorRole { - HOST - ADMIN - MEMBER - CONTRIBUTOR - BACKER - ATTENDEE - FOLLOWER - CONNECTED_COLLECTIVE - ACCOUNTANT -} + BWP -input AccountReferenceInput { """ - The public id identifying the account (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + Belarussian Ruble """ - id: String + BYN """ - The internal id of the account (ie: 580) + Belize Dollar """ - legacyId: Int @deprecated(reason: "2020-01-01: should only be used during the transition to GraphQL API v2.") + BZD """ - The slug identifying the account (ie: babel for https://opencollective.com/babel) + Canadian Dollar """ - slug: String -} - -""" -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! -} + CAD -""" -All supported expense types -""" -enum HostFeeStructure { """ - Use global host fees + Congolese Franc """ - DEFAULT + CDF """ - Custom fee for this Collective only + Swiss Franc """ - CUSTOM_FEE + CHF """ - Set a monthly retainer for this Collective + Chilean Peso """ - MONTHLY_RETAINER -} + CLP -""" -Input to order results -""" -input OrderByInput { """ - Field to order by. + Yuan Renminbi """ - field: OrderByFieldType! + CNY """ - Ordering direction. + Colombian Peso """ - direction: OrderDirection! -} - -""" -Possible fields you can use to order by -""" -enum OrderByFieldType { - CREATED_AT - MEMBER_COUNT - TOTAL_CONTRIBUTED + COP """ - The financial activity of the collective (number of transactions) + Costa Rican Colon """ - ACTIVITY - RANK -} - -""" -A collection of Transactions (Debit or Credit) -""" -type TransactionCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Transaction] - kinds: [TransactionKind] + CRC """ - The types of payment methods used in this collection, regardless of the pagination + Cabo Verde Escudo """ - paymentMethodTypes: [PaymentMethodType]! -} - -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") - ALIPAY - CREDITCARD - PREPAID - PAYMENT - SUBSCRIPTION - COLLECTIVE - HOST - ADAPTIVE - GIFTCARD - MANUAL - CRYPTO - PAYMENT_INTENT - US_BANK_ACCOUNT - SEPA_DEBIT - BACS_DEBIT - BANCONTACT -} + CVE -input PaymentMethodReferenceInput { """ - The id assigned to the payment method + Czech Koruna """ - id: String -} - -""" -Account orders filter (INCOMING or OUTGOING) -""" -enum AccountOrdersFilter { - INCOMING - OUTGOING -} - -""" -A collection of "Conversations" -""" -type ConversationCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Conversation] -} - -""" -A conversation thread -""" -type Conversation { - id: String! - slug: String! - title: String! - createdAt: DateTime! - updatedAt: DateTime! - tags: [String] - summary: String! - account: Account - fromAccount: Account + CZK """ - The root comment / starter for this conversation + Djibouti Franc """ - body: Comment + DJF """ - List the comments for this conversation. Not backed by a loader, don't use this in lists. + Danish Krone """ - comments(limit: Int! = 150, offset: Int! = 0): CommentCollection! - followers(limit: Int! = 10, offset: Int! = 0): AccountCollection! - stats: ConversationStats -} - -""" -A collection of "Accounts" -""" -type AccountCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Account] -} + DKK -type ConversationStats { - id: String! + """ + Dominican Peso + """ + DOP """ - Total number of comments for this conversation + Algerian Dinar """ - commentsCount: Int -} + DZD -""" -Statistics for a given tag -""" -type TagStat { """ - An unique identifier for this tag + Egyptian Pound """ - id: String! + EGP """ - Name/Label of the tag + Ethiopian Birr """ - tag: String! + ETB """ - Number of entries for this tag + Euro """ - count: Int! + EUR """ - Total amount for this tag + Fiji Dollar """ - amount: Amount -} + FJD -""" -PaymentMethod model -""" -type PaymentMethod { - id: String - legacyId: Int - name: String - service: PaymentMethodService - type: PaymentMethodType + """ + Falkland Islands Pound + """ + FKP """ - Defines the type of the payment method. Meant to be moved to "type" in the future. + Pound Sterling """ - providerType: PaymentMethodLegacyType @deprecated(reason: "2021-03-02: Please use service + type") + GBP """ - Returns the balance amount and the currency of this paymentMethod + Lari """ - balance: Amount! - account: Account + GEL """ - For gift cards, this field will return to the source payment method + Gibraltar Pound """ - sourcePaymentMethod: PaymentMethod - data: JSON - limitedToHosts: [Host] - expiryDate: DateTime - createdAt: DateTime + GIP """ - For monthly gift cards, this field will return the monthly limit + Dalasi """ - monthlyLimit: Amount + GMD """ - Get all the orders associated with this payment method + Guinea Franc """ - orders( - """ - The number of results to fetch (default 10, max 1000) - """ - limit: Int! = 100 + GNF - """ - The offset to use to fetch - """ - offset: Int! = 0 + """ + Quetzal + """ + GTQ - """ - If account is a host, also include hosted accounts orders - """ - includeHostedAccounts: Boolean + """ + Guyana Dollar + """ + GYD - """ - Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. - """ - includeIncognito: Boolean = false + """ + Hong Kong Dollar + """ + HKD - """ - Account orders filter (INCOMING or OUTGOING) - """ - filter: AccountOrdersFilter + """ + Lempira + """ + HNL - """ - Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) - """ - frequency: ContributionFrequency + """ + Kuna + """ + HRK - """ - Use this field to filter orders on their statuses - """ - status: [OrderStatus] + """ + Gourde + """ + HTG - """ - The order of results - """ - orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + """ + Forint + """ + HUF - """ - Only return orders where the amount is greater than or equal to this value (in cents) - """ - minAmount: Int + """ + Rupiah + """ + IDR - """ - Only return orders where the amount is lower than or equal to this value (in cents) - """ - maxAmount: Int + """ + New Israeli Sheqel + """ + ILS - """ - Only return orders that were created after this date - """ - dateFrom: DateTime + """ + Indian Rupee + """ + INR - """ - Only return orders that were created after this date - """ - dateTo: DateTime + """ + Iceland Krona + """ + ISK - """ - The term to search - """ - searchTerm: String - tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") + """ + Jamaican Dollar + """ + JMD - """ - Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. - """ - onlySubscriptions: Boolean + """ + Yen + """ + JPY - """ - Same as onlySubscriptions, but returns only orders with active subscriptions - """ - onlyActiveSubscriptions: Boolean - ): OrderCollection -} + """ + Kenyan Shilling + """ + KES -enum PaymentMethodService { - PAYPAL - STRIPE - OPENCOLLECTIVE - PREPAID - THEGIVINGBLOCK -} + """ + Som + """ + KGS -enum PaymentMethodLegacyType { - ALIPAY - CREDIT_CARD - GIFT_CARD - PREPAID_BUDGET - ACCOUNT_BALANCE - PAYPAL - BANK_TRANSFER - ADDED_FUNDS - CRYPTO - PAYMENT_INTENT - US_BANK_ACCOUNT - SEPA_DEBIT - BACS_DEBIT - BANCONTACT -} + """ + Riel + """ + KHR -""" -This represents a Connected Account -""" -type ConnectedAccount { """ - Unique identifier for this connected account + Comoro Franc """ - id: String! + KMF """ - The internal database identifier of the Connected Account (ie: 580) + Won """ - legacyId: Int @deprecated(reason: "2020-05-01: should only be used during the transition to GraphQL API v2.") + KRW """ - The date on which the ConnectedAccount was created + Cayman Islands Dollar """ - createdAt: DateTime! + KYD """ - The date on which the ConnectedAccount was last updated + Tenge """ - updatedAt: DateTime! - settings: JSON - service: ConnectedAccountService! -} + KZT -""" -All supported services a user can connect with -""" -enum ConnectedAccountService { - paypal - stripe - stripe_customer - github - twitter - transferwise - privacy - thegivingblock - meetup @deprecated(reason: "Not using this service anymore") -} + """ + Kip + """ + LAK -""" -A collection of "Application" -""" -type OAuthApplicationCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Application] -} + """ + Lebanese Pound + """ + LBP -""" -Stats for the Account -""" -type AccountStats { - id: String + """ + Sri Lanka Rupee + """ + LKR """ - Amount of money in cents in the currency of the collective currently available to spend + Liberian Dollar """ - balanceWithBlockedFunds: Amount! @deprecated(reason: "2022-12-13: Use balance + withBlockedFunds instead") + LRD """ - Amount of money in cents in the currency of the collective + Loti """ - balance( - """ - Calculate amount before this date - """ - dateTo: DateTime + LSL - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false + """ + Moroccan Dirham + """ + MAD - """ - An optional currency. If not provided, will use the collective currency. - """ - currency: Currency + """ + Moldovan Leu + """ + MDL - """ - Remove blocked funds from the balance - """ - withBlockedFunds: Boolean = false - ): Amount! + """ + Malagasy Ariary + """ + MGA """ - The consolidated amount of all the events and projects combined. + Denar """ - consolidatedBalance: Amount! @deprecated(reason: "2022-09-02: Use balance + includeChildren instead") + MKD """ - Average amount spent per month based on the last 90 days + Kyat """ - monthlySpending: Amount! + MMK """ - Total amount spent + Tugrik """ - totalAmountSpent( - """ - Return the net amount (with payment processor fees removed) - """ - net: Boolean = false + MNT - """ - Filter by kind - """ - kind: [TransactionKind] + """ + Pataca + """ + MOP - """ - Calculate amount after this date - """ - dateFrom: DateTime + """ + Mauritius Rupee + """ + MUR - """ - Calculate amount before this date - """ - dateTo: DateTime + """ + Rufiyaa + """ + MVR - """ - Calculate amount for the last x months. Cannot be used with startDate/endDate - """ - periodInMonths: Int + """ + Kwacha + """ + MWK - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false + """ + Mexican Peso + """ + MXN - """ - An optional currency. If not provided, will use the collective currency. - """ - currency: Currency + """ + Malaysian Ringgit + """ + MYR - """ - Include transactions using Gift Cards (not working together with includeChildren) - """ - includeGiftCards: Boolean = false - ): Amount! + """ + Mozambique Metical + """ + MZN """ - Total amount received + Namibia Dollar """ - totalAmountReceived( - """ - Return the net amount (with payment processor fees removed) - """ - net: Boolean = false + NAD - """ - Filter by kind - """ - kind: [TransactionKind] + """ + Naira + """ + NGN - """ - Calculate amount after this date - """ - dateFrom: DateTime + """ + Cordoba Oro + """ + NIO - """ - Calculate amount before this date - """ - dateTo: DateTime + """ + Norwegian Krone + """ + NOK - """ - Calculate amount for the last x months. Cannot be used with startDate/endDate - """ - periodInMonths: Int + """ + Nepalese Rupee + """ + NPR - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false + """ + New Zealand Dollar + """ + NZD - """ - An optional currency. If not provided, will use the collective currency. - """ - currency: Currency + """ + Balboa + """ + PAB - """ - Set this to true to use cached data - """ - useCache: Boolean! = false - @deprecated(reason: "2022-12-14: this is not used anymore as results should be fast by default") - ): Amount! + """ + Nuevo Sol + """ + PEN """ - Total amount received time series + Kina """ - totalAmountReceivedTimeSeries( - """ - The start date of the time series - """ - dateFrom: DateTime + PGK - """ - The end date of the time series - """ - dateTo: DateTime + """ + Philippine Peso + """ + PHP - """ - 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 + """ + Pakistan Rupee + """ + PKR - """ - Return the net amount (with payment processor fees removed) - """ - net: Boolean = false + """ + Zloty + """ + PLN - """ - Filter by kind - """ - kind: [TransactionKind] + """ + Guarani + """ + PYG - """ - Calculate amount for the last x months. Cannot be used with startDate/endDate - """ - periodInMonths: Int + """ + Qatari Rial + """ + QAR - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false + """ + Romanian Leu + """ + RON - """ - An optional currency. If not provided, will use the collective currency. - """ - currency: Currency - ): TimeSeriesAmount! + """ + Serbian Dinar + """ + RSD """ - Total of paid expenses to the account, filter per expense type + Russian Ruble """ - totalPaidExpenses( - """ - Calculate amount after this date - """ - dateFrom: DateTime + RUB - """ - Calculate amount before this date - """ - dateTo: DateTime + """ + Rwanda Franc + """ + RWF - """ - An optional currency. If not provided, will use the collective currency. - """ - currency: Currency + """ + Saudi Riyal + """ + SAR - """ - Filter by ExpenseType - """ - expenseType: [ExpenseType] - ): Amount! - yearlyBudget: Amount! - yearlyBudgetManaged: Amount! + """ + Solomon Islands Dollar + """ + SBD """ - Total net amount received + Seychelles Rupee """ - totalNetAmountReceived( - """ - Filter by kind - """ - kind: [TransactionKind] + SCR - """ - Calculate amount after this date - """ - dateFrom: DateTime + """ + Swedish Krona + """ + SEK - """ - Calculate amount before this date - """ - dateTo: DateTime + """ + Singapore Dollar + """ + SGD - """ - Calculate amount for the last x months. Cannot be used with startDate/endDate - """ - periodInMonths: Int + """ + Saint Helena Pound + """ + SHP - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false - ): Amount! @deprecated(reason: "2022-12-13: Use totalAmountReceived + net=true instead") + """ + Leone + """ + SLL """ - Total net amount received time series + Somali Shilling """ - totalNetAmountReceivedTimeSeries( - """ - The start date of the time series - """ - dateFrom: DateTime + SOS - """ - The end date of the time series - """ - dateTo: DateTime + """ + Surinam Dollar + """ + SRD - """ - 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 + """ + Lilangeni + """ + SZL - """ - Filter by kind - """ - kind: [TransactionKind] + """ + Baht + """ + THB - """ - Calculate amount for the last x months. Cannot be used with startDate/endDate - """ - periodInMonths: Int + """ + Somoni + """ + TJS - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false + """ + Pa’anga + """ + TOP - """ - An optional currency. If not provided, will use the collective currency. - """ - currency: Currency - ): TimeSeriesAmount! @deprecated(reason: "2022-12-13: Use totalAmountReceivedTimeSeries + net=true instead") - activeRecurringContributions: JSON - @deprecated(reason: "2022-10-21: Use activeRecurringContributionsV2 while we migrate to better semantics.") - activeRecurringContributionsV2( - """ - The frequency of the recurring contribution (MONTHLY or YEARLY) - """ - frequency: ContributionFrequency! = MONTHLY - ): Amount + """ + Turkish Lira + """ + TRY """ - Returns expense tags for collective sorted by popularity + Trinidad and Tobago Dollar """ - expensesTags( - limit: Int! = 30 + TTD - """ - Calculate amount after this date - """ - dateFrom: DateTime + """ + New Taiwan Dollar + """ + TWD - """ - Calculate amount before this date - """ - dateTo: DateTime + """ + Tanzanian Shilling + """ + TZS - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false - ): [AmountStats] + """ + Hryvnia + """ + UAH """ - History of the expense tags used by this collective. + Uganda Shilling """ - expensesTagsTimeSeries( - """ - The start date of the time series - """ - dateFrom: DateTime + UGX - """ - The end date of the time series - """ - dateTo: DateTime + """ + Peso Uruguayo + """ + UYU - """ - 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 + """ + Uzbekistan Sum + """ + UZS - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false - ): TimeSeriesAmount! - contributionsCount( - """ - Calculate amount after this date - """ - dateFrom: DateTime + """ + Dong + """ + VND - """ - Calculate amount before this date - """ - dateTo: DateTime + """ + Vatu + """ + VUV - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false - ): Int! - contributorsCount( - """ - Calculate amount after this date - """ - dateFrom: DateTime + """ + Tala + """ + WST - """ - Calculate amount before this date - """ - dateTo: DateTime + """ + CFA Franc BEAC + """ + XAF - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false - ): Int! + """ + East Caribbean Dollar + """ + XCD """ - Return amount stats for contributions (default, and only for now: one-time vs recurring) + CFA Franc BCEAO """ - contributionsAmount( - """ - Calculate amount after this date - """ - dateFrom: DateTime - - """ - Calculate amount before this date - """ - dateTo: DateTime - - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false - ): [AmountStats] + XOF """ - Return amount time series for contributions (default, and only for now: one-time vs recurring) + CFP Franc """ - contributionsAmountTimeSeries( - """ - The start date of the time series - """ - dateFrom: DateTime + XPF - """ - The end date of the time series - """ - dateTo: DateTime + """ + Yemeni Rial + """ + YER - """ - 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 + """ + Rand + """ + ZAR - """ - Include transactions from children (Projects and Events) - """ - includeChildren: Boolean = false - ): TimeSeriesAmount! + """ + Zambian Kwacha + """ + ZMW } """ @@ -4295,7 +4551,7 @@ type TimeSeriesAmountNode { } """ -Statistics aith amounts +Statistics with amounts """ type AmountStats { """ @@ -4321,7 +4577,7 @@ type UpdateCollection implements Collection { offset: Int limit: Int totalCount: Int - nodes: [Update] + nodes: [Update!] } """ @@ -4528,11 +4784,24 @@ type VirtualCardCollection implements Collection { nodes: [VirtualCard] } +""" +The status of a virtual card +""" +enum VirtualCardStatus { + ACTIVE + INACTIVE + CANCELED +} + type Policies { + id: String EXPENSE_AUTHOR_CANNOT_APPROVE: EXPENSE_AUTHOR_CANNOT_APPROVE REQUIRE_2FA_FOR_ADMINS: Boolean + COLLECTIVE_ADMINS_CAN_REFUND: Boolean COLLECTIVE_MINIMUM_ADMINS: COLLECTIVE_MINIMUM_ADMINS MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL: MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL + EXPENSE_CATEGORIZATION: EXPENSE_CATEGORIZATION + EXPENSE_PUBLIC_VENDORS: Boolean } type EXPENSE_AUTHOR_CANNOT_APPROVE { @@ -4565,6 +4834,11 @@ type MAXIMUM_VIRTUAL_CARD_LIMIT_AMOUNT_FOR_INTERVAL { YEARLY: Amount } +type EXPENSE_CATEGORIZATION { + requiredForExpenseSubmitters: Boolean + requiredForCollectiveAdmins: Boolean +} + type ActivitySubscription { """ Unique identifier for this notification setting @@ -4607,7 +4881,6 @@ type ActivitySubscription { All supported Activity channels we can broadcast to """ enum ActivityChannel { - gitter slack twitter webhook @@ -4621,9 +4894,219 @@ type AccountPermissions { id: String! """ - Whether the current user can mark this order as expired + Whether the current user can add funds to this account """ addFunds: Permission! + + """ + Whether the current user can contact this account + """ + contact: Permission! +} + +type Permission { + allowed: Boolean! + reason: String + reasonDetails: JSON +} + +""" +An activity describing something that happened on the platform +""" +type Activity { + """ + Unique identifier for this activity + """ + id: String! + + """ + The type of the activity + """ + type: ActivityType! + + """ + The date on which the ConnectedAccount was created + """ + createdAt: DateTime! + + """ + The account that authored by this activity, if any + """ + fromAccount: Account + + """ + The account targeted by this activity, if any + """ + account: Account + + """ + The host under which this activity happened, if any + """ + host: Host + + """ + The person who triggered the action, if any + """ + individual: Individual + + """ + The expense related to this activity, if any + """ + expense: Expense + + """ + The order related to this activity, if any + """ + order: Order + + """ + The update related to this activity, if any + """ + update: Update + + """ + The transaction related to this activity, if any + """ + transaction: Transaction + + """ + Data attached to this activity (if any) + """ + data: JSON! + + """ + Specifies whether this is a system generated activity + """ + isSystem: Boolean! +} + +enum ActivityType { + ACTIVITY_ALL + ACCOUNTING_CATEGORIES_EDITED + CONNECTED_ACCOUNT_CREATED + CONNECTED_ACCOUNT_ERROR + COLLECTIVE_CREATED_GITHUB + COLLECTIVE_APPLY + COLLECTIVE_APPROVED + COLLECTIVE_REJECTED + COLLECTIVE_CREATED + COLLECTIVE_EDITED + COLLECTIVE_DELETED + COLLECTIVE_UNHOSTED + ORGANIZATION_COLLECTIVE_CREATED + COLLECTIVE_FROZEN + COLLECTIVE_UNFROZEN + COLLECTIVE_CONVERSATION_CREATED + UPDATE_COMMENT_CREATED + EXPENSE_COMMENT_CREATED + CONVERSATION_COMMENT_CREATED + ORDER_COMMENT_CREATED + COLLECTIVE_EXPENSE_CREATED + COLLECTIVE_EXPENSE_DELETED + COLLECTIVE_EXPENSE_UPDATED + COLLECTIVE_EXPENSE_REJECTED + COLLECTIVE_EXPENSE_APPROVED + COLLECTIVE_EXPENSE_RE_APPROVAL_REQUESTED + COLLECTIVE_EXPENSE_UNAPPROVED + COLLECTIVE_EXPENSE_MOVED + COLLECTIVE_EXPENSE_PAID + COLLECTIVE_EXPENSE_MARKED_AS_UNPAID + COLLECTIVE_EXPENSE_MARKED_AS_SPAM + COLLECTIVE_EXPENSE_MARKED_AS_INCOMPLETE + COLLECTIVE_EXPENSE_PROCESSING + COLLECTIVE_EXPENSE_PUT_ON_HOLD + COLLECTIVE_EXPENSE_RELEASED_FROM_HOLD + COLLECTIVE_EXPENSE_SCHEDULED_FOR_PAYMENT + COLLECTIVE_EXPENSE_UNSCHEDULED_FOR_PAYMENT + COLLECTIVE_EXPENSE_ERROR + COLLECTIVE_EXPENSE_INVITE_DRAFTED + COLLECTIVE_EXPENSE_RECURRING_DRAFTED + COLLECTIVE_EXPENSE_MISSING_RECEIPT + TAXFORM_REQUEST + COLLECTIVE_VIRTUAL_CARD_ADDED + COLLECTIVE_VIRTUAL_CARD_MISSING_RECEIPTS + COLLECTIVE_VIRTUAL_CARD_SUSPENDED + COLLECTIVE_VIRTUAL_CARD_SUSPENDED_DUE_TO_INACTIVITY + COLLECTIVE_VIRTUAL_CARD_DELETED + COLLECTIVE_VIRTUAL_CARD_REQUEST_APPROVED + COLLECTIVE_VIRTUAL_CARD_REQUEST_REJECTED + VIRTUAL_CARD_REQUESTED + VIRTUAL_CARD_CHARGE_DECLINED + VIRTUAL_CARD_PURCHASE + COLLECTIVE_MEMBER_INVITED + COLLECTIVE_MEMBER_CREATED + COLLECTIVE_CORE_MEMBER_ADDED + COLLECTIVE_CORE_MEMBER_INVITED + COLLECTIVE_CORE_MEMBER_INVITATION_DECLINED + COLLECTIVE_CORE_MEMBER_REMOVED + COLLECTIVE_CORE_MEMBER_EDITED + COLLECTIVE_TRANSACTION_CREATED + COLLECTIVE_UPDATE_CREATED + COLLECTIVE_UPDATE_PUBLISHED + COLLECTIVE_CONTACT + HOST_APPLICATION_CONTACT + CONTRIBUTION_REJECTED + SUBSCRIPTION_ACTIVATED + SUBSCRIPTION_CANCELED + TICKET_CONFIRMED + ORDER_CANCELED_ARCHIVED_COLLECTIVE + ORDER_PENDING + ORDER_PENDING_CONTRIBUTION_NEW + ORDER_PENDING_CONTRIBUTION_REMINDER + ORDER_PROCESSING + ORDER_PAYMENT_FAILED + ORDER_THANKYOU + VENDOR_CREATED + VENDOR_EDITED + VENDOR_DELETED + ORDER_PENDING_CREATED + ORDER_PENDING_FOLLOWUP + ORDER_PENDING_RECEIVED + ORDERS_SUSPICIOUS + PAYMENT_FAILED + PAYMENT_CREDITCARD_CONFIRMATION + PAYMENT_CREDITCARD_EXPIRING + USER_CREATED + USER_NEW_TOKEN + USER_SIGNIN + USER_RESET_PASSWORD + OAUTH_APPLICATION_AUTHORIZED + TWO_FACTOR_METHOD_ADDED + TWO_FACTOR_METHOD_DELETED + TWO_FACTOR_CODE_REQUESTED + USER_CHANGE_EMAIL + USER_PAYMENT_METHOD_CREATED + USER_PASSWORD_SET + USER_CARD_CLAIMED + USER_CARD_INVITED + WEBHOOK_STRIPE_RECEIVED + WEBHOOK_PAYPAL_RECEIVED + COLLECTIVE_MONTHLY_REPORT + ACTIVATED_COLLECTIVE_AS_HOST + ACTIVATED_COLLECTIVE_AS_INDEPENDENT + DEACTIVATED_COLLECTIVE_AS_HOST + AGREEMENT_CREATED + AGREEMENT_EDITED + AGREEMENT_DELETED + ADDED_FUND_TO_ORG + COLLECTIVE_TRANSACTION_PAID + COLLECTIVE_USER_ADDED + COLLECTIVE_VIRTUAL_CARD_ASSIGNED + COLLECTIVE_VIRTUAL_CARD_CREATED + SUBSCRIPTION_CONFIRMED + COLLECTIVE_COMMENT_CREATED + ORDER_PENDING_CRYPTO + BACKYOURSTACK_DISPATCH_CONFIRMED +} + +enum ActivityClassType { + COLLECTIVE + EXPENSES + CONTRIBUTIONS + ACTIVITIES_UPDATES + VIRTUAL_CARDS + FUND_EVENTS + REPORTS } """ @@ -4647,6 +5130,20 @@ type Webhook { account: Account! } +""" +A collection of "Accounting Categories" +""" +type AccountingCategoryCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + + """ + The Accounting Categories + """ + nodes: [AccountingCategory!]! +} + """ The name of the current plan and its characteristics. """ @@ -4900,6 +5397,14 @@ type TimeSeriesAmountWithKindNode { kind: TransactionKind! } +""" +Stripe connected account properties +""" +type StripeConnectedAccount { + username: String + issuingBalance: Amount +} + """ A collection of "HostApplication" """ @@ -4934,6 +5439,26 @@ enum HostApplicationStatus { EXPIRED } +""" +Input type for an amount with the value and currency +""" +input AmountInput { + """ + The value in plain + """ + value: Float + + """ + The currency string + """ + currency: Currency + + """ + The value in cents + """ + valueInCents: Int +} + """ Contribution statistics related to the given accounts """ @@ -4964,29 +5489,298 @@ Expense statistics related to the given accounts """ type ExpenseStats { """ - The total number of expenses + 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: [Agreement!] +} + +""" +An agreement +""" +type Agreement { + id: String + title: String! + + """ + Additional notes about the agreement for the host admins + """ + notes: String + + """ + The time of creation of this agreement + """ + createdAt: DateTime! + createdBy: Account + account: Account! + host: Host! + expiresAt: DateTime + attachment: FileInfo +} + +""" +A collection of Vendors +""" +type VendorCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Vendor!] +} + +type ExpenseValuesByRole { + id: NonEmptyString! + + """ + The values provided by the expense submitter(s) + """ + submitter: ExpenseValuesRoleDetails + + """ + The values provided by the account admin(s) + """ + accountAdmin: ExpenseValuesRoleDetails + + """ + The values provided by the host admin(s) + """ + hostAdmin: ExpenseValuesRoleDetails +} + +""" +A string that cannot be passed as an empty value +""" +scalar NonEmptyString + +type ExpenseValuesRoleDetails { + accountingCategory: AccountingCategory +} + +enum ExpenseStatus { + DRAFT + UNVERIFIED + PENDING + INCOMPLETE + APPROVED + REJECTED + PROCESSING + ERROR + PAID + SCHEDULED_FOR_PAYMENT + SPAM + CANCELED +} + +""" +Fields for an expense's attached file +""" +type ExpenseAttachedFile { + """ + Unique identifier for this file + """ + id: String! + url: URL + + """ + The file info associated with this item (if any) + """ + info: FileInfo + + """ + The original filename + """ + name: String @deprecated(reason: "2023-01-23: We're moving this field to \"file.name\"") +} + +""" +Fields for an expense item +""" +type ExpenseItem { + """ + Unique identifier for this expense item + """ + id: String! + + """ + Amount of this item + """ + amount: Int! + + """ + The date on which the item was created + """ + createdAt: DateTime! + + """ + The date on which the item was last updated + """ + updatedAt: DateTime! + + """ + The date on which the expense took place + """ + incurredAt: DateTime! + + """ + A description for this item. Enforced for new items, but old expenses may not have one. + """ + description: String + url: URL + + """ + The file associated with this item (if any) + """ + file: FileInfo +} + +""" +All supported expense types +""" +enum FeesPayer { + """ + The collective will be responsible for paying the fees + """ + COLLECTIVE + + """ + The payee will be responsible for paying the fees (they'll be deduced from the total amount) + """ + PAYEE +} + +""" +Fields for the user permissions on an expense +""" +type ExpensePermissions { + id: String! + + """ + Whether the current user can edit the expense + """ + canEdit: Boolean! + + """ + Whether the current user can edit the expense accounting category + """ + canEditAccountingCategory: Boolean! + + """ + Tags permissions are a bit different, and can be edited by admins even if the expense has already been paid + """ + canEditTags: Boolean! + + """ + Whether the current user can edit the expense + """ + canDelete: Boolean! + + """ + Whether the current user can the the invoice info for this expense + """ + canSeeInvoiceInfo: Boolean! + + """ + Whether the current user can trigger the payment for this expense + """ + canPay: Boolean! + + """ + Whether the current user can approve this expense + """ + canApprove: Boolean! + + """ + Whether the current user can unapprove this expense + """ + canUnapprove: Boolean! + + """ + Whether the current user can reject this expense + """ + canReject: Boolean! + + """ + Whether the current user can mark this expense as spam + """ + canMarkAsSpam: Boolean! + + """ + Whether the current user can mark this expense as unpaid + """ + canMarkAsUnpaid: Boolean! + + """ + Whether the current user can mark this expense as incomplete """ - expensesCount: Int! + canMarkAsIncomplete: Boolean! """ - The daily average paid in expenses + Whether the current user can comment and see comments for this expense """ - dailyAverageAmount: Amount! + canComment: Boolean! """ - Number of invoices + Whether the current user can unschedule this expense payment """ - invoicesCount: Int! + canUnschedulePayment: Boolean! """ - Number of reimbursements + Whether the current user can verify this draft expense """ - reimbursementsCount: Int! + canVerifyDraftExpense: Boolean! + canUsePrivateNote: Boolean! + canHold: Boolean! + canRelease: Boolean! + edit: Permission! """ - Number of grants + Whether the current user can edit the expense accounting category """ - grantsCount: Int! + editAccountingCategory: Boolean! + editTags: Permission! + delete: Permission! + seeInvoiceInfo: Permission! + pay: Permission! + approve: Permission! + unapprove: Permission! + reject: Permission! + markAsSpam: Permission! + markAsUnpaid: Permission! + comment: Permission! + usePrivateNote: Permission! + unschedulePayment: Permission! + verifyDraftExpense: Permission! + hold: Permission! + release: Permission! } """ @@ -5148,9 +5942,34 @@ type OrderPermissions { canMarkAsPaid: Boolean! """ - Whether the current user edit this pending order + Whether the current user can edit this pending order """ canEdit: Boolean! + + """ + Whether the current user can comment on this order + """ + canComment: Boolean! + + """ + Whether the current user can see private activities for this order + """ + canSeePrivateActivities: Boolean! + + """ + Whether the current user can set tags on this order + """ + canSetTags: Boolean! +} + +""" +A collection of "Activities" +""" +type ActivityCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [Activity!] } type PendingOrderData { @@ -5193,6 +6012,23 @@ enum TierAmountType { FLEXIBLE } +""" +Stats about a tier +""" +type TierStats { + id: String! + + """ + Total amount donated for this tier, in cents. + """ + totalAmountReceived: Amount! + + """ + How much money is given for this tier for each tier.interval (monthly/yearly). For flexible tiers, this amount is a monthly average of contributions amount, taking into account both yearly and monthly subscriptions. + """ + recurringAmount: Amount! +} + """ A financial amount. """ @@ -5292,6 +6128,11 @@ 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 """ @@ -5528,6 +6369,7 @@ type Bot implements Account { The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! orders( """ @@ -5591,7 +6433,7 @@ type Bot implements Account { dateFrom: DateTime """ - Only return orders that were created after this date + Only return orders that were created before this date """ dateTo: DateTime @@ -5611,6 +6453,114 @@ type Bot implements Account { """ onlyActiveSubscriptions: Boolean ): OrderCollection! + expenses( + direction: ExpenseDirection + + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput + + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput + + """ + Return expenses only for this host + """ + host: AccountReferenceInput + + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput + + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter + + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] + + """ + 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 + + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime + + """ + Only return expenses that were created after this date + """ + dateTo: DateTime + + """ + The term to search + """ + searchTerm: String + + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false + + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -5644,7 +6594,7 @@ type Bot implements Account { payoutMethods: [PayoutMethod] """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ paymentMethods( type: [PaymentMethodType] @@ -5723,7 +6673,8 @@ type Bot implements Account { virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -5758,6 +6709,22 @@ type Bot implements Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] webhooks( """ The number of results to fetch (default 10, max 1000) @@ -5810,6 +6777,11 @@ 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 """ @@ -6025,33 +6997,118 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ Whether to include transactions from children (Events and Projects) """ - includeChildrenTransactions: Boolean! = false + includeChildrenTransactions: Boolean! = false + + """ + Whether to include transactions from Gift Cards issued by the account. + """ + includeGiftCardTransactions: Boolean! = false + + """ + Whether to include debt transactions + """ + includeDebts: Boolean! = false + + """ + To filter by transaction kind + """ + kind: [TransactionKind] + + """ + The transactions group to filter by + """ + group: String + virtualCard: [VirtualCardReferenceInput] + ): TransactionCollection! + orders( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 100 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + If account is a host, also include hosted accounts orders + """ + includeHostedAccounts: Boolean + + """ + Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. + """ + paymentMethod: PaymentMethodReferenceInput + + """ + Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. + """ + includeIncognito: Boolean = false + + """ + Account orders filter (INCOMING or OUTGOING) + """ + filter: AccountOrdersFilter + + """ + Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) + """ + frequency: ContributionFrequency + + """ + Use this field to filter orders on their statuses + """ + status: [OrderStatus] + + """ + The order of results + """ + orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } + + """ + Only return orders where the amount is greater than or equal to this value (in cents) + """ + minAmount: Int + + """ + Only return orders where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return orders that were created after this date + """ + dateFrom: DateTime """ - Whether to include transactions from Gift Cards issued by the account. + Only return orders that were created before this date """ - includeGiftCardTransactions: Boolean! = false + dateTo: DateTime """ - Whether to include debt transactions + The term to search """ - includeDebts: Boolean! = false + searchTerm: String + tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") """ - To filter by transaction kind + Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. """ - kind: [TransactionKind] + onlySubscriptions: Boolean """ - The transactions group to filter by + Same as onlySubscriptions, but returns only orders with active subscriptions """ - group: String - ): TransactionCollection! - orders( + onlyActiveSubscriptions: Boolean + ): OrderCollection! + expenses( + direction: ExpenseDirection + """ The number of results to fetch (default 10, max 1000) """ - limit: Int! = 100 + limit: Int! = 10 """ The offset to use to fetch @@ -6059,34 +7116,44 @@ type Collective implements Account & AccountWithHost & AccountWithContributions offset: Int! = 0 """ - If account is a host, also include hosted accounts orders + Reference of an account that is the payee of an expense """ - includeHostedAccounts: Boolean + fromAccount: AccountReferenceInput """ - Only return orders that were paid with this payment method. Must be an admin of the account owning the payment method. + Reference of an account that is the payer of an expense """ - paymentMethod: PaymentMethodReferenceInput + account: AccountReferenceInput """ - Whether to include incognito orders. Must be admin or root. Only with filter null or OUTGOING. + Return expenses only for this host """ - includeIncognito: Boolean = false + host: AccountReferenceInput """ - Account orders filter (INCOMING or OUTGOING) + Return expenses only created by this INDIVIDUAL account """ - filter: AccountOrdersFilter + createdByAccount: AccountReferenceInput """ - Use this field to filter orders on their frequency (ONETIME, MONTHLY or YEARLY) + Use this field to filter expenses on their statuses """ - frequency: ContributionFrequency + status: ExpenseStatusFilter """ - Use this field to filter orders on their statuses + Use this field to filter expenses on their type (RECEIPT/INVOICE) """ - status: [OrderStatus] + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] """ The order of results @@ -6094,22 +7161,27 @@ type Collective implements Account & AccountWithHost & AccountWithContributions orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } """ - Only return orders where the amount is greater than or equal to this value (in cents) + Only return expenses where the amount is greater than or equal to this value (in cents) """ minAmount: Int """ - Only return orders where the amount is lower than or equal to this value (in cents) + Only return expenses where the amount is lower than or equal to this value (in cents) """ maxAmount: Int """ - Only return orders that were created after this date + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date """ dateFrom: DateTime """ - Only return orders that were created after this date + Only return expenses that were created after this date """ dateTo: DateTime @@ -6117,18 +7189,27 @@ type Collective implements Account & AccountWithHost & AccountWithContributions The term to search """ searchTerm: String - tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") """ - Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + Whether to include expenses from children of the account (Events and Projects) """ - onlySubscriptions: Boolean + includeChildrenExpenses: Boolean! = false """ - Same as onlySubscriptions, but returns only orders with active subscriptions + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. """ - onlyActiveSubscriptions: Boolean - ): OrderCollection! + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -6162,7 +7243,7 @@ type Collective implements Account & AccountWithHost & AccountWithContributions payoutMethods: [PayoutMethod] """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ paymentMethods( type: [PaymentMethodType] @@ -6241,7 +7322,8 @@ type Collective implements Account & AccountWithHost & AccountWithContributions virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -6276,6 +7358,22 @@ type Collective implements Account & AccountWithHost & AccountWithContributions Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] webhooks( """ The number of results to fetch (default 10, max 1000) @@ -6319,6 +7417,21 @@ type Collective implements Account & AccountWithHost & AccountWithContributions """ isApproved: Boolean! + """ + Returns agreements this account has with its host, or null if not enough permissions. + """ + hostAgreements( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 30 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): AgreementCollection + """ Number of unique financial contributors. """ @@ -6401,6 +7514,21 @@ interface AccountWithHost { Returns whether it's active: can accept financial contributions and pay expenses. """ isActive: Boolean! + + """ + Returns agreements this account has with its host, or null if not enough permissions. + """ + hostAgreements( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 30 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): AgreementCollection } """ @@ -6436,12 +7564,22 @@ type Credit implements Transaction { 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 ): Amount! netAmountInHostCurrency( """ 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 ): Amount! taxAmount: Amount! @@ -6460,7 +7598,12 @@ type Credit implements Transaction { """ Payment Processor Fee (usually in host currency) """ - paymentProcessorFee: Amount! + paymentProcessorFee( + """ + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. + """ + fetchPaymentProcessorFee: Boolean = false + ): Amount! host: Account """ @@ -6496,6 +7639,11 @@ type Credit implements Transaction { permissions: TransactionPermissions! isOrderRejected: Boolean! refundTransaction: Transaction + + """ + The opposite transaction (CREDIT -> DEBIT, DEBIT -> CREDIT) + """ + oppositeTransaction: Transaction relatedTransactions( """ Filter by kind @@ -6544,12 +7692,22 @@ type Debit implements Transaction { 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 ): Amount! netAmountInHostCurrency( """ 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 ): Amount! taxAmount: Amount! @@ -6568,7 +7726,12 @@ type Debit implements Transaction { """ Payment Processor Fee (usually in host currency) """ - paymentProcessorFee: Amount! + paymentProcessorFee( + """ + Fetch PAYMENT_PROCESSOR_FEE transaction for retro-compatiblity. + """ + fetchPaymentProcessorFee: Boolean = false + ): Amount! host: Account """ @@ -6604,6 +7767,11 @@ type Debit implements Transaction { permissions: TransactionPermissions! isOrderRejected: Boolean! refundTransaction: Transaction + + """ + The opposite transaction (CREDIT -> DEBIT, DEBIT -> CREDIT) + """ + oppositeTransaction: Transaction relatedTransactions( """ Filter by kind @@ -6657,6 +7825,11 @@ 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 """ @@ -6893,6 +8066,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! orders( """ @@ -6956,26 +8130,134 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc dateFrom: DateTime """ - Only return orders that were created after this date + Only return orders that were created before this date + """ + dateTo: DateTime + + """ + The term to search + """ + searchTerm: String + tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") + + """ + Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + """ + onlySubscriptions: Boolean + + """ + Same as onlySubscriptions, but returns only orders with active subscriptions + """ + onlyActiveSubscriptions: Boolean + ): OrderCollection! + expenses( + direction: ExpenseDirection + + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput + + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput + + """ + Return expenses only for this host + """ + host: AccountReferenceInput + + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput + + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter + + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] + + """ + 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 + + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime + + """ + Only return expenses that were created after this date """ dateTo: DateTime """ The term to search """ - searchTerm: String - tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") + searchTerm: String + + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false + + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON """ - Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + Filter expenses of type charges based on presence of receipts """ - onlySubscriptions: Boolean + chargeHasReceipts: Boolean """ - Same as onlySubscriptions, but returns only orders with active subscriptions + Filter expenses of type charges using these virtual cards """ - onlyActiveSubscriptions: Boolean - ): OrderCollection! + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -7009,7 +8291,7 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc payoutMethods: [PayoutMethod] """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ paymentMethods( type: [PaymentMethodType] @@ -7088,7 +8370,8 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -7123,6 +8406,22 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] webhooks( """ The number of results to fetch (default 10, max 1000) @@ -7166,6 +8465,21 @@ type Event implements Account & AccountWithHost & AccountWithContributions & Acc """ isApproved: Boolean! + """ + Returns agreements this account has with its host, or null if not enough permissions. + """ + hostAgreements( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 30 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): AgreementCollection + """ Number of unique financial contributors. """ @@ -7380,6 +8694,11 @@ 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 """ @@ -7616,6 +8935,7 @@ type Individual implements Account { The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! orders( """ @@ -7679,7 +8999,7 @@ type Individual implements Account { dateFrom: DateTime """ - Only return orders that were created after this date + Only return orders that were created before this date """ dateTo: DateTime @@ -7699,6 +9019,114 @@ type Individual implements Account { """ onlyActiveSubscriptions: Boolean ): OrderCollection! + expenses( + direction: ExpenseDirection + + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput + + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput + + """ + Return expenses only for this host + """ + host: AccountReferenceInput + + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput + + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter + + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] + + """ + 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 + + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime + + """ + Only return expenses that were created after this date + """ + dateTo: DateTime + + """ + The term to search + """ + searchTerm: String + + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false + + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -7732,7 +9160,7 @@ type Individual implements Account { payoutMethods: [PayoutMethod] """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ paymentMethods( type: [PaymentMethodType] @@ -7809,7 +9237,8 @@ type Individual implements Account { virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -7844,6 +9273,22 @@ type Individual implements Account { Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] webhooks( """ The number of results to fetch (default 10, max 1000) @@ -7870,7 +9315,7 @@ type Individual implements Account { If the individual is a host account, this will return the matching Host object """ host: Host - hasSeenLatestChangelogEntry: Boolean! + hasSeenLatestChangelogEntry: Boolean oAuthAuthorizations( """ The number of results to fetch (default 10, max 1000) @@ -7902,6 +9347,11 @@ type Individual implements Account { Has the account a password set? For authenticated user: scope: "account". """ hasPassword: Boolean + + """ + User two factor methods + """ + twoFactorMethods: [UserTwoFactorMethod] } """ @@ -7967,6 +9417,32 @@ type PersonalToken { The date on which the personal token was last updated """ updatedAt: DateTime + + """ + Whether this token is allowed to directly use operations that would normally require 2FA + """ + preAuthorize2FA: Boolean! +} + +""" +User two factor authentication method +""" +type UserTwoFactorMethod { + id: String! + method: TwoFactorMethod! + name: String! + createdAt: DateTime! + description: String + icon: String +} + +""" +A two factor authentication method +""" +enum TwoFactorMethod { + TOTP + YUBIKEY_OTP + WEBAUTHN } """ @@ -8073,6 +9549,11 @@ 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 """ @@ -8309,6 +9790,7 @@ type Organization implements Account & AccountWithContributions { The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! orders( """ @@ -8357,22 +9839,121 @@ type Organization implements Account & AccountWithContributions { orderBy: ChronologicalOrderInput! = { field: CREATED_AT, direction: DESC } """ - Only return orders where the amount is greater than or equal to this value (in cents) + Only return orders where the amount is greater than or equal to this value (in cents) + """ + minAmount: Int + + """ + Only return orders where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return orders that were created after this date + """ + dateFrom: DateTime + + """ + Only return orders that were created before this date + """ + dateTo: DateTime + + """ + The term to search + """ + searchTerm: String + tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") + + """ + Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + """ + onlySubscriptions: Boolean + + """ + Same as onlySubscriptions, but returns only orders with active subscriptions + """ + onlyActiveSubscriptions: Boolean + ): OrderCollection! + expenses( + direction: ExpenseDirection + + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput + + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput + + """ + Return expenses only for this host + """ + host: AccountReferenceInput + + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput + + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter + + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] + + """ + 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 """ - Only return orders where the amount is lower than or equal to this value (in cents) + Only return expenses where the amount is lower than or equal to this value (in cents) """ maxAmount: Int """ - Only return orders that were created after this date + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date """ dateFrom: DateTime """ - Only return orders that were created after this date + Only return expenses that were created after this date """ dateTo: DateTime @@ -8380,18 +9961,27 @@ type Organization implements Account & AccountWithContributions { The term to search """ searchTerm: String - tierSlug: String @deprecated(reason: "2022-02-25: Should be replaced by a tier reference. Not existing yet.") """ - Only returns orders that have a subscription (monthly/yearly). Don't use together with frequency. + Whether to include expenses from children of the account (Events and Projects) """ - onlySubscriptions: Boolean + includeChildrenExpenses: Boolean! = false """ - Same as onlySubscriptions, but returns only orders with active subscriptions + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. """ - onlyActiveSubscriptions: Boolean - ): OrderCollection! + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -8425,7 +10015,7 @@ type Organization implements Account & AccountWithContributions { payoutMethods: [PayoutMethod] """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ paymentMethods( type: [PaymentMethodType] @@ -8502,7 +10092,8 @@ type Organization implements Account & AccountWithContributions { virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -8537,6 +10128,22 @@ type Organization implements Account & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] webhooks( """ The number of results to fetch (default 10, max 1000) @@ -8600,7 +10207,7 @@ type Organization implements Account & AccountWithContributions { email: String @deprecated(reason: "2022-07-18: This field is deprecated and will return null") """ - If the organization if a host account, this will return the matching Host object + If the organization is a host account, this will return the matching Host object """ host: Host } @@ -8630,6 +10237,12 @@ type TransferWise { """ ignoreBlockedCurrencies: Boolean ): [JSONObject] + + """ + Transferwise balances. Returns null if Transferwise account is not connected. + """ + balances: [Amount] + amountBatched: Amount } type TransferWiseRequiredField { @@ -8671,7 +10284,7 @@ scalar JSONObject """ This represents a Vendor account """ -type Vendor implements Account & AccountWithHost & AccountWithContributions { +type Vendor implements Account & AccountWithContributions { id: String! legacyId: Int! @@ -8706,6 +10319,11 @@ type Vendor 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 """ @@ -8725,9 +10343,9 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { isFrozen: Boolean! """ - Returns whether it's active: can accept financial contributions and pay expenses. + Returns whether the account accepts financial contributions. """ - isActive: Boolean! + isActive: Boolean """ Returns whether the account is setup to Host collectives. @@ -8942,6 +10560,7 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! orders( """ @@ -9005,7 +10624,7 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { dateFrom: DateTime """ - Only return orders that were created after this date + Only return orders that were created before this date """ dateTo: DateTime @@ -9025,6 +10644,114 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { """ onlyActiveSubscriptions: Boolean ): OrderCollection! + expenses( + direction: ExpenseDirection + + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput + + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput + + """ + Return expenses only for this host + """ + host: AccountReferenceInput + + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput + + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter + + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] + + """ + 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 + + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime + + """ + Only return expenses that were created after this date + """ + dateTo: DateTime + + """ + The term to search + """ + searchTerm: String + + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false + + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -9058,7 +10785,7 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { payoutMethods: [PayoutMethod] """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ paymentMethods( type: [PaymentMethodType] @@ -9137,7 +10864,8 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -9172,6 +10900,22 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] webhooks( """ The number of results to fetch (default 10, max 1000) @@ -9185,36 +10929,6 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { account: AccountReferenceInput! ): WebhookCollection! - """ - Returns the Fiscal Host - """ - host: Host - - """ - Describe how the host charges the collective - """ - hostFeesStructure: HostFeeStructure - - """ - Fees percentage that the host takes for this collective - """ - hostFeePercent(paymentMethodService: PaymentMethodService, paymentMethodType: PaymentMethodType): Float - - """ - How much platform fees are charged for this account - """ - platformFeePercent: Float! - - """ - Date of approval by the Fiscal Host. - """ - approvedAt: DateTime - - """ - Returns whether it's approved by the Fiscal Host - """ - isApproved: Boolean! - """ Number of unique financial contributors. """ @@ -9252,11 +10966,42 @@ type Vendor implements Account & AccountWithHost & AccountWithContributions { 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 + vendorInfo: VendorInfo + + """ + The account who created this order + """ + createdByAccount: Account +} + +""" +Some context about the vendor +""" +type VendorInfo { + contact: VendorContact + taxFormUrl: String + taxFormRequired: Boolean + taxType: String + taxId: String + notes: String +} + +""" +Some context about the vendor contact person +""" +type VendorContact { + name: String + email: String } """ @@ -9265,11 +11010,12 @@ A Virtual Card used to pay expenses type VirtualCard { id: String account: Account - host: Account + host: Host assignee: Individual name: String last4: String data: JSONObject + status: VirtualCardStatus privateData: JSONObject provider: String spendingLimitAmount: Int @@ -9277,6 +11023,7 @@ type VirtualCard { spendingLimitRenewsOn: DateTime remainingLimit: Int currency: Currency + virtualCardRequest: VirtualCardRequest createdAt: DateTime updatedAt: DateTime } @@ -9290,6 +11037,34 @@ enum VirtualCardLimitInterval { ALL_TIME } +""" +A Virtual Card request +""" +type VirtualCardRequest { + id: String! + legacyId: Int + purpose: String + notes: String + status: VirtualCardRequestStatus + currency: Currency + spendingLimitAmount: Amount + spendingLimitInterval: VirtualCardLimitInterval + assignee: Individual + host: Host + account: Account + createdAt: DateTime + updatedAt: DateTime +} + +""" +The status of a virtual card request +""" +enum VirtualCardRequestStatus { + APPROVED + REJECTED + PENDING +} + """ This is the root query """ @@ -9342,57 +11117,54 @@ type Query { tagSearchOperator: TagSearchOperator! = AND """ - Host hosting the account - """ - host: [AccountReferenceInput] - - """ - Only return accounts that match these account types (COLLECTIVE, FUND, EVENT, PROJECT, ORGANIZATION or INDIVIDUAL) + Included collectives which are archived """ - type: [AccountType] + includeArchived: Boolean """ - Only return Fiscal Hosts accounts if true + Only return "active" accounts with Financial Contributions enabled if true. """ - isHost: Boolean + isActive: Boolean """ - Included collectives which are archived + Whether to skip recent suspicious accounts (48h) """ - includeArchived: Boolean + skipRecentAccounts: Boolean = false """ - Only return "active" accounts with Financial Contributions enabled if true. + Limit the search to collectives belonging to these countries """ - isActive: Boolean + country: [CountryISO] """ - Only accounts with custom contribution (/donate) enabled + Host hosting the account """ - hasCustomContributionsEnabled: Boolean + host: [AccountReferenceInput] """ - Only accounts that support one of these payment services will be returned + Only return accounts that match these account types (COLLECTIVE, FUND, EVENT, PROJECT, ORGANIZATION or INDIVIDUAL) """ - supportedPaymentMethodService: [PaymentMethodService] - @deprecated( - reason: "2022-04-22: Introduced for Hacktoberfest. Reference: https://github.com/opencollective/opencollective-api/pull/7440#issuecomment-1121504508" - ) + type: [AccountType] """ - Whether to skip recent suspicious accounts (48h) + Only return Fiscal Hosts accounts if true """ - skipRecentAccounts: Boolean = false + isHost: Boolean """ - Limit the search to collectives belonging to these countries + Only accounts with custom contribution (/donate) enabled """ - country: [CountryISO] + hasCustomContributionsEnabled: Boolean """ The order of results. Defaults to [RANK, DESC] (or [CREATED_AT, DESC] if `supportedPaymentMethodService` is provided) """ orderBy: OrderByInput + + """ + Include vendors for this host + """ + includeVendorsForHost: AccountReferenceInput ): AccountCollection! activities( """ @@ -9439,6 +11211,11 @@ type Query { Only return activities that are of this class/type """ type: [ActivityAndClassesType!] = null + + """ + If true, return the timeline of activities for this account + """ + timeline: Boolean! = false ): ActivityCollection! application( """ @@ -9610,7 +11387,40 @@ type Query { Whether to include expenses from children of the account (Events and Projects) """ includeChildrenExpenses: Boolean! = false + + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] ): ExpenseCollection! + expenseTagStats( + """ + Return tags which includes this search term. + """ + tagSearchTerm: String + + """ + Return tags from expenses to accounts hosted by this account. Can not be used together with "account". + """ + host: AccountReferenceInput + + """ + Return tags from expenses to this account. Can not be used together with "host". + """ + account: AccountReferenceInput + limit: Int! = 10 + offset: Int! = 0 + ): TagStatsCollection! fund( """ The public id identifying the Fund (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) @@ -9665,14 +11475,45 @@ type Query { offset: Int! = 0 """ - Filter hosts by tags (multiple = OR) + Search accounts related to this term based on name, description, tags, slug, and location """ - tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + searchTerm: String """ - Filter hosts by tags (multiple = OR) + Only accounts that match these tags """ tag: [String] + + """ + Operator to use when searching with tags. Defaults to 'AND' + """ + tagSearchOperator: TagSearchOperator! = AND + + """ + Included collectives which are archived + """ + includeArchived: Boolean + + """ + Only return "active" accounts with Financial Contributions enabled if true. + """ + isActive: Boolean + + """ + Whether to skip recent suspicious accounts (48h) + """ + skipRecentAccounts: Boolean = false + + """ + Limit the search to collectives belonging to these countries + """ + country: [CountryISO] + currency: String + + """ + Filter hosts by tags (multiple = OR) + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") ): HostCollection individual( """ @@ -9788,7 +11629,7 @@ type Query { dateFrom: DateTime """ - Only return orders that were created after this date + Only return orders that were created before this date """ dateTo: DateTime @@ -9879,6 +11720,16 @@ type Query { """ throwIfMissing: Boolean! = true ): Tier + + """ + Fetch a single transaction + """ + transaction( + """ + The public id identifying the transaction (ie: rvelja97-pkzqbgq7-bbzyx6wd-50o8n4rm) + """ + id: String + ): Transaction transactions( """ Reference of the account(s) assigned to the main side of the transaction (CREDIT -> recipient, DEBIT -> sender) @@ -9994,6 +11845,7 @@ type Query { The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! update( """ @@ -10036,7 +11888,7 @@ type Query { Host for the accounts for which to get updates """ host: [AccountReferenceInput] - ): UpdatesCollection! + ): UpdateCollection! paypalPlan( """ The account that serves as a payment target @@ -10069,6 +11921,46 @@ type Query { """ legacyId: Int ): PersonalToken + virtualCard( + """ + Identifiers to retrieve the virtual card + """ + virtualCard: VirtualCardReferenceInput! + + """ + If true, an error will be returned if the virtual card is missing + """ + throwIfMissing: Boolean! = true + ): VirtualCard + virtualCardRequest( + """ + Identifiers to retrieve the virtual card request + """ + virtualCardRequest: VirtualCardRequestReferenceInput! + + """ + If true, an error will be returned if the virtual card request is missing + """ + throwIfMissing: Boolean! = true + ): VirtualCardRequest + virtualCardRequests( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Host for the accounts for which to get virtual card requests + """ + host: AccountReferenceInput! + status: [VirtualCardRequestStatus] + collective: [AccountReferenceInput] + ): VirtualCardRequestCollection! loggedInAccount: Individual me: Individual } @@ -11316,18 +13208,9 @@ enum CountryISO { EH } -""" -A collection of "Activities" -""" -type ActivityCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Activity!] -} - enum ActivityAndClassesType { ACTIVITY_ALL + ACCOUNTING_CATEGORIES_EDITED CONNECTED_ACCOUNT_CREATED CONNECTED_ACCOUNT_ERROR COLLECTIVE_CREATED_GITHUB @@ -11345,11 +13228,13 @@ enum ActivityAndClassesType { UPDATE_COMMENT_CREATED EXPENSE_COMMENT_CREATED CONVERSATION_COMMENT_CREATED + ORDER_COMMENT_CREATED COLLECTIVE_EXPENSE_CREATED COLLECTIVE_EXPENSE_DELETED COLLECTIVE_EXPENSE_UPDATED COLLECTIVE_EXPENSE_REJECTED COLLECTIVE_EXPENSE_APPROVED + COLLECTIVE_EXPENSE_RE_APPROVAL_REQUESTED COLLECTIVE_EXPENSE_UNAPPROVED COLLECTIVE_EXPENSE_MOVED COLLECTIVE_EXPENSE_PAID @@ -11357,6 +13242,8 @@ enum ActivityAndClassesType { COLLECTIVE_EXPENSE_MARKED_AS_SPAM COLLECTIVE_EXPENSE_MARKED_AS_INCOMPLETE COLLECTIVE_EXPENSE_PROCESSING + COLLECTIVE_EXPENSE_PUT_ON_HOLD + COLLECTIVE_EXPENSE_RELEASED_FROM_HOLD COLLECTIVE_EXPENSE_SCHEDULED_FOR_PAYMENT COLLECTIVE_EXPENSE_UNSCHEDULED_FOR_PAYMENT COLLECTIVE_EXPENSE_ERROR @@ -11367,7 +13254,10 @@ enum ActivityAndClassesType { COLLECTIVE_VIRTUAL_CARD_ADDED COLLECTIVE_VIRTUAL_CARD_MISSING_RECEIPTS COLLECTIVE_VIRTUAL_CARD_SUSPENDED + COLLECTIVE_VIRTUAL_CARD_SUSPENDED_DUE_TO_INACTIVITY COLLECTIVE_VIRTUAL_CARD_DELETED + COLLECTIVE_VIRTUAL_CARD_REQUEST_APPROVED + COLLECTIVE_VIRTUAL_CARD_REQUEST_REJECTED VIRTUAL_CARD_REQUESTED VIRTUAL_CARD_CHARGE_DECLINED VIRTUAL_CARD_PURCHASE @@ -11389,17 +13279,18 @@ enum ActivityAndClassesType { TICKET_CONFIRMED ORDER_CANCELED_ARCHIVED_COLLECTIVE ORDER_PENDING - ORDER_PENDING_CRYPTO ORDER_PENDING_CONTRIBUTION_NEW ORDER_PENDING_CONTRIBUTION_REMINDER ORDER_PROCESSING ORDER_PAYMENT_FAILED ORDER_THANKYOU + VENDOR_CREATED + VENDOR_EDITED + VENDOR_DELETED ORDER_PENDING_CREATED ORDER_PENDING_FOLLOWUP ORDER_PENDING_RECEIVED ORDERS_SUSPICIOUS - BACKYOURSTACK_DISPATCH_CONFIRMED PAYMENT_FAILED PAYMENT_CREDITCARD_CONFIRMATION PAYMENT_CREDITCARD_EXPIRING @@ -11408,8 +13299,9 @@ enum ActivityAndClassesType { USER_SIGNIN USER_RESET_PASSWORD OAUTH_APPLICATION_AUTHORIZED - TWO_FACTOR_CODE_ADDED - TWO_FACTOR_CODE_DELETED + TWO_FACTOR_METHOD_ADDED + TWO_FACTOR_METHOD_DELETED + TWO_FACTOR_CODE_REQUESTED USER_CHANGE_EMAIL USER_PAYMENT_METHOD_CREATED USER_PASSWORD_SET @@ -11421,6 +13313,9 @@ enum ActivityAndClassesType { ACTIVATED_COLLECTIVE_AS_HOST ACTIVATED_COLLECTIVE_AS_INDEPENDENT DEACTIVATED_COLLECTIVE_AS_HOST + AGREEMENT_CREATED + AGREEMENT_EDITED + AGREEMENT_DELETED ADDED_FUND_TO_ORG COLLECTIVE_TRANSACTION_PAID COLLECTIVE_USER_ADDED @@ -11428,6 +13323,8 @@ enum ActivityAndClassesType { COLLECTIVE_VIRTUAL_CARD_CREATED SUBSCRIPTION_CONFIRMED COLLECTIVE_COMMENT_CREATED + ORDER_PENDING_CRYPTO + BACKYOURSTACK_DISPATCH_CONFIRMED COLLECTIVE EXPENSES CONTRIBUTIONS @@ -11450,36 +13347,13 @@ input ExpenseReferenceInput { } """ -A collection of "Expenses" +A collection of "Tags" """ -type ExpenseCollection implements Collection { +type TagStatsCollection implements Collection { offset: Int limit: Int totalCount: Int - nodes: [Expense] -} - -""" -Describes the values allowed to filter expenses, namely all the expense statuses and the special "READY_TO_PAY" value. -""" -enum ExpenseStatusFilter { - DRAFT - UNVERIFIED - PENDING - INCOMPLETE - APPROVED - REJECTED - PROCESSING - ERROR - PAID - SCHEDULED_FOR_PAYMENT - SPAM - CANCELED - - """ - Only expenses that are ready to be paid (must be approved, have the sufficiant balance and have the tax forms completed) - """ - READY_TO_PAY + nodes: [TagStat] } """ @@ -11520,6 +13394,11 @@ 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 """ @@ -11756,6 +13635,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! orders( """ @@ -11819,7 +13699,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { dateFrom: DateTime """ - Only return orders that were created after this date + Only return orders that were created before this date """ dateTo: DateTime @@ -11839,6 +13719,114 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ onlyActiveSubscriptions: Boolean ): OrderCollection! + expenses( + direction: ExpenseDirection + + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput + + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput + + """ + Return expenses only for this host + """ + host: AccountReferenceInput + + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput + + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter + + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] + + """ + 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 + + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime + + """ + Only return expenses that were created after this date + """ + dateTo: DateTime + + """ + The term to search + """ + searchTerm: String + + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false + + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -11872,7 +13860,7 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { payoutMethods: [PayoutMethod] """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ paymentMethods( type: [PaymentMethodType] @@ -11951,7 +13939,8 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -11986,6 +13975,22 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] webhooks( """ The number of results to fetch (default 10, max 1000) @@ -12029,6 +14034,21 @@ type Fund implements Account & AccountWithHost & AccountWithContributions { """ isApproved: Boolean! + """ + Returns agreements this account has with its host, or null if not enough permissions. + """ + hostAgreements( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 30 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): AgreementCollection + """ Number of unique financial contributors. """ @@ -12133,6 +14153,11 @@ 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 """ @@ -12369,6 +14394,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A The transactions group to filter by """ group: String + virtualCard: [VirtualCardReferenceInput] ): TransactionCollection! orders( """ @@ -12432,7 +14458,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A dateFrom: DateTime """ - Only return orders that were created after this date + Only return orders that were created before this date """ dateTo: DateTime @@ -12452,6 +14478,114 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ onlyActiveSubscriptions: Boolean ): OrderCollection! + expenses( + direction: ExpenseDirection + + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 10 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + + """ + Reference of an account that is the payee of an expense + """ + fromAccount: AccountReferenceInput + + """ + Reference of an account that is the payer of an expense + """ + account: AccountReferenceInput + + """ + Return expenses only for this host + """ + host: AccountReferenceInput + + """ + Return expenses only created by this INDIVIDUAL account + """ + createdByAccount: AccountReferenceInput + + """ + Use this field to filter expenses on their statuses + """ + status: ExpenseStatusFilter + + """ + Use this field to filter expenses on their type (RECEIPT/INVOICE) + """ + type: ExpenseType + + """ + Only expenses that match these tags + """ + tags: [String] @deprecated(reason: "2020-06-30: Please use tag (singular)") + + """ + Only expenses that match these tags + """ + tag: [String] + + """ + 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 + + """ + Only return expenses where the amount is lower than or equal to this value (in cents) + """ + maxAmount: Int + + """ + Only return expenses that use the given type as payout method + """ + payoutMethodType: PayoutMethodType + + """ + Only return expenses that were created after this date + """ + dateFrom: DateTime + + """ + Only return expenses that were created after this date + """ + dateTo: DateTime + + """ + The term to search + """ + searchTerm: String + + """ + Whether to include expenses from children of the account (Events and Projects) + """ + includeChildrenExpenses: Boolean! = false + + """ + Only return expenses that contains this custom data. Requires being an admin of the collective, payee or host. + """ + customData: JSON + + """ + Filter expenses of type charges based on presence of receipts + """ + chargeHasReceipts: Boolean + + """ + Filter expenses of type charges using these virtual cards + """ + virtualCards: [VirtualCardReferenceInput] + ): ExpenseCollection! settings: JSON! conversations( limit: Int! = 15 @@ -12485,7 +14619,7 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A payoutMethods: [PayoutMethod] """ - The list of payment methods that this collective can use to pay for Orders. Admin only. Scope: "orders". + The list of payment methods that this collective can use to pay for Orders. Admin or Host only. Scope: "orders". """ paymentMethods( type: [PaymentMethodType] @@ -12564,7 +14698,8 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A virtualCards( limit: Int! = 100 offset: Int! = 0 - state: String = null + state: String = null @deprecated(reason: "2023-11-06: Please use status.") + status: [VirtualCardStatus] merchantAccount: AccountReferenceInput = null """ @@ -12599,6 +14734,22 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A Logged-in user permissions on an account """ permissions: AccountPermissions! + 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] webhooks( """ The number of results to fetch (default 10, max 1000) @@ -12642,6 +14793,21 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A """ isApproved: Boolean! + """ + Returns agreements this account has with its host, or null if not enough permissions. + """ + hostAgreements( + """ + The number of results to fetch (default 10, max 1000) + """ + limit: Int! = 30 + + """ + The offset to use to fetch + """ + offset: Int! = 0 + ): AgreementCollection + """ Number of unique financial contributors. """ @@ -12691,16 +14857,6 @@ type Project implements Account & AccountWithHost & AccountWithContributions & A parent: Account } -""" -A collection of "Tags" -""" -type TagStatsCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [TagStat] -} - input TierReferenceInput { """ The id assigned to the Tier @@ -12718,16 +14874,6 @@ input TierReferenceInput { isCustom: Boolean } -""" -A collection of "Updates" -""" -type UpdatesCollection implements Collection { - offset: Int - limit: Int - totalCount: Int - nodes: [Update!] -} - """ A PayPal plan to associate with a contribution """ @@ -12735,24 +14881,19 @@ type PaypalPlan { id: String! } +input VirtualCardRequestReferenceInput { + id: String + legacyId: Int +} + """ -Input type for an amount with the value and currency +A collection of "VirtualCardRequest" """ -input AmountInput { - """ - The value in plain - """ - value: Float - - """ - The currency string - """ - currency: Currency - - """ - The value in cents - """ - valueInCents: Int +type VirtualCardRequestCollection implements Collection { + offset: Int + limit: Int + totalCount: Int + nodes: [VirtualCardRequest!] } """ @@ -12763,15 +14904,55 @@ 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 - hostFeePercent: Float + + """ + The invoice template to use for this order + """ invoiceTemplate: String + + """ + The tax to apply to the order + """ + tax: TaxInput ): Order! """ @@ -12862,6 +15043,11 @@ type Mutation { Information about the organization to create (name, slug, description, website, ...) """ organization: OrganizationCreateInput! + + """ + List of members to invite on Organization creation. + """ + inviteMembers: [InviteMemberInput] ): Organization """ @@ -12935,6 +15121,16 @@ type Mutation { message: String ): Account! + """ + Create WebAuthn public key registration request options + """ + createWebAuthnRegistrationOptions( + """ + Account that will create a WebAuthn registration + """ + account: AccountReferenceInput! + ): JSON! + """ Add 2FA to the Individual if it does not have it. Scope: "account". """ @@ -12944,25 +15140,56 @@ type Mutation { """ account: AccountReferenceInput! + """ + The two factor method to add, defaults to TOTP + """ + type: TwoFactorMethod + """ The generated secret to save to the Individual """ - token: String! - ): AddTwoFactorAuthTokenToIndividualResponse! + token: String! + ): AddTwoFactorAuthTokenToIndividualResponse! + + """ + Remove 2FA from the Individual if it has been enabled. Scope: "account". + """ + removeTwoFactorAuthTokenFromIndividual( + """ + Method to remove from this account + """ + userTwoFactorMethod: UserTwoFactorMethodReferenceInput + + """ + Account that will have 2FA removed from it + """ + account: AccountReferenceInput! + + """ + The two factor method to remove. Removes all if empty + """ + type: TwoFactorMethod + @deprecated(reason: "2023-08-01: Use the two factor method reference to specify method to remove") + + """ + The 6-digit 2FA code + """ + code: String @deprecated(reason: "2023-08-01: 2FA code to validate this action must be set via 2FA header") + ): Individual! """ - Remove 2FA from the Individual if it has been enabled. Scope: "account". + Edit 2FA method """ - removeTwoFactorAuthTokenFromIndividual( + editTwoFactorAuthenticationMethod( """ - Account that will have 2FA removed from it + Method to edit """ - account: AccountReferenceInput! + userTwoFactorMethod: UserTwoFactorMethodReferenceInput! """ - The 6-digit 2FA code + New name for the method """ - code: String! + name: String ): Individual! """ @@ -13015,6 +15242,26 @@ type Mutation { message: NonEmptyString! subject: String ): SendMessageResult + + """ + Regenerate two factor authentication recovery codes + """ + regenerateRecoveryCodes: [String!] + + """ + Edit an accounting category. Returns the account with the updated categories. + """ + editAccountingCategories( + """ + The host to edit accounting categories for + """ + account: AccountReferenceInput! + + """ + The list of categories to edit + """ + categories: [AccountingCategoryInput!]! + ): Account! createApplication(application: ApplicationCreateInput!): Application updateApplication(application: ApplicationUpdateInput!): Application deleteApplication(application: ApplicationReferenceInput!): Application @@ -13072,7 +15319,12 @@ type Mutation { """ ID of the Collective where the conversation will be created """ - CollectiveId: String! + CollectiveId: String @deprecated(reason: "2023-07-18: Please use `account` instead") + + """ + Account where the conversation will be created + """ + account: AccountReferenceInput """ A list of tags for this conversation @@ -13239,21 +15491,6 @@ type Mutation { expense: ExpenseReferenceInput! ): Expense! - """ - To verify and unverified expense. Scope: "expenses". - """ - verifyExpense( - """ - Reference of the expense to process - """ - expense: ExpenseReferenceInput! - - """ - Expense draft key if invited to submit expense - """ - draftKey: String - ): Expense! - """ Sends an email for guest to confirm their emails and create their Open Collective account """ @@ -13429,6 +15666,26 @@ type Mutation { accept: Boolean! ): Boolean! + """ + Follows a given Collective. Scope: "account" + """ + followAccount( + """ + user will follow this account + """ + account: AccountReferenceInput! + ): FollowAccountResult! + + """ + Unfollows a given Collective. Scope: "account" + """ + unfollowAccount( + """ + account to unfollow + """ + account: AccountReferenceInput! + ): UnfollowAccountResult! + """ Edit the public message for the given Member of a Collective. Scope: "account". """ @@ -13624,7 +15881,7 @@ type Mutation { """ Creates a Stripe payment intent """ - createPaymentIntent(paymentIntent: PaymentIntentInput!): PaymentIntent! + createPaymentIntent(paymentIntent: PaymentIntentInput!, guestInfo: GuestInfoInput): PaymentIntent! """ To submit a new order. Scope: "orders". @@ -13711,6 +15968,16 @@ type Mutation { isTwoFactorAuthEnabled: Boolean ): Account! + """ + [Root only] Edits account type from User to Organization + """ + editAccountType( + """ + Account to change the type for + """ + account: AccountReferenceInput! + ): Account! + """ [Root only] Clears the cache for a given account """ @@ -13782,20 +16049,24 @@ type Mutation { ): [Expense]! """ - Add platform tips to a transaction. Scope: "transactions". + [Root only] A mutation to set the tax from for an account. """ - addPlatformTipToTransaction( + setTaxForm( """ - Reference to the transaction in the platform tip + Reference to the Account the tax form should be set. """ - transaction: TransactionReferenceInput! + account: AccountReferenceInput! """ - Amount of the platform tip + The tax from link. """ - amount: AmountInput! - ): Transaction! - @deprecated(reason: "2022-07-06: This feature will not be supported in the future. Please don't rely on it.") + taxFormLink: URL! + + """ + The tax form year. + """ + year: Int! + ): SetTaxFormResult """ Refunds a transaction. Scope: "transactions". @@ -13846,6 +16117,12 @@ type Mutation { Delete update. Scope: "updates". """ deleteUpdate(id: String!): Update! + uploadFile( + """ + The files to upload + """ + files: [UploadFileInput!]! + ): [UploadFileResult!]! """ Assign Virtual Card information to existing hosted collective. Scope: "virtualCards". @@ -13895,6 +16172,11 @@ type Mutation { Individual account responsible for the virtual card """ assignee: AccountReferenceInput! + + """ + Virtual card request to link to this virtual card + """ + virtualCardRequest: VirtualCardRequestReferenceInput ): VirtualCard! """ @@ -13944,7 +16226,17 @@ type Mutation { """ Monthly budget you want for this Virtual Card """ - budget: Int + budget: Int @deprecated(reason: "2023-06-29: Use spendingLimitAmount") + + """ + Limit you want for this Virtual Card in the given use interval + """ + spendingLimitAmount: AmountInput + + """ + Interval to apply the amount limit on this virtual card + """ + spendingLimitInterval: VirtualCardLimitInterval = MONTHLY """ Account where the virtual card will be associated @@ -13952,6 +16244,16 @@ type Mutation { account: AccountReferenceInput! ): Boolean + """ + Reject a virtual card request. Scope: "virtualCards" + """ + rejectVirtualCardRequest( + """ + Virtual card request + """ + virtualCardRequest: VirtualCardRequestReferenceInput + ): VirtualCardRequest! + """ Pause active Virtual Card. Scope: "virtualCards". """ @@ -14031,8 +16333,8 @@ type Mutation { Delete a tier. """ deleteTier(tier: TierReferenceInput!, stopRecurringContributions: Boolean! = false): Tier! - createPersonalToken(personalToken: PersonalTokenCreateInput!): PersonalToken - updatePersonalToken(personalToken: PersonalTokenUpdateInput!): PersonalToken + createPersonalToken(personalToken: PersonalTokenCreateInput!): PersonalToken! + updatePersonalToken(personalToken: PersonalTokenUpdateInput!): PersonalToken! deletePersonalToken(personalToken: PersonalTokenReferenceInput!): PersonalToken """ @@ -14057,6 +16359,186 @@ type Mutation { order: OrderReferenceInput expense: ExpenseReferenceInput ): TagResponse! + + """ + Add an agreement for the given host account. Scope: "host". + """ + addAgreement( + """ + Agreement title. + """ + title: NonEmptyString! + + """ + Optional date in which this agreement expires. + """ + expiresAt: DateTime + + """ + Host where the agreement will be created. + """ + host: AccountReferenceInput! + + """ + Account that is a party in this agreement + """ + account: AccountReferenceInput! + + """ + Agreement attachment + """ + attachment: Upload + + """ + Additional notes about the agreement for the host admins + """ + notes: String + ): Agreement! + + """ + Edit an agreement for the given host account. Scope: "host". + """ + editAgreement( + """ + Agreement to update. + """ + agreement: AgreementReferenceInput! + + """ + Updated agreement title + """ + title: NonEmptyString + + """ + Optional date in which this agreement expires. + """ + expiresAt: DateTime + + """ + Agreement attachment + """ + attachment: Upload + + """ + Additional notes about the agreement for the host admins + """ + notes: String + ): Agreement! + + """ + Delete an agreement for the given host account. Scope: "host". + """ + deleteAgreement( + """ + Agreement to delete. + """ + agreement: AgreementReferenceInput! + ): Agreement! + + """ + Create a new vendor for given host + """ + createVendor( + """ + Reference to the host that holds the vendor + """ + host: AccountReferenceInput! + + """ + The vendor to create + """ + vendor: VendorCreateInput! + ): Vendor! + + """ + Edit an existing vendor + """ + editVendor( + """ + Reference to the host that holds the vendor + """ + vendor: VendorEditInput! + + """ + Whether to archive (true) or unarchive (unarchive) the vendor + """ + archive: Boolean + ): Vendor! + + """ + Delete a vendor + """ + deleteVendor( + """ + Reference to the vendor to delete + """ + vendor: AccountReferenceInput! + ): Boolean! + + """ + Convert an organization to a vendor + """ + convertOrganizationToVendor( + """ + Reference to the organization to convert + """ + organization: AccountReferenceInput! + + """ + Reference to the host that will hold the vendor + """ + host: AccountReferenceInput! + ): Vendor! + + """ + Send In-App Survey response + """ + 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 } input CollectiveCreateInput { @@ -14064,11 +16546,47 @@ input CollectiveCreateInput { slug: String! description: String! tags: [String] + location: LocationInput githubHandle: String @deprecated(reason: "2022-06-03: Please use repositoryUrl") repositoryUrl: String @deprecated(reason: "2023-01-16: Please use socialLinks") settings: JSON } +""" +Input type for Geographic location +""" +input LocationInput { + """ + A short name for the location (eg. Open Collective Headquarters) + """ + name: String + + """ + Postal address without country (eg. 12 opensource avenue, 7500 Paris) + """ + address: String + + """ + Two letters country code (eg. FR, BE...etc) + """ + country: CountryISO + + """ + Latitude + """ + lat: Float + + """ + Longitude + """ + long: Float + + """ + Structured JSON address + """ + structured: JSON +} + input IndividualCreateInput { name: String! email: String! @@ -14166,6 +16684,11 @@ type AddTwoFactorAuthTokenToIndividualResponse { recoveryCodes: [String] } +input UserTwoFactorMethodReferenceInput { + id: String + legacyId: Int +} + input AccountUpdateInput { """ The public id identifying the account (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) @@ -14177,7 +16700,10 @@ input AccountUpdateInput { input PoliciesInput { EXPENSE_AUTHOR_CANNOT_APPROVE: PoliciesCollectiveExpenseAuthorCannotApprove REQUIRE_2FA_FOR_ADMINS: Boolean + COLLECTIVE_ADMINS_CAN_REFUND: Boolean COLLECTIVE_MINIMUM_ADMINS: PoliciesCollectiveMinimumAdminsInput + EXPENSE_CATEGORIZATION: PoliciesExpenseCategorizationInput + EXPENSE_PUBLIC_VENDORS: Boolean } input PoliciesCollectiveExpenseAuthorCannotApprove { @@ -14193,14 +16719,39 @@ input PoliciesCollectiveMinimumAdminsInput { freeze: Boolean } +input PoliciesExpenseCategorizationInput { + requiredForExpenseSubmitters: Boolean + requiredForCollectiveAdmins: Boolean +} + type SendMessageResult { success: Boolean } """ -A string that cannot be passed as an empty value +Input for creating or updating an account category """ -scalar NonEmptyString +input AccountingCategoryInput { + """ + The ID of the accounting category to edit + """ + id: NonEmptyString + + """ + The code of the accounting category + """ + code: NonEmptyString + + """ + The technical name of the accounting category + """ + name: NonEmptyString + + """ + A friendly name for non-accountants (i.e. expense submitters and collective admins) + """ + friendlyName: String +} """ Input type for Application @@ -14272,9 +16823,19 @@ input CommentCreateInput { If your comment is linked to an expense, set it here """ expense: ExpenseReferenceInput + + """ + If your comment is linked to an order, set it here + """ + order: OrderReferenceInput ConversationId: String @deprecated(reason: "2022-08-26: Please use \"conversation\"") conversation: ConversationReferenceInput update: UpdateReferenceInput + + """ + The type of the comment + """ + type: CommentType = COMMENT } input ConversationReferenceInput { @@ -14425,6 +16986,16 @@ input ExpenseCreateInput { The list of taxes that should be applied to the expense (VAT, GST, etc...) """ tax: [ExpenseTaxInput] + + """ + Custom data to be stored in the expense + """ + customData: JSON + + """ + The accounting category this expense belongs to + """ + accountingCategory: AccountingCategoryReferenceInput } input PayoutMethodInput { @@ -14454,11 +17025,9 @@ input ExpenseItemCreateInput { """ When was the money spent? """ - incurredAt: DateString + incurredAt: DateTime } -scalar DateString - input ExpenseAttachedFileInput { """ ID of the file @@ -14479,41 +17048,6 @@ input ExpenseAttachedFileInput { url: URL! } -""" -Input type for Geographic location -""" -input LocationInput { - """ - A short name for the location (eg. Open Collective Headquarters) - """ - name: String - - """ - Postal address without country (eg. 12 opensource avenue, 7500 Paris) - """ - address: String - - """ - Two letters country code (eg. FR, BE...etc) - """ - country: CountryISO - - """ - Latitude - """ - lat: Float - - """ - Longitude - """ - long: Float - - """ - Structured JSON address - """ - structured: JSON -} - """ Input to set taxes for an expense """ @@ -14532,18 +17066,13 @@ input ExpenseTaxInput { } """ -The type of a tax like GST, VAT, etc +Reference to an accounting category """ -enum TaxType { - """ - European Value Added Tax +input AccountingCategoryReferenceInput { """ - VAT - - """ - New Zealand Good and Services Tax + The ID of the accounting category """ - GST + id: NonEmptyString! } input RecurringExpenseInput { @@ -14633,6 +17162,16 @@ input ExpenseUpdateInput { The list of taxes that should be applied to the expense (VAT, GST, etc...) """ tax: [ExpenseTaxInput] + + """ + Custom data to be stored in the expense + """ + customData: JSON + + """ + The accounting category this expense belongs to + """ + accountingCategory: AccountingCategoryReferenceInput } input ExpenseItemInput { @@ -14659,7 +17198,7 @@ input ExpenseItemInput { """ When was the money spent? """ - incurredAt: DateString + incurredAt: DateTime } input NewAccountOrReferenceInput { @@ -14706,6 +17245,11 @@ enum ExpenseProcessAction { """ UNAPPROVE + """ + To request re-approval of the expense, marking it as pending. + """ + REQUEST_RE_APPROVAL + """ To mark the expense as rejected """ @@ -14740,6 +17284,16 @@ enum ExpenseProcessAction { To mark the expense as incomplete and notify the payee it requires more information """ MARK_AS_INCOMPLETE + + """ + To put the expense on hold + """ + HOLD + + """ + To release the expense from hold + """ + RELEASE } """ @@ -14761,6 +17315,11 @@ input ProcessExpensePaymentParams { """ shouldRefundPaymentProcessorFee: Boolean + """ + New expense status when triggering MARK_AS_UNPAID + """ + markAsUnPaidStatus: MarkAsUnPaidExpenseStatus = APPROVED + """ Bypass automatic integrations (ie. PayPal, Transferwise) to process the expense manually """ @@ -14772,6 +17331,12 @@ input ProcessExpensePaymentParams { feesPayer: FeesPayer = COLLECTIVE } +enum MarkAsUnPaidExpenseStatus { + APPROVED + INCOMPLETE + ERROR +} + input ExpenseInviteDraftInput { """ Main title of the expense @@ -14783,6 +17348,11 @@ input ExpenseInviteDraftInput { """ longDescription: String + """ + Currency that should be used for the payout. Defaults to the account currency + """ + currency: Currency + """ Tags associated to the expense (ie. Food, Engineering...) """ @@ -14799,14 +17369,14 @@ input ExpenseInviteDraftInput { privateMessage: String """ - Tax ID, VAT number...etc This information will be printed on your invoice. + Custom information to print on the invoice """ invoiceInfo: String """ - Note to be sent to the invited user through email. + The payout method that will be used to reimburse the expense """ - recipientNote: String + payoutMethod: PayoutMethodInput """ The list of items for this expense. Total amount will be computed from them. @@ -14829,13 +17399,29 @@ input ExpenseInviteDraftInput { payeeLocation: LocationInput """ - The payout method that will be used to reimburse the expense + The list of taxes that should be applied to the expense (VAT, GST, etc...) """ - payoutMethod: PayoutMethodInput + tax: [ExpenseTaxInput] + + """ + Custom data to be stored in the expense + """ + customData: JSON + + """ + The accounting category this expense belongs to + """ + accountingCategory: AccountingCategoryReferenceInput + + """ + Note to be sent to the invited user through email. + """ + recipientNote: String } input ExpenseInvitee { - id: Int + id: Int @deprecated(reason: "2023-04-12: Please use legacyId") + legacyId: Int slug: String name: String email: String @@ -14919,6 +17505,16 @@ input MemberInvitationReferenceInput { legacyId: Int } +type FollowAccountResult { + individual: Individual! + member: Member! +} + +type UnfollowAccountResult { + individual: Individual! + member: Member +} + input OAuthAuthorizationReferenceInput { """ The id identifying the OAuth Authorization (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) @@ -14991,10 +17587,15 @@ input OrderCreateInput { """ platformTipAmount: AmountInput + """ + The tax to apply to the order + """ + tax: TaxInput + """ Use this field to set the taxes associated to this order """ - taxes: [OrderTaxInput] + taxes: [OrderTaxInput] @deprecated(reason: "2023-04-11: Please use `tax` instead") """ The tier you are contributing to @@ -15188,6 +17789,11 @@ input OrderContextInput { Whether this order was created using the embedded contribution flow """ isEmbed: Boolean + + """ + Whether this order was created using the new platform tip flow + """ + isNewPlatformTipFlow: Boolean } input OrderUpdateInput { @@ -15202,10 +17808,15 @@ input OrderUpdateInput { legacyId: Int """ - Amount received by collective, excluding any tips or fees + Amount received by collective, excluding any tips, taxes or fees """ amount: AmountInput + """ + The tax to apply to the order + """ + tax: TaxInput + """ Amount paid in fees for the payment processor """ @@ -15286,14 +17897,9 @@ input PendingOrderCreateInput { toAccount: AccountReferenceInput! """ - Platform tip attached to this order - """ - platformTipAmount: AmountInput - + The tax to apply to the order """ - Use this field to set the taxes associated to this order - """ - taxes: [OrderTaxInput] + tax: TaxInput """ The tier you are contributing to @@ -15323,7 +17929,11 @@ input PendingOrderCreateInput { """ When is the money expected? """ - expectedAt: DateString + expectedAt: DateTime + + """ + Custom Host fee percent for this order + """ hostFeePercent: Float } @@ -15346,6 +17956,11 @@ input PendingOrderEditInput { """ amount: AmountInput! + """ + Platform tip attached to this order + """ + platformTipAmount: AmountInput + """ The profile making the contribution. """ @@ -15357,14 +17972,9 @@ input PendingOrderEditInput { fromAccountInfo: OrderFromAccountInfo """ - Platform tip attached to this order - """ - platformTipAmount: AmountInput - - """ - Use this field to set the taxes associated to this order + The tax to apply to the order """ - taxes: [OrderTaxInput] + tax: TaxInput """ The tier you are contributing to @@ -15394,7 +18004,11 @@ input PendingOrderEditInput { """ When is the money expected? """ - expectedAt: DateString + expectedAt: DateTime + + """ + Custom Host fee percent for this order + """ hostFeePercent: Float } @@ -15445,6 +18059,10 @@ type BanAccountResponse { accounts: [Account!]! } +type SetTaxFormResult { + success: Boolean! +} + input TransactionReferenceInput { """ The public id identifying the transaction (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) @@ -15464,14 +18082,12 @@ input UpdateCreateInput { title: String! isPrivate: Boolean isChangelog: Boolean - makePublicOn: IsoDateString + makePublicOn: DateTime html: String! fromAccount: AccountReferenceInput account: AccountReferenceInput! } -scalar IsoDateString - """ Input type for UpdateType """ @@ -15485,6 +18101,91 @@ input UpdateUpdateInput { fromAccount: AccountReferenceInput } +type UploadFileResult { + file: FileInfo! + parsingResult: ParseUploadedFileResult +} + +type ParseUploadedFileResult { + """ + Whether the parsing was successful + """ + success: Boolean! + + """ + A message describing the parsing result, usually an error message (if parsing failed) or some warnings + """ + message: String + + """ + The parsed expense information + """ + expense: ExpenseParsedFileInfo +} + +type ExpenseParsedFileInfo { + confidence: StrictPercentage + description: String + amount: Amount + date: Date + items: [ExpenseItemParsedFileInfo!]! +} + +""" +A positive float value between 0 and 100 +""" +scalar StrictPercentage + +""" +A date string, such as 2007-12-03, compliant with the `full-date` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. +""" +scalar Date + +type ExpenseItemParsedFileInfo { + description: String + amount: Amount + incurredAt: Date + url: String +} + +input UploadFileInput { + """ + The file to upload + """ + file: Upload! + + """ + The kind of file to uploaded + """ + kind: UploadedFileKind! + + """ + Whether to run OCR on the document. Note that this feature is only available to selected accounts. + """ + parseDocument: Boolean! = false +} + +""" +The `Upload` scalar type represents a file upload. +""" +scalar Upload + +""" +The kind of file that was uploaded +""" +enum UploadedFileKind { + ACCOUNT_AVATAR + ACCOUNT_BANNER + EXPENSE_ATTACHED_FILE + EXPENSE_ITEM + ACCOUNT_LONG_DESCRIPTION + UPDATE + COMMENT + TIER_LONG_DESCRIPTION + ACCOUNT_CUSTOM_EMAIL + AGREEMENT_ATTACHMENT +} + input VirtualCardInput { id: String name: String @@ -15499,10 +18200,6 @@ enum VirtualCardProvider { STRIPE } -input VirtualCardReferenceInput { - id: String -} - """ Input type for Webhooks """ @@ -15590,6 +18287,11 @@ input PersonalTokenCreateInput { scope: [OAuthScope] expiresAt: String + """ + Whether this token is allowed to directly use operations that would normally require 2FA + """ + preAuthorize2FA: Boolean = false + """ The account to use as the owner of the application. Defaults to currently logged in user. """ @@ -15612,6 +18314,11 @@ input PersonalTokenUpdateInput { name: String scope: [OAuthScope] expiresAt: String + + """ + Whether this token is allowed to directly use operations that would normally require 2FA + """ + preAuthorize2FA: Boolean } input PersonalTokenReferenceInput { @@ -15635,3 +18342,69 @@ type TagResponse { order: Order expense: Expense } + +input AgreementReferenceInput { + """ + The public id identifying the agreement (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + """ + id: String + + """ + The internal id of the agreement (ie: 580) + """ + legacyId: Int +} + +input VendorCreateInput { + name: NonEmptyString! + legalName: String + tags: [NonEmptyString] + location: LocationInput + imageUrl: String + vendorInfo: VendorInfoInput + payoutMethod: PayoutMethodInput +} + +""" +Some context about the vendor +""" +input VendorInfoInput { + contact: VendorContactInput + taxFormRequired: Boolean + taxFormUrl: String + taxType: String + taxId: String + notes: String +} + +""" +Some context about the vendor contact person +""" +input VendorContactInput { + name: String + email: String +} + +input VendorEditInput { + """ + The public id identifying the account (ie: dgm9bnk8-0437xqry-ejpvzeol-jdayw5re) + """ + id: String + + """ + 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.") + + """ + The slug identifying the account (ie: babel for https://opencollective.com/babel) + """ + slug: String + name: NonEmptyString + legalName: String + tags: [NonEmptyString] + location: LocationInput + imageUrl: String + vendorInfo: VendorInfoInput + payoutMethod: PayoutMethodInput +} diff --git a/src/server/controllers/account-transactions.js b/src/server/controllers/account-transactions.js index f0ae03d7..d9ca4e23 100644 --- a/src/server/controllers/account-transactions.js +++ b/src/server/controllers/account-transactions.js @@ -38,7 +38,7 @@ export const transactionsFragment = gqlV2/* GraphQL */ ` value currency } - paymentProcessorFee { + paymentProcessorFee(fetchPaymentProcessorFee: $fetchPaymentProcessorFee) { value currency } @@ -50,7 +50,7 @@ export const transactionsFragment = gqlV2/* GraphQL */ ` value currency } - netAmountInHostCurrency(fetchHostFee: $fetchHostFee) { + netAmountInHostCurrency(fetchHostFee: $fetchHostFee, fetchPaymentProcessorFee: $fetchPaymentProcessorFee) { value currency } @@ -146,6 +146,7 @@ const transactionsQuery = gqlV2/* GraphQL */ ` $includeGiftCardTransactions: Boolean $includeRegularTransactions: Boolean $fetchHostFee: Boolean + $fetchPaymentProcessorFee: Boolean $fullDescription: Boolean ) { transactions( @@ -183,6 +184,7 @@ const hostTransactionsQuery = gqlV2/* GraphQL */ ` $minAmount: Int $maxAmount: Int $fetchHostFee: Boolean + $fetchPaymentProcessorFee: Boolean $fullDescription: Boolean $account: [AccountReferenceInput!] ) { @@ -435,6 +437,11 @@ const accountTransactions = async (req, res) => { variables.kind = difference(variables.kind || allKinds, ['HOST_FEE']); } + variables.fetchPaymentProcessorFee = parseToBooleanDefaultFalse(req.query.flattenPaymentProcessorFee); + if (variables.fetchPaymentProcessorFee) { + variables.kind = difference(variables.kind || allKinds, ['PAYMENT_PROCESSOR_FEE']); + } + if (req.query.fullDescription) { variables.fullDescription = parseToBooleanDefaultFalse(req.query.fullDescription); } else { @@ -460,9 +467,13 @@ const accountTransactions = async (req, res) => { const baseAllFields = req.params.reportType === 'hostTransactions' ? allFields.filter((field) => field !== 'balance') : allFields; - const baseDefaultFields = !variables.fetchHostFee - ? defaultFields.filter((field) => field !== 'hostFee') - : defaultFields; + let baseDefaultFields = defaultFields; + if (!variables.fetchHostFee) { + baseDefaultFields = baseDefaultFields.filter((field) => field !== 'hostFee'); + } + if (!variables.fetchPaymentProcessorFee) { + baseDefaultFields = baseDefaultFields.filter((field) => field !== 'paymentProcessorFee'); + } fields = difference(intersection(baseAllFields, [...baseDefaultFields, ...add]), remove); }