-
Notifications
You must be signed in to change notification settings - Fork 364
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
108 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {IRateLimit, OctokitRateLimit} from '../interfaces/rate-limit'; | ||
|
||
export class RateLimit implements IRateLimit { | ||
readonly limit: number; | ||
readonly remaining: number; | ||
readonly reset: Date; | ||
readonly used: number; | ||
|
||
constructor(rateLimit: Readonly<OctokitRateLimit>) { | ||
this.limit = rateLimit.limit; | ||
this.remaining = rateLimit.remaining; | ||
this.used = rateLimit.used; | ||
this.reset = new Date(rateLimit.reset * 1000); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {components} from '@octokit/openapi-types'; | ||
|
||
export interface IRateLimit { | ||
limit: number; | ||
used: number; | ||
remaining: number; | ||
reset: Date; | ||
} | ||
|
||
export type OctokitRateLimit = components['schemas']['rate-limit']; |
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