Skip to content

Latest commit

 

History

History
384 lines (280 loc) · 33.6 KB

File metadata and controls

384 lines (280 loc) · 33.6 KB

CustomerPortal.Seats

Overview

Available Operations

listSeats

Scopes: customer_portal:read customer_portal:write

Example Usage

import { Polar } from "@polar-sh/sdk";

const polar = new Polar();

async function run() {
  const result = await polar.customerPortal.seats.listSeats({
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {
    subscriptionId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalSeatsListSeats } from "@polar-sh/sdk/funcs/customerPortalSeatsListSeats.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 customerPortalSeatsListSeats(polar, {
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {
    subscriptionId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("customerPortalSeatsListSeats failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CustomerPortalSeatsListSeatsRequest ✔️ The request object to use for the request.
security operations.CustomerPortalSeatsListSeatsSecurity ✔️ 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.

Response

Promise<components.SeatsList>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

assignSeat

Assign Seat

Example Usage

import { Polar } from "@polar-sh/sdk";

const polar = new Polar();

async function run() {
  const result = await polar.customerPortal.seats.assignSeat({
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalSeatsAssignSeat } from "@polar-sh/sdk/funcs/customerPortalSeatsAssignSeat.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 customerPortalSeatsAssignSeat(polar, {
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("customerPortalSeatsAssignSeat failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request components.CustomerSeatAssign ✔️ The request object to use for the request.
security operations.CustomerPortalSeatsAssignSeatSecurity ✔️ 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.

Response

Promise<components.CustomerSeat>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

revokeSeat

Revoke Seat

Example Usage

import { Polar } from "@polar-sh/sdk";

const polar = new Polar();

async function run() {
  const result = await polar.customerPortal.seats.revokeSeat({
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {
    seatId: "4b3d74b3-01ff-4aac-bd03-320535cd5ce4",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalSeatsRevokeSeat } from "@polar-sh/sdk/funcs/customerPortalSeatsRevokeSeat.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 customerPortalSeatsRevokeSeat(polar, {
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {
    seatId: "4b3d74b3-01ff-4aac-bd03-320535cd5ce4",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("customerPortalSeatsRevokeSeat failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CustomerPortalSeatsRevokeSeatRequest ✔️ The request object to use for the request.
security operations.CustomerPortalSeatsRevokeSeatSecurity ✔️ 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.

Response

Promise<components.CustomerSeat>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

resendInvitation

Resend Invitation

Example Usage

import { Polar } from "@polar-sh/sdk";

const polar = new Polar();

async function run() {
  const result = await polar.customerPortal.seats.resendInvitation({
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {
    seatId: "e3817437-8d53-4578-88d2-1dc256825965",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalSeatsResendInvitation } from "@polar-sh/sdk/funcs/customerPortalSeatsResendInvitation.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 customerPortalSeatsResendInvitation(polar, {
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {
    seatId: "e3817437-8d53-4578-88d2-1dc256825965",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("customerPortalSeatsResendInvitation failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CustomerPortalSeatsResendInvitationRequest ✔️ The request object to use for the request.
security operations.CustomerPortalSeatsResendInvitationSecurity ✔️ 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.

Response

Promise<components.CustomerSeat>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

listClaimedSubscriptions

List all subscriptions where the authenticated customer has claimed a seat.

Scopes: customer_portal:read customer_portal:write

Example Usage

import { Polar } from "@polar-sh/sdk";

const polar = new Polar();

async function run() {
  const result = await polar.customerPortal.seats.listClaimedSubscriptions({
    customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
  }, {});

  for await (const page of result) {
    console.log(page);
  }
}

run();

Standalone function

The standalone function version of this method:

import { PolarCore } from "@polar-sh/sdk/core.js";
import { customerPortalSeatsListClaimedSubscriptions } from "@polar-sh/sdk/funcs/customerPortalSeatsListClaimedSubscriptions.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 customerPortalSeatsListClaimedSubscriptions(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("customerPortalSeatsListClaimedSubscriptions failed:", res.error);
  }
}

run();

Parameters

Parameter Type Required Description
request operations.CustomerPortalSeatsListClaimedSubscriptionsRequest ✔️ The request object to use for the request.
security operations.CustomerPortalSeatsListClaimedSubscriptionsSecurity ✔️ 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.

Response

Promise<operations.CustomerPortalSeatsListClaimedSubscriptionsResponse>

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*