diff --git a/enzyme/enzyme-tests.tsx b/enzyme/enzyme-tests.tsx index 56767b4ab3..4cc45e9fd4 100644 --- a/enzyme/enzyme-tests.tsx +++ b/enzyme/enzyme-tests.tsx @@ -107,6 +107,10 @@ namespace ShallowWrapperTest { shallowWrapper = shallowWrapper.shallow(); } + function test_unmount() { + shallowWrapper = shallowWrapper.unmount(); + } + function test_render() { var cheerioWrapper: CheerioWrapper = shallowWrapper.render(); } @@ -238,6 +242,14 @@ namespace ReactWrapperTest { stringVal: String, elementWrapper: ReactWrapper + function test_unmount() { + reactWrapper = reactWrapper.unmount(); + } + + function test_mount() { + reactWrapper = reactWrapper.mount(); + } + function test_find() { elementWrapper = reactWrapper.find('.selector'); reactWrapper = reactWrapper.find(MyComponent); @@ -418,7 +430,7 @@ namespace CheerioWrapperTest { objectVal: Object, boolVal: Boolean, stringVal: String, - elementWrapper: ReactWrapper + elementWrapper: CheerioWrapper function test_find() { elementWrapper = cheerioWrapper.find('.selector'); diff --git a/enzyme/enzyme.d.ts b/enzyme/enzyme.d.ts index 9047fbf728..13c00041a5 100644 --- a/enzyme/enzyme.d.ts +++ b/enzyme/enzyme.d.ts @@ -313,6 +313,7 @@ declare module "enzyme" { export interface ShallowWrapper extends CommonWrapper { shallow(): ShallowWrapper; render(): CheerioWrapper; + unmount(): ShallowWrapper; /** * Find every node in the render tree that matches the provided selector. @@ -376,7 +377,68 @@ declare module "enzyme" { } export interface ReactWrapper extends CommonWrapper { + unmount(): ReactWrapper; + mount(): ReactWrapper; + /** + * Find every node in the render tree that matches the provided selector. + * @param selector The selector to match. + */ + find(component: ComponentClass): ReactWrapper; + find(statelessComponent: (props: P2) => JSX.Element): ReactWrapper; + find(selector: string): ReactWrapper; + + /** + * Finds every node in the render tree that returns true for the provided predicate function. + * @param predicate + */ + findWhere(predicate: (wrapper: CommonWrapper) => Boolean): ReactWrapper; + + /** + * Removes nodes in the current wrapper that do not match the provided selector. + * @param selector The selector to match. + */ + filter(component: ComponentClass): ReactWrapper; + filter(statelessComponent: StatelessComponent): ReactWrapper; + filter(selector: string): ReactWrapper; + + /** + * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector + * can be provided and it will filter the children by this selector. + * @param [selector] + */ + children(component: ComponentClass): ReactWrapper; + children(statelessComponent: StatelessComponent): ReactWrapper; + children(selector: string): ReactWrapper; + children(): ReactWrapper; + + /** + * Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the + * current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector. + * + * Note: can only be called on a wrapper of a single node. + * @param [selector] + */ + parents(component: ComponentClass): ReactWrapper; + parents(statelessComponent: StatelessComponent): ReactWrapper; + parents(selector: string): ReactWrapper; + parents(): ReactWrapper; + + /** + * Returns a wrapper of the first element that matches the selector by traversing up through the current node's + * ancestors in the tree, starting with itself. + * + * Note: can only be called on a wrapper of a single node. + * @param selector + */ + closest(component: ComponentClass): ReactWrapper; + closest(statelessComponent: StatelessComponent): ReactWrapper; + closest(selector: string): ReactWrapper; + + /** + * Returns a wrapper with the direct parent of the node in the current wrapper. + */ + parent(): ReactWrapper; } export interface CheerioWrapper extends CommonWrapper { diff --git a/helmet/helmet.d.ts b/helmet/helmet.d.ts index 7154d0b739..6feef0bad8 100644 --- a/helmet/helmet.d.ts +++ b/helmet/helmet.d.ts @@ -1,6 +1,6 @@ // Type definitions for helmet // Project: https://github.com/helmetjs/helmet -// Definitions by: Cyril Schumacher +// Definitions by: Cyril Schumacher , Evan Hahn // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index a08251b8ba..f1a385a238 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -219,7 +219,7 @@ declare module "mongodb" { indexInformation(name: string, options?: { full?: boolean, readPreference?: ReadPreference | string }): Promise; indexInformation(name: string, options: { full?: boolean, readPreference?: ReadPreference | string }, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#listCollections - listCollections(filter: { name?: string }, options?: { batchSize?: number, readPreference?: ReadPreference | string }): CommandCursor; + listCollections(filter: Object, options?: { batchSize?: number, readPreference?: ReadPreference | string }): CommandCursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html#logout logout(callback: MongoCallback): void; logout(options?: { dbName?: string }): Promise; diff --git a/phonegap-nfc/phonegap-nfc-tests.ts b/phonegap-nfc/phonegap-nfc-tests.ts index ddaabebce7..08700fa919 100644 --- a/phonegap-nfc/phonegap-nfc-tests.ts +++ b/phonegap-nfc/phonegap-nfc-tests.ts @@ -3,6 +3,8 @@ import nfc = require('nfc'); import ndef = require('ndef'); import NdefRecord = PhoneGapNfc.NdefRecord; +import NdefTag = PhoneGapNfc.NdefTag; +import NdefTagEvent = PhoneGapNfc.NdefTagEvent; nfc.addTagDiscoveredListener(() => {}); nfc.addTagDiscoveredListener(() => {},() => {}, () => {}); @@ -39,7 +41,7 @@ nfc.erase(); nfc.erase(() => {}, () => {}); nfc.enabled(); -nfc.enabled(() => {}, () => {}); +nfc.enabled((status: String) => {}, (status: String) => {}); nfc.removeTagDiscoveredListener(() => {}); nfc.removeTagDiscoveredListener(() => {},() => {},() => {}); @@ -78,3 +80,45 @@ let obj:any = ndef.decodeTnf(bytes[0]); let tnfByte:number = ndef.encodeTnf(bytes[0],bytes[1],bytes[2],bytes[3],bytes[4],bytes[5]); let tnfString:string = ndef.tnfToString(tnfByte); + +let ndefTag: NdefTag = { + id: [4, 12, 109, 98, 8, 41, -127], + techTypes: ["android.nfc.tech.MifareUltralight", "android.nfc.tech.NfcA", "android.nfc.tech.Ndef"], + type: "NFC Forum Type 2", + date: "1394448136236", + + canMakeReadOnly: true, + isWritable: true, + maxSize: 137, + ndefMessage: records +}; + +let eventTarget: EventTarget = { + addEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean) { return; }, + dispatchEvent(evt: Event) { return true; }, + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, useCapture?: boolean) { return; } +} + +let ndefTagEvent: NdefTagEvent = { + bubbles: false, + cancelBubble: false, + cancelable: false, + currentTarget: eventTarget, + defaultPrevented: false, + eventPhase: 2, + isTrusted: true, + returnValue: true, + srcElement: new Element(), + target: eventTarget, + timeStamp: 1394448136236, + type: "ndef", + initEvent(eventTypeArg: string, canBubbleArg: boolean, cancelableArg: boolean) { return; }, + preventDefault() { return; }, + stopImmediatePropagation() { return; }, + stopPropagation() { return; }, + AT_TARGET: 0, + BUBBLING_PHASE: 0, + CAPTURING_PHASE: 0, + + tag: ndefTag +}; diff --git a/phonegap-nfc/phonegap-nfc.d.ts b/phonegap-nfc/phonegap-nfc.d.ts index 849e2527cc..ff980eea33 100644 --- a/phonegap-nfc/phonegap-nfc.d.ts +++ b/phonegap-nfc/phonegap-nfc.d.ts @@ -49,7 +49,7 @@ declare namespace PhoneGapNfc { canMakeReadOnly:boolean; isWritable:boolean; maxSize:number; - records:Array; + ndefMessage:Array; } interface TagEvent extends Event { @@ -406,7 +406,7 @@ declare namespace PhoneGapNfc { * @param win The callback that is called when NFC is enabled. * @param fail The callback that is called when NFC is disabled or missing. */ - enabled(win?:() => void, fail?:() => void):void; + enabled(win?:(status:String) => void, fail?:(status:String) => void):void; /** * Removes the previously registered event listener added via nfc.addTagDiscoveredListener diff --git a/soap/soap-tests.ts b/soap/soap-tests.ts index 5229cfcf8e..8010d7285e 100644 --- a/soap/soap-tests.ts +++ b/soap/soap-tests.ts @@ -2,6 +2,8 @@ import * as soap from 'soap'; import * as events from 'events'; +import * as fs from "fs"; +import * as http from "http"; const url = 'http://example.com/wsdl?wsdl'; const wsdlOptions = { name: 'value' }; @@ -21,3 +23,45 @@ soap.createClient(url, wsdlOptions, function(err: any, client: soap.Client) { }); }); +var myService = { + MyService: { + MyPort: { + MyFunction: function(args: any) { + return { + name: args.name + }; + }, + + // This is how to define an asynchronous function. + MyAsyncFunction: function(args: any, callback: any) { + // do some work + callback({ + name: args.name + }); + }, + + // This is how to receive incoming headers + HeadersAwareFunction: function(args: any, cb: any, headers: any) { + return { + name: headers.Token + }; + }, + + // You can also inspect the original `req` + reallyDeatailedFunction: function(args: any, cb: any, headers: any, req: any) { + console.log('SOAP `reallyDeatailedFunction` request from ' + req.connection.remoteAddress); + return { + name: headers.Token + }; + } + } + } + }; + +var xml = fs.readFileSync('myservice.wsdl', 'utf8'), + server = http.createServer(function(request,response) { + response.end("404: Not Found: " + request.url); + }); + +server.listen(8000); +soap.listen(server, '/wsdl', myService, xml); diff --git a/soap/soap.d.ts b/soap/soap.d.ts index 21fcb98514..fa26cbf04c 100644 --- a/soap/soap.d.ts +++ b/soap/soap.d.ts @@ -1,9 +1,9 @@ // Type definitions for soap // Project: https://www.npmjs.com/package/soap -// Definitions by: Nicole Wang +// Definitions by: Nicole Wang , Cage Fox // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// +/// declare module 'soap' { import * as events from 'events'; @@ -18,4 +18,12 @@ declare module 'soap' { } function createClient(wsdlPath: string, options: any, fn: (err: any, client: Client) => void): void; -} \ No newline at end of file + export interface Server extends events.EventEmitter { + addSoapHeader(soapHeader: any, name:any, namespace: any, xmlns: any): any; + changeSoapHeader(index: any, soapHeader: any, name: any, namespace: any, xmlns: any): any; + getSoapHeaders(): any; + clearSoapHeaders(): any; + log(type: any, data: any): any; + } + export function listen(server: any, path: string, service:any, wsdl: string): Server; +} diff --git a/sqs-consumer/sqs-consumer-tests.ts b/sqs-consumer/sqs-consumer-tests.ts new file mode 100644 index 0000000000..516aeb6adf --- /dev/null +++ b/sqs-consumer/sqs-consumer-tests.ts @@ -0,0 +1,28 @@ +/// + +import * as Consumer from "sqs-consumer"; + +var app = Consumer.create({ + queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name', + handleMessage: function (message, done) { + // do some work with `message` + done(); + } +}); + +var app2 = Consumer.create({ + queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name', + handleMessage: function(message, done){ + done(); + }, + region: "us-west-1", + batchSize: 15, + visibilityTimeout: 50, + waitTimeSeconds: 50 +}); + +app.on('error', function (err: any) { + console.log(err.message); +}); + +app.start(); diff --git a/sqs-consumer/sqs-consumer.d.ts b/sqs-consumer/sqs-consumer.d.ts new file mode 100644 index 0000000000..8c2315d083 --- /dev/null +++ b/sqs-consumer/sqs-consumer.d.ts @@ -0,0 +1,43 @@ +// Type definitions for sqs-consumer +// Project: https://github.com/BBC/sqs-consumer +// Definitions by: Daniel Chao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "sqs-consumer" { + + import { SQS } from "aws-sdk"; + + module SQSConsumer { + + interface MessageHandler { + (message: SQS.Message, done: Function): any; + } + + interface ConsumerOpts { + queueUrl: string; + handleMessage: MessageHandler; + region?: string; + attributeNames?: string[]; + messageAttributeNames?: string[]; + batchSize?: number; + visibilityTimeout?: number; + waitTimeSeconds?: number; + authenticationErrorTimeout?: number; + sqs?: SQS; + } + + interface Consumer extends NodeJS.EventEmitter { + start (): void; + stop (): void; + } + + interface ConsumerFactory { + create(opts: ConsumerOpts): Consumer; + } + } + const Consumer: SQSConsumer.ConsumerFactory; + export = Consumer; + +} diff --git a/sqs-producer/sqs-producer-tests.ts b/sqs-producer/sqs-producer-tests.ts new file mode 100644 index 0000000000..f224ab11fb --- /dev/null +++ b/sqs-producer/sqs-producer-tests.ts @@ -0,0 +1,52 @@ +// Taken straight from sqs-producer's README.md + +/// + + +import * as Producer from "sqs-producer"; + +var producer = Producer.create({ + queueUrl: 'https://sqs.eu-west-1.amazonaws.com/account-id/queue-name', + region: 'eu-west-1' +}); + +// send messages to the queue +producer.send(['msg1', 'msg2'], function(err) { + if (err) console.log(err); +}); + +// get the current size of the queue +producer.queueSize(function (err, size) { + if (err) console.log(err); + + console.log('There are', size, 'messages on the queue.'); +}); + +// send a message to the queue with a specific ID (by default the body is used as the ID) +producer.send([{ + id: 'id1', + body: 'Hello world' +}], function(err) { + if (err) console.log(err); +}); + +// send a message to the queue with +// - delaySeconds (must be an number contained within 0 and 900) +// - messageAttributes +producer.send([ + { + id: 'id1', + body: 'Hello world with two string attributes: attr1 and attr2', + messageAttributes: { + attr1: { DataType: 'String', StringValue: 'stringValue' }, + attr2: { DataType: 'Binary', BinaryValue: new Buffer('binaryValue') } + } + }, + { + id: 'id2', + body: 'Hello world delayed by 5 seconds', + delaySeconds: 5 + } +], function(err) { + if (err) console.log(err); +}); diff --git a/sqs-producer/sqs-producer.d.ts b/sqs-producer/sqs-producer.d.ts new file mode 100644 index 0000000000..10638f90c5 --- /dev/null +++ b/sqs-producer/sqs-producer.d.ts @@ -0,0 +1,51 @@ +// Type definitions for sqs-producer +// Project: https://github.com/BBC/sqs-producer +// Definitions by: Daniel Chao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "sqs-producer" { + + import { SQS } from "aws-sdk"; + + module SQSProducer { + + interface ProducerOpts { + queueUrl: string; + region?: string; + batchSize?: number; + sqs?: SQS; + } + + interface ProducerCallback { + (err?: Error, data?: T): any; + } + + interface ProducerMessageAttribute { + DataType: "String"|"Binary"; + StringValue?: string; + BinaryValue?: Buffer; + } + + interface ProducerMessage { + id: string; + body: string; + messageAttributes?: { [key: string]: ProducerMessageAttribute } + delaySeconds?: number; + } + + interface ProducerFactory { + create(opts: ProducerOpts): Producer; + } + + interface Producer { + send(messages: string[], cb: ProducerCallback): void; + send(messages: ProducerMessage[], cb: ProducerCallback): void; + queueSize(cb: ProducerCallback): void; + } + } + + const Producer: SQSProducer.ProducerFactory; + export = Producer; +} diff --git a/stripe/stripe-node-tests.ts b/stripe/stripe-node-tests.ts index 0a42d9dbba..960a3abfb8 100644 --- a/stripe/stripe-node-tests.ts +++ b/stripe/stripe-node-tests.ts @@ -941,6 +941,39 @@ stripe.plans.list().then(function (plans) { //#region Subscriptions tests // ################################################################################## +stripe.subscriptions.create({ plan: "platypi-dev", customer: "cus_5rfJKDJkuxzh5Q" }, function(err, subscription) { + // asynchronously called +}); +stripe.subscriptions.create({ plan: "platypi-dev", customer: "cus_5rfJKDJkuxzh5Q" }).then(function(subscription) { + // asynchronously called +}); +stripe.subscriptions.retrieve("sub_8QwCiwZ9tmMSpt", function(err, subscription) { + // asynchronously called +}); +stripe.subscriptions.retrieve("sub_8QwCiwZ9tmMSpt").then(function(subscription) { + // asynchronously called +}); + +stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { plan: "platypi" }, function(err, subscription) { + // asynchronously called +}); +stripe.subscriptions.update("sub_8QwCiwZ9tmMSpt", { plan: "platypi" }).then(function(subscription) { + // asynchronously called +}); + +stripe.subscriptions.del("sub_8QwCiwZ9tmMSpt", function(err, subscription) { + // asynchronously called +}); +stripe.subscriptions.del("sub_8QwCiwZ9tmMSpt").then(function(subscription) { + // asynchronously called +}); + +stripe.subscriptions.list({ customer: "cus_5rfJKDJkuxzh5Q", plan: "platypi-dev" }, function(err, subscriptions) { + // asynchronously called +}); +stripe.subscriptions.list({ customer: "cus_5rfJKDJkuxzh5Q", plan: "platypi-dev" }).then(function(subscriptions) { + // asynchronously called +}); //#endregion diff --git a/stripe/stripe-node.d.ts b/stripe/stripe-node.d.ts index 5f0575b53b..202cd5790d 100644 --- a/stripe/stripe-node.d.ts +++ b/stripe/stripe-node.d.ts @@ -1,4 +1,4 @@ -// Type definitions for stripe-node 4.5.0 +// Type definitions for stripe-node 4.6.0 // Project: https://github.com/stripe/stripe-node/ // Definitions by: William Johnston , Peter Harris // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -61,6 +61,7 @@ declare namespace StripeNode { * @deprecated */ recipients: resources.Recipients; + subscriptions: resources.Subscriptions; tokens: resources.Tokens; transfers: resources.Transfers; applicationFees: resources.ApplicationFees; @@ -1250,7 +1251,7 @@ declare namespace StripeNode { subscriptions: ICustomerSubscriptions; } - interface ICustomerSubscriptions extends IList, resources.CustomerSubscriptions {} + interface ICustomerSubscriptions extends IList, resources.CustomerSubscriptions {} interface ICustomerCreationOptions extends IDataOptionsWithMetadata { /** @@ -3999,7 +4000,7 @@ declare namespace StripeNode { } } - namespace customerSubscriptions { + namespace subscriptions { /** * Subscriptions allow you to charge a customer's card on a recurring basis. A subscription ties a customer to * a particular plan you've created: https://stripe.com/docs/api#create_plan @@ -4098,7 +4099,7 @@ declare namespace StripeNode { trial_start: number; } - interface ISubscriptionCreationOptions extends IDataOptionsWithMetadata { + interface ISubscriptionCustCreationOptions extends IDataOptionsWithMetadata { /** * The identifier of the plan to subscribe the customer to. */ @@ -4143,6 +4144,13 @@ declare namespace StripeNode { trial_end?: number; } + interface ISubscriptionCreationOptions extends ISubscriptionCustCreationOptions { + /*** + * The identifier of the customer to subscribe. + */ + customer: string; + } + interface ISubscriptionUpdateOptions extends IDataOptionsWithMetadata { /** * A positive decimal (with at most two decimal places) between 1 and 100. This represents the percentage of the subscription invoice @@ -4206,6 +4214,18 @@ declare namespace StripeNode { */ at_period_end?: boolean; } + + interface ISubscriptionListOptions extends IListOptionsCreated { + /** + * The ID of the customer whose subscriptions will be retrieved + */ + customer?: string; + + /** + * The ID of the plan whose subscriptions will be retrieved + */ + plan?: string; + } } namespace refunds { @@ -5303,8 +5323,8 @@ declare namespace StripeNode { * @param customerId The customer to which the add the subscription. * @param options The options for the new subscription */ - createSubscription(customerId: string, data: customerSubscriptions.ISubscriptionCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; - createSubscription(customerId: string, data: customerSubscriptions.ISubscriptionCreationOptions, response?: IResponseFn): Promise; + createSubscription(customerId: string, data: subscriptions.ISubscriptionCustCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + createSubscription(customerId: string, data: subscriptions.ISubscriptionCustCreationOptions, response?: IResponseFn): Promise; /** * By default, you can see the 10 most recent active subscriptions stored on a customer directly on the customer @@ -5315,8 +5335,8 @@ declare namespace StripeNode { * @param customerId The customer ID for the subscription * @param subscriptionId The ID of the subscription to retrieve */ - retrieveSubscription(customerId: string, subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; - retrieveSubscription(customerId: string, subscriptionId: string, response?: IResponseFn): Promise; + retrieveSubscription(customerId: string, subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; + retrieveSubscription(customerId: string, subscriptionId: string, response?: IResponseFn): Promise; /** * Updates an existing subscription on a customer to match the specified parameters. When changing plans or quantities, @@ -5343,8 +5363,8 @@ declare namespace StripeNode { * @param subscriptionId The ID of the subscription to update. * @param data The fields to update */ - updateSubscription(customerId: string, subscriptionId: string, data: customerSubscriptions.ISubscriptionUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; - updateSubscription(customerId: string, subscriptionId: string, data: customerSubscriptions.ISubscriptionUpdateOptions, response?: IResponseFn): Promise; + updateSubscription(customerId: string, subscriptionId: string, data: subscriptions.ISubscriptionUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; + updateSubscription(customerId: string, subscriptionId: string, data: subscriptions.ISubscriptionUpdateOptions, response?: IResponseFn): Promise; /** * Cancels a customer's subscription. If you set the at_period_end parameter to true, the subscription will remain active until @@ -5365,9 +5385,9 @@ declare namespace StripeNode { * @param subscriptionId The ID of the subscription to cancel. * @param data Specify when to cancel the subscription */ - cancelSubscription(customerId: string, subscriptionId: string, data: customerSubscriptions.ISubscriptionCancellationOptions, options: HeaderOptions, response?: IResponseFn): Promise; - cancelSubscription(customerId: string, subscriptionId: string, data: customerSubscriptions.ISubscriptionCancellationOptions, response?: IResponseFn): Promise; - cancelSubscription(customerId: string, subscriptionId: string, response?: IResponseFn): Promise; + cancelSubscription(customerId: string, subscriptionId: string, data: subscriptions.ISubscriptionCancellationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + cancelSubscription(customerId: string, subscriptionId: string, data: subscriptions.ISubscriptionCancellationOptions, response?: IResponseFn): Promise; + cancelSubscription(customerId: string, subscriptionId: string, response?: IResponseFn): Promise; /** * You can see a list of the customer's active subscriptions. Note that the 10 most recent active subscriptions are always available @@ -5380,10 +5400,10 @@ declare namespace StripeNode { * @param customerId The ID of the customer whose subscriptions will be retrieved * @param data Filtering options */ - listSubscriptions(customerId: string, data: IListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; - listSubscriptions(customerId: string, data: IListOptions, response?: IResponseFn>): Promise>; - listSubscriptions(customerId: string, options: HeaderOptions, response?: IResponseFn>): Promise>; - listSubscriptions(customerId: string, response?: IResponseFn>): Promise>; + listSubscriptions(customerId: string, data: IListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + listSubscriptions(customerId: string, data: IListOptions, response?: IResponseFn>): Promise>; + listSubscriptions(customerId: string, options: HeaderOptions, response?: IResponseFn>): Promise>; + listSubscriptions(customerId: string, response?: IResponseFn>): Promise>; /** @@ -5410,19 +5430,7 @@ declare namespace StripeNode { deleteSubscriptionDiscount(customerId: string, subscriptionId: string, response?: IResponseFn): Promise;; } - class CustomerSubscriptions extends StripeResource { - /** - * Creates a new subscription on an existing customer. - * - * @returns The newly created subscription object if the call succeeded. If the customer has no card or the - * attempted charge fails, this call throws an error (unless the specified plan is free or has a trial - * period). - * - * @param options The options for the new subscription - */ - create(data: customerSubscriptions.ISubscriptionCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; - create(data: customerSubscriptions.ISubscriptionCreationOptions, response?: IResponseFn): Promise; - + class SubscriptionsBase extends StripeResource { /** * By default, you can see the 10 most recent active subscriptions stored on a customer directly on the customer * object, but you can also retrieve details about a specific active subscription for a customer. @@ -5431,8 +5439,8 @@ declare namespace StripeNode { * * @param subscriptionId The ID of the subscription to retrieve */ - retrieve(subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; - retrieve(subscriptionId: string, response?: IResponseFn): Promise; + retrieve(subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; + retrieve(subscriptionId: string, response?: IResponseFn): Promise; /** * Updates an existing subscription on a customer to match the specified parameters. When changing plans or quantities, @@ -5458,8 +5466,8 @@ declare namespace StripeNode { * @param subscriptionId The ID of the subscription to update. * @param data The fields to update */ - update(subscriptionId: string, data: customerSubscriptions.ISubscriptionUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; - update(subscriptionId: string, data: customerSubscriptions.ISubscriptionUpdateOptions, response?: IResponseFn): Promise; + update(subscriptionId: string, data: subscriptions.ISubscriptionUpdateOptions, options: HeaderOptions, response?: IResponseFn): Promise; + update(subscriptionId: string, data: subscriptions.ISubscriptionUpdateOptions, response?: IResponseFn): Promise; /** * Cancels a customer's subscription. If you set the at_period_end parameter to true, the subscription will remain active until @@ -5479,10 +5487,10 @@ declare namespace StripeNode { * @param subscriptionId The ID of the subscription to cancel. * @param data Specify when to cancel the subscription */ - del(subscriptionId: string, data: customerSubscriptions.ISubscriptionCancellationOptions, options: HeaderOptions, response?: IResponseFn): Promise; - del(subscriptionId: string, data: customerSubscriptions.ISubscriptionCancellationOptions, response?: IResponseFn): Promise; - del(subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; - del(subscriptionId: string, response?: IResponseFn): Promise; + del(subscriptionId: string, data: subscriptions.ISubscriptionCancellationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + del(subscriptionId: string, data: subscriptions.ISubscriptionCancellationOptions, response?: IResponseFn): Promise; + del(subscriptionId: string, options: HeaderOptions, response?: IResponseFn): Promise; + del(subscriptionId: string, response?: IResponseFn): Promise; /** * You can see a list of the customer's active subscriptions. Note that the 10 most recent active subscriptions are always available @@ -5494,10 +5502,10 @@ declare namespace StripeNode { * * @param data Filtering options */ - list(data: IListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; - list(data: IListOptions, response?: IResponseFn>): Promise>; - list(options: HeaderOptions, response?: IResponseFn>): Promise>; - list(response?: IResponseFn>): Promise>; + list(data: subscriptions.ISubscriptionListOptions, options: HeaderOptions, response?: IResponseFn>): Promise>; + list(data: subscriptions.ISubscriptionListOptions, response?: IResponseFn>): Promise>; + list(options: HeaderOptions, response?: IResponseFn>): Promise>; + list(response?: IResponseFn>): Promise>; /** * Removes the currently applied discount on a subscription. @@ -5511,6 +5519,33 @@ declare namespace StripeNode { deleteDiscount(subscriptionId: string, response?: IResponseFn): Promise;; } + class Subscriptions extends SubscriptionsBase { + /** + * Creates a new subscription on an existing customer. + * + * @returns The newly created subscription object if the call succeeded. If the customer has no card or the + * attempted charge fails, this call throws an error (unless the specified plan is free or has a trial + * period). + * + * @param options The options for the new subscription + */ + create(data: subscriptions.ISubscriptionCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + create(data: subscriptions.ISubscriptionCreationOptions, response?: IResponseFn): Promise; + } + class CustomerSubscriptions extends SubscriptionsBase { + /** + * Creates a new subscription on an existing customer. + * + * @returns The newly created subscription object if the call succeeded. If the customer has no card or the + * attempted charge fails, this call throws an error (unless the specified plan is free or has a trial + * period). + * + * @param options The options for the new subscription + */ + create(data: subscriptions.ISubscriptionCustCreationOptions, options: HeaderOptions, response?: IResponseFn): Promise; + create(data: subscriptions.ISubscriptionCustCreationOptions, response?: IResponseFn): Promise; + } + class Disputes extends StripeResource { /** * Retrieves the dispute with the given ID.