Skip to content

Latest commit

 

History

History
349 lines (253 loc) · 27.4 KB

File metadata and controls

349 lines (253 loc) · 27.4 KB

Conversations

(conversations)

Overview

Available Operations

  • log - Log Conversation
  • list - Get All Conversations
  • get - Get Conversation
  • delete - Delete Conversation

log

Logs a new conversation or updates an existing one with new messages. Always include all messages.

API Key Types: WEB, API

Example Usage

import { InkeepAnalytics } from "@inkeep/inkeep-analytics";

const inkeepAnalytics = new InkeepAnalytics();

async function run() {
  const result = await inkeepAnalytics.conversations.log({
    webIntegrationKey: process.env["INKEEPANALYTICS_WEB_INTEGRATION_KEY"] ?? "",
  }, {
    type: "support_ticket",
    messages: [
      {
        role: "<value>",
      },
    ],
  });

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

run();

Standalone function

The standalone function version of this method:

import { InkeepAnalyticsCore } from "@inkeep/inkeep-analytics/core.js";
import { conversationsLog } from "@inkeep/inkeep-analytics/funcs/conversationsLog.js";

// Use `InkeepAnalyticsCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const inkeepAnalytics = new InkeepAnalyticsCore();

async function run() {
  const res = await conversationsLog(inkeepAnalytics, {
    webIntegrationKey: process.env["INKEEPANALYTICS_WEB_INTEGRATION_KEY"] ?? "",
  }, {
    type: "support_ticket",
    messages: [
      {
        role: "<value>",
      },
    ],
  });

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.BadRequest 400 application/problem+json
errors.Unauthorized 401 application/problem+json
errors.Forbidden 403 application/problem+json
errors.UnprocessableEntity 422 application/problem+json
errors.InternalServerError 500 application/problem+json
errors.APIError 4XX, 5XX */*

list

Get All Conversations

Example Usage

import { InkeepAnalytics } from "@inkeep/inkeep-analytics";

const inkeepAnalytics = new InkeepAnalytics({
  apiIntegrationKey: process.env["INKEEPANALYTICS_API_INTEGRATION_KEY"] ?? "",
});

async function run() {
  const result = await inkeepAnalytics.conversations.list({});

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

run();

Standalone function

The standalone function version of this method:

import { InkeepAnalyticsCore } from "@inkeep/inkeep-analytics/core.js";
import { conversationsList } from "@inkeep/inkeep-analytics/funcs/conversationsList.js";

// Use `InkeepAnalyticsCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const inkeepAnalytics = new InkeepAnalyticsCore({
  apiIntegrationKey: process.env["INKEEPANALYTICS_API_INTEGRATION_KEY"] ?? "",
});

async function run() {
  const res = await conversationsList(inkeepAnalytics, {});

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

  const { value: result } = res;

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

run();

Parameters

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

Errors

Error Type Status Code Content Type
errors.BadRequest 400 application/problem+json
errors.Unauthorized 401 application/problem+json
errors.Forbidden 403 application/problem+json
errors.NotFound 404 application/problem+json
errors.UnprocessableEntity 422 application/problem+json
errors.InternalServerError 500 application/problem+json
errors.APIError 4XX, 5XX */*

get

Get Conversation

Example Usage

import { InkeepAnalytics } from "@inkeep/inkeep-analytics";

const inkeepAnalytics = new InkeepAnalytics();

async function run() {
  const result = await inkeepAnalytics.conversations.get({
    webIntegrationKey: process.env["INKEEPANALYTICS_WEB_INTEGRATION_KEY"] ?? "",
  }, {
    id: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { InkeepAnalyticsCore } from "@inkeep/inkeep-analytics/core.js";
import { conversationsGet } from "@inkeep/inkeep-analytics/funcs/conversationsGet.js";

// Use `InkeepAnalyticsCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const inkeepAnalytics = new InkeepAnalyticsCore();

async function run() {
  const res = await conversationsGet(inkeepAnalytics, {
    webIntegrationKey: process.env["INKEEPANALYTICS_WEB_INTEGRATION_KEY"] ?? "",
  }, {
    id: "<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.GetConversationRequest ✔️ The request object to use for the request.
security operations.GetConversationSecurity ✔️ 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.Conversation>

Errors

Error Type Status Code Content Type
errors.BadRequest 400 application/problem+json
errors.Unauthorized 401 application/problem+json
errors.Forbidden 403 application/problem+json
errors.NotFound 404 application/problem+json
errors.UnprocessableEntity 422 application/problem+json
errors.InternalServerError 500 application/problem+json
errors.APIError 4XX, 5XX */*

delete

Delete Conversation

Example Usage

import { InkeepAnalytics } from "@inkeep/inkeep-analytics";

const inkeepAnalytics = new InkeepAnalytics();

async function run() {
  const result = await inkeepAnalytics.conversations.delete({
    webIntegrationKey: process.env["INKEEPANALYTICS_WEB_INTEGRATION_KEY"] ?? "",
  }, {
    id: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { InkeepAnalyticsCore } from "@inkeep/inkeep-analytics/core.js";
import { conversationsDelete } from "@inkeep/inkeep-analytics/funcs/conversationsDelete.js";

// Use `InkeepAnalyticsCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const inkeepAnalytics = new InkeepAnalyticsCore();

async function run() {
  const res = await conversationsDelete(inkeepAnalytics, {
    webIntegrationKey: process.env["INKEEPANALYTICS_WEB_INTEGRATION_KEY"] ?? "",
  }, {
    id: "<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.DeleteConversationRequest ✔️ The request object to use for the request.
security operations.DeleteConversationSecurity ✔️ 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.DeleteConversationResponseBody>

Errors

Error Type Status Code Content Type
errors.BadRequest 400 application/problem+json
errors.Unauthorized 401 application/problem+json
errors.Forbidden 403 application/problem+json
errors.NotFound 404 application/problem+json
errors.UnprocessableEntity 422 application/problem+json
errors.InternalServerError 500 application/problem+json
errors.APIError 4XX, 5XX */*