Add redux store and package

This commit is contained in:
Abhas
2018-07-11 19:44:03 +05:30
parent 69d9b8081d
commit 4fd92d9130
7 changed files with 263 additions and 114 deletions
+80 -69
View File
@@ -2,140 +2,151 @@ import * as Octokit from '@octokit/rest';
// +++ All typescript definitions +++
interface RequestOptions {
method: string;
url: string;
headers: any;
query?: string;
variables?: Variables;
method: string;
url: string;
headers: any;
query?: string;
variables?: Variables;
}
interface Result {
headers: {
status: string;
};
headers: {
status: string;
};
}
interface OctokitError {
code: number;
status: string;
code: number;
status: string;
}
export interface OctokitMod extends Octokit {
// The following are added because Octokit does not expose the hook.error, hook.before, and hook.after methods
hook: {
error: (when: 'request', callback: (error: OctokitError, options: RequestOptions) => void) => void;
before: (when: 'request', callback: (result: Result, options: RequestOptions) => void) => void;
after: (when: 'request', callback: (result: Result, options: RequestOptions) => void) => void;
};
// The following are added because Octokit does not expose the hook.error, hook.before, and hook.after methods
hook: {
error: (
when: 'request',
callback: (error: OctokitError, options: RequestOptions) => void
) => void;
before: (
when: 'request',
callback: (result: Result, options: RequestOptions) => void
) => void;
after: (
when: 'request',
callback: (result: Result, options: RequestOptions) => void
) => void;
};
}
interface Variables {
[key: string]: any;
[key: string]: any;
}
export interface ResponseWithDataArray<T> {
data: T[];
data: T[];
}
interface ResponseWithMetaLink {
meta: {
link: string;
};
meta: {
link: string;
};
}
export interface ResponseWithDataArrayAndMeta<T> extends ResponseWithDataArray<T>, ResponseWithMetaLink {
}
export interface ResponseWithDataArrayAndMeta<T>
extends ResponseWithDataArray<T>,
ResponseWithMetaLink {}
export interface ResponseFromGetUserRepo extends ResponseWithMetaLink {
data: RepoFromGetUserRepo[];
data: RepoFromGetUserRepo[];
}
export interface ResponseFromGetBranches extends ResponseWithMetaLink {
data: BranchFromGetBranches[];
data: BranchFromGetBranches[];
}
export interface ResponseFromGetRepo {
data: RepoFromGetRepo;
meta: {};
data: RepoFromGetRepo;
meta: {};
}
export interface ResponseFromCompareCommits {
data: {
status: string;
ahead_by: number;
behind_by: number;
total_commits: number;
};
data: {
status: string;
ahead_by: number;
behind_by: number;
total_commits: number;
};
}
export interface ResponseFromGetContributors extends ResponseWithMetaLink {
data: OwnerFromGetContributors[] | undefined;
data: OwnerFromGetContributors[] | undefined;
}
export interface RepoFromGetUserRepo {
default_branch: string;
description: string;
fork: boolean;
full_name: string;
homepage: string;
id: number;
language: string;
name: string;
owner: OwnerFromGetUserRepo;
private: boolean;
pushed_at: string;
url: string;
default_branch: string;
description: string;
fork: boolean;
full_name: string;
homepage: string;
id: number;
language: string;
name: string;
owner: OwnerFromGetUserRepo;
private: boolean;
pushed_at: string;
url: string;
}
interface OwnerFromGetUserRepo {
avatar_url: string;
gravatar_id: string;
html_url: string;
id: number;
login: string;
repos_url: string;
type: UserType;
avatar_url: string;
gravatar_id: string;
html_url: string;
id: number;
login: string;
repos_url: string;
type: UserType;
}
export type OwnerFromGetContributors = OwnerFromGetUserRepo;
enum UserType {
User = 'User'
User = 'User',
}
export interface BranchFromGetBranches {
name: string;
commit: CommitFromGetBranches;
name: string;
commit: CommitFromGetBranches;
}
interface CommitFromGetBranches {
sha: string;
url: string;
sha: string;
url: string;
}
interface RepoFromGetRepo {
parent: RepoFromGetUserRepo;
parent: RepoFromGetUserRepo;
}
export interface RepoNameWithUnusedFlag {
repoName: string;
unused: boolean;
repoName: string;
unused: boolean;
}
export interface RepoNameWithBranches {
repoName: string;
branches: BranchFromGetBranches[];
repoName: string;
branches: BranchFromGetBranches[];
}
export interface RepoNameWithParentRepo {
repoName: string;
parentRepo: RepoFromGetUserRepo;
repoName: string;
parentRepo: RepoFromGetUserRepo;
}
export interface RepoNameWithBranchesAndParent extends RepoNameWithBranches, RepoNameWithParentRepo {
}
export interface RepoNameWithBranchesAndParent
extends RepoNameWithBranches,
RepoNameWithParentRepo {}
export interface ObjectWithPerPage {
per_page?: number;
per_page?: number;
}
// --- End all typescript definitions ---
// --- End all typescript definitions ---