azure_devops/constants/
paths.rs1pub struct ApiPath;
2
3impl ApiPath {
4 pub fn projects() -> String {
5 "_apis/projects".into()
6 }
7 pub fn project(id: &str) -> String {
8 format!("_apis/projects/{id}")
9 }
10
11 pub fn work_item(id: i64) -> String {
12 format!("_apis/wit/workitems/{id}")
13 }
14 pub fn work_items() -> String {
15 "_apis/wit/workitems".into()
16 }
17 pub fn work_items_batch() -> String {
18 "_apis/wit/workitemsbatch".into()
19 }
20 pub fn work_item_create(project: &str, r#type: &str) -> String {
21 format!("{project}/_apis/wit/workitems/${type}")
22 }
23 pub fn wiql(project: &str) -> String {
24 format!("{project}/_apis/wit/wiql")
25 }
26 pub fn wiql_team(project: &str, team: &str) -> String {
27 format!("{project}/{team}/_apis/wit/wiql")
28 }
29 pub fn wiql_by_id(project: &str, id: &str) -> String {
30 format!("{project}/_apis/wit/wiql/{id}")
31 }
32 pub fn wiql_by_id_team(p: &str, t: &str, id: &str) -> String {
33 format!("{p}/{t}/_apis/wit/wiql/{id}")
34 }
35 pub fn work_item_types(project: &str) -> String {
36 format!("{project}/_apis/wit/workitemtypes")
37 }
38 pub fn work_item_type(project: &str, t: &str) -> String {
39 format!("{project}/_apis/wit/workitemtypes/{t}")
40 }
41 pub fn fields() -> String {
42 "_apis/wit/fields".into()
43 }
44 pub fn state_colors() -> String {
45 "_apis/wit/workitemstatescolors".into()
46 }
47
48 pub fn repositories() -> String {
49 "_apis/git/repositories".into()
50 }
51 pub fn repository(id: &str) -> String {
52 format!("_apis/git/repositories/{id}")
53 }
54 pub fn repository_refs(id: &str) -> String {
55 format!("_apis/git/repositories/{id}/refs")
56 }
57 pub fn repository_commits(id: &str) -> String {
58 format!("_apis/git/repositories/{id}/commits")
59 }
60 pub fn repository_commit(id: &str, sha: &str) -> String {
61 format!("_apis/git/repositories/{id}/commits/{sha}")
62 }
63 pub fn repository_pushes(id: &str) -> String {
64 format!("_apis/git/repositories/{id}/pushes")
65 }
66 pub fn repository_push(id: &str, push: i64) -> String {
67 format!("_apis/git/repositories/{id}/pushes/{push}")
68 }
69 pub fn repository_branches(id: &str) -> String {
70 format!("_apis/git/repositories/{id}/stats/branches")
71 }
72 pub fn repository_items(id: &str) -> String {
73 format!("_apis/git/repositories/{id}/items")
74 }
75 pub fn repository_blob(id: &str, sha: &str) -> String {
76 format!("_apis/git/repositories/{id}/blobs/{sha}")
77 }
78 pub fn repository_statuses(id: &str, sha: &str) -> String {
79 format!("_apis/git/repositories/{id}/commits/{sha}/statuses")
80 }
81
82 pub fn prs(repo: &str) -> String {
83 format!("_apis/git/repositories/{repo}/pullrequests")
84 }
85 pub fn prs_by_project(project: &str) -> String {
86 format!("{project}/_apis/git/pullrequests")
87 }
88 pub fn pr(repo: &str, id: i64) -> String {
89 format!("_apis/git/repositories/{repo}/pullrequests/{id}")
90 }
91 pub fn pr_by_id(id: i64) -> String {
92 format!("_apis/git/pullrequests/{id}")
93 }
94 pub fn pr_commits(repo: &str, id: i64) -> String {
95 format!("_apis/git/repositories/{repo}/pullrequests/{id}/commits")
96 }
97 pub fn pr_workitems(repo: &str, id: i64) -> String {
98 format!("_apis/git/repositories/{repo}/pullrequests/{id}/workitems")
99 }
100 pub fn pr_reviewers(repo: &str, id: i64) -> String {
101 format!("_apis/git/repositories/{repo}/pullrequests/{id}/reviewers")
102 }
103 pub fn pr_reviewer(repo: &str, pr: i64, rev: &str) -> String {
104 format!("_apis/git/repositories/{repo}/pullrequests/{pr}/reviewers/{rev}")
105 }
106 pub fn pr_threads(repo: &str, id: i64) -> String {
107 format!("_apis/git/repositories/{repo}/pullrequests/{id}/threads")
108 }
109 pub fn pr_comments(repo: &str, pr: i64, thread: i64) -> String {
110 format!("_apis/git/repositories/{repo}/pullrequests/{pr}/threads/{thread}/comments")
111 }
112 pub fn pr_comment(repo: &str, pr: i64, thread: i64, comment: i64) -> String {
113 format!(
114 "_apis/git/repositories/{repo}/pullrequests/{pr}/threads/{thread}/comments/{comment}"
115 )
116 }
117
118 pub fn build_definitions(project: &str) -> String {
119 format!("{project}/_apis/build/definitions")
120 }
121 pub fn build_definition(project: &str, id: i64) -> String {
122 format!("{project}/_apis/build/definitions/{id}")
123 }
124 pub fn build_definition_revisions(project: &str, id: i64) -> String {
125 format!("{project}/_apis/build/definitions/{id}/revisions")
126 }
127 pub fn builds(project: &str) -> String {
128 format!("{project}/_apis/build/builds")
129 }
130 pub fn build(project: &str, id: i64) -> String {
131 format!("{project}/_apis/build/builds/{id}")
132 }
133 pub fn build_latest(project: &str, def: i64) -> String {
134 format!("{project}/_apis/build/latest/{def}")
135 }
136 pub fn build_tags(project: &str, id: i64) -> String {
137 format!("{project}/_apis/build/builds/{id}/tags")
138 }
139 pub fn build_tag(project: &str, id: i64, tag: &str) -> String {
140 format!("{project}/_apis/build/builds/{id}/tags/{tag}")
141 }
142 pub fn build_timeline(project: &str, id: i64) -> String {
143 format!("{project}/_apis/build/builds/{id}/timeline")
144 }
145 pub fn build_logs(project: &str, id: i64) -> String {
146 format!("{project}/_apis/build/builds/{id}/logs")
147 }
148 pub fn build_artifacts(project: &str, id: i64) -> String {
149 format!("{project}/_apis/build/builds/{id}/artifacts")
150 }
151 pub fn build_artifact(project: &str, id: i64, name: &str) -> String {
152 format!("{project}/_apis/build/builds/{id}/artifacts/{name}")
153 }
154 pub fn build_changes(project: &str, id: i64) -> String {
155 format!("{project}/_apis/build/builds/{id}/changes")
156 }
157 pub fn build_metrics(project: &str) -> String {
158 format!("{project}/_apis/build/metrics/definitions")
159 }
160 pub fn build_definition_metrics(project: &str, id: i64) -> String {
161 format!("{project}/_apis/build/definitions/{id}/metrics")
162 }
163 pub fn build_badge(base_url: &str, def: i64) -> String {
164 format!("{base_url}_apis/public/build/definitions/{def}/badge")
165 }
166
167 pub fn pipelines(project: &str) -> String {
168 format!("{project}/_apis/pipelines")
169 }
170 pub fn pipeline(project: &str, id: i64) -> String {
171 format!("{project}/_apis/pipelines/{id}")
172 }
173 pub fn pipeline_runs(project: &str, id: i64) -> String {
174 format!("{project}/_apis/pipelines/{id}/runs")
175 }
176 pub fn pipeline_run(project: &str, pid: i64, rid: i64) -> String {
177 format!("{project}/_apis/pipelines/{pid}/runs/{rid}")
178 }
179 pub fn pipeline_preview(project: &str, id: i64) -> String {
180 format!("{project}/_apis/pipelines/{id}/preview")
181 }
182 pub fn pipeline_artifact(project: &str, pid: i64, rid: i64, name: &str) -> String {
183 format!("{project}/_apis/pipelines/{pid}/runs/{rid}/artifacts/{name}")
184 }
185 pub fn pipeline_logs(project: &str, pid: i64, rid: i64) -> String {
186 format!("{project}/_apis/pipelines/{pid}/runs/{rid}/logs")
187 }
188 pub fn pipeline_log(project: &str, pid: i64, rid: i64, lid: i64) -> String {
189 format!("{project}/_apis/pipelines/{pid}/runs/{rid}/logs/{lid}")
190 }
191}