Skip to content

Latest commit

 

History

History
438 lines (319 loc) · 29.4 KB

File metadata and controls

438 lines (319 loc) · 29.4 KB

Events

(events)

Overview

REST APIs for capturing event data

Available Operations

  • getEventsByTarget - Load recent events for a particular workspace
  • getTargets - Load targets for a particular workspace
  • getTargetsDeprecated - Load targets for a particular workspace
  • post - Post events for a specific workspace
  • search - Search events for a particular workspace by any field

getEventsByTarget

Load recent events for a particular 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.events.getEventsByTarget({
    workspaceId: "<id>",
    targetId: "<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 { eventsGetEventsByTarget } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/eventsGetEventsByTarget.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 eventsGetEventsByTarget(speakeasy, {
    workspaceId: "<id>",
    targetId: "<id>",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

getTargets

Load targets for a particular 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.events.getTargets({});

  // 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 { eventsGetTargets } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/eventsGetTargets.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 eventsGetTargets(speakeasy, {});

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

getTargetsDeprecated

Load targets for a particular 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.events.getTargetsDeprecated({
    workspaceId: "<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 { eventsGetTargetsDeprecated } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/eventsGetTargetsDeprecated.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 eventsGetTargetsDeprecated(speakeasy, {
    workspaceId: "<id>",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

post

Sends an array of events to be stored for a particular 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.events.post({
    workspaceId: "<id>",
    requestBody: [
      {
        createdAt: new Date("2024-03-02T10:07:28.113Z"),
        executionId: "<id>",
        id: "<id>",
        interactionType: "AUTHENTICATE",
        localStartedAt: new Date("2024-08-12T17:54:17.538Z"),
        speakeasyApiKeyName: "<value>",
        speakeasyVersion: "<value>",
        success: true,
        workspaceId: "<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 { eventsPost } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/eventsPost.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 eventsPost(speakeasy, {
    workspaceId: "<id>",
    requestBody: [
      {
        createdAt: new Date("2024-03-02T10:07:28.113Z"),
        executionId: "<id>",
        id: "<id>",
        interactionType: "AUTHENTICATE",
        localStartedAt: new Date("2024-08-12T17:54:17.538Z"),
        speakeasyApiKeyName: "<value>",
        speakeasyVersion: "<value>",
        success: true,
        workspaceId: "<id>",
      },
    ],
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*

search

Search events for a particular workspace by any field

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.events.search({
    workspaceId: "<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 { eventsSearch } from "@speakeasy-api/speakeasy-client-sdk-typescript/funcs/eventsSearch.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 eventsSearch(speakeasy, {
    workspaceId: "<id>",
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.SDKError 4XX, 5XX */*