Stripe: Add Types for Review Object (#40570)

* typing for reviews

* codeowner

* run lint
This commit is contained in:
Aseel Al Dallal
2019-11-22 08:28:14 -08:00
committed by Sheetal Nandi
parent 0d10d141e7
commit 5204fcfeeb
2 changed files with 73 additions and 0 deletions
+44
View File
@@ -120,6 +120,7 @@ declare class Stripe {
fileLinks: Stripe.resources.FileLinks;
bitcoinReceivers: Stripe.resources.BitcoinReceivers;
refunds: Stripe.resources.Refunds;
reviews: Stripe.resources.Reviews;
countrySpecs: Stripe.resources.CountrySpecs;
orders: Stripe.resources.Orders;
products: Stripe.resources.Products;
@@ -13901,6 +13902,49 @@ declare namespace Stripe {
list(response?: IResponseFn<IList<refunds.IRefund>>): IListPromise<refunds.IRefund>;
}
class Reviews extends StripeResource {
/**
* Approves a Review object, closing it and removing it from the list of reviews. Returns the approved
* review object.
* @param id - The identifier of the review to be approved.
*/
approve(
id: string,
options: HeaderOptions,
response?: IResponseFn<reviews.IReview>,
): Promise<reviews.IReview>;
approve(id: string, response?: IResponseFn<reviews.IReview>): Promise<reviews.IReview>;
retrieve(
id: string,
options: HeaderOptions,
response?: IResponseFn<reviews.IReview>,
): Promise<reviews.IReview>;
retrieve(
id: string,
response?: IResponseFn<reviews.IReview>,
): Promise<reviews.IReview>;
/**
* Returns a list of Review objects that have open set to true. The objects are sorted in descending
* order by creation date, with the most recently created object appearing first.
*/
list(
data: IListOptionsCreated,
options: HeaderOptions,
response?: IResponseFn<IList<reviews.IReview>>,
): IListPromise<reviews.IReview>;
list(
data: IListOptionsCreated,
response?: IResponseFn<IList<reviews.IReview>>,
): IListPromise<reviews.IReview>;
list(
options: HeaderOptions,
response?: IResponseFn<IList<reviews.IReview>>,
): IListPromise<reviews.IReview>;
list(response?: IResponseFn<IList<reviews.IReview>>): IListPromise<reviews.IReview>;
}
class Sources extends StripeResource {
/** Create Source: https://stripe.com/docs/api/sources/create */
create(
+29
View File
@@ -1394,6 +1394,35 @@ stripe.applicationFees.retrieveRefund('fee_1Eq2auEELBA7Bnp1FpeuNccq', 'fr_1Eq2au
//#endregion
//#region Reviews tests
// ##################################################################################
stripe.reviews.approve('prv_1FhJ93BZBR5SQORgPByBqMbC', (err, review) => {
review; // $ExpectType IReview
});
stripe.reviews.approve('prv_1FhJ93BZBR5SQORgPByBqMbC').then(review => {
review; // $ExpectType IReview
});
stripe.reviews.retrieve('prv_1FhJ93BZBR5SQORgPByBqMbC', (err, review) => {
review; // $ExpectType IReview
});
stripe.reviews.retrieve('prv_1FhJ93BZBR5SQORgPByBqMbC').then(review => {
review; // $ExpectType IReview
});
stripe.reviews.list({ limit: 3 }, (err, reviews) => {
reviews; // $ExpectType IList<IReview>
});
stripe.reviews.list({ limit: 3 }).then(reviews => {
reviews; // $ExpectType IList<IReview>
});
//#endregion
//#region External Accounts tests
// ##################################################################################