Skip to main content

Crate asimov_social

Crate asimov_social 

Source
Expand description

Social graph primitives for ASIMOV.

Use SocialHandle to associate an account handle with its platform, SocialProperty to select account information, and FollowRelationship to describe the direction of a follow relationship between accounts. SocialLink recognizes URLs for profiles, relationships, and other social resources, with fallible conversions to and from supported account handles. SocialPlatform::handle parses an identifier on a selected platform. URL parsers accept HTTP(S), an optional www. hostname prefix, and known host aliases; formatted URLs use HTTPS without www..

Platform modules re-export their platform-specific handle types. Each module and its corresponding SocialHandle variant require the matching platform feature; all platform features are enabled by default.

FetchRequest and ListRequest share asimov-remote’s transport-independent request types and options. The serde feature enables their JSON encoding without an HTTP client; client enables SocialClient for HTTP execution. Caching, filtering, and timing are configured on the requests and encoded alongside pattern options in the JSON options object.

use asimov_social::{FetchRequest, ListRequest};

let fetch = FetchRequest::new("https://example.com/profile", Default::default());
let json = serde_json::to_string(&fetch).unwrap();
assert_eq!(serde_json::from_str::<FetchRequest>(&json).unwrap(), fetch);

let list: ListRequest = serde_json::from_str(
    r#"{"url":"https://example.com/collection","options":{"limit":0}}"#,
).unwrap();
assert_eq!(list.options.limit, Some(0));

Modules§

facebookfacebook
Facebook-specific types, including account handles. Re-exports the types from known_types_facebook, including FacebookHandle.
githubgithub
GitHub-specific types, including account handles. Re-exports the types from known_types_github, including GithubHandle.
gravatargravatar
Gravatar-specific types, including account handles. Re-exports the types from known_types_gravatar, including GravatarHandle.
instagraminstagram
Instagram-specific types, including account handles. Re-exports the types from known_types_instagram, including InstagramHandle.
introcointroco
Intro.co-specific types, including account handles. Re-exports the types from known_types_introco, including IntrocoHandle.
linkedinlinkedin
LinkedIn-specific types, including account handles. Re-exports the types from known_types_linkedin, including LinkedinHandle.
localailocalai
Local.ai-specific types, including account handles. Re-exports the types from known_types_localai, including LocalaiHandle.
lumaluma
Luma-specific types, including account handles. Re-exports the types from known_types_luma, including LumaHandle.
telegramtelegram
Telegram-specific types, including account handles. Re-exports the types from known_types_telegram, including TelegramHandle.
whatsappwhatsapp
WhatsApp-specific types, including account handles. Re-exports the types from known_types_whatsapp, including WhatsappHandle.
xx
X-specific account handles, profiles, and list identifiers. Re-exports XHandle from known_types_x and provides XProfile for handle-based account profiles and XList for numeric list identifiers.

Structs§

BlueskyHandlebluesky
A Bluesky domain handle: ASCII DNS labels, at most 253 bytes, with an alphabetic TLD start. DIDs are profile selectors, not handles.
CachingOptions
Cache freshness requests shared by fetcher and lister commands.
CollectionStub
A collection’s optional identifier and item count, without its contents.
DiscordHandlediscord
A Discord profile identifier: a nonzero decimal u64 snowflake, not a username. Leading zeroes are rejected.
FetchRequest
Shared, transport-independent request for one or more social resources. An owned, transport-independent request to fetch resources.
FetchRequestOptions
Shared output options for a social fetch. Output-format selection and additional arguments for a Fetcher.
FilteringOptions
Output filtering requests for host commands.
GitlabHandlegitlab
A GitLab.com username: 2–255 ASCII letters, digits, _, -, or .; no leading punctuation, trailing dot, repeated dots, or .git/.atom suffix. Reserved names are not checked.
ListRequest
Shared, transport-independent request for a social collection. An owned, transport-independent request to list a collection.
ListRequestOptions
Shared ordering, pagination, and output options for a social listing. Output-format and pagination requests for a Lister.
MediumHandlemedium
A Medium profile identifier. Accepts a nonempty ASCII alphanumeric, _, -, or . path segment; account availability and registration rules are not checked.
PinterestHandlepinterest
A Pinterest username: 3–30 ASCII letters, digits, or underscores.
RedditHandlereddit
A Reddit username: 3–20 ASCII letters, digits, underscores, or hyphens.
SnapchatHandlesnapchat
A Snapchat username: 3–15 ASCII letters, digits, _, -, or .; starts with a letter and ends with a letter or digit.
SocialClientclient
A domain-specific façade over ASIMOV’s remote HTTP transport. Responses contain raw JSONL batches, preserving bytes and line endings.
SubstackHandlesubstack
A Substack profile identifier. Accepts a nonempty ASCII alphanumeric, _, or - path segment; publication names and account availability are not checked.
ThreadsHandlethreads
A Threads username: 1–30 ASCII letters, digits, underscores, or dots; no leading, trailing, or consecutive dots.
TiktokHandletiktok
A TikTok username: 2–24 ASCII letters, digits, underscores, or dots, with no trailing dot.
TimingOptions
Execution timing requests shared by program commands.
TwitchHandletwitch
A Twitch username: 4–25 ASCII letters, digits, or underscores.
YoutubeHandleyoutube
A YouTube handle without @. Accepts 1–30 Unicode letters/digits with internal _, -, ., or ·; language-specific length and script restrictions are not checked.

Enums§

FollowRelationship
The direction of a follow relationship with another account.
ParseSocialPropertyError
An error encountered when parsing a SocialProperty selector.
SocialClientError
HTTP adapter configuration, startup, or response-body failure.
SocialHandle
An account handle paired with the social platform to which it belongs.
SocialLink
A recognized social-platform URL, classified by the resource it selects.
SocialLinkConversionError
A social link or handle cannot be represented by the requested type.
SocialLinkError
A URL could not be parsed or does not match a supported social link.
SocialPlatform
A social platform, identified by its canonical HTTPS base URL.
SocialPlatformHandleError
An account identifier could not be parsed on the selected platform.
SocialProperty
A selector for an account’s identity, connections, or content.

Type Aliases§

SocialResponseStream
A raw JSONL batch stream with HTTP-specific failures.