- listWebhookEndpoints - List Webhook Endpoints
- createWebhookEndpoint - Create Webhook Endpoint
- getWebhookEndpoint - Get Webhook Endpoint
- deleteWebhookEndpoint - Delete Webhook Endpoint
- updateWebhookEndpoint - Update Webhook Endpoint
- resetWebhookEndpointSecret - Reset Webhook Endpoint Secret
- listWebhookDeliveries - List Webhook Deliveries
- redeliverWebhookEvent - Redeliver Webhook Event
List webhook endpoints.
Scopes: webhooks:read webhooks:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.webhooks.listWebhookEndpoints({
organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
});
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 { webhooksListWebhookEndpoints } from "@polar-sh/sdk/funcs/webhooksListWebhookEndpoints.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await webhooksListWebhookEndpoints(polar, {
organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("webhooksListWebhookEndpoints failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.WebhooksListWebhookEndpointsRequest | ✔️ | The request object 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.WebhooksListWebhookEndpointsResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Create a webhook endpoint.
Scopes: webhooks:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.webhooks.createWebhookEndpoint({
url: "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0",
format: "slack",
events: [
"subscription.uncanceled",
],
organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { webhooksCreateWebhookEndpoint } from "@polar-sh/sdk/funcs/webhooksCreateWebhookEndpoint.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await webhooksCreateWebhookEndpoint(polar, {
url: "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0",
format: "slack",
events: [
"subscription.uncanceled",
],
organizationId: "1dbfc517-0bbf-4301-9ba8-555ca42b9737",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("webhooksCreateWebhookEndpoint failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.WebhookEndpointCreate | ✔️ | The request object 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.WebhookEndpoint>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get a webhook endpoint by ID.
Scopes: webhooks:read webhooks:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.webhooks.getWebhookEndpoint({
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { webhooksGetWebhookEndpoint } from "@polar-sh/sdk/funcs/webhooksGetWebhookEndpoint.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await webhooksGetWebhookEndpoint(polar, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("webhooksGetWebhookEndpoint failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.WebhooksGetWebhookEndpointRequest | ✔️ | The request object 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.WebhookEndpoint>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Delete a webhook endpoint.
Scopes: webhooks:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
await polar.webhooks.deleteWebhookEndpoint({
id: "<value>",
});
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { webhooksDeleteWebhookEndpoint } from "@polar-sh/sdk/funcs/webhooksDeleteWebhookEndpoint.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await webhooksDeleteWebhookEndpoint(polar, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("webhooksDeleteWebhookEndpoint failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.WebhooksDeleteWebhookEndpointRequest | ✔️ | The request object 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<void>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Update a webhook endpoint.
Scopes: webhooks:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.webhooks.updateWebhookEndpoint({
id: "<value>",
webhookEndpointUpdate: {
url: "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0",
},
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { webhooksUpdateWebhookEndpoint } from "@polar-sh/sdk/funcs/webhooksUpdateWebhookEndpoint.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await webhooksUpdateWebhookEndpoint(polar, {
id: "<value>",
webhookEndpointUpdate: {
url: "https://webhook.site/cb791d80-f26e-4f8c-be88-6e56054192b0",
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("webhooksUpdateWebhookEndpoint failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.WebhooksUpdateWebhookEndpointRequest | ✔️ | The request object 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.WebhookEndpoint>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Regenerate a webhook endpoint secret.
Scopes: webhooks:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.webhooks.resetWebhookEndpointSecret({
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { webhooksResetWebhookEndpointSecret } from "@polar-sh/sdk/funcs/webhooksResetWebhookEndpointSecret.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await webhooksResetWebhookEndpointSecret(polar, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("webhooksResetWebhookEndpointSecret failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.WebhooksResetWebhookEndpointSecretRequest | ✔️ | The request object 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.WebhookEndpoint>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
List webhook deliveries.
Deliveries are all the attempts to deliver a webhook event to an endpoint.
Scopes: webhooks:read webhooks:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.webhooks.listWebhookDeliveries({});
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 { webhooksListWebhookDeliveries } from "@polar-sh/sdk/funcs/webhooksListWebhookDeliveries.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await webhooksListWebhookDeliveries(polar, {});
if (res.ok) {
const { value: result } = res;
for await (const page of result) {
console.log(page);
}
} else {
console.log("webhooksListWebhookDeliveries failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.WebhooksListWebhookDeliveriesRequest | ✔️ | The request object 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.WebhooksListWebhookDeliveriesResponse>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Schedule the re-delivery of a webhook event.
Scopes: webhooks:write
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.webhooks.redeliverWebhookEvent({
id: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { webhooksRedeliverWebhookEvent } from "@polar-sh/sdk/funcs/webhooksRedeliverWebhookEvent.js";
// Use `PolarCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const polar = new PolarCore({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const res = await webhooksRedeliverWebhookEvent(polar, {
id: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("webhooksRedeliverWebhookEvent failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.WebhooksRedeliverWebhookEventRequest | ✔️ | The request object 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<any>
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ResourceNotFound | 404 | application/json |
| errors.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |