-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRepository.js
75 lines (63 loc) · 1.96 KB
/
Repository.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// @flow
import { request, required } from './Client'
// flow types
import type { FetchOptions } from './Client';
import type {
RepositoryEntity,
UserEntity,
CommitEntity,
GitCommitEntity,
} from './definitions';
type getRepositoryParams = {
}
export function getRepository(
owner: string = required("owner"),
repo: string = required("repo"),
params: getRepositoryParams,
options?: FetchOptions
): Promise<RepositoryEntity> {
return request(`/repos/${owner}/${repo}`, params, "GET", options);
}
type getRepositoryIssueParams = {
}
export function getRepositoryIssue(
owner: string = required("owner"),
repo: string = required("repo"),
id: number = required("id"),
params: getRepositoryIssueParams,
options?: FetchOptions
): Promise<RepositoryEntity> {
return request(`/repos/${owner}/${repo}/issues/${id}`, params, "GET", options);
}
type getRepositoryCollaboratorsParams = {
}
export function getRepositoryCollaborators(
owner: string = required("owner"),
repo: string = required("repo"),
params: getRepositoryCollaboratorsParams,
options?: FetchOptions
): Promise<Array<UserEntity>> {
return request(`/repos/${owner}/${repo}/collaborators`, params, "GET", options);
}
type getRepositoryCommitParams = {
}
export function getRepositoryCommit(
owner: string = required("owner"),
repo: string = required("repo"),
sha: string = required("sha"),
params: getRepositoryCommitParams,
options?: FetchOptions
): Promise<CommitEntity> {
return request(`/repos/${owner}/${repo}/commits/${sha}`, params, "GET", options);
}
type getRepositoryGitCommitParams = {
}
export function getRepositoryGitCommit(
owner: string = required("owner"),
repo: string = required("repo"),
sha: string = required("sha"),
params: getRepositoryGitCommitParams,
options?: FetchOptions
): Promise<GitCommitEntity> {
return request(`/repos/${owner}/${repo}/git/commits/${sha}`, params, "GET", options);
}