-
Notifications
You must be signed in to change notification settings - Fork 354
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
473: Handle Bitbucket API changes (#475)
- Loading branch information
1 parent
3817449
commit 9ee5f97
Showing
4 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
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
67 changes: 67 additions & 0 deletions
67
src/main/java/com/cloudbees/jenkins/plugins/bitbucket/api/BitbucketCloudWorkspace.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,67 @@ | ||
package com.cloudbees.jenkins.plugins.bitbucket.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class BitbucketCloudWorkspace implements BitbucketWorkspace { | ||
@JsonProperty("uuid") | ||
private String uuid; | ||
|
||
@JsonProperty("name") | ||
private String name; | ||
|
||
@JsonProperty("slug") | ||
private String slug; | ||
|
||
@JsonProperty("is_private") | ||
private boolean isPrivate; | ||
|
||
@JsonProperty("links") | ||
@JsonDeserialize(keyAs = String.class, contentUsing = BitbucketHref.Deserializer.class) | ||
private Map<String, List<BitbucketHref>> links; | ||
|
||
@Override | ||
public String getUuid() { | ||
return uuid; | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return name; | ||
} | ||
|
||
@Override | ||
public String getSlug() { | ||
return slug; | ||
} | ||
|
||
@Override | ||
public boolean isPrivate() { | ||
return isPrivate; | ||
} | ||
|
||
@Override | ||
public Map<String, List<BitbucketHref>> getLinks() { | ||
return links; | ||
} | ||
|
||
@Override | ||
public String getLink(String name) { | ||
if (links == null) { | ||
return null; | ||
} | ||
List<BitbucketHref> hrefs = links.get(name); | ||
if (hrefs == null || hrefs.isEmpty()) { | ||
return null; | ||
} | ||
BitbucketHref href = hrefs.get(0); | ||
return href == null ? null : href.getHref(); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/java/com/cloudbees/jenkins/plugins/bitbucket/api/BitbucketWorkspace.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,9 @@ | ||
package com.cloudbees.jenkins.plugins.bitbucket.api; | ||
|
||
public interface BitbucketWorkspace extends BitbucketTeam { | ||
String getUuid(); | ||
|
||
String getSlug(); | ||
|
||
boolean isPrivate(); | ||
} |
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