naystack - v1.9.9
    Preparing search index...

    Type Alias SocialProvider

    One platform's implementation of connect, read profile, read content.

    A plain object with no per-instance state — credentials come from the environment at call time, tokens are arguments — so each platform exports one ready-made constant. InstagramProvider is the reference implementation.

    Capability is method presence: a platform that can't refresh tokens omits refresh, one with no content-listing API omits fetchMedia, and callers narrow with if (provider.fetchMedia). This describes the platform, not a token — a token missing a scope still fails at runtime with a null return.

    import { InstagramProvider } from "naystack/socials";

    const profile = await InstagramProvider.fetchProfile(accessToken);
    const posts = await InstagramProvider.fetchMedia?.(accessToken, { limit: 12 });
    type SocialProvider = {
        auth: {
            authorizationURL: (
                input: { redirectURI: string; scopes?: string[]; state: string },
            ) => string;
            exchangeCode: (
                input: { code: string; redirectURI: string },
            ) => Promise<SocialTokens & { platformUserId: string | null } | null>;
            refresh?: (tokens: SocialTokens) => Promise<SocialTokens | null>;
        };
        fetchMedia?: (
            accessToken: string,
            options?: { limit?: number },
        ) => Promise<SocialPost[] | null>;
        fetchProfile: (accessToken: string) => Promise<SocialProfile | null>;
        platform: SocialPlatform;
        profileURL: (username: string) => string;
    }
    Index

    Properties

    auth: {
        authorizationURL: (
            input: { redirectURI: string; scopes?: string[]; state: string },
        ) => string;
        exchangeCode: (
            input: { code: string; redirectURI: string },
        ) => Promise<SocialTokens & { platformUserId: string | null } | null>;
        refresh?: (tokens: SocialTokens) => Promise<SocialTokens | null>;
    }
    fetchMedia?: (
        accessToken: string,
        options?: { limit?: number },
    ) => Promise<SocialPost[] | null>

    Omitted by platforms with no content-listing API. Resolves to null when the request failed and [] when the account genuinely has no content — a caller that caches results must not treat an outage as an empty grid.

    fetchProfile: (accessToken: string) => Promise<SocialProfile | null>
    platform: SocialPlatform
    profileURL: (username: string) => string

    Public profile link for a handle. Platform knowledge, not a capability, so every adapter has one.