gitea-client 1.5.8 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2329e00e2af0a331e2ae7c951f0581c4cb672ed48b72d2efd93ee7dc6ad74528
4
- data.tar.gz: 3e1b7b481ed27f11b68fe363118396af0722dda9c0d591c4df46341db3561b2f
3
+ metadata.gz: 53fe0f2181f0d524c29763ffe01e7ba2b41659f1802642f5e08a78548a4ded69
4
+ data.tar.gz: 89c607503606f38aabad618c2d3f8f7db9e602057b9042fc7e2bd95bbbfea7bd
5
5
  SHA512:
6
- metadata.gz: 84bfc1052683db65b1d4f0e620310f6772355745e0cb8027462701d4652ad7c8c4ce9a3b12f2efb9cddf8bd4adb4862146b513f7fad90a9d4e2ab33b0425cd7d
7
- data.tar.gz: cb07ef775f22bf237817485a719e7b34453fded60306bb1985414b22ff6cb65c023b14f5bb744bab198e3bdf7c7304b2029110107c745c168a6fbefd05557f6c
6
+ metadata.gz: 20bfb39421e59ca4d339a1de6bb890e3adbdc6a4725e89e8722bc31d85d3935352ac176b00d5a849927aad19bb6d2ab57a19292c635c3954299b0cdee08530a3
7
+ data.tar.gz: ef6bfae120d497a9bb285818359b7cb4e0476dc7625b2d767dbf384625b40c614262a050175ecf65b9ae568686ade91f069c5a9b2acfe662128b0ae82f8ab828
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitea-client (1.5.8)
4
+ gitea-client (1.6.0)
5
5
  rest-client (~> 2.1.0)
6
6
 
7
7
  GEM
@@ -48,8 +48,8 @@ GEM
48
48
 
49
49
  PLATFORMS
50
50
  -darwin-21
51
- arm64-darwin-21
52
51
  x86_64-darwin-20
52
+ x86_64-linux
53
53
 
54
54
  DEPENDENCIES
55
55
  gitea-client!
@@ -58,4 +58,4 @@ DEPENDENCIES
58
58
  standard
59
59
 
60
60
  BUNDLED WITH
61
- 2.3.26
61
+ 2.4.22
data/README.md CHANGED
@@ -17,7 +17,6 @@ And then execute:
17
17
  Or install it yourself as:
18
18
 
19
19
  $ gem install gitea-client
20
-
21
20
 
22
21
  ## Usage Example
23
22
 
@@ -9,6 +9,34 @@ module Gitea
9
9
  @http.post("/admin/cron/#{task}", opt)
10
10
  end
11
11
 
12
+ def get_admin_emails(opt={})
13
+ @http.get("/admin/emails", opt)
14
+ end
15
+
16
+ def get_admin_emails_search(opt={})
17
+ @http.get("/admin/emails/search", opt)
18
+ end
19
+
20
+ def get_admin_hooks(opt={})
21
+ @http.get("/admin/hooks", opt)
22
+ end
23
+
24
+ def post_admin_hooks(opt={})
25
+ @http.post("/admin/hooks", opt)
26
+ end
27
+
28
+ def get_admin_hooks_by_id(id, opt={})
29
+ @http.get("/admin/hooks/#{id}", opt)
30
+ end
31
+
32
+ def delete_admin_hooks_by_id(id, opt={})
33
+ @http.delete("/admin/hooks/#{id}", opt)
34
+ end
35
+
36
+ def patch_admin_hooks_by_id(id, opt={})
37
+ @http.patch("/admin/hooks/#{id}", opt)
38
+ end
39
+
12
40
  def get_admin_orgs(opt={})
13
41
  @http.get("/admin/orgs", opt)
14
42
  end
@@ -53,6 +81,10 @@ module Gitea
53
81
  @http.post("/admin/users/#{username}/orgs", opt)
54
82
  end
55
83
 
84
+ def post_admin_users_rename_by_username(username, opt={})
85
+ @http.post("/admin/users/#{username}/rename", opt)
86
+ end
87
+
56
88
  def post_admin_users_repos_by_username(username, opt={})
57
89
  @http.post("/admin/users/#{username}/repos", opt)
58
90
  end
@@ -29,6 +29,26 @@ module Gitea
29
29
  @http.patch("/repos/#{owner}/#{repo}/issues/comments/#{id}", opt)
30
30
  end
31
31
 
32
+ def get_repos_issues_comments_assets_by_owner_repo_id(owner, repo, id, opt={})
33
+ @http.get("/repos/#{owner}/#{repo}/issues/comments/#{id}/assets", opt)
34
+ end
35
+
36
+ def post_repos_issues_comments_assets_by_owner_repo_id(owner, repo, id, opt={})
37
+ @http.post("/repos/#{owner}/#{repo}/issues/comments/#{id}/assets", opt)
38
+ end
39
+
40
+ def get_repos_issues_comments_assets_by_owner_repo_id_attachment_id(owner, repo, id, attachment_id, opt={})
41
+ @http.get("/repos/#{owner}/#{repo}/issues/comments/#{id}/assets/#{attachment_id}", opt)
42
+ end
43
+
44
+ def delete_repos_issues_comments_assets_by_owner_repo_id_attachment_id(owner, repo, id, attachment_id, opt={})
45
+ @http.delete("/repos/#{owner}/#{repo}/issues/comments/#{id}/assets/#{attachment_id}", opt)
46
+ end
47
+
48
+ def patch_repos_issues_comments_assets_by_owner_repo_id_attachment_id(owner, repo, id, attachment_id, opt={})
49
+ @http.patch("/repos/#{owner}/#{repo}/issues/comments/#{id}/assets/#{attachment_id}", opt)
50
+ end
51
+
32
52
  def get_repos_issues_comments_reactions_by_owner_repo_id(owner, repo, id, opt = {})
33
53
  @http.get("/repos/#{owner}/#{repo}/issues/comments/#{id}/reactions", opt)
34
54
  end
@@ -53,6 +73,38 @@ module Gitea
53
73
  @http.patch("/repos/#{owner}/#{repo}/issues/#{index}", opt)
54
74
  end
55
75
 
76
+ def get_repos_issues_assets_by_owner_repo_index(owner, repo, index, opt={})
77
+ @http.get("/repos/#{owner}/#{repo}/issues/#{index}/assets", opt)
78
+ end
79
+
80
+ def post_repos_issues_assets_by_owner_repo_index(owner, repo, index, opt={})
81
+ @http.post("/repos/#{owner}/#{repo}/issues/#{index}/assets", opt)
82
+ end
83
+
84
+ def get_repos_issues_assets_by_owner_repo_index_attachment_id(owner, repo, index, attachment_id, opt={})
85
+ @http.get("/repos/#{owner}/#{repo}/issues/#{index}/assets/#{attachment_id}", opt)
86
+ end
87
+
88
+ def delete_repos_issues_assets_by_owner_repo_index_attachment_id(owner, repo, index, attachment_id, opt={})
89
+ @http.delete("/repos/#{owner}/#{repo}/issues/#{index}/assets/#{attachment_id}", opt)
90
+ end
91
+
92
+ def patch_repos_issues_assets_by_owner_repo_index_attachment_id(owner, repo, index, attachment_id, opt={})
93
+ @http.patch("/repos/#{owner}/#{repo}/issues/#{index}/assets/#{attachment_id}", opt)
94
+ end
95
+
96
+ def get_repos_issues_blocks_by_owner_repo_index(owner, repo, index, opt={})
97
+ @http.get("/repos/#{owner}/#{repo}/issues/#{index}/blocks", opt)
98
+ end
99
+
100
+ def post_repos_issues_blocks_by_owner_repo_index(owner, repo, index, opt={})
101
+ @http.post("/repos/#{owner}/#{repo}/issues/#{index}/blocks", opt)
102
+ end
103
+
104
+ def delete_repos_issues_blocks_by_owner_repo_index(owner, repo, index, opt={})
105
+ @http.delete("/repos/#{owner}/#{repo}/issues/#{index}/blocks", opt)
106
+ end
107
+
56
108
  def get_repos_issues_comments_by_owner_repo_index(owner, repo, index, opt = {})
57
109
  @http.get("/repos/#{owner}/#{repo}/issues/#{index}/comments", opt)
58
110
  end
@@ -65,6 +117,18 @@ module Gitea
65
117
  @http.post("/repos/#{owner}/#{repo}/issues/#{index}/deadline", opt)
66
118
  end
67
119
 
120
+ def get_repos_issues_dependencies_by_owner_repo_index(owner, repo, index, opt={})
121
+ @http.get("/repos/#{owner}/#{repo}/issues/#{index}/dependencies", opt)
122
+ end
123
+
124
+ def post_repos_issues_dependencies_by_owner_repo_index(owner, repo, index, opt={})
125
+ @http.post("/repos/#{owner}/#{repo}/issues/#{index}/dependencies", opt)
126
+ end
127
+
128
+ def delete_repos_issues_dependencies_by_owner_repo_index(owner, repo, index, opt={})
129
+ @http.delete("/repos/#{owner}/#{repo}/issues/#{index}/dependencies", opt)
130
+ end
131
+
68
132
  def get_repos_issues_labels_by_owner_repo_index(owner, repo, index, opt = {})
69
133
  @http.get("/repos/#{owner}/#{repo}/issues/#{index}/labels", opt)
70
134
  end
@@ -85,6 +149,18 @@ module Gitea
85
149
  @http.delete("/repos/#{owner}/#{repo}/issues/#{index}/labels/#{id}", opt)
86
150
  end
87
151
 
152
+ def post_repos_issues_pin_by_owner_repo_index(owner, repo, index, opt={})
153
+ @http.post("/repos/#{owner}/#{repo}/issues/#{index}/pin", opt)
154
+ end
155
+
156
+ def delete_repos_issues_pin_by_owner_repo_index(owner, repo, index, opt={})
157
+ @http.delete("/repos/#{owner}/#{repo}/issues/#{index}/pin", opt)
158
+ end
159
+
160
+ def patch_repos_issues_pin_by_owner_repo_index_position(owner, repo, index, position, opt={})
161
+ @http.patch("/repos/#{owner}/#{repo}/issues/#{index}/pin/#{position}", opt)
162
+ end
163
+
88
164
  def get_repos_issues_reactions_by_owner_repo_index(owner, repo, index, opt = {})
89
165
  @http.get("/repos/#{owner}/#{repo}/issues/#{index}/reactions", opt)
90
166
  end
@@ -1,12 +1,40 @@
1
1
  module Gitea
2
2
  module Api
3
3
  module Miscellaneous
4
+ def get_gitignore_templates(opt={})
5
+ @http.get("/gitignore/templates", opt)
6
+ end
7
+
8
+ def get_gitignore_templates_by_name(name, opt={})
9
+ @http.get("/gitignore/templates/#{name}", opt)
10
+ end
11
+
12
+ def get_label_templates(opt={})
13
+ @http.get("/label/templates", opt)
14
+ end
15
+
16
+ def get_label_templates_by_name(name, opt={})
17
+ @http.get("/label/templates/#{name}", opt)
18
+ end
19
+
20
+ def get_licenses(opt={})
21
+ @http.get("/licenses", opt)
22
+ end
23
+
24
+ def get_licenses_by_name(opt={})
25
+ @http.get("/licenses/#{name}", opt)
26
+ end
27
+
4
28
  def post_markdown(opt={})
5
29
  @http.post("/markdown", opt)
6
30
  end
7
31
 
8
- def post_markdown_new(opt={})
9
- @http.post("/markdown/new", opt)
32
+ def post_markdown_raw(opt={})
33
+ @http.post("/markdown/raw", opt)
34
+ end
35
+
36
+ def post_markup(opt={})
37
+ @http.post("/markup", opt)
10
38
  end
11
39
 
12
40
  def get_nodeinfo(opt = {})
@@ -21,6 +21,30 @@ module Gitea
21
21
  @http.patch("/orgs/#{org}", opt)
22
22
  end
23
23
 
24
+ def get_orgs_actions_secrets_org(org, opt={})
25
+ @http.get("/orgs/#{org}/actions/secrets", opt)
26
+ end
27
+
28
+ def put_orgs_actions_secrets_by_org_secretname(org, secretname, opt={})
29
+ @http.put("/orgs/#{org}/actions/secrets/#{secretname}", opt)
30
+ end
31
+
32
+ def delete_orgs_actions_secrets_by_org_secretname(org, secretname, opt={})
33
+ @http.delete("/orgs/#{org}/actions/secrets/#{secretname}", opt)
34
+ end
35
+
36
+ def get_orgs_activities_feeds_by_org(org, opt={})
37
+ @http.get("/orgs/#{org}/activities/feeds", opt)
38
+ end
39
+
40
+ def post_orgs_avatar_by_org(org, opt={})
41
+ @http.post("/orgs/#{org}/avatar", opt)
42
+ end
43
+
44
+ def delete_orgs_avatar_by_orb(org, opt={})
45
+ @http.delete("/orgs/#{org}/avatar", opt={})
46
+ end
47
+
24
48
  def get_orgs_hooks_by_org(org, opt={})
25
49
  @http.get("/orgs/#{org}/hooks", opt)
26
50
  end
@@ -105,7 +129,7 @@ module Gitea
105
129
  @http.post("/orgs/#{org}/teams", opt)
106
130
  end
107
131
 
108
- def get_orgs_temas_search_by_org(org, opt={})
132
+ def get_orgs_teams_search_by_org(org, opt={})
109
133
  @http.get("/orgs/#{org}/teams/search", opt)
110
134
  end
111
135
 
@@ -121,6 +145,10 @@ module Gitea
121
145
  @http.patch("/teams/#{id}", opt)
122
146
  end
123
147
 
148
+ def get_teams_activities_feeds_by_id(id, opt={})
149
+ @http.get("/teams/#{id}/activities/feeds", opt)
150
+ end
151
+
124
152
  def get_teams_members_by_id(id, opt={})
125
153
  @http.get("/teams/#{id}/members", opt)
126
154
  end
@@ -15,7 +15,7 @@ module Gitea
15
15
  end
16
16
 
17
17
  def get_packages_files_by_owner_type_name_version(owner, type, name, version, opt = {})
18
- @http.get("/packages/#{owner}/#{type}/#{name}/#{version}", opt)
18
+ @http.get("/packages/#{owner}/#{type}/#{name}/#{version}/files", opt)
19
19
  end
20
20
  end # Package
21
21
  end # Api
@@ -21,6 +21,18 @@ module Gitea
21
21
  @http.patch("/repos/#{owner}/#{repo}", opt)
22
22
  end
23
23
 
24
+ def put_repos_actions_secrets_by_owner_repo_secretname(owner, repo, secretname, opt={})
25
+ @http.put("/repos/#{owner}/#{repo}/actions/secrets/#{secretname}", opt)
26
+ end
27
+
28
+ def delete_repos_actions_secrets_by_owner_repo_secretname(owner, repo, secretname, opt={})
29
+ @http.delete("/repos/#{owner}/#{repo}/actions/secrets/#{secretname}", opt)
30
+ end
31
+
32
+ def get_repos_activities_feeds_by_owner_repo(owner, repo, opt={})
33
+ @http.get("/repos/#{owner}/#{repo}/activities/feeds", opt)
34
+ end
35
+
24
36
  def get_repos_archive_by_owner_repo_archive(owner, repo, archive, opt = {})
25
37
  @http.get("/repos/#{owner}/#{repo}/archive/#{archive}")
26
38
  end
@@ -29,6 +41,14 @@ module Gitea
29
41
  @http.get("/repos/#{owner}/#{repo}/assignees", opt)
30
42
  end
31
43
 
44
+ def post_repos_avatar_by_owner_repo(owner, repo, opt={})
45
+ @http.post("/repos/#{owner}/#{repo}/avatar", opt)
46
+ end
47
+
48
+ def delete_repos_avatar_by_owner_repo(owner, repo, opt={})
49
+ @http.delete("/repos/#{owner}/#{repo}/avatar", opt)
50
+ end
51
+
32
52
  def get_repos_branch_protections_by_owner_repo(owner, repo, opt = {})
33
53
  @http.get("/repos/#{owner}/#{repo}/branch_protections", opt)
34
54
  end
@@ -81,10 +101,6 @@ module Gitea
81
101
  @http.delete("/repos/#{owner}/#{repo}/collaborators/#{collaborator}", opt)
82
102
  end
83
103
 
84
- def get_repos_pulls_files_by_owner_repo_index(owner, repo, index, opt = {})
85
- @http.get("/repos/#{owner}/#{repo}/pulls/#{index}/files", opt)
86
- end
87
-
88
104
  def get_repos_collaborators_permission_by_owner_repo_collaborator(owner, repo, collaborator, opt = {})
89
105
  @http.get("/repos/#{owner}/#{repo}/collaborators/#{collaborator}/permission", opt)
90
106
  end
@@ -101,28 +117,12 @@ module Gitea
101
117
  @http.get("/repos/#{owner}/#{repo}/commits/#{ref}/statuses", opt)
102
118
  end
103
119
 
104
- def get_repos_push_mirrors_by_owner_repo(owner, repo, opt = {})
105
- @http.get("/repos/#{owner}/#{repo}/push_mirrors", opt)
106
- end
107
-
108
- def post_repos_push_mirrors_by_owner_repo(owner, repo, opt = {})
109
- @http.post("/repos/#{owner}/#{repo}/push_mirrors", opt)
110
- end
111
-
112
120
  def get_repos_contents_by_owner_repo(owner, repo, opt = {})
113
121
  @http.get("/repos/#{owner}/#{repo}/contents", opt)
114
122
  end
115
123
 
116
- def post_repos_push_mirrors_sync_by_owner_repo(owner, repo, opt = {})
117
- @http.post("/repos/#{owner}/#{repo}/push_mirrors-sync", opt)
118
- end
119
-
120
- def get_repos_push_mirrors_by_owner_repo_name(owner, repo, name, opt = {})
121
- @http.get("/repos/#{owner}/#{repo}/push_mirrors/#{name}", opt)
122
- end
123
-
124
- def delete_repos_push_mirrors_by_owner_repo_name(owner, repo, name, opt = {})
125
- @http.delete("/repos/#{owner}/#{repo}/push_mirrors/#{name}", opt)
124
+ def post_repos_contents_by_owner_repo(owner, repo, opt={})
125
+ @http.post("/repos/#{owner}/#{repo}/contents", opt)
126
126
  end
127
127
 
128
128
  def get_repos_contents_by_owner_repo_filepath(owner, repo, filepath, opt = {})
@@ -229,6 +229,14 @@ module Gitea
229
229
  @http.post("/repos/#{owner}/#{repo}/hooks/#{id}/tests", opt)
230
230
  end
231
231
 
232
+ def get_repos_issue_config_by_owner_repo(owner, repo, opt={})
233
+ @http.get("/repos/#{owner}/#{repo}/issue_config", opt)
234
+ end
235
+
236
+ def get_repos_issue_config_validate_by_owner_repo(owner, repo, opt={})
237
+ @http.get("/repos/#{owner}/#{repo}/issue_config/validate", opt)
238
+ end
239
+
232
240
  def get_repos_issue_templates_by_owner_repo(owner, repo, opt = {})
233
241
  @http.get("/repos/#{owner}/#{repo}/issue_templates", opt)
234
242
  end
@@ -261,6 +269,10 @@ module Gitea
261
269
  @http.post("/repos/#{owner}/#{repo}/mirror-sync", opt)
262
270
  end
263
271
 
272
+ def get_repos_new_pin_allowed_by_owner_repo(owner, repo, opt={})
273
+ @http.get("/repos/#{owner}/#{repo}/new_pin_allowed", opt)
274
+ end
275
+
264
276
  def get_repos_pulls_by_owner_repo(owner, repo, opt = {})
265
277
  @http.get("/repos/#{owner}/#{repo}/pulls", opt)
266
278
  end
@@ -269,6 +281,10 @@ module Gitea
269
281
  @http.post("/repos/#{owner}/#{repo}/pulls", opt)
270
282
  end
271
283
 
284
+ def get_repos_pulls_pinned_by_owner_repo(owner, repo, opt={})
285
+ @http.get("/repos/#{owner}/#{repo}/pulls/pinned", opt)
286
+ end
287
+
272
288
  def patch_repos_pulls_by_owner_repo_index(owner, repo, index, opt = {})
273
289
  @http.patch("/repos/#{owner}/#{repo}/pulls/#{index}", opt)
274
290
  end
@@ -281,6 +297,10 @@ module Gitea
281
297
  @http.get("/repos/#{owner}/#{repo}/pulls/#{index}/commits", opt)
282
298
  end
283
299
 
300
+ def get_repos_pulls_files_by_owner_repo_index(owner, repo, index, opt = {})
301
+ @http.get("/repos/#{owner}/#{repo}/pulls/#{index}/files", opt)
302
+ end
303
+
284
304
  def get_repos_pulls_merge_by_owner_repo_index(owner, repo, index, opt = {})
285
305
  @http.get("/repos/#{owner}/#{repo}/pulls/#{index}/merge", opt)
286
306
  end
@@ -337,6 +357,26 @@ module Gitea
337
357
  @http.post("/repos/#{owner}/#{repo}/pulls/#{index}/update", opt)
338
358
  end
339
359
 
360
+ def get_repos_push_mirrors_by_owner_repo(owner, repo, opt = {})
361
+ @http.get("/repos/#{owner}/#{repo}/push_mirrors", opt)
362
+ end
363
+
364
+ def post_repos_push_mirrors_by_owner_repo(owner, repo, opt = {})
365
+ @http.post("/repos/#{owner}/#{repo}/push_mirrors", opt)
366
+ end
367
+
368
+ def post_repos_push_mirrors_sync_by_owner_repo(owner, repo, opt = {})
369
+ @http.post("/repos/#{owner}/#{repo}/push_mirrors-sync", opt)
370
+ end
371
+
372
+ def get_repos_push_mirrors_by_owner_repo_name(owner, repo, name, opt = {})
373
+ @http.get("/repos/#{owner}/#{repo}/push_mirrors/#{name}", opt)
374
+ end
375
+
376
+ def delete_repos_push_mirrors_by_owner_repo_name(owner, repo, name, opt = {})
377
+ @http.delete("/repos/#{owner}/#{repo}/push_mirrors/#{name}", opt)
378
+ end
379
+
340
380
  def get_repos_raw_by_owner_repo_filepath(owner, repo, filepath, opt = {})
341
381
  @http.get("/repos/#{owner}/#{repo}/raw/#{filepath}", opt)
342
382
  end
@@ -349,6 +389,10 @@ module Gitea
349
389
  @http.post("/repos/#{owner}/#{repo}/releases", opt)
350
390
  end
351
391
 
392
+ def get_repos_releases_latest_by_owner_repo(owner, repo, opt={})
393
+ @http.get("/repos/#{owner}/#{repo}/releases/latest", opt)
394
+ end
395
+
352
396
  def get_repos_releases_tags_by_owner_repo_tag(owner, repo, tag, opt = {})
353
397
  @http.get("/repos/#{owner}/#{repo}/releases/tags/#{tag}", opt)
354
398
  end
@@ -6,6 +6,14 @@ module Gitea
6
6
  @http.get("/user", opt)
7
7
  end
8
8
 
9
+ def put_user_actions_secrets_by_secretname(secretname, opt={})
10
+ @http.put("/user/actions/secrets/#{secretname}", opt)
11
+ end
12
+
13
+ def delete_user_actions_secrets_by_secretname(secretname, opt={})
14
+ @http.delete("/user/actions/secrets/#{secretname}", opt)
15
+ end
16
+
9
17
  def get_user_applications_oauth2(opt={})
10
18
  @http.get("/user/applications/oauth2", opt)
11
19
  end
@@ -26,6 +34,14 @@ module Gitea
26
34
  @http.patch("/user/applications/oauth2/#{id}", opt)
27
35
  end
28
36
 
37
+ def post_user_avatar(opt={})
38
+ @http.post("/user/avatar", opt)
39
+ end
40
+
41
+ def delete_user_avatar(opt={})
42
+ @http.delete("/user/avatar", opt)
43
+ end
44
+
29
45
  def get_user_emails(opt={})
30
46
  @http.get("/user/emails", opt)
31
47
  end
@@ -82,6 +98,26 @@ module Gitea
82
98
  @http.delete("/user/gpg_keys/#{id}", opt)
83
99
  end
84
100
 
101
+ def get_user_hooks(opt={})
102
+ @http.get("/user/hooks", opt)
103
+ end
104
+
105
+ def post_user_hooks(opt={})
106
+ @http.post("/user/hooks", opt)
107
+ end
108
+
109
+ def get_user_hooks_by_id(id, opt={})
110
+ @http.get("/user/hooks/#{id}", opt)
111
+ end
112
+
113
+ def delete_user_hooks_by_id(id, opt={})
114
+ @http.delete("/user/hooks/#{id}", opt)
115
+ end
116
+
117
+ def patch_user_hooks_by_id(id, opt={})
118
+ @http.patch("/user/hooks/#{id}", opt)
119
+ end
120
+
85
121
  def get_user_keys(opt={})
86
122
  @http.get("/user/keys", opt)
87
123
  end
@@ -102,6 +138,10 @@ module Gitea
102
138
  @http.get("/user/repos", opt)
103
139
  end
104
140
 
141
+ def post_user_repos(opt={})
142
+ @http.post("/user/repos", opt)
143
+ end
144
+
105
145
  def get_user_settings(opt={})
106
146
  @http.get("/user/settings", opt)
107
147
  end
@@ -150,8 +190,8 @@ module Gitea
150
190
  @http.get("/users/#{username}", opt)
151
191
  end
152
192
 
153
- def get_users_following_by_follower_followee(follower, followee, opt={})
154
- @http.get("/users/#{follower}/following/#{followee}", opt)
193
+ def get_users_activities_feeds_by_username(username, opt={})
194
+ @http.get("/users/#{username}/activities/feeds", opt)
155
195
  end
156
196
 
157
197
  def get_users_followers_by_username(username, opt={})
@@ -159,7 +199,11 @@ module Gitea
159
199
  end
160
200
 
161
201
  def get_users_following_by_username(username, opt={})
162
- @http.get("/user/#{username}/following", opt)
202
+ @http.get("/users/#{username}/following", opt)
203
+ end
204
+
205
+ def get_users_following_by_username_target(username, target, opt={})
206
+ @http.get("/users/#{username}/following/#{target}", opt)
163
207
  end
164
208
 
165
209
  def get_users_gpg_keys_by_username(username, opt={})
data/lib/gitea/api.rb CHANGED
@@ -11,10 +11,3 @@ require_relative 'api/client'
11
11
  require_relative 'api/config'
12
12
  require_relative 'api/exception'
13
13
  require_relative 'api/http'
14
- require_relative 'api/hat/repository'
15
- require_relative 'api/hat/organization'
16
- require_relative 'api/hat/users'
17
- require_relative 'api/hat/admin'
18
- require_relative 'api/hat/client'
19
- require_relative 'api/hat/config'
20
- require_relative 'api/hat/http'
data/lib/gitea/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gitea
4
- VERSION = "1.5.8"
4
+ VERSION = "1.6.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitea-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.8
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - viletyy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-11 00:00:00.000000000 Z
11
+ date: 2024-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -49,13 +49,6 @@ files:
49
49
  - lib/gitea/api/client.rb
50
50
  - lib/gitea/api/config.rb
51
51
  - lib/gitea/api/exception.rb
52
- - lib/gitea/api/hat/admin.rb
53
- - lib/gitea/api/hat/client.rb
54
- - lib/gitea/api/hat/config.rb
55
- - lib/gitea/api/hat/http.rb
56
- - lib/gitea/api/hat/organization.rb
57
- - lib/gitea/api/hat/repository.rb
58
- - lib/gitea/api/hat/users.rb
59
52
  - lib/gitea/api/http.rb
60
53
  - lib/gitea/api/issue.rb
61
54
  - lib/gitea/api/miscellaneous.rb
@@ -92,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
85
  - !ruby/object:Gem::Version
93
86
  version: '0'
94
87
  requirements: []
95
- rubygems_version: 3.4.10
88
+ rubygems_version: 3.0.9
96
89
  signing_key:
97
90
  specification_version: 4
98
91
  summary: Gitea API 库
@@ -1,13 +0,0 @@
1
- module Gitea
2
- module Api
3
- module Hat
4
- module Admin
5
-
6
- def patch_admin_users_by_username(username, opt = {})
7
- @http.patch("/admin/users/#{username}", opt)
8
- end
9
-
10
- end # Admin
11
- end # Hat
12
- end # Api
13
- end # Gitea
@@ -1,48 +0,0 @@
1
- module Gitea
2
- module Api
3
- module Hat
4
- class Client
5
-
6
- # 构造Api client,用于操作Api数据
7
- # @param opts [Hash] 构造client时的参数选项
8
- # @option opts [string] domain [必填] gitea服务地址
9
- # @option opts [string] hat_base_url [必填] api相对路径
10
- # @option opts [string] admin_username [必填] 管理员账号
11
- # @option opts [string] admin_password [必填] 管理员密码
12
- # @option opts [string] username [选填] 用户账号
13
- # @option opts [string] password [选填] 用户密码
14
- # @option opts [string] gitea_token [选填] 用户token
15
- def initialize(opts)
16
- @config = Config.new(opts)
17
- Gitea::Common::Logging.set_log_file(@config.log_filepath)
18
- @http = Http.new(@config)
19
- end
20
-
21
- def config
22
- @config
23
- end
24
-
25
- def config=(config)
26
- unless config.is_a?(Gitea::Api::Hat::Config)
27
- fail Exception, "load config failure!"
28
- end
29
- @config = config
30
- @http = Http.new(config)
31
- end
32
-
33
- def token
34
- @config.token
35
- end
36
-
37
- def token=(token)
38
- @config.token = token
39
- end
40
-
41
- include Gitea::Api::Hat::Repository
42
- include Gitea::Api::Hat::Users
43
- include Gitea::Api::Hat::Organization
44
- include Gitea::Api::Hat::Admin
45
- end
46
- end # Hat
47
- end # Api
48
- end # Gitea
@@ -1,36 +0,0 @@
1
- module Gitea
2
- module Api
3
-
4
- module Hat
5
- class Config < Common::Struct::Base
6
- attrs :domain, :hat_base_url, :username, :password, :token, :open_timeout, :read_timeout, :log_filepath
7
-
8
- def initialize(opts = {})
9
- super(opts)
10
-
11
- valid!
12
- normalize_domain
13
- end
14
-
15
- private
16
- def valid!
17
- if @domain.nil? || @hat_base_url.nil?
18
- fail Exception, "@domain, @hat_base_url not permit blank."
19
- end
20
- end
21
-
22
- def normalize_domain
23
- uri = URI.parse(domain)
24
- uri = URI.parse(domain)
25
- uri = URI.parse("http://#{domain}") unless uri.scheme
26
-
27
- if uri.scheme != 'http' and uri.scheme != 'https'
28
- fail ClientError, "Only HTTP and HTTPS domain are accepted."
29
- end
30
-
31
- @domain = uri
32
- end
33
- end
34
- end # Hat
35
- end # Api
36
- end # Gitea
@@ -1,132 +0,0 @@
1
- require 'base64'
2
- require 'json'
3
-
4
- module Gitea
5
- module Api
6
- module Hat
7
- class Http
8
- DEFAULT_CONTENT_TYPE = 'application/json'
9
- TOKEN_HEADER = 'Authorization'
10
- OPEN_TIMEOUT = 10
11
- READ_TIMEOUT = 120
12
-
13
-
14
- def initialize(config)
15
- @config = config
16
- end
17
-
18
- include Gitea::Common::Logging
19
-
20
- def get_request_url(api_url)
21
- url = @config.domain.dup
22
- url.query = nil
23
- url.fragment = nil
24
- [url.to_s, @config.hat_base_url, api_url].join('')
25
- end
26
-
27
- def get(api_url = '', http_options = {}, &block)
28
- do_request('GET', api_url, http_options, &block)
29
- end
30
-
31
- def put(api_url = '', http_options = {}, &block)
32
- do_request('PUT', api_url, http_options, &block)
33
- end
34
-
35
- def patch(api_url = '', http_options = {}, &block)
36
- do_request('PATCH', api_url, http_options, &block)
37
- end
38
-
39
- def post(api_url = '', http_options = {}, &block)
40
- do_request('POST', api_url, http_options, &block)
41
- end
42
-
43
- def delete(api_url = '', http_options = {}, &block)
44
- do_request('DELETE', api_url, http_options, &block)
45
- end
46
-
47
- def head(api_url = '', http_options = {}, &block)
48
- do_request('HEAD', api_url, http_options, &block)
49
- end
50
-
51
- def options(api_url = '', http_options = {}, &block)
52
- do_request('OPTIONS', api_url, http_options, &block)
53
- end
54
-
55
- private
56
- # Do Http request
57
- def do_request(verb, api_url, http_options = {}, &block)
58
-
59
- headers = http_options[:headers] || {}
60
- headers['user-agent'] = get_user_agent
61
- headers['date'] = Time.now.httpdate
62
- headers['content-type'] ||= DEFAULT_CONTENT_TYPE
63
-
64
- if @config.username and @config.password
65
- headers[TOKEN_HEADER] = 'Basic ' + Base64::encode64(@config.username + ":" + @config.password)
66
- end
67
-
68
- headers[:params] = http_options[:query] || {}
69
- headers[:params].merge!({access_token: @config.token}) if @config.token
70
- logger.info("Gitea Hat Client Begin a Request!...")
71
- logger.info("Send HTTP request, verb: #{verb}, http_options: #{http_options}")
72
- logger.info("Relative Url: #{api_url}")
73
- logger.info("Headers: #{headers}")
74
- request = RestClient::Request.new(
75
- :method => verb,
76
- :url => get_request_url(api_url),
77
- :headers => headers,
78
- :payload => http_options[:body],
79
- :open_timeout => @config.open_timeout || OPEN_TIMEOUT,
80
- :read_timeout => @config.read_timeout || READ_TIMEOUT
81
- )
82
-
83
-
84
- response = request.execute do |resp, &blk|
85
- if resp.code >= 300
86
- e = Gitea::Api::ServerError.new(resp)
87
- logger.error(e.to_s)
88
- raise e
89
- else
90
- resp.return!(&blk)
91
- end
92
- end
93
-
94
- # If streaming read_body is used, we need to create the
95
- # RestClient::Response ourselves
96
- unless response.is_a?(RestClient::Response)
97
- if response.code.to_i >= 300
98
- body = response.body
99
- if RestClient::version < '2.1.0'
100
- body = RestClient::Request.decode(response['content-encoding'], response.body)
101
- end
102
- response = RestClient::Response.create(body, response, request)
103
- e = Gitea::Api::ServerError.new(response)
104
- logger.error(e.to_s)
105
- raise e
106
- end
107
- response = RestClient::Response.create(nil, response, request)
108
- response.return!
109
- end
110
-
111
- begin
112
- if response.headers.has_key?(:x_total) || response.headers.has_key?(:x_total_count)
113
- return {data: JSON.parse(response), total_data: response.headers[:x_total_count]}
114
- else
115
- return JSON.parse(response)
116
- end
117
- rescue => e
118
- logger.error(e.to_s)
119
- return {}
120
- end
121
-
122
- logger.info("Gitea Hat Client Success End a Request!...")
123
- end
124
-
125
- def get_user_agent
126
- "gitea-client/#{VERSION}"
127
- end
128
-
129
- end
130
- end # Hat
131
- end # Common
132
- end # Gitea
@@ -1,25 +0,0 @@
1
- module Gitea
2
- module Api
3
- module Hat
4
- module Organization
5
-
6
- def patch_orgs_by_org(org, opt = {})
7
- @http.patch("/orgs/#{org}", opt)
8
- end
9
-
10
- def post_orgs(opt = {})
11
- @http.post("/orgs", opt)
12
- end
13
-
14
- def put_teams_repos_by_id_org(id, org, opt = {})
15
- @http.put("/teams/#{id}/repos/#{org}", opt)
16
- end
17
-
18
- def delete_teams_repos_by_id_org(id, org, opt = {})
19
- @http.delete("/teams/#{id}/repos/#{org}", opt)
20
- end
21
-
22
- end # Organization
23
- end # Hat
24
- end # Api
25
- end # Gitea
@@ -1,197 +0,0 @@
1
- module Gitea
2
- module Api
3
- module Hat
4
- module Repository
5
-
6
- def get_repos_actions_by_owner_repo(owner, repo, opt = {})
7
- @http.get("/repos/#{owner}/#{repo}/actions", opt)
8
- end
9
-
10
- def post_repos_actions_runs_by_owner_repo(owner, repo, opt = {})
11
- @http.post("/repos/#{owner}/#{repo}/actions/runs", opt)
12
- end
13
-
14
- def post_repos_actions_runs_jobs_by_owner_repo_run_job(owner, repo, run, job, opt = {})
15
- @http.post("/repos/#{owner}/#{repo}/actions/runs/#{run}/jobs/#{job}", opt)
16
- end
17
-
18
- def post_repos_actions_runs_rerun_by_owner_repo_run(owner, repo, run, opt = {})
19
- @http.post("/repos/#{owner}/#{repo}/actions/runs/#{run}/rerun", opt)
20
- end
21
-
22
- def post_repos_actions_runs_jobs_rerun_by_owner_repo_run_job(owner, repo, run, job, opt = {})
23
- @http.post("/repos/#{owner}/#{repo}/actions/runs/#{run}/jobs/#{job}/rerun", opt)
24
- end
25
-
26
- def get_repos_actions_runs_jobs_logs_by_owner_repo_run_job(owner, repo, run, job, opt = {})
27
- @http.get("/repos/#{owner}/#{repo}/actions/runs/#{run}/jobs/#{job}/logs")
28
- end
29
-
30
- def post_repos_actions_disable(owner, repo, opt= {})
31
- @http.post("/repos/#{owner}/#{repo}/actions/disable", opt)
32
- end
33
-
34
- def post_repos_actions_enable(owner, repo, opt= {})
35
- @http.post("/repos/#{owner}/#{repo}/actions/enable", opt)
36
- end
37
-
38
- def get_repos_contents_by_owner_repo(owner, repo, opt = {})
39
- @http.get("/repos/#{owner}/#{repo}/contents", opt)
40
- end
41
-
42
- def get_repos_contents_by_owner_repo_filepath(owner, repo, filepath, opt = {})
43
- @http.get("/repos/#{owner}/#{repo}/contents/#{filepath}", opt)
44
- end
45
-
46
- def get_repos_find_by_owner_repo(owner, repo, opt = {})
47
- @http.get("/repos/#{owner}/#{repo}/find", opt)
48
- end
49
-
50
- def get_repos_git_commits_by_owner_repo_sha(owner, repo, sha, opt = {})
51
- @http.get("/repos/#{owner}/#{repo}/git/commits/#{sha}", opt)
52
- end
53
-
54
- def get_repos_commits_diff_by_owner_repo_sha(owner, repo, sha, opt = {})
55
- @http.get("/repos/#{owner}/#{repo}/commits/#{sha}/diff", opt)
56
- end
57
-
58
- def post_repos_hooks_by_owner_repo(owner, repo, opt = {})
59
- @http.post("/repos/#{owner}/#{repo}/hooks", opt)
60
- end
61
-
62
- def patch_repos_hooks_by_owner_repo_id(owner, repo, id, opt = {})
63
- @http.patch("/repos/#{owner}/#{repo}/hooks/#{id}", opt)
64
- end
65
-
66
- def get_repos_hooks_hooktasks_by_owner_repo_id(owner, repo, id, opt = {})
67
- @http.get("/repos/#{owner}/#{repo}/hooks/#{id}/hooktasks", opt)
68
- end
69
-
70
- def get_repos_releases_latest_by_owner_repo(owner, repo, opt = {})
71
- @http.get("/repos/#{owner}/#{repo}/releases/latest", opt)
72
- end
73
-
74
- def get_repos_releases_by_owner_repo(owner, repo, opt = {})
75
- @http.get("/repos/#{owner}/#{repo}/releases", opt)
76
- end
77
-
78
- def get_repos_releases_by_owner_repo_id(owner, repo, opt = {})
79
- @http.get("/repos/#{owner}/#{repo}/releases/#{id}", opt)
80
- end
81
-
82
- def post_repos_releases_by_owner_repo(owner, repo, opt = {})
83
- @http.post("/repos/#{owner}/#{repo}/releases", opt)
84
- end
85
-
86
- def patch_repos_releases_by_owner_repo_id(owner, repo, id, opt = {})
87
- @http.patch("/repos/#{owner}/#{repo}/releases/#{id}", opt)
88
- end
89
-
90
- def get_repos_branch_name_set_by_owner_repo(owner, repo, opt = {})
91
- @http.get("/repos/#{owner}/#{repo}/branch_name_set", opt)
92
- end
93
-
94
- def get_repos_branches_by_owner_repo(owner, repo, opt={})
95
- @http.get("/repos/#{owner}/#{repo}/branches", opt)
96
- end
97
-
98
- def get_repos_branches_branches_slice_by_owner_repo(owner, repo, opt = {})
99
- @http.get("/repos/#{owner}/#{repo}/branches/branches_slice", opt)
100
- end
101
-
102
- def post_repos_branches_restore_by_owner_repo(owner, repo, opt = {})
103
- @http.post("/repos/#{owner}/#{repo}/branches/restore", opt)
104
- end
105
-
106
- def get_repos_tag_name_set_by_owner_repo(owner, repo, opt = {})
107
- @http.get("/repos/#{owner}/#{repo}/tag_name_set", opt)
108
- end
109
-
110
- def get_repos_tags_by_owner_repo(owner, repo, opt = {})
111
- @http.get("/repos/#{owner}/#{repo}/tags", opt)
112
- end
113
-
114
- def get_repos_tags_by_owner_repo_tag(owner, repo, tag, opt = {})
115
- @http.get("/repos/#{owner}/#{repo}/tags/#{tag}", opt)
116
- end
117
-
118
- def get_repos_branch_tag_count_by_owner_repo(owner, repo, opt = {})
119
- @http.get("/repos/#{owner}/#{repo}/branch_tag_count", opt)
120
- end
121
-
122
- def get_repos_readme_by_owner_repo(owner, repo, opt = {})
123
- @http.get("/repos/#{owner}/#{repo}/readme", opt)
124
- end
125
-
126
- def get_repos_readme_by_owner_repo_filepath(owner, repo, filepath, opt = {})
127
- @http.get("/repos/#{owner}/#{repo}/readme/#{filepath}", opt)
128
- end
129
-
130
- def get_repos_commits_slice_by_owner_repo(owner, repo, opt = {})
131
- @http.get("/repos/#{owner}/#{repo}/commits_slice", opt)
132
- end
133
-
134
- def get_repos_recent_commits_by_owner_repo(owner, repo, opt = {})
135
- @http.get("/repos/#{owner}/#{repo}/recent_commits", opt)
136
- end
137
-
138
- def get_repos_contributors_by_owner_repo(owner, repo, opt = {})
139
- @http.get("/repos/#{owner}/#{repo}/contributors", opt)
140
- end
141
-
142
- def get_repos_contributors_stat_by_owner_repo(owner, repo, opt = {})
143
- @http.get("/repos/#{owner}/#{repo}/contributors/stat", opt)
144
- end
145
-
146
- def get_repos_code_stats_by_owner_repo(owner, repo, opt = {})
147
- @http.get("/repos/#{owner}/#{repo}/code_stats", opt)
148
- end
149
-
150
- def get_repos_count_by_owner_repo(owner, repo, opt = {})
151
- @http.get("/repos/#{owner}/#{repo}/count", opt)
152
- end
153
-
154
- def get_repos_file_commits_by_owner_repo_filepath(owner, repo, filepath, opt = {})
155
- @http.get("/repos/#{owner}/#{repo}/file_commits/#{filepath}", opt)
156
- end
157
-
158
- def get_repos_blame_by_owner_repo(owner, repo, opt = {})
159
- @http.get("/repos/#{owner}/#{repo}/blame", opt)
160
- end
161
-
162
- def get_repos_compare_by_owner_repo_baseref_headref(owner, repo, baseRef, headRef, opt = {})
163
- @http.get("/repos/#{owner}/#{repo}/compare/#{baseRef}...#{headRef}", opt)
164
- end
165
-
166
- def post_repos_transfer_by_owner_repo(owner, repo, opt = {})
167
- @http.post("/repos/#{owner}/#{repo}/transfer", opt)
168
- end
169
-
170
- def get_repos_pulls_by_owner_repo_index(owner, repo, index, opt = {})
171
- @http.get("/repos/#{owner}/#{repo}/pulls/#{index}", opt)
172
- end
173
-
174
- def get_repos_pulls_commits_by_owner_repo_index(owner, repo, index, opt = {})
175
- @http.get("/repos/#{owner}/#{repo}/pulls/#{index}/commits", opt)
176
- end
177
-
178
- def get_repos_pulls_files_by_owner_repo_index(owner, repo, index, opt = {})
179
- @http.get("/repos/#{owner}/#{repo}/pulls/#{index}/files", opt)
180
- end
181
-
182
- def post_repos_contents_batch_by_owner_repo(owner, repo, opt = {})
183
- @http.post("/repos/#{owner}/#{repo}/contents/batch", opt)
184
- end
185
-
186
- def get_repos_pulls_versions_by_owner_repo_index(owner, repo, index, opt = {})
187
- @http.get("/repos/#{owner}/#{repo}/pulls/#{index}/versions", opt)
188
- end
189
-
190
- def get_repos_pulls_versions_diff_by_owner_repo_index_id(owner, repo, index, versionID, opt = {})
191
- @http.get("/repos/#{owner}/#{repo}/pulls/#{index}/versions/#{versionID}/diff", opt)
192
- end
193
-
194
- end # Repository
195
- end # Hat
196
- end # Api
197
- end # Gitea
@@ -1,13 +0,0 @@
1
- module Gitea
2
- module Api
3
- module Hat
4
- module Users
5
-
6
- def get_users_heatmap_by_username(username, opt = {})
7
- @http.get("/users/#{username}/heatmap", opt)
8
- end
9
-
10
- end # Users
11
- end # Hat
12
- end # Api
13
- end # Gitea