Skip to content

Latest commit

 

History

History
730 lines (519 loc) · 44.4 KB

File metadata and controls

730 lines (519 loc) · 44.4 KB

PublishingTokens

(publishingTokens)

Overview

Available Operations

  • create - Create a publishing token for a workspace
  • delete - Delete a specific publishing token
  • get - Get a specific publishing token
  • list - Get publishing tokens for a workspace
  • resolveMetadata - Get metadata about the token
  • resolveTarget - Get a specific publishing token target
  • update - Updates the validitity period of a publishing token

create

Creates a publishing token for the current workspace

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.publishingTokens.create();

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { publishingTokensCreate } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/publishingTokensCreate.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await publishingTokensCreate(speakeasy);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

import {
  // Mutation hook for triggering the API call.
  usePublishingTokensCreateMutation
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/publishingTokensCreate.js";

Parameters

Parameter Type Required Description
request operations.CreatePublishingTokenRequestBody ✔️ 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.

Response

Promise<shared.PublishingToken>

Errors

Error Type Status Code Content Type
errors.ErrorT 4XX application/json
errors.SDKError 5XX */*

delete

Delete a particular publishing token.

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  await speakeasy.publishingTokens.delete({
    tokenID: "<id>",
  });


}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { publishingTokensDelete } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/publishingTokensDelete.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await publishingTokensDelete(speakeasy, {
    tokenID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

import {
  // Mutation hook for triggering the API call.
  usePublishingTokensDeleteMutation
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/publishingTokensDelete.js";

Parameters

Parameter Type Required Description
request operations.DeletePublishingTokenRequest ✔️ 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.

Response

Promise<void>

Errors

Error Type Status Code Content Type
errors.ErrorT 4XX application/json
errors.SDKError 5XX */*

get

Get information about a particular publishing token.

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.publishingTokens.get({
    tokenID: "<id>",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { publishingTokensGet } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/publishingTokensGet.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await publishingTokensGet(speakeasy, {
    tokenID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

import {
  // Query hooks for fetching data.
  usePublishingTokensGet,
  usePublishingTokensGetSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchPublishingTokensGet,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidatePublishingTokensGet,
  invalidateAllPublishingTokensGet,
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/publishingTokensGet.js";

Parameters

Parameter Type Required Description
request operations.GetPublishingTokenByIDRequest ✔️ 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.

Response

Promise<shared.PublishingToken>

Errors

Error Type Status Code Content Type
errors.ErrorT 4XX application/json
errors.SDKError 5XX */*

list

Returns a publishing token for the current workspace

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.publishingTokens.list();

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { publishingTokensList } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/publishingTokensList.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await publishingTokensList(speakeasy);

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

import {
  // Query hooks for fetching data.
  usePublishingTokensList,
  usePublishingTokensListSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchPublishingTokensList,
  
  // Utility to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateAllPublishingTokensList,
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/publishingTokensList.js";

Parameters

Parameter Type Required Description
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<shared.PublishingToken[]>

Errors

Error Type Status Code Content Type
errors.ErrorT 4XX application/json
errors.SDKError 5XX */*

resolveMetadata

Get information about a particular publishing token.

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.publishingTokens.resolveMetadata({
    tokenID: "<id>",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { publishingTokensResolveMetadata } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/publishingTokensResolveMetadata.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await publishingTokensResolveMetadata(speakeasy, {
    tokenID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

import {
  // Query hooks for fetching data.
  usePublishingTokensResolveMetadata,
  usePublishingTokensResolveMetadataSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchPublishingTokensResolveMetadata,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidatePublishingTokensResolveMetadata,
  invalidateAllPublishingTokensResolveMetadata,
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/publishingTokensResolveMetadata.js";

Parameters

Parameter Type Required Description
request operations.GetPublishingTokenPublicMetadataRequest ✔️ 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.

Response

Promise<operations.GetPublishingTokenPublicMetadataResponseBody>

Errors

Error Type Status Code Content Type
errors.ErrorT 4XX application/json
errors.SDKError 5XX */*

resolveTarget

Get information about a particular publishing token target.

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const result = await speakeasy.publishingTokens.resolveTarget({
    tokenID: "<id>",
  });

  // Handle the result
  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { publishingTokensResolveTarget } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/publishingTokensResolveTarget.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await publishingTokensResolveTarget(speakeasy, {
    tokenID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  // Handle the result
  console.log(result);
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

import {
  // Query hooks for fetching data.
  usePublishingTokensResolveTarget,
  usePublishingTokensResolveTargetSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchPublishingTokensResolveTarget,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidatePublishingTokensResolveTarget,
  invalidateAllPublishingTokensResolveTarget,
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/publishingTokensResolveTarget.js";

Parameters

Parameter Type Required Description
request operations.GetPublishingTokenTargetByIDRequest ✔️ 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.

Response

Promise<string>

Errors

Error Type Status Code Content Type
errors.ErrorT 4XX application/json
errors.SDKError 5XX */*

update

Updates the validity period of a particular publishing token.

Example Usage

import { Speakeasy } from "@speakeasy-api/speakeasy-client-sdk-typescript";

const speakeasy = new Speakeasy({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  await speakeasy.publishingTokens.update({
    tokenID: "<id>",
  });


}

run();

Standalone function

The standalone function version of this method:

import { SpeakeasyCore } from "@speakeasy-api/speakeasy-client-sdk-typescript/core.js";
import { publishingTokensUpdate } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/publishingTokensUpdate.js";

// Use `SpeakeasyCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const speakeasy = new SpeakeasyCore({
  security: {
    apiKey: "<YOUR_API_KEY_HERE>",
  },
});

async function run() {
  const res = await publishingTokensUpdate(speakeasy, {
    tokenID: "<id>",
  });

  if (!res.ok) {
    throw res.error;
  }

  const { value: result } = res;

  
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

import {
  // Mutation hook for triggering the API call.
  usePublishingTokensUpdateMutation
} from "@speakeasy-api/speakeasy-client-sdk-typescript/react-query/publishingTokensUpdate.js";

Parameters

Parameter Type Required Description
request operations.UpdatePublishingTokenExpirationRequest ✔️ 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.

Response

Promise<void>

Errors

Error Type Status Code Content Type
errors.ErrorT 4XX application/json
errors.SDKError 5XX */*