list()
List available coupons
Returns coupons visible to the authenticated account. Staff accounts receive administrative fields; customers receive the public coupon view.
Signature
client.coupons.list(options: CouponsListOptions = {}): Promise<CouponsListResponse>Parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
code | string | Optional | — |
limit | number | Optional | Number of results to return per page. |
offset | number | Optional | The initial index from which to return the results. |
ordering | string | Optional | Which field to use when ordering the results. |
search | string | Optional | Case-insensitive partial search across Coupon fields: `title` and `content`. Separate multiple terms with spaces or commas; every term must match at least one listed field. |
type | string | Optional | * `free_data` - Free Data * `monetary` - Money * `percentage` - Percentage |
acceptLanguage | string | Optional | Preferred language for human-readable API errors. Supported languages: en, ru, uk, de, it, fr, es, zh-hans, ja. Regional language tags and quality weights are accepted; unsupported or omitted values use English. |
Example
const result = await client.coupons.list();Returns
PaginatedCouponShortListThe operation completed successfully.
typePaginatedCouponShortList4fields
countnumbernextstringpreviousstringresultsCouponShort[]typeCouponShort14fields
idstringis_expiredbooleanis_redeemedbooleanpackagesPackageShort[]typePackageShort5fields
idstringnamestringaliasstringis_unlimited_databooleantargeting_optionsTargetingOptionstypeTargetingOptions25fields
packagestringsplit_charstringvalue_charstringcontinentstringcountrystringregionstringcitystringasnstringispstringusernamestringpoolstringlocationstringlocation_formatstringsessionstringsession_mode_tagstringsession_ttlstringsession_ttl_formatnumberosstringos_combinedbooleanos_split_charstringos_linuxstringos_windowsstringos_iosstringos_macosstringos_androidstringcreatedstringvaluenumbercodestringis_multi_usebooleanis_available_to_one_timebooleantypeCouponTypeEnumenumCouponTypeEnum0fields
* `free_data` - Free Data * `monetary` - Money * `percentage` - Percentage
No fields.
limitnumbervalid_untilstringmarketerstringuserstringThrows
ApiErrorNormalized API, transport, and response processing failure.
kind: "validation"The request arguments or business rules are invalid.kind: "authentication"Authentication credentials are missing, expired, or invalid.kind: "permission"The authenticated account cannot perform this operation.kind: "network"The request could not reach ProxyRequest.kind: "unexpected"The response could not be decoded or did not match the SDK contract.
Advanced variants
client.coupons.listWithResponse(options): Promise<ApiResponse<CouponsListResponse>>Returns response status, headers, ETag and idempotency metadata with the decoded data.
Signature
client.coupons.list(*, code: str | Unset=UNSET, limit: int | Unset=UNSET, offset: int | Unset=UNSET, ordering: str | Unset=UNSET, search: str | Unset=UNSET, type_: CouponsListType | Unset=UNSET, accept_language: str | Unset=UNSET) -> PaginatedCouponShortListawait async_client.coupons.list(*, code: str | Unset=UNSET, limit: int | Unset=UNSET, offset: int | Unset=UNSET, ordering: str | Unset=UNSET, search: str | Unset=UNSET, type_: CouponsListType | Unset=UNSET, accept_language: str | Unset=UNSET) -> PaginatedCouponShortListParameters
| Name | Type | Requirement | Description |
|---|---|---|---|
code | str | Optional | — |
limit | int | Optional | Number of results to return per page. |
offset | int | Optional | The initial index from which to return the results. |
ordering | str | Optional | Which field to use when ordering the results. |
search | str | Optional | Case-insensitive partial search across Coupon fields: `title` and `content`. Separate multiple terms with spaces or commas; every term must match at least one listed field. |
type | str | Optional | * `free_data` - Free Data * `monetary` - Money * `percentage` - Percentage |
accept_language | str | Optional | Preferred language for human-readable API errors. Supported languages: en, ru, uk, de, it, fr, es, zh-hans, ja. Regional language tags and quality weights are accepted; unsupported or omitted values use English. |
Example
result = client.coupons.list()Async example
result = await async_client.coupons.list()Returns
PaginatedCouponShortListThe operation completed successfully.
classPaginatedCouponShortList4fields
countintresultslist[CouponShort]classCouponShort14fields
is_expiredboolis_redeemedboolpackageslist[PackageShort]classPackageShort5fields
namestraliasstrtargeting_optionsTargetingOptionsclassTargetingOptions25fields
packagestrsplit_charstrvalue_charstrcontinentstrcountrystrregionstrcitystrasnstrispstrusernamestrpoolstrlocationstrlocation_formatstrsessionstrsession_mode_tagstrsession_ttlstrsession_ttl_formatintosstros_combinedboolos_split_charstros_linuxstros_windowsstros_iosstros_macosstros_androidstridstris_unlimited_databoolcreateddatetime.datetimevalueintcodestrtype_CouponTypeEnumenumCouponTypeEnum0fields
No fields.
userNone | UUIDidstris_multi_useboolis_available_to_one_timeboollimitintvalid_untildatetime.datetime | NonemarketerNone | UUIDnext_None | strpreviousNone | strThrows
ApiErrorNormalized API, transport, and response processing failure.
ErrorKind.VALIDATIONThe request arguments or business rules are invalid.ErrorKind.AUTHENTICATIONAuthentication credentials are missing, expired, or invalid.ErrorKind.PERMISSIONThe authenticated account cannot perform this operation.ErrorKind.NETWORKThe request could not reach ProxyRequest.ErrorKind.UNEXPECTEDThe response could not be decoded or did not match the SDK contract.
Advanced variants
client.coupons.list_with_response(*, code: str | Unset=UNSET, limit: int | Unset=UNSET, offset: int | Unset=UNSET, ordering: str | Unset=UNSET, search: str | Unset=UNSET, type_: CouponsListType | Unset=UNSET, accept_language: str | Unset=UNSET) -> ApiResponse[PaginatedCouponShortList]Returns response status, headers, ETag and idempotency metadata with the decoded data.
Signature
$client->coupons()->list($code = null, $limit = null, $offset = null, $ordering = null, $search = null, $type = null, $acceptLanguage = null, string $contentType = self::contentTypes['list'][0])Parameters
| Name | Type | Requirement | Description |
|---|---|---|---|
code | string | Optional | — |
limit | int | Optional | Number of results to return per page. |
offset | int | Optional | The initial index from which to return the results. |
ordering | string | Optional | Which field to use when ordering the results. |
search | string | Optional | Case-insensitive partial search across Coupon fields: `title` and `content`. Separate multiple terms with spaces or commas; every term must match at least one listed field. |
type | string | Optional | * `free_data` - Free Data * `monetary` - Money * `percentage` - Percentage |
acceptLanguage | string | Optional | Preferred language for human-readable API errors. Supported languages: en, ru, uk, de, it, fr, es, zh-hans, ja. Regional language tags and quality weights are accepted; unsupported or omitted values use English. |
Example
$result = $client->coupons()->list();Returns
PaginatedCouponShortListThe operation completed successfully.
classPaginatedCouponShortList4fields
countintnextstringpreviousstringresults[CouponShort[]](CouponShort.md)classCouponShort14fields
idstringisExpiredboolisRedeemedboolpackages[PackageShort[]](PackageShort.md)classPackageShort5fields
idstringnamestringaliasstringisUnlimitedDatabooltargetingOptionsTargetingOptionsclassTargetingOptions25fields
packagestringsplitCharstringvalueCharstringcontinentstringcountrystringregionstringcitystringasnstringispstringusernamestringpoolstringlocationstringlocationFormatstringsessionstringsessionModeTagstringsessionTtlstringsessionTtlFormatintosstringosCombinedboolosSplitCharstringosLinuxstringosWindowsstringosIosstringosMacosstringosAndroidstringcreatedDateTimevalueintcodestringisMultiUseboolisAvailableToOneTimebooltypeCouponTypeEnumenumCouponTypeEnum0fields
* `free_data` - Free Data * `monetary` - Money * `percentage` - Percentage
No fields.
limitintvalidUntilDateTimemarketerstringuserstringThrows
ApiExceptionNormalized API, transport, and response processing failure.
ErrorKind::ValidationThe request arguments or business rules are invalid.ErrorKind::AuthenticationAuthentication credentials are missing, expired, or invalid.ErrorKind::PermissionThe authenticated account cannot perform this operation.ErrorKind::NetworkThe request could not reach ProxyRequest.ErrorKind::UnexpectedThe response could not be decoded or did not match the SDK contract.
InvalidArgumentExceptionA required argument is missing or violates a local SDK constraint.
local validationThe request was rejected before it was sent.
Advanced variants
$client->coupons()->listWithResponse($code = null, $limit = null, $offset = null, $ordering = null, $search = null, $type = null, $acceptLanguage = null, string $contentType = self::contentTypes['list'][0]): \ProxyRequest\ApiResponseReturns an ApiResponse with decoded data and HTTP metadata.
$client->coupons()->listWithHttpInfo($code = null, $limit = null, $offset = null, $ordering = null, $search = null, $type = null, $acceptLanguage = null, string $contentType = self::contentTypes['list'][0])Returns the OpenAPI Generator response tuple.
$client->coupons()->listAsync($code = null, $limit = null, $offset = null, $ordering = null, $search = null, $type = null, $acceptLanguage = null, string $contentType = self::contentTypes['list'][0])Returns a Guzzle promise for the decoded result.
$client->coupons()->listAsyncWithHttpInfo($code = null, $limit = null, $offset = null, $ordering = null, $search = null, $type = null, $acceptLanguage = null, string $contentType = self::contentTypes['list'][0])Returns a Guzzle promise for the response tuple.
$client->coupons()->listRequest($code = null, $limit = null, $offset = null, $ordering = null, $search = null, $type = null, $acceptLanguage = null, string $contentType = self::contentTypes['list'][0])Builds the PSR-7 request without sending it.