Create an OAuth2 client.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.oauth2.clients.create({
redirectUris: [
"https://impolite-hippodrome.com/",
"https://acidic-tomography.net/",
],
clientName: "<value>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { oauth2ClientsCreate } from "@polar-sh/sdk/funcs/oauth2ClientsCreate.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 oauth2ClientsCreate(polar, {
redirectUris: [
"https://impolite-hippodrome.com/",
"https://acidic-tomography.net/",
],
clientName: "<value>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("oauth2ClientsCreate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
components.OAuth2ClientConfiguration | ✔️ | 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.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Get an OAuth2 client by Client ID.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.oauth2.clients.get({
clientId: "<id>",
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { oauth2ClientsGet } from "@polar-sh/sdk/funcs/oauth2ClientsGet.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 oauth2ClientsGet(polar, {
clientId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("oauth2ClientsGet failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.Oauth2ClientsOauth2GetClientRequest | ✔️ | 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.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Update an OAuth2 client.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await polar.oauth2.clients.update({
clientId: "<id>",
oAuth2ClientConfigurationUpdate: {
redirectUris: [
"https://classic-cantaloupe.org",
"https://corrupt-status.biz/",
],
clientName: "<value>",
clientId: "<id>",
},
});
console.log(result);
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { oauth2ClientsUpdate } from "@polar-sh/sdk/funcs/oauth2ClientsUpdate.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 oauth2ClientsUpdate(polar, {
clientId: "<id>",
oAuth2ClientConfigurationUpdate: {
redirectUris: [
"https://classic-cantaloupe.org",
"https://corrupt-status.biz/",
],
clientName: "<value>",
clientId: "<id>",
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("oauth2ClientsUpdate failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.Oauth2ClientsOauth2UpdateClientRequest | ✔️ | 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.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |
Delete an OAuth2 client.
import { Polar } from "@polar-sh/sdk";
const polar = new Polar({
accessToken: process.env["POLAR_ACCESS_TOKEN"] ?? "",
});
async function run() {
await polar.oauth2.clients.delete({
clientId: "<id>",
});
}
run();The standalone function version of this method:
import { PolarCore } from "@polar-sh/sdk/core.js";
import { oauth2ClientsDelete } from "@polar-sh/sdk/funcs/oauth2ClientsDelete.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 oauth2ClientsDelete(polar, {
clientId: "<id>",
});
if (res.ok) {
const { value: result } = res;
} else {
console.log("oauth2ClientsDelete failed:", res.error);
}
}
run();| Parameter | Type | Required | Description |
|---|---|---|---|
request |
operations.Oauth2ClientsOauth2DeleteClientRequest | ✔️ | 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.HTTPValidationError | 422 | application/json |
| errors.SDKError | 4XX, 5XX | */* |