1 /*
2 * SPDX-FileCopyrightText: Copyright (c) 2013-2025 Yegor Bugayenko
3 * SPDX-License-Identifier: MIT
4 */
5 package com.jcabi.github;
6
7 import java.lang.annotation.Documented;
8 import java.lang.annotation.ElementType;
9 import java.lang.annotation.Retention;
10 import java.lang.annotation.RetentionPolicy;
11 import java.lang.annotation.Target;
12
13 /**
14 * Annotates an integration test case to indicate required OAuth scopes to run
15 * such case.
16 * @todo #975:30min Now all IT cases are annotated with OAuthScope annotation
17 * to marked down its required scopes. A checker needs to be implemented to
18 * check if the supplied account can fulfill the IT case requirement before
19 * it is run and make the case fail if the required OAuth scopes is not
20 * present.
21 * @see <a href="https://developer.github.com/v3/oauth/#scopes">GitHub OAuth
22 * scopes</a>
23 */
24 @Documented
25 @Retention(RetentionPolicy.RUNTIME)
26 @Target(ElementType.TYPE)
27 public @interface OAuthScope {
28 OAuthScope.Scope[] value();
29
30 enum Scope {
31 /**
32 * No scope.
33 */
34 NO_SCOPE,
35 /**
36 * User scope.
37 */
38 USER,
39 /**
40 * User email scope.
41 */
42 USER_EMAIL,
43 /**
44 * User follow scope.
45 */
46 USER_FOLLOW,
47 /**
48 * Public repo scope.
49 */
50 PUBLIC_REPO,
51 /**
52 * Repo scope.
53 */
54 REPO,
55 /**
56 * Repo deployment scope.
57 */
58 REPO_DEPLOYMENT,
59 /**
60 * Repo status scope.
61 */
62 REPO_STATUS,
63 /**
64 * Delete repo scope.
65 */
66 DELETE_REPO,
67 /**
68 * Notifications scope.
69 */
70 NOTIFICATIONS,
71 /**
72 * Gist scope.
73 */
74 GIST,
75 /**
76 * Read repo hook scope.
77 */
78 READ_REPO_HOOK,
79 /**
80 * Write repo hook scope.
81 */
82 WRITE_REPO_HOOK,
83 /**
84 * Admin repo hook scope.
85 */
86 ADMIN_REPO_HOOK,
87 /**
88 * Admin org hook scope.
89 */
90 ADMIN_ORG_HOOK,
91 /**
92 * Read org scope.
93 */
94 READ_ORG,
95 /**
96 * Write org scope.
97 */
98 WRITE_ORG,
99 /**
100 * Admin org scope.
101 */
102 ADMIN_ORG,
103 /**
104 * Read public key scope.
105 */
106 READ_PUBLIC_KEY,
107 /**
108 * Write public key scope.
109 */
110 WRITE_PUBLIC_KEY,
111 /**
112 * Admin public key scope.
113 */
114 ADMIN_PUBLIC_KEY;
115 }
116 }