|
8 | 8 | public enum Endpoint { |
9 | 9 | // Languages |
10 | 10 | LANGUAGES("languages"), |
11 | | - LANGUAGE_SPECIFIC("language/%s"), |
| 11 | + LANGUAGE_SPECIFIC("language/%s", 1), |
12 | 12 |
|
13 | 13 | // Categories |
14 | 14 | CATEGORIES("categories"), |
15 | | - CATEGORY_SPECIFIC("categories/%s"), |
| 15 | + CATEGORY_SPECIFIC("categories/%s", 1), |
16 | 16 |
|
17 | 17 | // Snippets |
18 | 18 | SNIPPETS("snippets"), |
19 | | - SNIPPET_SPECIFIC("snippets/%s"), |
| 19 | + SNIPPET_SPECIFIC("snippets/%s", 1), |
20 | 20 | // Snippet Revisions |
21 | | - SNIPPET_REVISIONS("snippets/%s/revisions"), |
22 | | - SNIPPET_REVISION_SPECIFIC("snippets/%s/revisions/%s"); |
| 21 | + SNIPPET_REVISIONS("snippets/%s/revisions", 1), |
| 22 | + SNIPPET_REVISION_SPECIFIC("snippets/%s/revisions/%s", 2); |
23 | 23 |
|
24 | 24 | public static final String URL_BASE = "https://api.codebottle.io/"; |
25 | 25 |
|
26 | 26 | private final String appendix; |
| 27 | + private final int requiredParameterCount; |
27 | 28 |
|
28 | 29 | Endpoint(String appendix) { |
29 | 30 | this.appendix = appendix; |
| 31 | + this.requiredParameterCount = 0; |
| 32 | + } |
| 33 | + |
| 34 | + Endpoint(String appendix, int requiredParameterCount) { |
| 35 | + this.appendix = appendix; |
| 36 | + this.requiredParameterCount = requiredParameterCount; |
30 | 37 | } |
31 | 38 |
|
32 | 39 | public int getRequiredParameterCount() { |
33 | | - return appendix.split("%s").length - 1; |
| 40 | + return requiredParameterCount; |
34 | 41 | } |
35 | 42 |
|
36 | 43 | public URL url(Object... args) throws IllegalArgumentException { |
|
0 commit comments