Skip to content

Latest commit

 

History

History
257 lines (194 loc) · 17.7 KB

README.md

File metadata and controls

257 lines (194 loc) · 17.7 KB

ChatConvo

(chatConvo)

Overview

Available Operations

  • sendMessageBatch - This endpoint is part of the Bluesky Chat (DMs) APIs. Requests usually require authentication, are directed to the user's PDS intance, and proxied to the single central chat service by setting the appropriate service DID (did:web:api.bsky.chat) in the service proxying header.

To learn more about calling atproto API endpoints like this one, see the API Hosts and Auth guide.

  • unmute - This endpoint is part of the Bluesky Chat (DMs) APIs. Requests usually require authentication, are directed to the user's PDS intance, and proxied to the single central chat service by setting the appropriate service DID (did:web:api.bsky.chat) in the service proxying header.

To learn more about calling atproto API endpoints like this one, see the API Hosts and Auth guide.

sendMessageBatch

This endpoint is part of the Bluesky Chat (DMs) APIs. Requests usually require authentication, are directed to the user's PDS intance, and proxied to the single central chat service by setting the appropriate service DID (did:web:api.bsky.chat) in the service proxying header.

To learn more about calling atproto API endpoints like this one, see the API Hosts and Auth guide.

Example Usage

import { Bluesky } from "@speakeasy-api/bluesky";

const bluesky = new Bluesky({
  bearer: process.env["BLUESKY_BEARER"] ?? "",
});

async function run() {
  const result = await bluesky.chatConvo.sendMessageBatch({
    items: [
      {
        convoId: "<id>",
        message: {
          text: "<value>",
        },
      },
      {
        convoId: "<id>",
        message: {
          text: "<value>",
        },
      },
      {
        convoId: "<id>",
        message: {
          text: "<value>",
        },
      },
    ],
  });

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

run();

Standalone function

The standalone function version of this method:

import { BlueskyCore } from "@speakeasy-api/bluesky/core.js";
import { chatConvoSendMessageBatch } from "@speakeasy-api/bluesky/funcs/chatConvoSendMessageBatch.js";

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

async function run() {
  const res = await chatConvoSendMessageBatch(bluesky, {
    items: [
      {
        convoId: "<id>",
        message: {
          text: "<value>",
        },
      },
      {
        convoId: "<id>",
        message: {
          text: "<value>",
        },
      },
      {
        convoId: "<id>",
        message: {
          text: "<value>",
        },
      },
    ],
  });

  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.
  useChatConvoSendMessageBatchMutation
} from "@speakeasy-api/bluesky/react-query/chatConvoSendMessageBatch.js";

Parameters

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

Errors

Error Type Status Code Content Type
errors.ChatBskyConvoSendMessageBatchResponseBody 400 application/json
errors.ChatBskyConvoSendMessageBatchChatConvoResponseBody 401 application/json
errors.Unauthorized 403, 407, 511 application/json
errors.NotFound 404, 501, 505 application/json
errors.Timeout 408, 504 application/json
errors.BadRequest 413, 414, 415, 422, 431, 510 application/json
errors.RateLimited 429 application/json
errors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
errors.APIError 4XX, 5XX */*

unmute

This endpoint is part of the Bluesky Chat (DMs) APIs. Requests usually require authentication, are directed to the user's PDS intance, and proxied to the single central chat service by setting the appropriate service DID (did:web:api.bsky.chat) in the service proxying header.

To learn more about calling atproto API endpoints like this one, see the API Hosts and Auth guide.

Example Usage

import { Bluesky } from "@speakeasy-api/bluesky";

const bluesky = new Bluesky({
  bearer: process.env["BLUESKY_BEARER"] ?? "",
});

async function run() {
  const result = await bluesky.chatConvo.unmute({
    convoId: "<id>",
  });

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

run();

Standalone function

The standalone function version of this method:

import { BlueskyCore } from "@speakeasy-api/bluesky/core.js";
import { chatConvoUnmute } from "@speakeasy-api/bluesky/funcs/chatConvoUnmute.js";

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

async function run() {
  const res = await chatConvoUnmute(bluesky, {
    convoId: "<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 {
  // Mutation hook for triggering the API call.
  useChatConvoUnmuteMutation
} from "@speakeasy-api/bluesky/react-query/chatConvoUnmute.js";

Parameters

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

Errors

Error Type Status Code Content Type
errors.ChatBskyConvoUnmuteConvoResponseBody 400 application/json
errors.ChatBskyConvoUnmuteConvoChatConvoResponseBody 401 application/json
errors.Unauthorized 403, 407, 511 application/json
errors.NotFound 404, 501, 505 application/json
errors.Timeout 408, 504 application/json
errors.BadRequest 413, 414, 415, 422, 431, 510 application/json
errors.RateLimited 429 application/json
errors.InternalServerError 500, 502, 503, 506, 507, 508 application/json
errors.APIError 4XX, 5XX */*