-
Notifications
You must be signed in to change notification settings - Fork 738
Expand file tree
/
Copy pathpullRequestBuilder.ts
More file actions
113 lines (109 loc) · 4.92 KB
/
pullRequestBuilder.ts
File metadata and controls
113 lines (109 loc) · 4.92 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { UserBuilder } from './userBuilder';
import { NonNullUserRefBuilder, RefBuilder } from './refBuilder';
import { createLink, createBuilderClass } from '../base';
import { OctokitCommon } from '../../../github/common';
export type PullRequestUnion = OctokitCommon.PullsGetResponseData;
type Links = PullRequestUnion['_links'];
type Milestone = PullRequestUnion['milestone'];
export const PullRequestBuilder = createBuilderClass<PullRequestUnion>()({
id: { default: 0 },
node_id: { default: 'node0' },
number: { default: 1347 },
url: { default: 'https://api.github.com/repos/octocat/reponame/pulls/1347' },
state: { default: 'open' },
html_url: { default: 'https://github.com/octocat/reponame/pull/1347' },
diff_url: { default: 'https://github.com/octocat/reponame/pull/1347.diff' },
patch_url: { default: 'https://github.com/octocat/reponame/pull/1347.patch' },
issue_url: { default: 'https://api.github.com/repos/octocat/reponame/issues/1347' },
commits_url: { default: 'https://api.github.com/repos/octocat/reponame/pulls/1347/commits' },
review_comments_url: { default: 'https://api.github.com/repos/octocat/reponame/pulls/1347/comments' },
review_comment_url: { default: 'https://api.github.com/repos/octocat/reponame/pulls/comments{/number}' },
comments_url: { default: 'https://api.github.com/repos/octocat/reponame/issues/1347/comments' },
statuses_url: {
default: 'https://api.github.com/repos/octocat/reponame/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e',
},
locked: { default: false },
title: { default: 'New feature' },
body: { default: 'Please merge thx' },
user: { linked: UserBuilder },
author_association: { default: 'OWNER' },
assignee: { linked: UserBuilder },
assignees: { default: [] },
requested_reviewers: { default: [] },
requested_teams: { default: [] },
labels: { default: [] },
active_lock_reason: { default: '' },
created_at: { default: '2019-01-01T08:00:00Z' },
updated_at: { default: '2019-01-01T08:00:00Z' },
closed_at: { default: '' },
merged_at: { default: '' },
merge_commit_sha: { default: '' },
head: { linked: NonNullUserRefBuilder },
base: { linked: NonNullUserRefBuilder },
draft: { default: false },
merged: { default: false },
mergeable: { default: true },
rebaseable: { default: true },
mergeable_state: { default: 'clean' },
review_comments: { default: 0 },
merged_by: { linked: UserBuilder },
comments: { default: 10 },
commits: { default: 5 },
additions: { default: 3 },
deletions: { default: 400 },
changed_files: { default: 10 },
maintainer_can_modify: { default: true },
milestone: createLink<Milestone>()({
id: { default: 1 },
node_id: { default: 'milestone0' },
number: { default: 100 },
state: { default: 'open' },
title: { default: 'milestone title' },
description: { default: 'milestone description' },
url: { default: 'https://api.github.com/repos/octocat/reponame/milestones/100' },
html_url: { default: 'https://github.com/octocat/reponame/milestones/123' },
labels_url: { default: 'https://github.com/octocat/reponame/milestones/123/labels' },
creator: { linked: UserBuilder },
open_issues: { default: 10 },
closed_issues: { default: 5 },
created_at: { default: '2019-01-01T10:00:00Z' },
updated_at: { default: '2019-01-01T10:00:00Z' },
closed_at: { default: '2019-01-01T10:00:00Z' },
due_on: { default: '2019-01-01T10:00:00Z' },
}),
_links: createLink<Links>()({
self: createLink<Links['self']>()({
href: { default: 'https://api.github.com/repos/octocat/reponame/pulls/1347' },
}),
html: createLink<Links['html']>()({
href: { default: 'https://github.com/octocat/reponame/pull/1347' },
}),
issue: createLink<Links['issue']>()({
href: { default: 'https://api.github.com/repos/octocat/reponame/issues/1347' },
}),
comments: createLink<Links['comments']>()({
href: { default: 'https://api.github.com/repos/octocat/reponame/issues/1347/comments' },
}),
review_comments: createLink<Links['review_comments']>()({
href: { default: 'https://api.github.com/repos/octocat/reponame/pulls/1347/comments' },
}),
review_comment: createLink<Links['review_comment']>()({
href: { default: 'https://api.github.com/repos/octocat/reponame/pulls/comments{/number}' },
}),
commits: createLink<Links['commits']>()({
href: { default: 'https://api.github.com/repos/octocat/reponame/pulls/1347/commits' },
}),
statuses: createLink<Links['statuses']>()({
href: {
default:
'https://api.github.com/repos/octocat/reponame/statuses/6dcb09b5b57875f334f61aebed695e2e4193db5e',
},
}),
}),
auto_merge: { default: null },
});
export type PullRequestBuilder = InstanceType<typeof PullRequestBuilder>;