generated from gagoar/ts-node-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Sometimes we want the full response and not just the token. Particularly when we want to see when the token will expire.
- Loading branch information
Showing
4 changed files
with
115 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,36 @@ | ||
import { AppsCreateInstallationAccessTokenResponseData } from '@octokit/types'; | ||
|
||
/** | ||
* Default permission level members have for organization repositories: | ||
* \* `read` - can pull, but not push to or administer this repository. | ||
* \* `write` - can pull and push, but not administer this repository. | ||
* \* `admin` - can pull, push, and administer this repository. | ||
* \* `none` - no permissions granted by default. | ||
*/ | ||
type DefaultRepositoryPermission = 'read' | 'write' | 'admin' | 'none'; | ||
export interface AppsCreateInstallationAccessTokenResponse { | ||
type: string; | ||
tokenType: string; | ||
token: string; | ||
installationId: number; | ||
permissions: { | ||
actions: DefaultRepositoryPermission; | ||
administration: DefaultRepositoryPermission; | ||
checks: DefaultRepositoryPermission; | ||
contents: DefaultRepositoryPermission; | ||
issues: DefaultRepositoryPermission; | ||
metadata: DefaultRepositoryPermission; | ||
pull_requests: DefaultRepositoryPermission; | ||
statuses: DefaultRepositoryPermission; | ||
}; | ||
createdAt: string; | ||
expiresAt: string; | ||
repositorySelection: 'all' | 'selected'; | ||
} | ||
export const isObject = (value: unknown): value is Record<string, unknown> => { | ||
return !!value && typeof value === 'object'; | ||
}; | ||
export const isString = (value: unknown): value is string => typeof value === 'string'; | ||
export const isAppsCreateInstallationAccessTokenResponseData = ( | ||
export const isAppsCreateInstallationAccessTokenResponse = ( | ||
response: unknown | ||
): response is AppsCreateInstallationAccessTokenResponseData => { | ||
): response is AppsCreateInstallationAccessTokenResponse => { | ||
return isObject(response) && typeof response?.token === 'string'; | ||
}; |