List meters 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.customerMeters.list({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {});
for await (const page of result) {
console.log(page);
}
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalCustomerMetersList } from "@polar-sh/sdk/funcs/customerPortalCustomerMetersList.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 customerPortalCustomerMetersList(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("customerPortalCustomerMetersList failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalCustomerMetersListRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalCustomerMetersListSecurity | ✔️ | 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.CustomerPortalCustomerMetersListResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get a meter 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.customerMeters.get({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalCustomerMetersGet } from "@polar-sh/sdk/funcs/customerPortalCustomerMetersGet.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 customerPortalCustomerMetersGet(polar, {
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("customerPortalCustomerMetersGet failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.CustomerPortalCustomerMetersGetRequest | ✔️ | The request object to use for the request. |
security |
operations.CustomerPortalCustomerMetersGetSecurity | ✔️ | 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.CustomerCustomerMeter>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |