-
Notifications
You must be signed in to change notification settings - Fork 736
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
164 additions
and
354 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
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
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 |
---|---|---|
@@ -1,36 +1,36 @@ | ||
package org.kohsuke.github; | ||
|
||
import java.net.URL; | ||
|
||
public class GHDeploymentStatus extends Identifiable { | ||
private GHRepository owner; | ||
private GitHub root; | ||
protected GHUser creator; | ||
protected String state; | ||
protected String description; | ||
protected String target_url; | ||
protected String deployment_url; | ||
protected String repository_url; | ||
public GHDeploymentStatus wrap(GHRepository owner) { | ||
this.owner = owner; | ||
this.root = owner.root; | ||
if(creator != null) creator.wrapUp(root); | ||
return this; | ||
} | ||
public URL getTargetUrl() { | ||
return GitHub.parseURL(target_url); | ||
} | ||
|
||
public URL getDeploymentUrl() { | ||
return GitHub.parseURL(deployment_url); | ||
} | ||
|
||
public URL getRepositoryUrl() { | ||
return GitHub.parseURL(repository_url); | ||
} | ||
public GHDeploymentState getState() { | ||
return GHDeploymentState.valueOf(state.toUpperCase()); | ||
} | ||
|
||
|
||
} | ||
package org.kohsuke.github; | ||
|
||
import java.net.URL; | ||
|
||
public class GHDeploymentStatus extends GHObject { | ||
private GHRepository owner; | ||
private GitHub root; | ||
protected GHUser creator; | ||
protected String state; | ||
protected String description; | ||
protected String target_url; | ||
protected String deployment_url; | ||
protected String repository_url; | ||
public GHDeploymentStatus wrap(GHRepository owner) { | ||
this.owner = owner; | ||
this.root = owner.root; | ||
if(creator != null) creator.wrapUp(root); | ||
return this; | ||
} | ||
public URL getTargetUrl() { | ||
return GitHub.parseURL(target_url); | ||
} | ||
|
||
public URL getDeploymentUrl() { | ||
return GitHub.parseURL(deployment_url); | ||
} | ||
|
||
public URL getRepositoryUrl() { | ||
return GitHub.parseURL(repository_url); | ||
} | ||
public GHDeploymentState getState() { | ||
return GHDeploymentState.valueOf(state.toUpperCase()); | ||
} | ||
|
||
|
||
} |
60 changes: 30 additions & 30 deletions
60
src/main/java/org/kohsuke/github/GHDeploymentStatusBuilder.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 |
---|---|---|
@@ -1,30 +1,30 @@ | ||
package org.kohsuke.github; | ||
|
||
import java.io.IOException; | ||
|
||
public class GHDeploymentStatusBuilder { | ||
private final Requester builder; | ||
private GHRepository repo; | ||
private int deploymentId; | ||
|
||
public GHDeploymentStatusBuilder(GHRepository repo, int deploymentId, GHDeploymentState state) { | ||
this.repo = repo; | ||
this.deploymentId = deploymentId; | ||
this.builder = new Requester(repo.root); | ||
this.builder.with("state",state.toString().toLowerCase()); | ||
} | ||
|
||
public GHDeploymentStatusBuilder description(String description) { | ||
this.builder.with("description",description); | ||
return this; | ||
} | ||
|
||
public GHDeploymentStatusBuilder targetUrl(String targetUrl) { | ||
this.builder.with("target_url",targetUrl); | ||
return this; | ||
} | ||
|
||
public GHDeploymentStatus create() throws IOException { | ||
return builder.to(repo.getApiTailUrl("deployments")+"/"+deploymentId+"/statuses",GHDeploymentStatus.class).wrap(repo); | ||
} | ||
} | ||
package org.kohsuke.github; | ||
|
||
import java.io.IOException; | ||
|
||
public class GHDeploymentStatusBuilder { | ||
private final Requester builder; | ||
private GHRepository repo; | ||
private int deploymentId; | ||
|
||
public GHDeploymentStatusBuilder(GHRepository repo, int deploymentId, GHDeploymentState state) { | ||
this.repo = repo; | ||
this.deploymentId = deploymentId; | ||
this.builder = new Requester(repo.root); | ||
this.builder.with("state",state.toString().toLowerCase()); | ||
} | ||
|
||
public GHDeploymentStatusBuilder description(String description) { | ||
this.builder.with("description",description); | ||
return this; | ||
} | ||
|
||
public GHDeploymentStatusBuilder targetUrl(String targetUrl) { | ||
this.builder.with("target_url",targetUrl); | ||
return this; | ||
} | ||
|
||
public GHDeploymentStatus create() throws IOException { | ||
return builder.to(repo.getApiTailUrl("deployments")+"/"+deploymentId+"/statuses",GHDeploymentStatus.class).wrap(repo); | ||
} | ||
} |
Oops, something went wrong.