Skip to content

Commit a08b587

Browse files
committed
Allow getApiClient to accept GitHubApiDetails
1 parent bfe264b commit a08b587

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

‎lib/entry-points.js‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/api-client.ts‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,22 @@ export function getApiDetails(env: ReadOnlyEnv = getEnv()): GitHubApiDetails {
169169
};
170170
}
171171

172-
export function getApiClient(env: ReadOnlyEnv = getEnv()) {
173-
return createApiClientWithDetails(getApiDetails(env));
172+
/**
173+
* Constructs an {@link ApiClient} using {@link apiDetails}.
174+
*
175+
* If {@link apiDetails} is not specified, then the GitHub instance URLs and auth token
176+
* are taken from {@link env}.
177+
*
178+
* If {@link env} is not specified, then the process environment is used.
179+
*
180+
* @param env The environment to obtain the GitHub instance URLs from.
181+
* @param apiDetails The {@link GitHubApiDetails} to construct the {@link ApiClient} for.
182+
*/
183+
export function getApiClient(
184+
env: ReadOnlyEnv = getEnv(),
185+
apiDetails?: GitHubApiDetails,
186+
) {
187+
return createApiClientWithDetails(apiDetails ?? getApiDetails(env));
174188
}
175189

176190
export function getApiClientWithExternalAuth(

0 commit comments

Comments
 (0)