Reformat types file

This commit is contained in:
Abhas
2018-07-10 14:30:05 +05:30
parent af3ec83aed
commit 8d9d3b2a8f
+24
View File
@@ -8,15 +8,18 @@ interface RequestOptions {
query?: string; query?: string;
variables?: Variables; variables?: Variables;
} }
interface Result { interface Result {
headers: { headers: {
status: string; status: string;
}; };
} }
interface OctokitError { interface OctokitError {
code: number; code: number;
status: string; status: string;
} }
export interface OctokitMod extends Octokit { export interface OctokitMod extends Octokit {
// The following are added because Octokit does not expose the hook.error, hook.before, and hook.after methods // The following are added because Octokit does not expose the hook.error, hook.before, and hook.after methods
hook: { hook: {
@@ -25,29 +28,37 @@ export interface OctokitMod extends Octokit {
after: (when: 'request', callback: (result: Result, options: RequestOptions) => void) => void; after: (when: 'request', callback: (result: Result, options: RequestOptions) => void) => void;
}; };
} }
interface Variables { interface Variables {
[key: string]: any; [key: string]: any;
} }
export interface ResponseWithDataArray<T> { export interface ResponseWithDataArray<T> {
data: T[]; data: T[];
} }
interface ResponseWithMetaLink { interface ResponseWithMetaLink {
meta: { meta: {
link: string; link: string;
}; };
} }
export interface ResponseWithDataArrayAndMeta<T> extends ResponseWithDataArray<T>, ResponseWithMetaLink { export interface ResponseWithDataArrayAndMeta<T> extends ResponseWithDataArray<T>, ResponseWithMetaLink {
} }
export interface ResponseFromGetUserRepo extends ResponseWithMetaLink { export interface ResponseFromGetUserRepo extends ResponseWithMetaLink {
data: RepoFromGetUserRepo[]; data: RepoFromGetUserRepo[];
} }
export interface ResponseFromGetBranches extends ResponseWithMetaLink { export interface ResponseFromGetBranches extends ResponseWithMetaLink {
data: BranchFromGetBranches[]; data: BranchFromGetBranches[];
} }
export interface ResponseFromGetRepo { export interface ResponseFromGetRepo {
data: RepoFromGetRepo; data: RepoFromGetRepo;
meta: {}; meta: {};
} }
export interface ResponseFromCompareCommits { export interface ResponseFromCompareCommits {
data: { data: {
status: string; status: string;
@@ -56,9 +67,11 @@ export interface ResponseFromCompareCommits {
total_commits: number; total_commits: number;
}; };
} }
export interface ResponseFromGetContributors extends ResponseWithMetaLink { export interface ResponseFromGetContributors extends ResponseWithMetaLink {
data: OwnerFromGetContributors[] | undefined; data: OwnerFromGetContributors[] | undefined;
} }
export interface RepoFromGetUserRepo { export interface RepoFromGetUserRepo {
default_branch: string; default_branch: string;
description: string; description: string;
@@ -73,6 +86,7 @@ export interface RepoFromGetUserRepo {
pushed_at: string; pushed_at: string;
url: string; url: string;
} }
interface OwnerFromGetUserRepo { interface OwnerFromGetUserRepo {
avatar_url: string; avatar_url: string;
gravatar_id: string; gravatar_id: string;
@@ -82,35 +96,45 @@ interface OwnerFromGetUserRepo {
repos_url: string; repos_url: string;
type: UserType; type: UserType;
} }
export type OwnerFromGetContributors = OwnerFromGetUserRepo; export type OwnerFromGetContributors = OwnerFromGetUserRepo;
enum UserType { enum UserType {
User = 'User' User = 'User'
} }
export interface BranchFromGetBranches { export interface BranchFromGetBranches {
name: string; name: string;
commit: CommitFromGetBranches; commit: CommitFromGetBranches;
} }
interface CommitFromGetBranches { interface CommitFromGetBranches {
sha: string; sha: string;
url: string; url: string;
} }
interface RepoFromGetRepo { interface RepoFromGetRepo {
parent: RepoFromGetUserRepo; parent: RepoFromGetUserRepo;
} }
export interface RepoNameWithUnusedFlag { export interface RepoNameWithUnusedFlag {
repoName: string; repoName: string;
unused: boolean; unused: boolean;
} }
export interface RepoNameWithBranches { export interface RepoNameWithBranches {
repoName: string; repoName: string;
branches: BranchFromGetBranches[]; branches: BranchFromGetBranches[];
} }
export interface RepoNameWithParentRepo { export interface RepoNameWithParentRepo {
repoName: string; repoName: string;
parentRepo: RepoFromGetUserRepo; parentRepo: RepoFromGetUserRepo;
} }
export interface RepoNameWithBranchesAndParent extends RepoNameWithBranches, RepoNameWithParentRepo { export interface RepoNameWithBranchesAndParent extends RepoNameWithBranches, RepoNameWithParentRepo {
} }
export interface ObjectWithPerPage { export interface ObjectWithPerPage {
per_page?: number; per_page?: number;
} }