3.1.2 • Published 5 months ago

@atcute/bluesky v3.1.2

Weekly downloads
-
License
0BSD
Repository
github
Last release
5 months ago

@atcute/bluesky

Bluesky (app.bsky.* and chat.bsky.*) schema definitions

usage

import { is, type $type } from '@atcute/lexicons';
import { AppBskyFeedPost, AppBskyRichtextFacet } from '@atcute/bluesky';

type Facet = AppBskyRichtextFacet.Main;
type MentionFeature = $type.enforce<AppBskyRichtextFacet.Mention>;

const mention: MentionFeature = {
	$type: 'app.bsky.richtext.facet#mention',
	did: 'did:plc:z72i7hdynmk6r22z27h6tvur',
};

const facet: Facet = {
	index: {
		byteStart: 6,
		byteEnd: 15,
	},
	features: [mention],
};

const record: AppBskyFeedPost.Main = {
	$type: 'app.bsky.feed.post',
	text: `hello @bsky.app!`,
	facets: [facet],
	createdAt: new Date().toISOString(),
};

is(AppBskyFeedPost.mainSchema, record);
// -> true

with @atcute/client

pick either one of these 3 options to register the ambient declarations

// tsconfig.json
{
	"compilerOptions": {
		"types": ["@atcute/bluesky"],
	},
}
// env.d.ts
/// <reference types="@atcute/bluesky" />
// index.ts
import type {} from '@atcute/bluesky';

now all the XRPC operations should be visible in the client

import { Client, simpleFetchHandler } from '@atcute/client';

const client = new Client({
	handler: simpleFetchHandler({ service: 'https://public.api.bsky.app' }),
});

const response = await client.get('app.bsky.actor.getProfile', {
	params: {
		actor: 'did:plc:z72i7hdynmk6r22z27h6tvur',
	},
});
// ...
1.0.9

12 months ago

1.0.8

12 months ago

2.0.3

7 months ago

2.1.1

6 months ago

2.0.2

7 months ago

2.1.0

6 months ago

2.0.1

7 months ago

2.0.0

7 months ago

3.0.4

5 months ago

3.1.2

5 months ago

3.0.3

5 months ago

3.1.1

5 months ago

3.0.2

6 months ago

3.1.0

5 months ago

3.0.1

6 months ago

3.0.0

6 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.15

7 months ago

1.0.14

8 months ago

1.0.13

9 months ago

1.0.12

10 months ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago