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
Methods
canLoad
▸ canLoad(pointer
): Promise
<boolean
>
Parameters
Name | Type |
---|---|
pointer | string |
Returns
Promise
<boolean
>
Defined in
packages/loaders/github/src/index.ts:69
canLoadSync
▸ canLoadSync(pointer
): boolean
Parameters
Name | Type |
---|---|
pointer | string |
Returns
boolean
Defined in
packages/loaders/github/src/index.ts:73
handleResponse
▸ handleResponse(«destructured»
): Source
[] | { document
: DocumentNode
; location
: undefined
| string
}[]
Parameters
Name | Type |
---|---|
«destructured» | Object |
› options | any |
› path | string |
› pointer | string |
› response | any |
› status | number |
Returns
Source
[] | { document
: DocumentNode
; location
: undefined
| string
}[]
Defined in
packages/loaders/github/src/index.ts:129
load
▸ load(pointer
, options
): Promise
<Source
[]>
Parameters
Name | Type |
---|---|
pointer | string |
options | GithubLoaderOptions |
Returns
Promise
<Source
[]>
Implementation of
Defined in
packages/loaders/github/src/index.ts:119
loadSync
▸ loadSync(pointer
, options
): Source
[]
Parameters
Name | Type |
---|---|
pointer | string |
options | GithubLoaderOptions |
Returns
Source
[]
Implementation of
Defined in
packages/loaders/github/src/index.ts:124
loadSyncOrAsync
▸ loadSyncOrAsync(pointer
, options
, asyncFetchFn
): Promise
<Source
[]>
Parameters
Name | Type |
---|---|
pointer | string |
options | GithubLoaderOptions |
asyncFetchFn | AsyncFetchFn |
Returns
Promise
<Source
[]>
Defined in
packages/loaders/github/src/index.ts:77
▸ loadSyncOrAsync(pointer
, options
, syncFetchFn
): Source
[]
Parameters
Name | Type |
---|---|
pointer | string |
options | GithubLoaderOptions |
syncFetchFn | SyncFetchFn |
Returns
Source
[]
Defined in
packages/loaders/github/src/index.ts:83
prepareRequest
▸ prepareRequest(«destructured»
): RequestInit
Parameters
Name | Type |
---|---|
«destructured» | Object |
› name | string |
› options | GithubLoaderOptions |
› owner | string |
› path | string |
› ref | string |
Returns
RequestInit