Skip to content

Commit 73048c9

Browse files
stevsmitSteven Smith
andcommitted
Adds user api endpoints (quay#1229)
Co-authored-by: Steven Smith <[email protected]>
1 parent a912182 commit 73048c9

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

api/master.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ include::modules/managing-teams-api.adoc[leveloffset=+2]
127127
include::modules/managing-team-members-api.adoc[leveloffset=+3]
128128
include::modules/setting-role-of-team-within-organization-api.adoc[leveloffset=+3]
129129
include::modules/deleting-team-within-organization-api.adoc[leveloffset=+3]
130+
//user
131+
include::modules/managing-user-options-api.adoc[leveloffset=+2]
130132
131133
132134

modules/managing-organization-teams.adoc

Whitespace-only changes.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
[id="manage-user-options-api"]
2+
= Managing current user options by using the {productname} API
3+
4+
Some user options, like starring a repository, or getting information about your account, are available with the {productname} API.
5+
6+
.Procedure
7+
8+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#getloggedinuser[`GET /api/v1/user/`] endpoint to get user information for the authenticated user.
9+
+
10+
[source,terminal]
11+
----
12+
$ curl -X GET "https://quay-server.example.com/api/v1/user/" \
13+
-H "Authorization: Bearer <your_access_token>"
14+
----
15+
+
16+
.Example output
17+
+
18+
[source,terminal]
19+
----
20+
{"anonymous": false, "username": "quayadmin", "avatar": {"name": "quayadmin", "hash": "6d640d802fe23b93779b987c187a4b7a4d8fbcbd4febe7009bdff58d84498fba", "color": "#f7b6d2", "kind": "user"}, "can_create_repo": true, "is_me": true, "verified": true, "email": "[email protected]", "logins": [], "invoice_email": false, "invoice_email_address": null, "preferred_namespace": false, "tag_expiration_s": 1209600, "prompts": [], "company": null, "family_name": null, "given_name": null, "location": null, "is_free_account": true, "has_password_set": true, "quotas": [{"id": 4, "limit_bytes": 2199023255552, "limits": [{"id": 3, "type": "Reject", "limit_percent": 100}]}], "quota_report": {"quota_bytes": 2280675, "configured_quota": 2199023255552, "running_backfill": "complete", "backfill_status": "complete"}, "organizations": [{"name": "test", "avatar": {"name": "test", "hash": "a15d479002b20f211568fd4419e76686d2b88a4980a5b4c4bc10420776c5f6fe", "color": "#aec7e8", "kind": "org"}, "can_create_repo": true, "public": false, "is_org_admin": true, "preferred_namespace": false}, {"name": "sample", "avatar": {"name": "sample", "hash": "ba560c68f1d26e8c6b911ac9b5d10d513e7e43e576cc2baece1b8a46f36a29a5", "color": "#b5cf6b", "kind": "org"}, "can_create_repo": true, "public": false, "is_org_admin": true, "preferred_namespace": false}], "super_user": true}
21+
----
22+
23+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#getuserinformation[`GET /api/v1/users/{username}`] endpoint to get user information for the specified user.
24+
25+
+
26+
[source,terminal]
27+
----
28+
$ curl -X GET "https://quay-server.example.com/api/v1/users/example_user" \
29+
-H "Authorization: Bearer <your_access_token>"
30+
----
31+
+
32+
.Example output
33+
+
34+
[source,terminal]
35+
----
36+
{"anonymous": false, "username": "testuser", "avatar": {"name": "testuser", "hash": "f660ab912ec121d1b1e928a0bb4bc61b15f5ad44d5efdc4e1c92a25e99b8e44a", "color": "#6b6ecf", "kind": "user"}, "super_user": false}
37+
----
38+
39+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#createstar[`POST /api/v1/user/starred`] endpoint to star a repository:
40+
+
41+
[source,terminal]
42+
----
43+
$ curl -X POST "https://quay-server.example.com/api/v1/user/starred" \
44+
-H "Authorization: Bearer <your_access_token>" \
45+
-H "Content-Type: application/json" \
46+
-d '{
47+
"namespace": "<namespace>",
48+
"repository": "<repository_name>"
49+
}'
50+
----
51+
+
52+
.Example output
53+
+
54+
[source,terminal]
55+
----
56+
{"namespace": "test", "repository": "testrepo"}
57+
----
58+
59+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#liststarredrepos[`GET /api/v1/user/starred`] endpoint to list all starred repositories:
60+
+
61+
[source,terminal]
62+
----
63+
$ curl -X GET "https://quay-server.example.com/api/v1/user/starred?next_page=<next_page_token>" \
64+
-H "Authorization: Bearer <your_access_token>"
65+
----
66+
+
67+
.Example output
68+
+
69+
[source,terminal]
70+
----
71+
{"repositories": [{"namespace": "test", "name": "testrepo", "description": "This repository is now under maintenance.", "is_public": true}]}
72+
----
73+
74+
. Use the link:https://docs.redhat.com/en/documentation/red_hat_quay/3.13/html-single/red_hat_quay_api_guide/index#deletestar[`DELETE /api/v1/user/starred/{repository}`] endpoint to delete a star from a repository:
75+
+
76+
[source,terminal]
77+
----
78+
$ curl -X DELETE "https://quay-server.example.com/api/v1/user/starred/namespace/repository-name" \
79+
-H "Authorization: Bearer <your_access_token>"
80+
----
81+
+
82+
This command does not return output in the CLI.

0 commit comments

Comments
 (0)