graphql-tools-monorepo / loaders/github/src / GithubLoader

Class: GithubLoader

loaders/github/src.GithubLoader

This loader loads a file from GitHub.

const typeDefs = await loadTypedefs('github:githubUser/githubRepo#branchName:path/to/file.ts', {
  loaders: [new GithubLoader()],
  token: YOUR_GITHUB_TOKEN,
})

Implements

Table of contents

Constructors

Methods

Constructors

constructor

new GithubLoader(): GithubLoader

Returns

GithubLoader

Methods

canLoad

canLoad(pointer): Promise<boolean>

Parameters

NameType
pointerstring

Returns

Promise<boolean>

Defined in

packages/loaders/github/src/index.ts:69


canLoadSync

canLoadSync(pointer): boolean

Parameters

NameType
pointerstring

Returns

boolean

Defined in

packages/loaders/github/src/index.ts:73


handleResponse

handleResponse(«destructured»): Source[] | { document: DocumentNode ; location: undefined | string }[]

Parameters

NameType
«destructured»Object
› optionsany
› pathstring
› pointerstring
› responseany
› statusnumber

Returns

Source[] | { document: DocumentNode ; location: undefined | string }[]

Defined in

packages/loaders/github/src/index.ts:129


load

load(pointer, options): Promise<Source[]>

Parameters

NameType
pointerstring
optionsGithubLoaderOptions

Returns

Promise<Source[]>

Implementation of

Loader.load

Defined in

packages/loaders/github/src/index.ts:119


loadSync

loadSync(pointer, options): Source[]

Parameters

NameType
pointerstring
optionsGithubLoaderOptions

Returns

Source[]

Implementation of

Loader.loadSync

Defined in

packages/loaders/github/src/index.ts:124


loadSyncOrAsync

loadSyncOrAsync(pointer, options, asyncFetchFn): Promise<Source[]>

Parameters

NameType
pointerstring
optionsGithubLoaderOptions
asyncFetchFnAsyncFetchFn

Returns

Promise<Source[]>

Defined in

packages/loaders/github/src/index.ts:77

loadSyncOrAsync(pointer, options, syncFetchFn): Source[]

Parameters

NameType
pointerstring
optionsGithubLoaderOptions
syncFetchFnSyncFetchFn

Returns

Source[]

Defined in

packages/loaders/github/src/index.ts:83


prepareRequest

prepareRequest(«destructured»): RequestInit

Parameters

NameType
«destructured»Object
› namestring
› optionsGithubLoaderOptions
› ownerstring
› pathstring
› refstring

Returns

RequestInit

Defined in

packages/loaders/github/src/index.ts:188