(customerPortal.benefitGrants)
List benefits grants of the authenticated customer.
Scopes: customer_portal:read
customer_portal:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.benefitGrants.list({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
organizationId: [
"1dbfc517-0bbf-4301-9ba8-555ca42b9737",
],
});
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalBenefitGrantsList } from "@polar-sh/sdk/funcs/customerPortalBenefitGrantsList.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalBenefitGrantsList(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
organizationId: [
"1dbfc517-0bbf-4301-9ba8-555ca42b9737",
],
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
for await (const page of result) {
// Handle the page
console.log(page);
}
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CustomerPortalBenefitGrantsListRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalBenefitGrantsListSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<operations.CustomerPortalBenefitGrantsListResponse>
Error Type | Status Code | Content Type |
---|---|---|
errors.HTTPValidationError | 422 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Get a benefit grant by ID for the authenticated customer.
Scopes: customer_portal:read
customer_portal:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.benefitGrants.get({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalBenefitGrantsGet } from "@polar-sh/sdk/funcs/customerPortalBenefitGrantsGet.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalBenefitGrantsGet(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CustomerPortalBenefitGrantsGetRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalBenefitGrantsGetSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerBenefitGrant>
Error Type | Status Code | Content Type |
---|---|---|
errors.ResourceNotFound | 404 | application/json |
errors.HTTPValidationError | 422 | application/json |
errors.SDKError | 4XX, 5XX | */* |
Update a benefit grant for the authenticated customer.
Scopes: customer_portal:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.benefitGrants.update({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
customerBenefitGrantUpdate: {},
});
// Handle the result
console.log(result);
}
run();
The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalBenefitGrantsUpdate } from "@polar-sh/sdk/funcs/customerPortalBenefitGrantsUpdate.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore();
async function run() {
const res = await customerPortalBenefitGrantsUpdate(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
customerBenefitGrantUpdate: {
properties: {
accountId: "<id>",
},
},
});
if (!res.ok) {
throw res.error;
}
const { value: result } = res;
// Handle the result
console.log(result);
}
run();
Parameter | Type | Required | Description |
---|---|---|---|
request |
operations.CustomerPortalBenefitGrantsUpdateRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalBenefitGrantsUpdateSecurity | ✔️ | The security requirements to use for the request. |
options |
RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions |
RequestInit | ➖ | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body , are allowed. |
options.retries |
RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Promise<components.CustomerBenefitGrant>
Error Type | Status Code | Content Type |
---|---|---|
errors.NotPermitted | 403 | application/json |
errors.ResourceNotFound | 404 | application/json |
errors.HTTPValidationError | 422 | application/json |
errors.SDKError | 4XX, 5XX | */* |