Skip to content

Latest commit

 

History

History
335 lines (234 loc) · 26.2 KB

README.md

File metadata and controls

335 lines (234 loc) · 26.2 KB

AtprotoRepo

(atprotoRepo)

Overview

Available Operations

  • delete - This endpoint is part of the atproto PDS repository management APIs. Requests usually require authentication (unlike the com.atproto.sync.* endpoints), and are made directly to the user's own PDS instance.

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

Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.

  • import - This endpoint is part of the atproto PDS repository management APIs. Requests usually require authentication (unlike the com.atproto.sync.* endpoints), and are made directly to the user's own PDS instance.

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

Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.

  • uploadBlob - This endpoint is part of the atproto PDS repository management APIs. Requests usually require authentication (unlike the com.atproto.sync.* endpoints), and are made directly to the user's own PDS instance.

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

Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS.

delete

This endpoint is part of the atproto PDS repository management APIs. Requests usually require authentication (unlike the com.atproto.sync.* endpoints), and are made directly to the user's own PDS instance.

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

Delete a repository record, or ensure it doesn't exist. Requires auth, implemented by PDS.

Example Usage

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

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

async function run() {
  const result = await bluesky.atprotoRepo.delete({
    repo: "<value>",
    collection: "<id>",
    rkey: "<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 { atprotoRepoDelete } from "@speakeasy-api/bluesky/funcs/atprotoRepoDelete.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 atprotoRepoDelete(bluesky, {
    repo: "<value>",
    collection: "<id>",
    rkey: "<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.
  useAtprotoRepoDeleteMutation
} from "@speakeasy-api/bluesky/react-query/atprotoRepoDelete.js";

Parameters

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

Errors

Error Type Status Code Content Type
errors.ComAtprotoRepoDeleteRecordResponseBody 400 application/json
errors.ComAtprotoRepoDeleteRecordAtprotoRepoResponseBody 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 */*

import

This endpoint is part of the atproto PDS repository management APIs. Requests usually require authentication (unlike the com.atproto.sync.* endpoints), and are made directly to the user's own PDS instance.

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

Import a repo in the form of a CAR file. Requires Content-Length HTTP header to be set.

Example Usage

import { Bluesky } from "@speakeasy-api/bluesky";
import { openAsBlob } from "node:fs";

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

async function run() {
  await bluesky.atprotoRepo.import(await openAsBlob("example.file"));


}

run();

Standalone function

The standalone function version of this method:

import { BlueskyCore } from "@speakeasy-api/bluesky/core.js";
import { atprotoRepoImport } from "@speakeasy-api/bluesky/funcs/atprotoRepoImport.js";
import { openAsBlob } from "node:fs";

// 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 atprotoRepoImport(bluesky, await openAsBlob("example.file"));

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

Parameters

Parameter Type Required Description
request ReadableStream ✔️ 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.ComAtprotoRepoImportRepoResponseBody 400 application/json
errors.ComAtprotoRepoImportRepoAtprotoRepoResponseBody 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 */*

uploadBlob

This endpoint is part of the atproto PDS repository management APIs. Requests usually require authentication (unlike the com.atproto.sync.* endpoints), and are made directly to the user's own PDS instance.

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

Upload a new blob, to be referenced from a repository record. The blob will be deleted if it is not referenced within a time window (eg, minutes). Blob restrictions (mimetype, size, etc) are enforced when the reference is created. Requires auth, implemented by PDS.

Example Usage

import { Bluesky } from "@speakeasy-api/bluesky";
import { openAsBlob } from "node:fs";

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

async function run() {
  const result = await bluesky.atprotoRepo.uploadBlob(await openAsBlob("example.file"));

  // 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 { atprotoRepoUploadBlob } from "@speakeasy-api/bluesky/funcs/atprotoRepoUploadBlob.js";
import { openAsBlob } from "node:fs";

// 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 atprotoRepoUploadBlob(bluesky, await openAsBlob("example.file"));

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

Parameters

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

Errors

Error Type Status Code Content Type
errors.ComAtprotoRepoUploadBlobResponseBody 400 application/json
errors.ComAtprotoRepoUploadBlobAtprotoRepoResponseBody 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 */*