Add post embeds (images and external links)

This commit is contained in:
Paul Frazee 2022-12-14 15:35:15 -06:00
parent 345ec83f26
commit 4966b2152e
30 changed files with 936 additions and 242 deletions

View file

@ -38,7 +38,8 @@ __export(src_exports, {
AppBskyActorSearch: () => search_exports,
AppBskyActorSearchTypeahead: () => searchTypeahead_exports,
AppBskyActorUpdateProfile: () => updateProfile_exports,
AppBskyFeedEmbed: () => embed_exports,
AppBskyEmbedExternal: () => external_exports,
AppBskyEmbedImages: () => images_exports,
AppBskyFeedGetAuthorFeed: () => getAuthorFeed_exports,
AppBskyFeedGetPostThread: () => getPostThread_exports,
AppBskyFeedGetRepostedBy: () => getRepostedBy_exports,
@ -99,6 +100,7 @@ __export(src_exports, {
ComNS: () => ComNS,
ConfirmationRecord: () => ConfirmationRecord,
DeclarationRecord: () => DeclarationRecord,
EmbedNS: () => EmbedNS,
FeedNS: () => FeedNS,
FollowRecord: () => FollowRecord,
GraphNS: () => GraphNS,
@ -5621,69 +5623,25 @@ var schemaDict = {
}
}
},
AppBskyFeedEmbed: {
AppBskyEmbedExternal: {
lexicon: 1,
id: "app.bsky.feed.embed",
description: "Content embedded in other content, such as an image or link embedded in a post.",
id: "app.bsky.embed.external",
description: "An representation of some externally linked content, embedded in another form of content",
defs: {
main: {
type: "object",
description: "A list embeds in a post or document.",
required: ["media"],
required: ["external"],
properties: {
items: {
type: "array",
items: {
type: "union",
refs: [
"lex:app.bsky.feed.embed#media",
"lex:app.bsky.feed.embed#record",
"lex:app.bsky.feed.embed#external"
]
}
}
}
},
media: {
type: "object",
required: ["original"],
properties: {
alt: {
type: "string"
},
thumb: {
type: "image"
},
original: {
type: "blob"
}
}
},
record: {
type: "object",
required: ["type", "author", "record"],
properties: {
type: {
type: "string",
const: "record"
},
author: {
external: {
type: "ref",
ref: "lex:app.bsky.actor.ref#withInfo"
},
record: {
type: "unknown"
ref: "lex:app.bsky.embed.external#external"
}
}
},
external: {
type: "object",
required: ["type", "uri", "title", "description", "imageUri"],
required: ["uri", "title", "description"],
properties: {
type: {
type: "string",
const: "external"
},
uri: {
type: "string"
},
@ -5693,7 +5651,105 @@ var schemaDict = {
description: {
type: "string"
},
imageUri: {
thumb: {
type: "image",
accept: ["image/*"],
maxWidth: 250,
maxHeight: 250,
maxSize: 1e5
}
}
},
presented: {
type: "object",
required: ["external"],
properties: {
external: {
type: "ref",
ref: "lex:app.bsky.embed.external#presentedExternal"
}
}
},
presentedExternal: {
type: "object",
required: ["uri", "title", "description"],
properties: {
uri: {
type: "string"
},
title: {
type: "string"
},
description: {
type: "string"
},
thumb: {
type: "string"
}
}
}
}
},
AppBskyEmbedImages: {
lexicon: 1,
id: "app.bsky.embed.images",
description: "A set of images embedded in some other form of content",
defs: {
main: {
type: "object",
required: ["images"],
properties: {
images: {
type: "array",
items: {
type: "ref",
ref: "lex:app.bsky.embed.images#image"
},
maxLength: 4
}
}
},
image: {
type: "object",
required: ["image", "alt"],
properties: {
image: {
type: "image",
accept: ["image/*"],
maxWidth: 500,
maxHeight: 500,
maxSize: 3e5
},
alt: {
type: "string"
}
}
},
presented: {
type: "object",
required: ["images"],
properties: {
images: {
type: "array",
items: {
type: "ref",
ref: "lex:app.bsky.embed.images#presentedImage"
},
maxLength: 4
}
}
},
presentedImage: {
type: "object",
required: ["thumb", "fullsize", "alt"],
properties: {
thumb: {
type: "string"
},
fullsize: {
type: "string"
},
alt: {
type: "string"
}
}
@ -5781,8 +5837,11 @@ var schemaDict = {
type: "unknown"
},
embed: {
type: "ref",
ref: "lex:app.bsky.feed.embed"
type: "union",
refs: [
"lex:app.bsky.embed.images#presented",
"lex:app.bsky.embed.external#presented"
]
},
replyCount: {
type: "integer"
@ -5889,8 +5948,11 @@ var schemaDict = {
type: "unknown"
},
embed: {
type: "ref",
ref: "lex:app.bsky.feed.embed"
type: "union",
refs: [
"lex:app.bsky.embed.images#presented",
"lex:app.bsky.embed.external#presented"
]
},
parent: {
type: "union",
@ -6123,8 +6185,11 @@ var schemaDict = {
type: "unknown"
},
embed: {
type: "ref",
ref: "lex:app.bsky.feed.embed"
type: "union",
refs: [
"lex:app.bsky.embed.images#presented",
"lex:app.bsky.embed.external#presented"
]
},
replyCount: {
type: "integer"
@ -6268,6 +6333,13 @@ var schemaDict = {
type: "ref",
ref: "lex:app.bsky.feed.post#replyRef"
},
embed: {
type: "union",
refs: [
"lex:app.bsky.embed.images",
"lex:app.bsky.embed.external"
]
},
createdAt: {
type: "datetime"
}
@ -7748,8 +7820,11 @@ var profile_exports = {};
// src/client/types/app/bsky/actor/ref.ts
var ref_exports = {};
// src/client/types/app/bsky/feed/embed.ts
var embed_exports = {};
// src/client/types/app/bsky/embed/external.ts
var external_exports = {};
// src/client/types/app/bsky/embed/images.ts
var images_exports = {};
// src/client/types/app/bsky/feed/post.ts
var post_exports = {};
@ -8015,6 +8090,7 @@ var BskyNS = class {
constructor(service) {
this._service = service;
this.actor = new ActorNS(service);
this.embed = new EmbedNS(service);
this.feed = new FeedNS(service);
this.graph = new GraphNS(service);
this.notification = new NotificationNS(service);
@ -8094,6 +8170,11 @@ var ProfileRecord = class {
);
}
};
var EmbedNS = class {
constructor(service) {
this._service = service;
}
};
var FeedNS = class {
constructor(service) {
this._service = service;
@ -8626,7 +8707,8 @@ var SessionManager = class extends import_events.default {
AppBskyActorSearch,
AppBskyActorSearchTypeahead,
AppBskyActorUpdateProfile,
AppBskyFeedEmbed,
AppBskyEmbedExternal,
AppBskyEmbedImages,
AppBskyFeedGetAuthorFeed,
AppBskyFeedGetPostThread,
AppBskyFeedGetRepostedBy,
@ -8687,6 +8769,7 @@ var SessionManager = class extends import_events.default {
ComNS,
ConfirmationRecord,
DeclarationRecord,
EmbedNS,
FeedNS,
FollowRecord,
GraphNS,

File diff suppressed because one or more lines are too long

View file

@ -83,7 +83,8 @@ export * as AppBskyActorRef from './types/app/bsky/actor/ref';
export * as AppBskyActorSearch from './types/app/bsky/actor/search';
export * as AppBskyActorSearchTypeahead from './types/app/bsky/actor/searchTypeahead';
export * as AppBskyActorUpdateProfile from './types/app/bsky/actor/updateProfile';
export * as AppBskyFeedEmbed from './types/app/bsky/feed/embed';
export * as AppBskyEmbedExternal from './types/app/bsky/embed/external';
export * as AppBskyEmbedImages from './types/app/bsky/embed/images';
export * as AppBskyFeedGetAuthorFeed from './types/app/bsky/feed/getAuthorFeed';
export * as AppBskyFeedGetPostThread from './types/app/bsky/feed/getPostThread';
export * as AppBskyFeedGetRepostedBy from './types/app/bsky/feed/getRepostedBy';
@ -209,6 +210,7 @@ export declare class AppNS {
export declare class BskyNS {
_service: ServiceClient;
actor: ActorNS;
embed: EmbedNS;
feed: FeedNS;
graph: GraphNS;
notification: NotificationNS;
@ -247,6 +249,10 @@ export declare class ProfileRecord {
}>;
delete(params: Omit<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, headers?: Record<string, string>): Promise<void>;
}
export declare class EmbedNS {
_service: ServiceClient;
constructor(service: ServiceClient);
}
export declare class FeedNS {
_service: ServiceClient;
post: PostRecord;

View file

@ -1371,65 +1371,25 @@ export declare const schemaDict: {
};
};
};
AppBskyFeedEmbed: {
AppBskyEmbedExternal: {
lexicon: number;
id: string;
description: string;
defs: {
main: {
type: string;
description: string;
required: string[];
properties: {
items: {
type: string;
items: {
type: string;
refs: string[];
};
};
};
};
media: {
type: string;
required: string[];
properties: {
alt: {
type: string;
};
thumb: {
type: string;
};
original: {
type: string;
};
};
};
record: {
type: string;
required: string[];
properties: {
type: {
type: string;
const: string;
};
author: {
external: {
type: string;
ref: string;
};
record: {
type: string;
};
};
};
external: {
type: string;
required: string[];
properties: {
type: {
type: string;
const: string;
};
uri: {
type: string;
};
@ -1439,7 +1399,105 @@ export declare const schemaDict: {
description: {
type: string;
};
imageUri: {
thumb: {
type: string;
accept: string[];
maxWidth: number;
maxHeight: number;
maxSize: number;
};
};
};
presented: {
type: string;
required: string[];
properties: {
external: {
type: string;
ref: string;
};
};
};
presentedExternal: {
type: string;
required: string[];
properties: {
uri: {
type: string;
};
title: {
type: string;
};
description: {
type: string;
};
thumb: {
type: string;
};
};
};
};
};
AppBskyEmbedImages: {
lexicon: number;
id: string;
description: string;
defs: {
main: {
type: string;
required: string[];
properties: {
images: {
type: string;
items: {
type: string;
ref: string;
};
maxLength: number;
};
};
};
image: {
type: string;
required: string[];
properties: {
image: {
type: string;
accept: string[];
maxWidth: number;
maxHeight: number;
maxSize: number;
};
alt: {
type: string;
};
};
};
presented: {
type: string;
required: string[];
properties: {
images: {
type: string;
items: {
type: string;
ref: string;
};
maxLength: number;
};
};
};
presentedImage: {
type: string;
required: string[];
properties: {
thumb: {
type: string;
};
fullsize: {
type: string;
};
alt: {
type: string;
};
};
@ -1518,7 +1576,7 @@ export declare const schemaDict: {
};
embed: {
type: string;
ref: string;
refs: string[];
};
replyCount: {
type: string;
@ -1611,7 +1669,7 @@ export declare const schemaDict: {
};
embed: {
type: string;
ref: string;
refs: string[];
};
parent: {
type: string;
@ -1829,7 +1887,7 @@ export declare const schemaDict: {
};
embed: {
type: string;
ref: string;
refs: string[];
};
replyCount: {
type: string;
@ -1973,6 +2031,10 @@ export declare const schemaDict: {
type: string;
ref: string;
};
embed: {
type: string;
refs: string[];
};
createdAt: {
type: string;
};
@ -2869,7 +2931,8 @@ export declare const ids: {
AppBskyActorSearch: string;
AppBskyActorSearchTypeahead: string;
AppBskyActorUpdateProfile: string;
AppBskyFeedEmbed: string;
AppBskyEmbedExternal: string;
AppBskyEmbedImages: string;
AppBskyFeedGetAuthorFeed: string;
AppBskyFeedGetPostThread: string;
AppBskyFeedGetRepostedBy: string;

View file

@ -0,0 +1,26 @@
export interface Main {
external: External;
[k: string]: unknown;
}
export interface External {
uri: string;
title: string;
description: string;
thumb?: {
cid: string;
mimeType: string;
[k: string]: unknown;
};
[k: string]: unknown;
}
export interface Presented {
external: PresentedExternal;
[k: string]: unknown;
}
export interface PresentedExternal {
uri: string;
title: string;
description: string;
thumb?: string;
[k: string]: unknown;
}

View file

@ -0,0 +1,23 @@
export interface Main {
images: Image[];
[k: string]: unknown;
}
export interface Image {
image: {
cid: string;
mimeType: string;
[k: string]: unknown;
};
alt: string;
[k: string]: unknown;
}
export interface Presented {
images: PresentedImage[];
[k: string]: unknown;
}
export interface PresentedImage {
thumb: string;
fullsize: string;
alt: string;
[k: string]: unknown;
}

View file

@ -1,6 +1,7 @@
import { Headers } from '@atproto/xrpc';
import * as AppBskyActorRef from '../actor/ref';
import * as AppBskyFeedEmbed from './embed';
import * as AppBskyEmbedImages from '../embed/images';
import * as AppBskyEmbedExternal from '../embed/external';
export interface QueryParams {
author: string;
limit?: number;
@ -28,7 +29,10 @@ export interface FeedItem {
trendedBy?: AppBskyActorRef.WithInfo;
repostedBy?: AppBskyActorRef.WithInfo;
record: {};
embed?: AppBskyFeedEmbed.Main;
embed?: AppBskyEmbedImages.Presented | AppBskyEmbedExternal.Presented | {
$type: string;
[k: string]: unknown;
};
replyCount: number;
repostCount: number;
upvoteCount: number;

View file

@ -1,6 +1,7 @@
import { Headers, XRPCError } from '@atproto/xrpc';
import * as AppBskyActorRef from '../actor/ref';
import * as AppBskyFeedEmbed from './embed';
import * as AppBskyEmbedImages from '../embed/images';
import * as AppBskyEmbedExternal from '../embed/external';
export interface QueryParams {
uri: string;
depth?: number;
@ -30,7 +31,10 @@ export interface Post {
cid: string;
author: AppBskyActorRef.WithInfo;
record: {};
embed?: AppBskyFeedEmbed.Main;
embed?: AppBskyEmbedImages.Presented | AppBskyEmbedExternal.Presented | {
$type: string;
[k: string]: unknown;
};
parent?: Post | NotFoundPost | {
$type: string;
[k: string]: unknown;

View file

@ -1,6 +1,7 @@
import { Headers } from '@atproto/xrpc';
import * as AppBskyActorRef from '../actor/ref';
import * as AppBskyFeedEmbed from './embed';
import * as AppBskyEmbedImages from '../embed/images';
import * as AppBskyEmbedExternal from '../embed/external';
export interface QueryParams {
algorithm?: string;
limit?: number;
@ -28,7 +29,10 @@ export interface FeedItem {
trendedBy?: AppBskyActorRef.WithInfo;
repostedBy?: AppBskyActorRef.WithInfo;
record: {};
embed?: AppBskyFeedEmbed.Main;
embed?: AppBskyEmbedImages.Presented | AppBskyEmbedExternal.Presented | {
$type: string;
[k: string]: unknown;
};
replyCount: number;
repostCount: number;
upvoteCount: number;

View file

@ -1,8 +1,14 @@
import * as AppBskyEmbedImages from '../embed/images';
import * as AppBskyEmbedExternal from '../embed/external';
import * as ComAtprotoRepoStrongRef from '../../../com/atproto/repo/strongRef';
export interface Record {
text: string;
entities?: Entity[];
reply?: ReplyRef;
embed?: AppBskyEmbedImages.Main | AppBskyEmbedExternal.Main | {
$type: string;
[k: string]: unknown;
};
createdAt: string;
[k: string]: unknown;
}

File diff suppressed because one or more lines are too long