import type { IdentityId, ProviderId, ProviderToken, IdentityData, IdentitySignedClaim, ProviderIdentityClaimId, ProviderAuthenticateRequest, ProviderPaginationToken } from '../../types.js'; import type { SignedClaim } from '../../../claims/types.js'; import type { ClaimLinkIdentity } from '../../../claims/payloads/claimLinkIdentity.js'; import Logger from '@matrixai/logger'; import Provider from '../../Provider.js'; declare class GitHubProvider extends Provider { readonly id: ProviderId; readonly clientId: string; readonly preferGetClaimsPage: boolean; protected readonly apiUrl: string; protected readonly gistFilename: string; protected readonly gistDescription: string; protected readonly scope: string; protected readonly pageSize: number; protected logger: Logger; constructor({ clientId, logger, }: { clientId: string; logger?: Logger; }); authenticate(timeout?: number): AsyncGenerator; refreshToken(): Promise; getAuthIdentityIds(): Promise>; /** * Gets own identity key. * GitHub has user ids, but it is an implementation detail. * Usernames on GitHub are changeable. */ getIdentityId(providerToken: ProviderToken): Promise; /** * Get identity data from a username. */ getIdentityData(authIdentityId: IdentityId, identityId: IdentityId, options?: { signal?: AbortSignal; }): Promise; /** * Gets connected IdentityData from following and follower connections. */ getConnectedIdentityDatas(authIdentityId: IdentityId, searchTerms?: Array): AsyncGenerator; /** * Returns a string suitable for use as the request body to the GitHub GraphQL endpoint. * This is used to construct a query that returns either the `followers` or the `following` of a user. * * Schemas Used: * - https://docs.github.com/en/graphql/reference/queries#user * - https://docs.github.com/en/graphql/reference/objects#user * - https://docs.github.com/en/graphql/reference/objects#followerconnection * * @param authIdentityId - The GitHub authentication token to use when getting user data * @param identityGroup - Specify whether the GraphQL query requests the `followers` or the `following` of a user * @param cursor - cursor for pagination, * this can be retrieved from `.data.user[identityGroup].pageinfo.endCursor` * of the JSON body on a response for a request made with the return value of this method as the body. */ protected getConnectedIdentityDatasGraphQLBody(authIdentityId: IdentityId, identityGroup: 'following' | 'followers', cursor?: string): string; /** * Publish an identity claim. * These are published as gists. */ publishClaim(authIdentityId: IdentityId, signedClaim: SignedClaim): Promise; /** * Gets the identity claim. * GitHub identity claims are published as gists. * The claimId is the gist id */ getClaim(authIdentityId: IdentityId, claimId: ProviderIdentityClaimId): Promise; /** * Gets a page of ProviderIdentityClaimIds from a given identity * sorted by latest. */ getClaimIdsPage(_authIdentityId: IdentityId, identityId: IdentityId, paginationToken?: ProviderPaginationToken): AsyncGenerator<{ claimId: ProviderIdentityClaimId; nextPaginationToken?: ProviderPaginationToken; }>; /** * Gets all IdentitySignedClaims from a given identity * sorted by latest. */ getClaimsPage(_authIdentityId: IdentityId, identityId: IdentityId, paginationToken?: ProviderPaginationToken): AsyncGenerator<{ claim: IdentitySignedClaim; nextPaginationToken?: ProviderPaginationToken; }>; protected createRequest(url: string, options: any, providerToken: ProviderToken): Request; protected extractPaginationToken(html: string): ProviderPaginationToken | undefined; protected extractClaimIds(html: string): Array; protected extractClaims(html: string): Array; } export default GitHubProvider;