From 245c0e1852e3d9a098dcbfc039ea6aa2ff73cbb4 Mon Sep 17 00:00:00 2001 From: Dominic Charley-Roy Date: Mon, 26 Jul 2021 19:45:29 -0400 Subject: [PATCH] Remove includeBasic. --- lib/StripeMethod.basic.js | 30 ------------------------------ lib/StripeResource.js | 7 ------- types/lib.d.ts | 27 +-------------------------- types/test/typescriptTest.ts | 1 - 4 files changed, 1 insertion(+), 64 deletions(-) delete mode 100644 lib/StripeMethod.basic.js diff --git a/lib/StripeMethod.basic.js b/lib/StripeMethod.basic.js deleted file mode 100644 index c807ea1849..0000000000 --- a/lib/StripeMethod.basic.js +++ /dev/null @@ -1,30 +0,0 @@ -'use strict'; - -const stripeMethod = require('./StripeMethod'); - -module.exports = { - create: stripeMethod({ - method: 'POST', - }), - - list: stripeMethod({ - method: 'GET', - methodType: 'list', - }), - - retrieve: stripeMethod({ - method: 'GET', - path: '/{id}', - }), - - update: stripeMethod({ - method: 'POST', - path: '{id}', - }), - - // Avoid 'delete' keyword in JS - del: stripeMethod({ - method: 'DELETE', - path: '{id}', - }), -}; diff --git a/lib/StripeResource.js b/lib/StripeResource.js index 516613879b..8646837a32 100644 --- a/lib/StripeResource.js +++ b/lib/StripeResource.js @@ -22,7 +22,6 @@ StripeResource.extend = utils.protoExtend; // Expose method-creator & prepared (basic) methods StripeResource.method = require('./StripeMethod'); -StripeResource.BASIC_METHODS = require('./StripeMethod.basic'); StripeResource.MAX_BUFFERED_REQUEST_METRICS = 100; const MAX_RETRY_AFTER_WAIT = 60; @@ -44,12 +43,6 @@ function StripeResource(stripe, deprecatedUrlData) { this.resourcePath = this.path; this.path = utils.makeURLInterpolator(this.path); - if (this.includeBasic) { - this.includeBasic.forEach(function(methodName) { - this[methodName] = StripeResource.BASIC_METHODS[methodName]; - }, this); - } - this.initialize(...arguments); } diff --git a/types/lib.d.ts b/types/lib.d.ts index 45d396a03b..700d969fd6 100644 --- a/types/lib.d.ts +++ b/types/lib.d.ts @@ -8,38 +8,13 @@ declare module 'stripe' { export class StripeResource { static extend< // eslint-disable-next-line @typescript-eslint/no-explicit-any - T extends {[prop: string]: any} & { - includeBasic?: Array< - 'create' | 'retrieve' | 'update' | 'list' | 'del' - >; - } + T extends {[prop: string]: any} >(spec: T): StripeResource & T; static method(spec: { method: string; path: string; methodType?: 'list'; }): (...args: any[]) => object; //eslint-disable-line @typescript-eslint/no-explicit-any - static BASIC_METHODS: { - create( - params: CouponCreateParams, - options?: RequestOptions - ): Promise; - retrieve( - id: string, - params?: CouponRetrieveParams, - options?: RequestOptions - ): Promise; - update( - id: string, - params?: CouponUpdateParams, - options?: RequestOptions - ): Promise; - list( - params?: CouponListParams, - options?: RequestOptions - ): ApiListPromise; - del(id: string, options?: RequestOptions): Promise; - }; static MAX_BUFFERED_REQUEST_METRICS: number; } export type LatestApiVersion = '2020-08-27'; diff --git a/types/test/typescriptTest.ts b/types/test/typescriptTest.ts index d93e3bdeff..4455fc2b31 100644 --- a/types/test/typescriptTest.ts +++ b/types/test/typescriptTest.ts @@ -175,7 +175,6 @@ const stripeCardError: Stripe.StripeCardError = Stripe.errors.generate({ }); Stripe.StripeResource.extend({ - includeBasic: ['retrieve'], foo: Stripe.StripeResource.method({ method: 'create', path: 'foo',