Skip to content

Commit

Permalink
Codegen for openapi v146
Browse files Browse the repository at this point in the history
  • Loading branch information
pakrym-stripe committed May 23, 2022
1 parent 76576f9 commit 6d2b851
Show file tree
Hide file tree
Showing 16 changed files with 830 additions and 0 deletions.
1 change: 1 addition & 0 deletions OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v146
3 changes: 3 additions & 0 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ module.exports = {
Topups: require('./resources/Topups'),
Transfers: require('./resources/Transfers'),
WebhookEndpoints: require('./resources/WebhookEndpoints'),
Apps: resourceNamespace('apps', {
Secrets: require('./resources/Apps/Secrets'),
}),
BillingPortal: resourceNamespace('billingPortal', {
Configurations: require('./resources/BillingPortal/Configurations'),
Sessions: require('./resources/BillingPortal/Sessions'),
Expand Down
31 changes: 31 additions & 0 deletions lib/resources/Apps/Secrets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// File generated from our OpenAPI spec

'use strict';

const StripeResource = require('../../StripeResource');
const stripeMethod = StripeResource.method;

module.exports = StripeResource.extend({
path: 'apps/secrets',

create: stripeMethod({
method: 'POST',
path: '',
}),

list: stripeMethod({
method: 'GET',
path: '',
methodType: 'list',
}),

deleteWhere: stripeMethod({
method: 'POST',
path: '/delete',
}),

find: stripeMethod({
method: 'GET',
path: '/find',
}),
});
27 changes: 27 additions & 0 deletions test/resources/generated_examples_test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,33 @@ describe('Treasury.ReceivedDebit', function() {
});
});

describe('Apps.Secret', function() {
it('create method', async function() {
const secret = await stripe.apps.secrets.create({
name: 'sec_123',
payload: 'very secret string',
scope: {type: 'account'},
});
expect(secret).not.to.be.null;
});

it('find method', async function() {
const secret = await stripe.apps.secrets.find({
name: 'sec_123',
scope: {type: 'account'},
});
expect(secret).not.to.be.null;
});

it('deleteWhere method', async function() {
const secret = await stripe.apps.secrets.deleteWhere({
name: 'sec_123',
scope: {type: 'account'},
});
expect(secret).not.to.be.null;
});
});

describe('Charge', function() {
it('create method', async function() {
const charge = await stripe.charges.create({
Expand Down
241 changes: 241 additions & 0 deletions types/2020-08-27/Apps/Secrets.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
// File generated from our OpenAPI spec

declare module 'stripe' {
namespace Stripe {
namespace Apps {
/**
* The Secret object.
*/
interface Secret {
/**
* Unique identifier for the object.
*/
id: string;

/**
* String representing the object's type. Objects of the same type share the same value.
*/
object: 'apps.secret';

/**
* Time at which the object was created. Measured in seconds since the Unix epoch.
*/
created: number;

/**
* If true, indicates that this secret has been deleted
*/
deleted?: boolean;

/**
* Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode.
*/
livemode: boolean;

/**
* A name for the secret that's unique within the scope.
*/
name: string;

/**
* The plaintext secret value to be stored.
*/
payload: string | null;

scope: Secret.Scope;
}

namespace Secret {
interface Scope {
/**
* The secret scope type.
*/
type: Scope.Type;

/**
* The user ID, if type is set to "user"
*/
user?: string;
}

namespace Scope {
type Type = 'account' | 'user';
}
}

interface SecretCreateParams {
/**
* A name for the secret that's unique within the scope.
*/
name: string;

/**
* The plaintext secret value to be stored.
*/
payload: string;

/**
* Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
*/
scope: SecretCreateParams.Scope;

/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

namespace SecretCreateParams {
interface Scope {
/**
* The secret scope type.
*/
type: Scope.Type;

/**
* The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
*/
user?: string;
}

namespace Scope {
type Type = 'account' | 'user';
}
}

interface SecretListParams extends PaginationParams {
/**
* Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
*/
scope: SecretListParams.Scope;

/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

namespace SecretListParams {
interface Scope {
/**
* The secret scope type.
*/
type: Scope.Type;

/**
* The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
*/
user?: string;
}

namespace Scope {
type Type = 'account' | 'user';
}
}

interface SecretDeleteWhereParams {
/**
* A name for the secret that's unique within the scope.
*/
name: string;

/**
* Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
*/
scope: SecretDeleteWhereParams.Scope;

/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

namespace SecretDeleteWhereParams {
interface Scope {
/**
* The secret scope type.
*/
type: Scope.Type;

/**
* The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
*/
user?: string;
}

namespace Scope {
type Type = 'account' | 'user';
}
}

interface SecretFindParams {
/**
* A name for the secret that's unique within the scope.
*/
name: string;

/**
* Specifies the scoping of the secret. Requests originating from UI extensions can only access account-scoped secrets or secrets scoped to their own user.
*/
scope: SecretFindParams.Scope;

/**
* Specifies which fields in the response should be expanded.
*/
expand?: Array<string>;
}

namespace SecretFindParams {
interface Scope {
/**
* The secret scope type.
*/
type: Scope.Type;

/**
* The user ID. This field is required if `type` is set to `user`, and should not be provided if `type` is set to `account`.
*/
user?: string;
}

namespace Scope {
type Type = 'account' | 'user';
}
}

class SecretsResource {
/**
* Create or replace a secret in the secret store.
*/
create(
params: SecretCreateParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Apps.Secret>>;

/**
* List all secrets stored on the given scope.
*/
list(
params: SecretListParams,
options?: RequestOptions
): ApiListPromise<Stripe.Apps.Secret>;

/**
* Deletes a secret from the secret store by name and scope.
*/
deleteWhere(
params: SecretDeleteWhereParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Apps.Secret>>;

/**
* Finds a secret in the secret store by name and scope.
*/
find(
params: SecretFindParams,
options?: RequestOptions
): Promise<Stripe.Response<Stripe.Apps.Secret>>;
}
}
}
}
8 changes: 8 additions & 0 deletions types/2020-08-27/Charges.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ declare module 'stripe' {

acss_debit?: PaymentMethodDetails.AcssDebit;

affirm?: PaymentMethodDetails.Affirm;

afterpay_clearpay?: PaymentMethodDetails.AfterpayClearpay;

alipay?: PaymentMethodDetails.Alipay;
Expand Down Expand Up @@ -422,6 +424,8 @@ declare module 'stripe' {

konbini?: PaymentMethodDetails.Konbini;

link?: PaymentMethodDetails.Link;

multibanco?: PaymentMethodDetails.Multibanco;

oxxo?: PaymentMethodDetails.Oxxo;
Expand Down Expand Up @@ -543,6 +547,8 @@ declare module 'stripe' {
transit_number: string | null;
}

interface Affirm {}

interface AfterpayClearpay {
/**
* Order identifier shown to the merchant in Afterpay's online portal.
Expand Down Expand Up @@ -1469,6 +1475,8 @@ declare module 'stripe' {
}
}

interface Link {}

interface Multibanco {
/**
* Entity number associated with this Multibanco payment.
Expand Down
2 changes: 2 additions & 0 deletions types/2020-08-27/Customers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,7 @@ declare module 'stripe' {
namespace CustomerListPaymentMethodsParams {
type Type =
| 'acss_debit'
| 'affirm'
| 'afterpay_clearpay'
| 'alipay'
| 'au_becs_debit'
Expand All @@ -826,6 +827,7 @@ declare module 'stripe' {
| 'ideal'
| 'klarna'
| 'konbini'
| 'link'
| 'oxxo'
| 'p24'
| 'paynow'
Expand Down
3 changes: 3 additions & 0 deletions types/2020-08-27/Invoices.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,7 @@ declare module 'stripe' {
| 'grabpay'
| 'ideal'
| 'konbini'
| 'link'
| 'paynow'
| 'sepa_credit_transfer'
| 'sepa_debit'
Expand Down Expand Up @@ -1193,6 +1194,7 @@ declare module 'stripe' {
| 'grabpay'
| 'ideal'
| 'konbini'
| 'link'
| 'paynow'
| 'sepa_credit_transfer'
| 'sepa_debit'
Expand Down Expand Up @@ -1533,6 +1535,7 @@ declare module 'stripe' {
| 'grabpay'
| 'ideal'
| 'konbini'
| 'link'
| 'paynow'
| 'sepa_credit_transfer'
| 'sepa_debit'
Expand Down
Loading

0 comments on commit 6d2b851

Please sign in to comment.