Skip to content

Latest commit

 

History

History
362 lines (255 loc) · 25.7 KB

README.md

File metadata and controls

362 lines (255 loc) · 25.7 KB

Sync

(sync)

Overview

Available Operations

  • getRepo - This endpoint is part of the atproto repository synchronization APIs. Requests usually do not require authentication, and can be made to PDS intances or Relay instances.*

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

Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS.

  • listBlobs - This endpoint is part of the atproto repository synchronization APIs. Requests usually do not require authentication, and can be made to PDS intances or Relay instances.*

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

List blob CIDs for an account, since some repo revision. Does not require auth; implemented by PDS.

  • notifyOfUpdate - This endpoint is part of the atproto repository synchronization APIs. Requests usually do not require authentication, and can be made to PDS intances or Relay instances.*

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

Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay.

getRepo

This endpoint is part of the atproto repository synchronization APIs. Requests usually do not require authentication, and can be made to PDS intances or Relay instances.*

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

Download a repository export as CAR file. Optionally only a 'diff' since a previous revision. Does not require auth; implemented by PDS.

Example Usage

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

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

async function run() {
  await bluesky.sync.getRepo({
    did: "<id>",
  });


}

run();

Standalone function

The standalone function version of this method:

import { BlueskyCore } from "@speakeasy-api/bluesky/core.js";
import { syncGetRepo } from "@speakeasy-api/bluesky/funcs/syncGetRepo.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 syncGetRepo(bluesky, {
    did: "<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 {
  // Query hooks for fetching data.
  useSyncGetRepo,
  useSyncGetRepoSuspense,

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

Parameters

Parameter Type Required Description
request operations.ComAtprotoSyncGetRepoRequest ✔️ 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.ComAtprotoSyncGetRepoResponseBody 400 application/json
errors.ComAtprotoSyncGetRepoSyncResponseBody 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 */*

listBlobs

This endpoint is part of the atproto repository synchronization APIs. Requests usually do not require authentication, and can be made to PDS intances or Relay instances.*

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

List blob CIDs for an account, since some repo revision. Does not require 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.sync.listBlobs({
    did: "<id>",
  });

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

run();

Standalone function

The standalone function version of this method:

import { BlueskyCore } from "@speakeasy-api/bluesky/core.js";
import { syncListBlobs } from "@speakeasy-api/bluesky/funcs/syncListBlobs.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 syncListBlobs(bluesky, {
    did: "<id>",
  });

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

  const { value: result } = res;

  for await (const page of result) {
    // Handle the page
    console.log(page);
  }
}

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.
  useSyncListBlobs,
  useSyncListBlobsSuspense,
  // Query hooks suitable for building infinite scrolling or "load more" UIs.
  useSyncListBlobsInfinite,
  useSyncListBlobsInfiniteSuspense,

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

Parameters

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

Errors

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

notifyOfUpdate

This endpoint is part of the atproto repository synchronization APIs. Requests usually do not require authentication, and can be made to PDS intances or Relay instances.*

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

Notify a crawling service of a recent update, and that crawling should resume. Intended use is after a gap between repo stream events caused the crawling service to disconnect. Does not require auth; implemented by Relay.

Example Usage

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

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

async function run() {
  await bluesky.sync.notifyOfUpdate({
    hostname: "major-instruction.com",
  });


}

run();

Standalone function

The standalone function version of this method:

import { BlueskyCore } from "@speakeasy-api/bluesky/core.js";
import { syncNotifyOfUpdate } from "@speakeasy-api/bluesky/funcs/syncNotifyOfUpdate.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 syncNotifyOfUpdate(bluesky, {
    hostname: "major-instruction.com",
  });

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

Parameters

Parameter Type Required Description
request operations.ComAtprotoSyncNotifyOfUpdateRequestBody ✔️ 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.ComAtprotoSyncNotifyOfUpdateResponseBody 400 application/json
errors.ComAtprotoSyncNotifyOfUpdateSyncResponseBody 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 */*