astro-loader-tweets
Version:
Astro loader for loading tweets by ID.
222 lines (217 loc) • 9.2 kB
TypeScript
import { z } from 'astro/zod';
import { Loader } from 'astro/loaders';
declare const TweetSchema: z.ZodObject<{
id: z.ZodString;
tweet: z.ZodObject<{
id: z.ZodString;
text: z.ZodString;
edit_history_tweet_ids: z.ZodArray<z.ZodString>;
attachments: z.ZodOptional<z.ZodObject<{
media_keys: z.ZodOptional<z.ZodArray<z.ZodString>>;
poll_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
}, z.core.$strip>>;
author_id: z.ZodOptional<z.ZodString>;
conversation_id: z.ZodOptional<z.ZodString>;
created_at: z.ZodOptional<z.ZodString>;
entities: z.ZodOptional<z.ZodObject<{
annotations: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
probability: z.ZodNumber;
type: z.ZodString;
normalized_text: z.ZodString;
}, z.core.$strip>>>;
urls: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
url: z.ZodString;
expanded_url: z.ZodString;
display_url: z.ZodString;
unwound_url: z.ZodOptional<z.ZodString>;
title: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
status: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
media_key: z.ZodOptional<z.ZodString>;
images: z.ZodOptional<z.ZodArray<z.ZodObject<{
url: z.ZodString;
width: z.ZodNumber;
height: z.ZodNumber;
}, z.core.$strip>>>;
}, z.core.$strip>>>;
hashtags: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
tag: z.ZodString;
}, z.core.$strip>>>;
cashtags: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
tag: z.ZodString;
}, z.core.$strip>>>;
mentions: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
username: z.ZodString;
id: z.ZodString;
}, z.core.$strip>>>;
}, z.core.$strip>>;
geo: z.ZodOptional<z.ZodObject<{
coordinates: z.ZodObject<{
type: z.ZodString;
coordinates: z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
}, z.core.$strip>;
place_id: z.ZodString;
}, z.core.$strip>>;
in_reply_to_user_id: z.ZodOptional<z.ZodString>;
lang: z.ZodOptional<z.ZodString>;
public_metrics: z.ZodOptional<z.ZodObject<{
retweet_count: z.ZodNumber;
reply_count: z.ZodNumber;
like_count: z.ZodNumber;
quote_count: z.ZodNumber;
impression_count: z.ZodNumber;
bookmark_count: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>>;
referenced_tweets: z.ZodOptional<z.ZodArray<z.ZodOptional<z.ZodObject<{
type: z.ZodUnion<readonly [z.ZodLiteral<"retweeted">, z.ZodLiteral<"quoted">, z.ZodLiteral<"replied_to">]>;
id: z.ZodString;
}, z.core.$strip>>>>;
source: z.ZodOptional<z.ZodString>;
text_html: z.ZodString;
text_markdown: z.ZodString;
view_type: z.ZodEnum<{
none: "none";
media: "media";
link: "link";
}>;
url_for_link_view: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
user: z.ZodUnion<readonly [z.ZodObject<{
id: z.ZodString;
name: z.ZodString;
username: z.ZodString;
connection_status: z.ZodOptional<z.ZodArray<z.ZodString>>;
created_at: z.ZodOptional<z.ZodString>;
description: z.ZodOptional<z.ZodString>;
entities: z.ZodOptional<z.ZodObject<{
url: z.ZodOptional<z.ZodObject<{
urls: z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
url: z.ZodString;
expanded_url: z.ZodString;
display_url: z.ZodString;
}, z.core.$strip>>;
}, z.core.$strip>>;
description: z.ZodOptional<z.ZodObject<{
urls: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
url: z.ZodString;
expanded_url: z.ZodString;
display_url: z.ZodString;
}, z.core.$strip>>>;
hashtags: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
tag: z.ZodOptional<z.ZodString>;
hashtag: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>>;
cashtags: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
tag: z.ZodOptional<z.ZodString>;
cashtag: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>>;
mentions: z.ZodOptional<z.ZodArray<z.ZodObject<{
start: z.ZodNumber;
end: z.ZodNumber;
username: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>>;
}, z.core.$strip>>;
}, z.core.$strip>>;
profile_image_url: z.ZodOptional<z.ZodString>;
public_metrics: z.ZodOptional<z.ZodObject<{
followers_count: z.ZodOptional<z.ZodNumber>;
following_count: z.ZodOptional<z.ZodNumber>;
tweet_count: z.ZodOptional<z.ZodNumber>;
listed_count: z.ZodOptional<z.ZodNumber>;
like_count: z.ZodOptional<z.ZodNumber>;
media_count: z.ZodOptional<z.ZodNumber>;
}, z.core.$strip>>;
url: z.ZodOptional<z.ZodString>;
}, z.core.$strip>, z.ZodNull]>;
place: z.ZodUnion<readonly [z.ZodObject<{
id: z.ZodString;
full_name: z.ZodString;
contained_within: z.ZodOptional<z.ZodArray<z.ZodString>>;
country: z.ZodOptional<z.ZodString>;
country_code: z.ZodOptional<z.ZodString>;
geo: z.ZodOptional<z.ZodObject<{
type: z.ZodString;
bbox: z.ZodArray<z.ZodNumber>;
properties: z.ZodAny;
}, z.core.$strip>>;
name: z.ZodOptional<z.ZodString>;
place_type: z.ZodOptional<z.ZodString>;
}, z.core.$strip>, z.ZodNull]>;
media: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
media_key: z.ZodString;
type: z.ZodUnion<readonly [z.ZodLiteral<"video">, z.ZodLiteral<"animated_gif">, z.ZodLiteral<"photo">, z.ZodString]>;
url: z.ZodOptional<z.ZodString>;
preview_image_url: z.ZodOptional<z.ZodString>;
width: z.ZodOptional<z.ZodNumber>;
height: z.ZodOptional<z.ZodNumber>;
alt_text: z.ZodOptional<z.ZodString>;
duration_ms: z.ZodOptional<z.ZodNumber>;
public_metrics: z.ZodOptional<z.ZodObject<{
view_count: z.ZodNumber;
}, z.core.$strip>>;
variants: z.ZodOptional<z.ZodArray<z.ZodObject<{
bit_rate: z.ZodOptional<z.ZodNumber>;
content_type: z.ZodUnion<readonly [z.ZodLiteral<"video/mp4">, z.ZodLiteral<"application/x-mpegURL">, z.ZodString]>;
url: z.ZodString;
}, z.core.$strip>>>;
}, z.core.$strip>>, z.ZodNull]>;
poll: z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
id: z.ZodString;
options: z.ZodArray<z.ZodObject<{
position: z.ZodNumber;
label: z.ZodString;
votes: z.ZodNumber;
}, z.core.$strip>>;
duration_minutes: z.ZodOptional<z.ZodNumber>;
end_datetime: z.ZodOptional<z.ZodString>;
voting_status: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>, z.ZodNull]>;
}, z.core.$strip>;
declare const TweetsLoaderConfigSchema: z.ZodObject<{
ids: z.ZodArray<z.ZodString>;
storage: z.ZodDefault<z.ZodEnum<{
default: "default";
custom: "custom";
both: "both";
}>>;
storePath: z.ZodDefault<z.ZodString>;
removeTrailingUrls: z.ZodDefault<z.ZodBoolean>;
linkTextType: z.ZodDefault<z.ZodEnum<{
"post-text": "post-text";
"domain-path": "domain-path";
}>>;
newlineHandling: z.ZodDefault<z.ZodEnum<{
none: "none";
break: "break";
paragraph: "paragraph";
}>>;
authToken: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
type TweetsLoaderUserConfig = z.input<typeof TweetsLoaderConfigSchema>;
/**
* Astro loader for loading tweets by ID.
*
* @see https://github.com/lin-stephanie/astro-loaders/tree/main/packages/astro-loader-tweets
*/
declare function tweetsLoader(userConfig: TweetsLoaderUserConfig): Loader & {
schema: typeof TweetSchema;
};
export { TweetSchema, type TweetsLoaderUserConfig, tweetsLoader };