-
Notifications
You must be signed in to change notification settings - Fork 1
Coupon
github-actions edited this page Aug 27, 2024
·
2 revisions
Contains all information about a given CsvOrder
Name | Type | Description |
---|---|---|
id |
string |
The ID of the coupon. |
name |
string |
The name of the coupon. |
companyId |
string |
The ID of the company the coupon belongs to. |
stats |
object |
An object containing the stats of the coupon. With keys 'total', 'used' and 'remaining' |
Refresh the Coupon data to get the latest information
Returns: Promise<void>
Example
const coupon: Coupon;
await coupon.refresh();
Get all coupon codes within the coupon. |
Returns: Promise<PaginatedResponse<CouponCode>>
Example
const couponCodes = await coupon.getCodes();
Get all coupon codes by its ID.
Parameters
Name | Type | Description |
---|---|---|
id |
string |
The ID of the coupon code to get. |
Returns: Promise<PaginatedResponse<CouponCode>>
Example
const couponCode = await coupon.getCode("example-coupon-code-id");
Add coupon codes to the coupon by uploading a CSV.
Parameters
Name | Type | Description |
---|---|---|
csv |
ArrayBuffer |
The file to upload. Must be a CSV |
**Returns: Promise<void>
Example
const data = fs.readFileSync("example.csv").buffer;
const file = await coupon.addCodes(data);
Delete the coupon.
**Returns: Promise<void>
Example
await coupon.delete();