Skip to content
← Public packages

@kentcdodds/bluesky

Bluesky and AT Protocol helpers using package-storage handle plus blueskyAppPassword.

src/types.ts

112 lines · 2.3 KB · TypeScript
export type BlueskyServiceInput = {
  service?: string
}

export type BlueskyConfirmInput = {
  dryRun?: boolean
  confirm?: boolean
}

export type BlueskyRequestInput = BlueskyServiceInput &
  BlueskyConfirmInput & {
    nsid?: string
    method?: string
    query?: Record<string, unknown>
    body?: unknown
    authenticated?: boolean
  }

export type ResolveHandleInput = BlueskyServiceInput & {
  handle?: string
}

export type GetProfileInput = BlueskyServiceInput & {
  actor?: string
  authenticated?: boolean
}

export type SearchPostsInput = BlueskyServiceInput & {
  q?: string
  limit?: number
  sort?: string
  since?: string
  until?: string
  mentions?: string
  author?: string
  domain?: string
  url?: string
  cursor?: string
  authenticated?: boolean
  /** Override session host for search (defaults to bsky.social). Ignored when `service` is set. */
  authService?: string
  identifier?: string
}

export type GetAuthorFeedInput = BlueskyServiceInput & {
  actor?: string
  limit?: number
  cursor?: string
  filter?: string
  authenticated?: boolean
}

export type GetPostThreadInput = BlueskyServiceInput & {
  uri?: string
  depth?: number
  parentHeight?: number
  authenticated?: boolean
}

export type ListNotificationsInput = BlueskyServiceInput & {
  limit?: number
  cursor?: string
  seenAt?: string
}

export type ExternalCardInput = {
  uri: string
  title: string
  description: string
  thumbnailUrl?: string
}

export type CreatePostInput = BlueskyServiceInput &
  BlueskyConfirmInput & {
    text?: string
    langs?: string[]
    facets?: unknown[]
    autoLinkFacets?: boolean
    reply?: unknown
    embed?: unknown
    externalCard?: ExternalCardInput
    createdAt?: string
    /** Session identifier; defaults to packageStorage blueskyHandle. */
    identifier?: string
  }

export type DeletePostInput = BlueskyServiceInput &
  BlueskyConfirmInput & {
    uri?: string
    repo?: string
    collection?: string
    rkey?: string
  }

export type LikeRepostInput = BlueskyServiceInput &
  BlueskyConfirmInput & {
    uri?: string
    cid?: string
    createdAt?: string
  }

export type FollowInput = BlueskyServiceInput &
  BlueskyConfirmInput & {
    actor?: string
    createdAt?: string
  }

export type UnfollowInput = BlueskyServiceInput &
  BlueskyConfirmInput & {
    uri?: string
    actor?: string
  }