DiscountsApi
All URIs are relative to http://localhost
| Method | HTTP request | Description |
|---|---|---|
| activateRandomYatCode | POST /codes/{code_id}/random_yat | Use random yat code |
| addPubkeyForCode | POST /codes/{code_id}/pubkeys/{pubkey} | Add pubkey for code |
| listCodes | GET /codes | Fetch codes |
| revokePubkeyForCode | DELETE /codes/{code_id}/pubkeys/{pubkey} | Revoke pubkey for code |
activateRandomYatCode#
/*** @returns DisplayOrder**/async function activateRandomYatCode(codeId: String, body: RandomYatActivateBody)Use random yat code
Notes:#
Creates cart with random yat
Example#
const yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let codeId = null; // String // populate codeId...
let body = new YatJs.RandomYatActivateBody(); // RandomYatActivateBody // populate body...
try { let res = await api.discounts().activateRandomYatCode(codeId, body); // res is of type DisplayOrder console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| codeId | String | ||
| body | RandomYatActivateBody | ||
Return type#
Authorization#
HTTP request headers#
- Content-Type: Not defined
- Accept: /
addPubkeyForCode#
/*** @returns String**/async function addPubkeyForCode(codeId: String, pubkey: String)Add pubkey for code
Notes:#
NOTE: user should have scope OrganizationCodeAdmin or CodeWrite
Example#
const yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let codeId = null; // String // populate codeId...
let pubkey = "pubkey_example"; // String | Public key to authorize usage of a code// populate pubkey...
try { let res = await api.discounts().addPubkeyForCode(codeId, pubkey); // res is of type String console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| codeId | String | ||
| pubkey | String | Public key to authorize usage of a code |
Return type#
String
Authorization#
HTTP request headers#
- Content-Type: Not defined
- Accept: /
listCodes#
/*** @returns ListOfCodeAvailability**/async function listCodes(opts)Fetch codes
Notes:#
Return codes with their usage and availability information NOTE: user should have scope OrganizationCodeAdmin or CodeRead
Example#
const yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let opts = { 'codeType': "codeType_example", // String | Optional: filter by code type 'dir': "dir_example", // String | 'limit': 56, // Number | 'organizationId': null, // String | Optional: filter by organization id 'page': 56, // Number | 'sort': "sort_example" // String | };try { let res = await api.discounts().listCodes(opts); // res is of type ListOfCodeAvailability console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| codeType | String | Optional: filter by code type | [optional] |
| dir | String | [optional] | |
| limit | Number | [optional] | |
| organizationId | String | ||
| Optional: filter by organization id | [optional] | ||
| page | Number | [optional] | |
| sort | String | [optional] |
Return type#
Authorization#
HTTP request headers#
- Content-Type: Not defined
- Accept: /
revokePubkeyForCode#
/*** @returns String**/async function revokePubkeyForCode(codeId: String, pubkey: String)Revoke pubkey for code
Notes:#
NOTE: user should have scope OrganizationCodeAdmin or CodeWrite
Example#
const yat = require('yatjs');const api = new yat.YatJs();
await api.login("[email protected]", "your_password");
let codeId = null; // String // populate codeId...
let pubkey = "pubkey_example"; // String | Public key to authorize usage of a code// populate pubkey...
try { let res = await api.discounts().revokePubkeyForCode(codeId, pubkey); // res is of type String console.log('API called successfully. Result: ', res);} catch (error) { console.error(error);}
Parameters#
| Name | Type | Description | Notes |
|---|---|---|---|
| codeId | String | ||
| pubkey | String | Public key to authorize usage of a code |
Return type#
String
Authorization#
HTTP request headers#
- Content-Type: Not defined
- Accept: /