-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add listCategories at ProjectApi and RepositoryApi
- Loading branch information
Showing
13 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/main/java/com/cdancy/bitbucket/rest/domain/category/CategoriesHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.cdancy.bitbucket.rest.domain.category; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* This interface should NOT be applied to "option" like classes and/or used in instances where this is applied to | ||
* outgoing http traffic. This interface should ONLY be used for classes modeled after incoming http traffic. | ||
*/ | ||
public interface CategoriesHolder { | ||
|
||
List<Category> categories(); | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/com/cdancy/bitbucket/rest/domain/category/Category.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.cdancy.bitbucket.rest.domain.category; | ||
|
||
import org.jclouds.json.SerializedNames; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class Category { | ||
|
||
public abstract int id(); | ||
public abstract String title(); | ||
|
||
Category() { | ||
} | ||
|
||
@SerializedNames({"id", "title"}) | ||
public static Category create(final int id, final String title) { | ||
return new AutoValue_Category(id, title); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/cdancy/bitbucket/rest/domain/category/ProjectCategoriesPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.cdancy.bitbucket.rest.domain.category; | ||
|
||
import org.jclouds.json.SerializedNames; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class ProjectCategoriesPage { | ||
|
||
/** | ||
* will contain error messages, if the call fails. | ||
*/ | ||
public abstract String message(); | ||
|
||
/** | ||
* the categories assigned to the project | ||
*/ | ||
public abstract ProjectCategory result(); | ||
|
||
ProjectCategoriesPage() {} | ||
|
||
@SerializedNames({"message", "result"}) | ||
public static ProjectCategoriesPage create(final String message, final ProjectCategory result) { | ||
return new AutoValue_ProjectCategoriesPage(message, result); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/java/com/cdancy/bitbucket/rest/domain/category/ProjectCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.cdancy.bitbucket.rest.domain.category; | ||
|
||
import java.util.List; | ||
|
||
import org.jclouds.json.SerializedNames; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class ProjectCategory implements ProjectHolder, CategoriesHolder { | ||
|
||
ProjectCategory() {} | ||
|
||
@SerializedNames({"projectId", "projectKey", "projectName", "categories"}) | ||
public static ProjectCategory create(final String projectId, | ||
final String projectKey, | ||
final String projectName, | ||
final List<Category> categories) { | ||
return new AutoValue_ProjectCategory(projectId, projectKey, projectName, categories); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/cdancy/bitbucket/rest/domain/category/ProjectHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.cdancy.bitbucket.rest.domain.category; | ||
|
||
/** | ||
* This interface should NOT be applied to "option" like classes and/or used in instances where this is applied to | ||
* outgoing http traffic. This interface should ONLY be used for classes modeled after incoming http traffic. | ||
*/ | ||
public interface ProjectHolder { | ||
|
||
String projectId(); | ||
String projectKey(); | ||
String projectName(); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/cdancy/bitbucket/rest/domain/category/RepositoryCategoriesPage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.cdancy.bitbucket.rest.domain.category; | ||
|
||
import org.jclouds.json.SerializedNames; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class RepositoryCategoriesPage { | ||
|
||
/** | ||
* will contain error messages, if the call fails. | ||
*/ | ||
public abstract String message(); | ||
|
||
/** | ||
* the categories assigned to the project/repository | ||
*/ | ||
public abstract RepositoryCategory result(); | ||
|
||
RepositoryCategoriesPage() {} | ||
|
||
@SerializedNames({"message", "result"}) | ||
public static RepositoryCategoriesPage create(final String message, final RepositoryCategory result) { | ||
return new AutoValue_RepositoryCategoriesPage(message, result); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/com/cdancy/bitbucket/rest/domain/category/RepositoryCategory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.cdancy.bitbucket.rest.domain.category; | ||
|
||
import java.util.List; | ||
|
||
import org.jclouds.json.SerializedNames; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
@AutoValue | ||
public abstract class RepositoryCategory implements ProjectHolder, CategoriesHolder { | ||
|
||
public abstract String repositoryId(); | ||
|
||
public abstract String repositoryName(); | ||
|
||
public abstract String repositorySlug(); | ||
|
||
RepositoryCategory() {} | ||
|
||
@SerializedNames({ "projectId", "projectKey", "projectName", "categories", "repositoryId", "repositoryName", "repositorySlug" }) | ||
public static RepositoryCategory create(final String projectId, | ||
final String projectKey, | ||
final String projectName, | ||
final List<Category> categories, | ||
final String repositoryId, | ||
final String repositoryName, | ||
final String repositorySlug) { | ||
return new AutoValue_RepositoryCategory(projectId, projectKey, projectName, | ||
categories, | ||
repositoryId, repositoryName, repositorySlug); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"message": "", | ||
"result": { | ||
"projectId": 1, | ||
"projectKey": "PRJ", | ||
"projectName": "ProjectName", | ||
"publicRepository": false, | ||
"categories": [ | ||
{ | ||
"id": 1, | ||
"title": "cat1" | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "cat2" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"message": "", | ||
"result": { | ||
"repositoryId": 1, | ||
"repositoryName": "repoName", | ||
"repositorySlug": "my-repo", | ||
"categories": [ | ||
{ | ||
"id": 1, | ||
"title": "cat1" | ||
}, | ||
{ | ||
"id": 2, | ||
"title": "cat2" | ||
} | ||
], | ||
"projectId": 1, | ||
"projectKey": "PRJ", | ||
"projectName": "ProjectName", | ||
"publicRepository": false | ||
} | ||
} |