Skip to content

Commit

Permalink
Extract resources file (to aid with code generation) (#626)
Browse files Browse the repository at this point in the history
* Extract separate resources file (to aid with code generation)

* Remove resources that were removed in #625

https://github.com/stripe/stripe-node/pull/625/files#diff-d3dd6c4fd6f915f29d42e4081dc817a8L85
  • Loading branch information
irace-stripe authored and rattrayalex-stripe committed May 14, 2019
1 parent 3c99464 commit 58c3ded
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 80 deletions.
79 changes: 79 additions & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
'use strict';

const resourceNamespace = require('./ResourceNamespace');

module.exports = {
// Support Accounts for consistency, Account for backwards compatibility
Account: require('./resources/Accounts'),
Accounts: require('./resources/Accounts'),
AccountLinks: require('./resources/AccountLinks'),
ApplePayDomains: require('./resources/ApplePayDomains'),
ApplicationFees: require('./resources/ApplicationFees'),
Balance: require('./resources/Balance'),
BalanceTransactions: require('./resources/BalanceTransactions'),
BitcoinReceivers: require('./resources/BitcoinReceivers'),
Charges: require('./resources/Charges'),
CountrySpecs: require('./resources/CountrySpecs'),
Coupons: require('./resources/Coupons'),
CreditNotes: require('./resources/CreditNotes'),
Customers: require('./resources/Customers'),
Disputes: require('./resources/Disputes'),
EphemeralKeys: require('./resources/EphemeralKeys'),
Events: require('./resources/Events'),
ExchangeRates: require('./resources/ExchangeRates'),
Files: require('./resources/Files'),
FileLinks: require('./resources/FileLinks'),
InvoiceItems: require('./resources/InvoiceItems'),
Invoices: require('./resources/Invoices'),
IssuerFraudRecords: require('./resources/IssuerFraudRecords'),
OAuth: require('./resources/OAuth'),
OrderReturns: require('./resources/OrderReturns'),
Orders: require('./resources/Orders'),
PaymentIntents: require('./resources/PaymentIntents'),
PaymentMethods: require('./resources/PaymentMethods'),
Payouts: require('./resources/Payouts'),
Plans: require('./resources/Plans'),
Products: require('./resources/Products'),
Recipients: require('./resources/Recipients'),
Refunds: require('./resources/Refunds'),
Reviews: require('./resources/Reviews'),
Skus: require('./resources/SKUs'),
Sources: require('./resources/Sources'),
SubscriptionItems: require('./resources/SubscriptionItems'),
SubscriptionSchedules: require('./resources/SubscriptionSchedules'),
Subscriptions: require('./resources/Subscriptions'),
TaxRates: require('./resources/TaxRates'),
ThreeDSecure: require('./resources/ThreeDSecure'),
Tokens: require('./resources/Tokens'),
Topups: require('./resources/Topups'),
Transfers: require('./resources/Transfers'),
UsageRecords: require('./resources/UsageRecords'),
UsageRecordSummaries: require('./resources/UsageRecordSummaries'),
WebhookEndpoints: require('./resources/WebhookEndpoints'),
Checkout: resourceNamespace('checkout', {
Sessions: require('./resources/Checkout/Sessions'),
}),
Issuing: resourceNamespace('issuing', {
Authorizations: require('./resources/Issuing/Authorizations'),
Cardholders: require('./resources/Issuing/Cardholders'),
Cards: require('./resources/Issuing/Cards'),
Disputes: require('./resources/Issuing/Disputes'),
Transactions: require('./resources/Issuing/Transactions'),
}),
Radar: resourceNamespace('radar', {
ValueLists: require('./resources/Radar/ValueLists'),
ValueListItems: require('./resources/Radar/ValueListItems'),
}),
Reporting: resourceNamespace('reporting', {
ReportRuns: require('./resources/Reporting/ReportRuns'),
ReportTypes: require('./resources/Reporting/ReportTypes'),
}),
Sigma: resourceNamespace('sigma', {
ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'),
}),
Terminal: resourceNamespace('terminal', {
ConnectionTokens: require('./resources/Terminal/ConnectionTokens'),
Locations: require('./resources/Terminal/Locations'),
Readers: require('./resources/Terminal/Readers'),
}),
};
82 changes: 2 additions & 80 deletions lib/stripe.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
'use strict';

const resources = require('./resources');

Stripe.DEFAULT_HOST = 'api.stripe.com';
Stripe.DEFAULT_PORT = '443';
Stripe.DEFAULT_BASE_PATH = '/v1/';
Expand Down Expand Up @@ -29,86 +31,6 @@ const APP_INFO_PROPERTIES = ['name', 'version', 'url', 'partner_id'];
const EventEmitter = require('events').EventEmitter;
const utils = require('./utils');

const resourceNamespace = require('./ResourceNamespace');

const resources = {
// Support Accounts for consistency, Account for backwards compat
Account: require('./resources/Accounts'),
Accounts: require('./resources/Accounts'),
AccountLinks: require('./resources/AccountLinks'),
ApplePayDomains: require('./resources/ApplePayDomains'),
ApplicationFees: require('./resources/ApplicationFees'),
Balance: require('./resources/Balance'),
BalanceTransactions: require('./resources/BalanceTransactions'),
BitcoinReceivers: require('./resources/BitcoinReceivers'),
Charges: require('./resources/Charges'),
CountrySpecs: require('./resources/CountrySpecs'),
Coupons: require('./resources/Coupons'),
CreditNotes: require('./resources/CreditNotes'),
Customers: require('./resources/Customers'),
Disputes: require('./resources/Disputes'),
EphemeralKeys: require('./resources/EphemeralKeys'),
Events: require('./resources/Events'),
ExchangeRates: require('./resources/ExchangeRates'),
Files: require('./resources/Files'),
FileLinks: require('./resources/FileLinks'),
InvoiceItems: require('./resources/InvoiceItems'),
Invoices: require('./resources/Invoices'),
IssuerFraudRecords: require('./resources/IssuerFraudRecords'),
OAuth: require('./resources/OAuth'),
OrderReturns: require('./resources/OrderReturns'),
Orders: require('./resources/Orders'),
PaymentIntents: require('./resources/PaymentIntents'),
PaymentMethods: require('./resources/PaymentMethods'),
Payouts: require('./resources/Payouts'),
Plans: require('./resources/Plans'),
Products: require('./resources/Products'),
Recipients: require('./resources/Recipients'),
Refunds: require('./resources/Refunds'),
Reviews: require('./resources/Reviews'),
Skus: require('./resources/SKUs'),
Sources: require('./resources/Sources'),
SubscriptionItems: require('./resources/SubscriptionItems'),
SubscriptionSchedules: require('./resources/SubscriptionSchedules'),
Subscriptions: require('./resources/Subscriptions'),
TaxRates: require('./resources/TaxRates'),
ThreeDSecure: require('./resources/ThreeDSecure'),
Tokens: require('./resources/Tokens'),
Topups: require('./resources/Topups'),
Transfers: require('./resources/Transfers'),
UsageRecords: require('./resources/UsageRecords'),
UsageRecordSummaries: require('./resources/UsageRecordSummaries'),
WebhookEndpoints: require('./resources/WebhookEndpoints'),

// Namespaced resources
Checkout: resourceNamespace('checkout', {
Sessions: require('./resources/Checkout/Sessions'),
}),
Issuing: resourceNamespace('issuing', {
Authorizations: require('./resources/Issuing/Authorizations'),
Cardholders: require('./resources/Issuing/Cardholders'),
Cards: require('./resources/Issuing/Cards'),
Disputes: require('./resources/Issuing/Disputes'),
Transactions: require('./resources/Issuing/Transactions'),
}),
Radar: resourceNamespace('radar', {
ValueLists: require('./resources/Radar/ValueLists'),
ValueListItems: require('./resources/Radar/ValueListItems'),
}),
Reporting: resourceNamespace('reporting', {
ReportRuns: require('./resources/Reporting/ReportRuns'),
ReportTypes: require('./resources/Reporting/ReportTypes'),
}),
Sigma: resourceNamespace('sigma', {
ScheduledQueryRuns: require('./resources/Sigma/ScheduledQueryRuns'),
}),
Terminal: resourceNamespace('terminal', {
ConnectionTokens: require('./resources/Terminal/ConnectionTokens'),
Locations: require('./resources/Terminal/Locations'),
Readers: require('./resources/Terminal/Readers'),
}),
};

Stripe.StripeResource = require('./StripeResource');
Stripe.resources = resources;

Expand Down

0 comments on commit 58c3ded

Please sign in to comment.