discdbapi
    Preparing search index...

    Class DiscDBContributionsClient

    Index

    Constructors

    Properties

    cookies: string | undefined
    gql: Client

    Internal, typed GraphQL client that may be used to bypass wrapper logic or compose custom queries

    origin: string = DISCDB_ORIGIN
    userAgent: string = ...

    Methods

    • Parameters

      • contributionId: string
      • discId: string
      • itemId: string
      • trackIndex: number
      • trackName: string

      Returns Promise<WithEncodedId>

    • Parameters

      • contributionId: string
      • discId: string
      • itemId: string
      • chapterIndex: number
      • chapterName: string

      Returns Promise<WithEncodedId>

    • Submit a new global ID to a disc that is without one. This is different from the hash. To calculate a global disc ID:

      • DVD: use libdvdread/dvd_info
      • BD: hash the raw bytes of AACS/Unit_Key_RO.inf as SHA1, then convert to hex. see discman/io/hash#computeAacsDiscId

      Parameters

      • input: Omit<AttachGlobalDiscIdInput, "files"> & { files: (FileHashInfo | File)[] }

        details by which to identify the disc. for most discs, mediaItemSlug + releaseSlug + discSlug is sufficient. for files, list the relevant media files (see hash).

      Returns Promise<
          Pick<
              {
                  __typename: "AttachDiscIdResult";
                  boxsetSlug: string
                  | null;
                  contentHash: string;
                  discIndex: number | null;
                  discSlug: string | null;
                  existingGlobalDiscId: string | null;
                  globalDiscId: string | null;
                  matchedDifferentDisc: boolean;
                  mediaItemSlug: string | null;
                  mediaItemType: string | null;
                  outcome: AttachDiscIdOutcome;
                  releaseSlug: string | null;
              },
              | "contentHash"
              | "globalDiscId"
              | "releaseSlug"
              | "mediaItemSlug"
              | "boxsetSlug"
              | "discSlug"
              | "discIndex"
              | "outcome"
              | "mediaItemType"
              | "existingGlobalDiscId"
              | "matchedDifferentDisc",
          >,
      >

      the result, which may not be successful; check outcome (APPLIED).

    • Add a disc to a contribution. This is only for specifying the surface details of the disc; after creating it, you must upload logs before you can identify items.

      Parameters

      • contributionId: string

        encoded ID of the contribtion

      • contentHash: string

        content hash of the disc

      • format: DiscFormat

        the disc format

      • name: string

        the name of the disc, like "Disc 1", "Extras", "DVD"

      • Optionalslug: string

        by default, a slugified version of the name is generated

      Returns Promise<WithEncodedId>

    • Parameters

      • contributionId: string

      Returns Promise<void>

    • Parameters

      • contributionId: string
      • variant: "front" | "back"

      Returns Promise<void>

    • Parameters

      • contributionId: string
      • discId: string
      • itemId: string

      Returns Promise<void>

    • Parameters

      • uploaderId: string

        The ID used to upload the image

      • variant: "front" | "back"

        Whether the image is the front or back cover

      Returns Promise<void>

    • Find a specific episode of the series associated with a contribution

      Episodes are numbered according to TMDB given that is currently the only external data source.

      Parameters

      • contributionId: string

        encoded contribution ID for a series release

      • season: string | number

        season number of the episode

      • episode: string | number

        episode number within the season

      Returns Promise<{ episode: string; name: string; season: string } | null>

      episode details, or null if not found

    • Parameters

      • name: string
      • ownerEmail: string
      • roles: string[]
      • OptionalexpiresAt: Date

      Returns Promise<
          Pick<
              {
                  __typename: "GenerateApiKeyPayload";
                  key: string;
                  keyPrefix: string;
                  name: string;
                  ownerEmail: string;
              },
              "name"
              | "key"
              | "ownerEmail"
              | "keyPrefix",
          >,
      >

    • Parameters

      • asin: string

      Returns Promise<
          | AmazonProductMetadata
          | Pick<
              {
                  __typename: "AmazonProductMetadata";
                  actors: string
                  | null;
                  asin: string | null;
                  aspectRatio: string | null;
                  backImageUrl: string | null;
                  director: string | null;
                  dubbed: string | null;
                  frontImageUrl: string | null;
                  isDiscontinued: boolean | null;
                  language: string | null;
                  mediaFormat: string | null;
                  modelNumber: string | null;
                  mpaaRating: string | null;
                  numberOfDiscs: number | null;
                  producers: string | null;
                  releaseDate: any;
                  studio: string | null;
                  subtitles: string | null;
                  title: string | null;
                  upc: string | null;
              },
              | "title"
              | "__typename"
              | "releaseDate"
              | "upc"
              | "asin"
              | "backImageUrl"
              | "frontImageUrl"
              | "language"
              | "numberOfDiscs"
              | "aspectRatio"
              | "isDiscontinued"
              | "mpaaRating"
              | "modelNumber"
              | "director"
              | "mediaFormat"
              | "actors"
              | "producers"
              | "dubbed"
              | "subtitles"
              | "studio",
          >,
      >

    • Parameters

      • keyPrefix: string

      Returns Promise<
          | Pick<
              {
                  __typename: "ApiKeyInfo";
                  createdAt: any;
                  expiresAt: any;
                  isActive: boolean;
                  keyPrefix: string;
                  lastUsedAt: any;
                  logUsage: boolean;
                  name: string;
                  ownerEmail: string;
                  roles: string
                  | null;
              },
              | "name"
              | "ownerEmail"
              | "roles"
              | "createdAt"
              | "expiresAt"
              | "lastUsedAt"
              | "isActive",
          >
          | undefined,
      >

    • Get a list of API keys.

      Parameters

      Returns Promise<
          {
              keys: Pick<
                  {
                      __typename: "ApiKeyInfo";
                      createdAt: any;
                      expiresAt: any;
                      isActive: boolean;
                      keyPrefix: string;
                      lastUsedAt: any;
                      logUsage: boolean;
                      name: string;
                      ownerEmail: string;
                      roles: string
                      | null;
                  },
                  | "name"
                  | "ownerEmail"
                  | "roles"
                  | "createdAt"
                  | "expiresAt"
                  | "lastUsedAt"
                  | "isActive",
              >[];
              page: { cursor: string | null; hasMoreData: boolean }
              | undefined;
          },
      >

      list of API keys as well as page info for pagination

    • Get a contribution by its encoded ID

      Parameters

      • id: string

        encoded ID

      Returns Promise<
          | UserContribution
          | Pick<
              {
                  __typename: "UserContribution";
                  asin: string;
                  backImageUrl: string
                  | null;
                  boxset: UserContributionBoxset | null;
                  boxsetId: number | null;
                  created: any;
                  discs: Pick<
                      {
                          __typename: "UserContributionDisc";
                          contentHash: string;
                          encodedId: any;
                          existingDiscPath: string
                          | null;
                          format: string;
                          globalDiscId: string | null;
                          id: number;
                          index: number | null;
                          items: UserContributionDiscItem[];
                          logsUploaded: boolean;
                          logUploadError: string | null;
                          name: string;
                          slug: string;
                          userContribution: UserContribution;
                      },
                      | "slug"
                      | "id"
                      | "name"
                      | "format"
                      | "encodedId"
                      | "existingDiscPath"
                      | "logsUploaded",
                  >[];
                  encodedId: any;
                  externalId: string;
                  externalProvider: string;
                  frontImageUrl: string;
                  hashItems: UserContributionDiscHashItem[];
                  id: number;
                  locale: string;
                  mediaType: string;
                  regionCode: string;
                  releaseDate: any;
                  releaseSlug: string
                  | null;
                  releaseTitle: string;
                  status: UserContributionStatus;
                  title: string | null;
                  titleSlug: string;
                  upc: string;
                  userId: string;
                  year: string | null;
              },
              | "locale"
              | "regionCode"
              | "year"
              | "title"
              | "discs"
              | "id"
              | "releaseDate"
              | "upc"
              | "asin"
              | "backImageUrl"
              | "created"
              | "status"
              | "mediaType"
              | "externalId"
              | "externalProvider"
              | "frontImageUrl"
              | "releaseTitle"
              | "releaseSlug"
              | "encodedId",
          >,
      >

    • Parameters

      • contributionId: string

        encoded contribution ID

      • Optionalinput: BidirectionalPaginationQuery<never, UserMessageSortInput>

        customize returned results

      Returns Promise<
          {
              messages: FieldsSelection<
                  UserMessage[]
                  | null,
                  {
                      contributionId: true;
                      createdAt: true;
                      fromUserId: true;
                      id: true;
                      isRead: true;
                      message: true;
                      toUserId: true;
                      type: true;
                  },
              >;
              page: { cursor: string
              | null; hasMoreData: boolean };
              totalCount: number;
          },
      >

    • The same as getExternalData, but takes a contribution ID instead of a provider-specific identifier

      Parameters

      • contributionId: string

        the encoded ID of the contribution

      Returns Promise<ExternalMetadata>

      title metadata

    • Parameters

      Returns Promise<
          {
              history: FieldsSelection<
                  ContributionHistory[]
                  | null,
                  {
                      contributionId: true;
                      description: true;
                      id: true;
                      timeStamp: true;
                      type: true;
                      userId: true;
                  },
              >;
              page: { cursor: string
              | null; hasMoreData: boolean };
              totalCount: number;
          },
      >

    • Type Parameters

      • Selection extends UserContributionGenqlSelection = {
            backImageUrl: true;
            created: true;
            encodedId: true;
            frontImageUrl: true;
            id: true;
            mediaType: true;
            releaseSlug: true;
            releaseTitle: true;
            status: true;
            title: true;
            year: true;
        }

      Parameters

      Returns Promise<
          {
              contributions: | UserContribution[]
              | NonNullable<
                  FieldsSelection<UserContribution[] | null, NonNullable<Selection>>,
              >;
              page: { cursor: string | null; hasMoreData: boolean } | undefined;
              totalCount: number;
          },
      >

    • Get disc & title information for the disc, as described by a previously-uploaded MakeMKV log file.

      Parameters

      • contributionId: string

        encoded ID for the contribution

      • discId: string

        encoded ID for the disc

      Returns Promise<
          FieldsSelection<
              DiscLogs
              | null,
              {
                  contribution: {
                      discs: {
                          encodedId: true;
                          id: true;
                          items: {
                              chapterCount: true;
                              chapters: { encodedId: true; id: true; index: true; title: true };
                              id: true;
                              name: true;
                          };
                          name: true;
                      };
                      encodedId: true;
                      id: true;
                      mediaType: true;
                      releaseTitle: true;
                      title: true;
                      year: true;
                  };
                  disc: {
                      contentHash: true;
                      encodedId: true;
                      existingDiscPath: true;
                      format: true;
                      id: true;
                      items: {
                          audioTracks: { encodedId: true; id: true; index: true; title: true };
                          chapterCount: true;
                          chapters: { encodedId: true; id: true; index: true; title: true };
                          description: true;
                          duration: true;
                          encodedId: true;
                          episode: true;
                          id: true;
                          name: true;
                          season: true;
                          segmentCount: true;
                          segmentMap: true;
                          size: true;
                          source: true;
                          type: true;
                      };
                      logsUploaded: true;
                      name: true;
                      slug: true;
                  };
                  info: {
                      titles: {
                          chapterCount: true;
                          comment: true;
                          displaySize: true;
                          index: true;
                          javaComment: true;
                          length: true;
                          playlist: true;
                          segmentMap: true;
                          segments: { audioType: true; name: true; type: true };
                          size: true;
                      };
                  };
              },
          > & NonNullable<
              FieldsSelection<
                  DiscLogs
                  | null,
                  {
                      contribution: {
                          discs: {
                              encodedId: true;
                              id: true;
                              items: {
                                  chapterCount: true;
                                  chapters: { encodedId: true; id: true; index: true; title: true };
                                  id: true;
                                  name: true;
                              };
                              name: true;
                          };
                          encodedId: true;
                          id: true;
                          mediaType: true;
                          releaseTitle: true;
                          title: true;
                          year: true;
                      };
                      disc: {
                          contentHash: true;
                          encodedId: true;
                          existingDiscPath: true;
                          format: true;
                          id: true;
                          items: {
                              audioTracks: {
                                  encodedId: true;
                                  id: true;
                                  index: true;
                                  title: true;
                              };
                              chapterCount: true;
                              chapters: { encodedId: true; id: true; index: true; title: true };
                              description: true;
                              duration: true;
                              encodedId: true;
                              episode: true;
                              id: true;
                              name: true;
                              season: true;
                              segmentCount: true;
                              segmentMap: true;
                              size: true;
                              source: true;
                              type: true;
                          };
                          logsUploaded: true;
                          name: true;
                          slug: true;
                      };
                      info: {
                          titles: {
                              chapterCount: true;
                              comment: true;
                              displaySize: true;
                              index: true;
                              javaComment: true;
                              length: true;
                              playlist: true;
                              segmentMap: true;
                              segments: { audioType: true; name: true; type: true };
                              size: true;
                          };
                      };
                  },
              >,
          >,
      >

      parsed logs for the disc, including parent contribution info

      uploadDiscLogs to upload plaintext logs for a disc

    • Check (poll) the status of uploading logs. If you are using uploadDiscLogs in the same application, this endpoint is probably not useful to you, as you can just wait for the promise to resolve.

      Parameters

      • discId: string

        encoded ID for the disc

      Returns Promise<
          FieldsSelection<
              DiscUploadStatus
              | null,
              { logsUploaded: true; logUploadError: true },
          > & NonNullable<
              FieldsSelection<
                  DiscUploadStatus
                  | null,
                  { logsUploaded: true; logUploadError: true },
              >,
          >,
      >

      upload status for the disc's logs

    • Returns a qualified image URL from a path. If only one dimension is provided, the other dimension will be resized automatically, maintaining the original aspect ratio.

      Parameters

      • path: string
      • Optionaloptions: { height?: number; width?: number }

      Returns string

    • Get a list of message threads that the client is part of

      Returns Promise<
          Pick<
              {
                  __typename: "MessageThread";
                  contributionId: number;
                  contributionTitle: string;
                  encodedContributionId: string;
                  isBoxset: boolean;
                  lastMessageAt: any;
                  lastMessagePreview: string;
                  mediaTitle: string
                  | null;
                  totalCount: number;
                  unreadCount: number;
              },
              | "__typename"
              | "totalCount"
              | "contributionId"
              | "encodedContributionId"
              | "contributionTitle"
              | "mediaTitle"
              | "lastMessagePreview"
              | "lastMessageAt"
              | "unreadCount"
              | "isBoxset",
          >[],
      >

      Message threads keyed by contribution ID

    • Type Parameters

      • Selection extends UserContributionGenqlSelection = {
            created: true;
            encodedId: true;
            frontImageUrl: true;
            id: true;
            mediaType: true;
            releaseTitle: true;
            status: true;
            title: true;
            year: true;
        }

      Parameters

      Returns Promise<
          {
              contributions: | UserContribution[]
              | NonNullable<
                  FieldsSelection<UserContribution[] | null, NonNullable<Selection>>,
              >;
              page: { cursor: string | null; hasMoreData: boolean } | undefined;
              totalCount: number;
          },
      >

    • Parameters

      Returns Promise<
          {
              messages: Pick<
                  {
                      __typename: "UserMessage";
                      boxset: UserContributionBoxset
                      | null;
                      boxsetId: number | null;
                      contribution: UserContribution | null;
                      contributionId: number | null;
                      createdAt: any;
                      fromUserId: string;
                      id: number;
                      isRead: boolean;
                      message: string;
                      toUserId: string;
                      type: UserMessageType;
                  },
                  | "type"
                  | "id"
                  | "message"
                  | "contributionId"
                  | "createdAt"
                  | "isRead"
                  | "fromUserId"
                  | "toUserId",
              >[];
              page: { cursor: string | null; hasMoreData: boolean }
              | undefined;
              totalCount: number;
          },
      >

    • Get surface details for the series associated with a contribution, including its full episode list

      Episodes are numbered according to TMDB given that is currently the only external data source.

      Parameters

      • contributionId: string

        encoded contribution ID for a series release

      Returns Promise<
          {
              episodes: | SeriesEpisodeNameEntry[]
              | Pick<
                  {
                      __typename: "SeriesEpisodeNameEntry";
                      episodeName: string;
                      episodeNumber: string;
                      seasonNumber: string;
                  },
                  "__typename"
                  | "seasonNumber"
                  | "episodeNumber"
                  | "episodeName",
              >[]
              | SeriesEpisodeNameEntry[] & Pick<
                  {
                      __typename: "SeriesEpisodeNameEntry";
                      episodeName: string;
                      episodeNumber: string;
                      seasonNumber: string;
                  },
                  "__typename"
                  | "seasonNumber"
                  | "episodeNumber"
                  | "episodeName",
              >[]
              | Pick<
                  {
                      __typename: "SeriesEpisodeNameEntry";
                      episodeName: string;
                      episodeNumber: string;
                      seasonNumber: string;
                  },
                  "__typename"
                  | "seasonNumber"
                  | "episodeNumber"
                  | "episodeName",
              >[] & SeriesEpisodeNameEntry[];
              name: string;
              year: string;
          },
      >

    • Generate a unique hash based on the files on a disc. See DiscDBClient#hash for more information.

      Parameters

      • contributionId: string
      • files: (FileHashInfo | File)[]

        details for the relevant files from the disc.

        • DVD: the contents of VIDEO_TS
        • Blu-ray: every .m2ts file in BDMV/STREAM

      Returns Promise<string>

      the computed hash

    • Returns Promise<boolean>

      Whether the client has any unread messages

    • Mark all messages as read for a given contribution thread

      Parameters

      • contributionId: string

        encoded contribution ID that the messages apply to

      Returns Promise<boolean>

    • Change the order of a contribution's discs by submitting all IDs in the new desired order.

      Parameters

      • contributionId: string

        encoded ID of the contribution that the discs are from

      • discIds: string[]

        new order for all disc IDs

      Returns Promise<
          FieldsSelection<
              UserContributionDisc[]
              | null,
              { encodedId: true; id: true; index: true; name: true; slug: true },
          > & NonNullable<
              FieldsSelection<
                  UserContributionDisc[]
                  | null,
                  { encodedId: true; id: true; index: true; name: true; slug: true },
              >,
          >,
      >

      all discs in the contribution

    • Parameters

      • keyPrefix: string

      Returns Promise<
          FieldsSelection<
              ApiKeyInfo
              | null,
              {
                  createdAt: true;
                  expiresAt: true;
                  lastUsedAt: true;
                  name: true;
                  ownerEmail: true;
                  roles: true;
              },
          > & NonNullable<
              FieldsSelection<
                  ApiKeyInfo
                  | null,
                  {
                      createdAt: true;
                      expiresAt: true;
                      lastUsedAt: true;
                      name: true;
                      ownerEmail: true;
                      roles: true;
                  },
              >,
          >,
      >

    • Send a message in a contribution thread.

      Parameters

      • contributionId: string

        encoded contribution ID

      • content: string

        the message content to send

      • type: UserMessageType = enumUserMessageType.USER_MESSAGE

        if you are an admin, this may be ADMIN_MESSAGE, but it defaults to USER_MESSAGE

      Returns Promise<
          FieldsSelection<
              UserMessage
              | null,
              {
                  contributionId: boolean;
                  createdAt: boolean;
                  fromUserId: boolean;
                  id: boolean;
                  isRead: boolean;
                  message: boolean;
                  toUserId: boolean;
                  type: boolean;
              },
          > & NonNullable<
              FieldsSelection<
                  UserMessage
                  | null,
                  {
                      contributionId: boolean;
                      createdAt: boolean;
                      fromUserId: boolean;
                      id: boolean;
                      isRead: boolean;
                      message: boolean;
                      toUserId: boolean;
                      type: boolean;
                  },
              >,
          >,
      >

      the sent message

    • Upload an image to an extant contribution

      Parameters

      • contributionId: string
      • variant: "front" | "back"

        Whether the image is the front or back cover

      • file: Blob

        File data to upload

      • uploaderId: string

        Temporary UUID from the details form.

      Returns Promise<{ url: string; variant: "front" | "back" }>

      metadata for the uploaded image

      uploadTemporalContributionImage

    • Upload MakeMKV logs to a contribution disc.

      Example for generating compatible logs:

      makemkvcon --minlength=0 --robot info disc:0 2>&1 | tee logs.txt
      # or simply read from stdout if in an integrated application

      Parameters

      • contributionId: string

        encoded ID of the contribution

      • discId: string

        encoded ID of the disc

      • logs: string

        plaintext log output from MakeMKV

      Returns Promise<void>

    • Upload an image for a contribution before the contribution is actually created

      Parameters

      • uploaderId: string

        Temporary UUID to use when uploading the image.

        Currently unsure how to get this value. It may be the case that it is generated on the client as an arbitrary value and then sent to the server to link the temporary file with the new contribution record.

      • variant: "front" | "back"

        Whether the image is the front or back cover

      • file: Blob

        File data to upload

      Returns Promise<{ id: string; url: string; variant: "front" | "back" }>

      metadata for the uploaded image