From 2607d6a107b90360c6e782f10b399815e4921bc7 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Thu, 27 Feb 2020 06:32:56 -0800
Subject: [PATCH 01/16] Make GHLabel example of proposed API design
---
src/main/java/org/kohsuke/github/GHIssue.java | 6 +-
src/main/java/org/kohsuke/github/GHLabel.java | 241 +++++++++++++++---
.../java/org/kohsuke/github/GHRepository.java | 17 +-
src/test/java/org/kohsuke/github/AppTest.java | 52 ++--
.../kohsuke/github/GHEventPayloadTest.java | 4 +-
.../org/kohsuke/github/GHPullRequestTest.java | 2 +-
...-org_test-labels_labels_test-7-aceb5f.json | 4 +-
...-org_test-labels_labels_test-8-0dc6e2.json | 2 +-
8 files changed, 243 insertions(+), 85 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java
index 30cfd89b6f..c8cc79324a 100644
--- a/src/main/java/org/kohsuke/github/GHIssue.java
+++ b/src/main/java/org/kohsuke/github/GHIssue.java
@@ -352,7 +352,7 @@ private void _addLabels(Collection names) throws IOException {
List newLabels = new ArrayList();
for (GHLabel label : getLabels()) {
- newLabels.add(label.getName());
+ newLabels.add(label.name());
}
for (String name : names) {
if (!newLabels.contains(name)) {
@@ -403,8 +403,8 @@ private void _removeLabels(Collection names) throws IOException {
List newLabels = new ArrayList();
for (GHLabel l : getLabels()) {
- if (!names.contains(l.getName())) {
- newLabels.add(l.getName());
+ if (!names.contains(l.name())) {
+ newLabels.add(l.name());
}
}
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 8fdd0d7d6f..b33f97851d 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -1,10 +1,16 @@
package org.kohsuke.github;
+import com.fasterxml.jackson.annotation.JacksonInject;
+import com.fasterxml.jackson.annotation.JsonCreator;
+
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
+import java.util.function.Consumer;
+
+import javax.annotation.Nonnull;
/**
* The type GHLabel.
@@ -14,16 +20,15 @@
* @see GHRepository#listLabels() GHRepository#listLabels()
*/
public class GHLabel {
- private String url, name, color, description;
- private GHRepository repo;
/**
* Gets url.
*
* @return the url
*/
+ @Deprecated
public String getUrl() {
- return url;
+ return this.url();
}
/**
@@ -31,8 +36,9 @@ public String getUrl() {
*
* @return the name
*/
+ @Deprecated
public String getName() {
- return name;
+ return this.name();
}
/**
@@ -40,8 +46,9 @@ public String getName() {
*
* @return the color
*/
+ @Deprecated
public String getColor() {
- return color;
+ return this.color();
}
/**
@@ -49,23 +56,9 @@ public String getColor() {
*
* @return the description
*/
+ @Deprecated
public String getDescription() {
- return description;
- }
-
- GHLabel wrapUp(GHRepository repo) {
- this.repo = repo;
- return this;
- }
-
- /**
- * Delete.
- *
- * @throws IOException
- * the io exception
- */
- public void delete() throws IOException {
- repo.root.createRequest().method("DELETE").setRawUrlPath(url).send();
+ return this.description();
}
/**
@@ -75,15 +68,11 @@ public void delete() throws IOException {
* 6-letter hex color code, like "f29513"
* @throws IOException
* the io exception
+ * @deprecated use {@link #update(Consumer)} instead
*/
+ @Deprecated
public void setColor(String newColor) throws IOException {
- repo.root.createRequest()
- .method("PATCH")
- .with("name", name)
- .with("color", newColor)
- .with("description", description)
- .setRawUrlPath(url)
- .send();
+ this.update(i -> i.color(newColor));
}
/**
@@ -93,25 +82,161 @@ public void setColor(String newColor) throws IOException {
* Description of label
* @throws IOException
* the io exception
+ * @deprecated use {@link #update(Consumer)} instead
*/
+ @Deprecated
public void setDescription(String newDescription) throws IOException {
- repo.root.createRequest()
- .method("PATCH")
- .with("name", name)
- .with("color", color)
- .with("description", newDescription)
- .setRawUrlPath(url)
- .send();
+ this.update(i -> i.description(newDescription));
}
static Collection toNames(Collection labels) {
- List r = new ArrayList();
+ List r = new ArrayList<>();
for (GHLabel l : labels) {
- r.add(l.getName());
+ r.add(l.name());
}
return r;
}
+ // NEW IMPLEMENTATION STARTS HERE
+
+ @Nonnull
+ private final GitHub root;
+
+ @Nonnull
+ private final String url, name, color, description;
+
+ private GHRepository repository;
+
+ @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
+ private GHLabel(@Nonnull Builder builder) {
+ this.root = builder.root;
+ this.url = builder.url;
+ this.name = builder.name;
+ this.color = builder.color;
+ this.description = builder.description;
+ }
+
+ /**
+ * Creates a label in a repository.
+ *
+ * @throws IOException
+ * the io exception
+ */
+ public static GHLabel create(GHRepository repository, Consumer initializer) throws IOException {
+ Builder builder = new Builder();
+ initializer.accept(builder);
+ return repository.root.createRequest()
+ .withUrlPath(repository.getApiTailUrl("labels"))
+ .method("POST")
+ .with("name", builder.name)
+ .with("color", builder.color)
+ .with("description", builder.description)
+ .fetch(GHLabel.class)
+ .lateBind(repository);
+
+ }
+
+ /**
+ * Creates a label in a repository.
+ *
+ * @throws IOException
+ * the io exception
+ */
+ public static GHLabel read(@Nonnull GHRepository repository, @Nonnull String name) throws IOException {
+ return repository.root.createRequest()
+ .withUrlPath(repository.getApiTailUrl("labels"), name)
+ .fetch(GHLabel.class)
+ .lateBind(repository);
+
+ }
+
+ /**
+ * Creates a label in a repository.
+ *
+ * @throws IOException
+ * the io exception
+ */
+ public static PagedIterable readAll(@Nonnull final GHRepository repository) throws IOException {
+ return repository.root.createRequest()
+ .withUrlPath(repository.getApiTailUrl("labels"))
+ .toIterable(GHLabel[].class, item -> item.lateBind(repository));
+
+ }
+
+ /**
+ * Gets url.
+ *
+ * @return the url
+ */
+ public String url() {
+ return this.url;
+ }
+
+ /**
+ * Gets name.
+ *
+ * @return the name
+ */
+ public String name() {
+ return this.name;
+ }
+
+ /**
+ * Color code without leading '#', such as 'f29513'
+ *
+ * @return the color
+ */
+ public String color() {
+ return this.color;
+ }
+
+ /**
+ * Purpose of Label
+ *
+ * @return the description
+ */
+ public String description() {
+ return this.description;
+ }
+
+ GHLabel lateBind(GHRepository repo) {
+ if (repository == null) {
+ this.repository = repo;
+ }
+ return this;
+ }
+
+ /**
+ * Modifies a label in a repository.
+ *
+ * @throws IOException
+ * the io exception
+ */
+ public GHLabel update(Consumer updater) throws IOException {
+ Builder builder = new Builder(this);
+ updater.accept(builder);
+
+ return repository.root.createRequest()
+ .method("PATCH")
+ .with("name", builder.name)
+ .with("color", builder.color)
+ .with("description", builder.description)
+ .setRawUrlPath(url)
+ .fetch(GHLabel.class)
+ .lateBind(repository);
+ }
+
+ /**
+ * Delete this label from this repository. Made static to make it clearer that this deletes the label entirely -
+ * different from adding removing labels from objects.
+ *
+ * @throws IOException
+ * the io exception
+ */
+ public void delete() throws IOException {
+ root.createRequest().method("DELETE").setRawUrlPath(url()).send();
+ }
+
@Override
public boolean equals(final Object o) {
if (this == o)
@@ -120,11 +245,49 @@ public boolean equals(final Object o) {
return false;
final GHLabel ghLabel = (GHLabel) o;
return Objects.equals(url, ghLabel.url) && Objects.equals(name, ghLabel.name)
- && Objects.equals(color, ghLabel.color) && Objects.equals(repo, ghLabel.repo);
+ && Objects.equals(color, ghLabel.color) && Objects.equals(repository, ghLabel.repository);
}
@Override
public int hashCode() {
- return Objects.hash(url, name, color, repo);
+ return Objects.hash(url, name, color, repository);
+ }
+
+ public static class Builder {
+ private String url, name, color, description;
+
+ @JacksonInject
+ private GitHub root;
+
+ public Builder() {
+ url = "";
+ name = "";
+ color = "";
+ description = "";
+ }
+
+ public Builder(GHLabel label) {
+ this.root = label.root;
+ // Url is maintained on the mutator but cannot be changed locally.
+ url = label.url();
+ name = label.name();
+ color = label.color();
+ description = label.description();
+ }
+
+ public Builder name(String value) {
+ name = value;
+ return this;
+ }
+
+ public Builder color(String value) {
+ color = value;
+ return this;
+ }
+
+ public Builder description(String value) {
+ description = value;
+ return this;
+ }
}
}
diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java
index 24349f03f7..4ab12c4bda 100644
--- a/src/main/java/org/kohsuke/github/GHRepository.java
+++ b/src/main/java/org/kohsuke/github/GHRepository.java
@@ -1872,9 +1872,7 @@ public PagedIterable listEvents() throws IOException {
* the io exception
*/
public PagedIterable listLabels() throws IOException {
- return root.createRequest()
- .withUrlPath(getApiTailUrl("labels"))
- .toIterable(GHLabel[].class, item -> item.wrapUp(this));
+ return GHLabel.readAll(this);
}
/**
@@ -1887,7 +1885,7 @@ public PagedIterable listLabels() throws IOException {
* the io exception
*/
public GHLabel getLabel(String name) throws IOException {
- return root.createRequest().withUrlPath(getApiTailUrl("labels/" + name)).fetch(GHLabel.class).wrapUp(this);
+ return GHLabel.read(this, name);
}
/**
@@ -1902,7 +1900,7 @@ public GHLabel getLabel(String name) throws IOException {
* the io exception
*/
public GHLabel createLabel(String name, String color) throws IOException {
- return createLabel(name, color, "");
+ return GHLabel.create(this, l -> l.name(name).color(color));
}
/**
@@ -1919,14 +1917,7 @@ public GHLabel createLabel(String name, String color) throws IOException {
* the io exception
*/
public GHLabel createLabel(String name, String color, String description) throws IOException {
- return root.createRequest()
- .method("POST")
- .with("name", name)
- .with("color", color)
- .with("description", description)
- .withUrlPath(getApiTailUrl("labels"))
- .fetch(GHLabel.class)
- .wrapUp(this);
+ return GHLabel.create(this, l -> l.name(name).color(color).description(description));
}
/**
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index 5041b4f6b7..b70157289c 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -797,44 +797,48 @@ public void testRepoLabel() throws IOException {
}
assertTrue(lst.size() > 5);
GHLabel e = r.getLabel("enhancement");
- assertEquals("enhancement", e.getName());
- assertNotNull(e.getUrl());
- assertTrue(Pattern.matches("[0-9a-fA-F]{6}", e.getColor()));
+ assertEquals("enhancement", e.name());
+ assertNotNull(e.url());
+ assertTrue(Pattern.matches("[0-9a-fA-F]{6}", e.color()));
GHLabel t = null;
GHLabel t2 = null;
try {// CRUD
t = r.createLabel("test", "123456");
t2 = r.getLabel("test");
- assertEquals(t.getName(), t2.getName());
- assertEquals(t.getColor(), "123456");
- assertEquals(t.getColor(), t2.getColor());
- assertEquals(t.getDescription(), "");
- assertEquals(t.getDescription(), t2.getDescription());
- assertEquals(t.getUrl(), t2.getUrl());
-
- t.setColor("000000");
-
- // This is annoying behavior, but it is by design at this time.
- // Verifying so we can know when it is fixed.
- assertEquals(t.getColor(), "123456");
+ assertEquals(t.name(), t2.name());
+ assertEquals(t.color(), "123456");
+ assertEquals(t.color(), t2.color());
+ assertEquals(t.description(), "");
+ assertEquals(t.description(), t2.description());
+ assertEquals(t.url(), t2.url());
+
+ // update works on multiple changes in one call
+ t.setColor("");
+ t2 = t.update(i -> i.color("000000").description("It is dark!"));
+
+ // instances are immutable, but update returns a new updated instance.
+ assertEquals(t.color(), "123456");
+ assertEquals(t.description(), "");
+ assertEquals(t2.color(), "000000");
+ assertEquals(t2.description(), "It is dark!");
t = r.getLabel("test");
- t.setDescription("this is also a test");
+ t.update(i -> i.description("this is also a test"));
GHLabel t3 = r.getLabel("test");
- assertEquals(t3.getColor(), "000000");
- assertEquals(t3.getDescription(), "this is also a test");
+ assertEquals(t3.color(), "000000");
+ assertEquals(t3.description(), "this is also a test");
t.delete();
t = r.createLabel("test2", "123457", "this is a different test");
t2 = r.getLabel("test2");
- assertEquals(t.getName(), t2.getName());
- assertEquals(t.getColor(), "123457");
- assertEquals(t.getColor(), t2.getColor());
- assertEquals(t.getDescription(), "this is a different test");
- assertEquals(t.getDescription(), t2.getDescription());
- assertEquals(t.getUrl(), t2.getUrl());
+ assertEquals(t.name(), t2.name());
+ assertEquals(t.color(), "123457");
+ assertEquals(t.color(), t2.color());
+ assertEquals(t.description(), "this is a different test");
+ assertEquals(t.description(), t2.description());
+ assertEquals(t.url(), t2.url());
} finally {
cleanupLabel("test");
cleanupLabel("test2");
diff --git a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java
index a57251560e..1fa1ea5c57 100644
--- a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java
+++ b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java
@@ -114,7 +114,7 @@ public void issue_comment() throws Exception {
assertThat(event.getIssue().getTitle(), is("Spelling error in the README file"));
assertThat(event.getIssue().getState(), is(GHIssueState.OPEN));
assertThat(event.getIssue().getLabels().size(), is(1));
- assertThat(event.getIssue().getLabels().iterator().next().getName(), is("bug"));
+ assertThat(event.getIssue().getLabels().iterator().next().name(), is("bug"));
assertThat(event.getComment().getUser().getLogin(), is("baxterthehacker"));
assertThat(event.getComment().getBody(), is("You are totally right! I'll get this fixed right away."));
assertThat(event.getRepository().getName(), is("public-repo"));
@@ -130,7 +130,7 @@ public void issues() throws Exception {
assertThat(event.getIssue().getTitle(), is("Spelling error in the README file"));
assertThat(event.getIssue().getState(), is(GHIssueState.OPEN));
assertThat(event.getIssue().getLabels().size(), is(1));
- assertThat(event.getIssue().getLabels().iterator().next().getName(), is("bug"));
+ assertThat(event.getIssue().getLabels().iterator().next().name(), is("bug"));
assertThat(event.getRepository().getName(), is("public-repo"));
assertThat(event.getRepository().getOwner().getLogin(), is("baxterthehacker"));
assertThat(event.getSender().getLogin(), is("baxterthehacker"));
diff --git a/src/test/java/org/kohsuke/github/GHPullRequestTest.java b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
index e277de4520..9e270a91aa 100644
--- a/src/test/java/org/kohsuke/github/GHPullRequestTest.java
+++ b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
@@ -295,7 +295,7 @@ public void setLabels() throws Exception {
Collection labels = getRepository().getPullRequest(p.getNumber()).getLabels();
assertEquals(1, labels.size());
- assertEquals(label, labels.iterator().next().getName());
+ assertEquals(label, labels.iterator().next().name());
}
@Test
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-aceb5f.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-aceb5f.json
index 5a4f20a02c..96c4616d0e 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-aceb5f.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-aceb5f.json
@@ -6,7 +6,7 @@
"method": "PATCH",
"bodyPatterns": [
{
- "equalToJson": "{\"color\":\"000000\",\"name\":\"test\",\"description\":\"\"}",
+ "equalToJson": "{\"color\":\"000000\",\"name\":\"test\",\"description\":\"It is dark!\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
@@ -19,7 +19,7 @@
},
"response": {
"status": 200,
- "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"\"}",
+ "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"It is dark!\"}",
"headers": {
"Date": "Sat, 05 Oct 2019 05:21:23 GMT",
"Content-Type": "application/json; charset=utf-8",
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-0dc6e2.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-0dc6e2.json
index f0fca3ba34..951d3f11ef 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-0dc6e2.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-0dc6e2.json
@@ -12,7 +12,7 @@
},
"response": {
"status": 200,
- "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"\"}",
+ "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"It is dark!\"}",
"headers": {
"Date": "Sat, 05 Oct 2019 05:21:23 GMT",
"Content-Type": "application/json; charset=utf-8",
From b7de4359fd8ed47ecdeb8cc28378b081e7daa4e8 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Sun, 1 Mar 2020 21:12:38 -0800
Subject: [PATCH 02/16] Alternative proposal
The guts of this version are a bit ugly but they result reasonable API code without a ton of extra
code needed.
---
src/main/java/org/kohsuke/github/GHLabel.java | 168 ++++++++++++------
.../java/org/kohsuke/github/GHRepository.java | 4 +-
src/test/java/org/kohsuke/github/AppTest.java | 7 +-
3 files changed, 122 insertions(+), 57 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index b33f97851d..b93911a455 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -1,14 +1,12 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JacksonInject;
-import com.fasterxml.jackson.annotation.JsonCreator;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
-import java.util.function.Consumer;
import javax.annotation.Nonnull;
@@ -68,11 +66,11 @@ public String getDescription() {
* 6-letter hex color code, like "f29513"
* @throws IOException
* the io exception
- * @deprecated use {@link #update(Consumer)} instead
+ * @deprecated use {@link #set()} instead
*/
@Deprecated
public void setColor(String newColor) throws IOException {
- this.update(i -> i.color(newColor));
+ this.set().color(newColor);
}
/**
@@ -82,11 +80,11 @@ public void setColor(String newColor) throws IOException {
* Description of label
* @throws IOException
* the io exception
- * @deprecated use {@link #update(Consumer)} instead
+ * @deprecated use {@link #set()} instead
*/
@Deprecated
public void setDescription(String newDescription) throws IOException {
- this.update(i -> i.description(newDescription));
+ this.set().description(newDescription);
}
static Collection toNames(Collection labels) {
@@ -99,16 +97,20 @@ static Collection toNames(Collection labels) {
// NEW IMPLEMENTATION STARTS HERE
+ @JacksonInject
@Nonnull
- private final GitHub root;
+ protected final GitHub root;
@Nonnull
private final String url, name, color, description;
- private GHRepository repository;
+ protected GHRepository repository;
- @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
- private GHLabel(@Nonnull Builder builder) {
+ GHLabel() {
+ this(new GHLabelBuilder());
+ }
+
+ private GHLabel(@Nonnull GHLabelBuilder builder) {
this.root = builder.root;
this.url = builder.url;
this.name = builder.name;
@@ -122,18 +124,8 @@ private GHLabel(@Nonnull Builder builder) {
* @throws IOException
* the io exception
*/
- public static GHLabel create(GHRepository repository, Consumer initializer) throws IOException {
- Builder builder = new Builder();
- initializer.accept(builder);
- return repository.root.createRequest()
- .withUrlPath(repository.getApiTailUrl("labels"))
- .method("POST")
- .with("name", builder.name)
- .with("color", builder.color)
- .with("description", builder.description)
- .fetch(GHLabel.class)
- .lateBind(repository);
-
+ public static Creator create(GHRepository repository) throws IOException {
+ return new Creator(repository);
}
/**
@@ -212,18 +204,18 @@ GHLabel lateBind(GHRepository repo) {
* @throws IOException
* the io exception
*/
- public GHLabel update(Consumer updater) throws IOException {
- Builder builder = new Builder(this);
- updater.accept(builder);
+ public BatchUpdater update() throws IOException {
+ return new BatchUpdater(this);
+ }
- return repository.root.createRequest()
- .method("PATCH")
- .with("name", builder.name)
- .with("color", builder.color)
- .with("description", builder.description)
- .setRawUrlPath(url)
- .fetch(GHLabel.class)
- .lateBind(repository);
+ /**
+ * Modifies a label in a repository.
+ *
+ * @throws IOException
+ * the io exception
+ */
+ public SingleUpdater set() throws IOException {
+ return new SingleUpdater(this);
}
/**
@@ -253,41 +245,115 @@ public int hashCode() {
return Objects.hash(url, name, color, repository);
}
- public static class Builder {
+ public static class SingleUpdater extends Builder {
+ private SingleUpdater(GHLabel base) throws IOException {
+ super(base, true);
+ requester.method("PATCH").setRawUrlPath(base.url());
+ }
+ }
+
+ public static class BatchUpdater extends Builder {
+ private BatchUpdater(GHLabel base) throws IOException {
+ super(base, false);
+ requester.method("PATCH").setRawUrlPath(base.url());
+ }
+ }
+
+ public static class Creator extends Builder {
+ private Creator(GHRepository repository) throws IOException {
+ super(repository);
+ requester.method("POST").withUrlPath(repository.getApiTailUrl("labels"));
+ }
+ }
+
+ public static class GHLabelBuilder {
private String url, name, color, description;
@JacksonInject
private GitHub root;
- public Builder() {
+ public GHLabelBuilder() {
+ root = null;
url = "";
name = "";
color = "";
description = "";
}
+ }
+
+ public static class Builder extends BaseBuilder {
+
+ final GHRepository repository;
+
+ public Builder(GHLabel label, boolean immediate) throws IOException {
+ super(label.root, GHLabel.class, label, immediate);
+ repository = label.repository;
+ }
+
+ public Builder(GHRepository repository) throws IOException {
+ super(repository.root, GHLabel.class, new GHLabel(new GHLabelBuilder()), false);
+ this.repository = repository;
+ }
+
+ public U name(String value) throws IOException {
+ return with("name", value);
+ }
+
+ public U color(String value) throws IOException {
+ return with("color", value);
+ }
- public Builder(GHLabel label) {
- this.root = label.root;
- // Url is maintained on the mutator but cannot be changed locally.
- url = label.url();
- name = label.name();
- color = label.color();
- description = label.description();
+ public U description(String value) throws IOException {
+ return with("description", value);
}
- public Builder name(String value) {
- name = value;
- return this;
+ @Override
+ protected void initialize(GHLabel base) throws IOException {
+ // Set initial values
+ name(base.name());
+ color(base.color());
+ description(base.description());
}
- public Builder color(String value) {
- color = value;
- return this;
+ @Override
+ public GHLabel done() throws IOException {
+ return requester.fetch(returnType).lateBind(repository);
}
+ }
+
+ /**
+ *
+ * @param
+ * @param
+ */
+ public abstract static class BaseBuilder {
+
+ private final boolean initialized;
+ private final boolean immediate;
+ protected final Class returnType;
+ protected final Requester requester;
+
+ protected BaseBuilder(GitHub root, Class returnType, T base, boolean immediate) throws IOException {
+ this.requester = root.createRequest();
+ this.immediate = immediate;
+ this.returnType = returnType;
+ initialize(base);
+ this.initialized = true;
+ }
+
+ public abstract T done() throws IOException;
+
+ protected abstract void initialize(T base) throws IOException;
- public Builder description(String value) {
- description = value;
- return this;
+ protected U with(String name, Object value) throws IOException {
+ requester.with(name, value);
+ if (initialized) {
+ if (immediate) {
+ return (U) done();
+ }
+ return (U) this;
+ }
+ return null;
}
}
}
diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java
index 4ab12c4bda..36f0734fd1 100644
--- a/src/main/java/org/kohsuke/github/GHRepository.java
+++ b/src/main/java/org/kohsuke/github/GHRepository.java
@@ -1900,7 +1900,7 @@ public GHLabel getLabel(String name) throws IOException {
* the io exception
*/
public GHLabel createLabel(String name, String color) throws IOException {
- return GHLabel.create(this, l -> l.name(name).color(color));
+ return GHLabel.create(this).name(name).color(color).done();
}
/**
@@ -1917,7 +1917,7 @@ public GHLabel createLabel(String name, String color) throws IOException {
* the io exception
*/
public GHLabel createLabel(String name, String color, String description) throws IOException {
- return GHLabel.create(this, l -> l.name(name).color(color).description(description));
+ return GHLabel.create(this).name(name).color(color).description(description).done();
}
/**
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index b70157289c..f91de42ab6 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -814,8 +814,8 @@ public void testRepoLabel() throws IOException {
assertEquals(t.url(), t2.url());
// update works on multiple changes in one call
- t.setColor("");
- t2 = t.update(i -> i.color("000000").description("It is dark!"));
+ // t.setColor("");
+ t2 = t.update().color("000000").description("It is dark!").done();
// instances are immutable, but update returns a new updated instance.
assertEquals(t.color(), "123456");
@@ -824,9 +824,8 @@ public void testRepoLabel() throws IOException {
assertEquals(t2.description(), "It is dark!");
t = r.getLabel("test");
- t.update(i -> i.description("this is also a test"));
+ GHLabel t3 = t.set().description("this is also a test");
- GHLabel t3 = r.getLabel("test");
assertEquals(t3.color(), "000000");
assertEquals(t3.description(), "this is also a test");
t.delete();
From 0cb237151777ce8aaa10838a959cdbadc2cbcd84 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Sun, 1 Mar 2020 23:21:08 -0800
Subject: [PATCH 03/16] Third alternative proposal
This removes the from the fields. Functionally the behavior is unchanged but
it is no longer guaranteed at compile time. This simplifies streamlines the code slightly,
but at the cost of only being able to assert immutability rather than know it.
However, as we move to using this structure through more of the library, this is may be a better choice.
There are so many places where the GitHub API itself returns partial records or updates them dynamically.
Trying to claim immutability where it doesn't exist is not great either.
---
src/main/java/org/kohsuke/github/GHLabel.java | 38 +++++--------------
1 file changed, 9 insertions(+), 29 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index b93911a455..ecef433844 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -97,25 +97,20 @@ static Collection toNames(Collection labels) {
// NEW IMPLEMENTATION STARTS HERE
- @JacksonInject
@Nonnull
- protected final GitHub root;
+ private String url, name, color, description;
- @Nonnull
- private final String url, name, color, description;
+ @JacksonInject
+ protected GitHub root;
+ // Late bind
protected GHRepository repository;
GHLabel() {
- this(new GHLabelBuilder());
- }
-
- private GHLabel(@Nonnull GHLabelBuilder builder) {
- this.root = builder.root;
- this.url = builder.url;
- this.name = builder.name;
- this.color = builder.color;
- this.description = builder.description;
+ url = "";
+ name = "";
+ color = "";
+ description = "";
}
/**
@@ -266,21 +261,6 @@ private Creator(GHRepository repository) throws IOException {
}
}
- public static class GHLabelBuilder {
- private String url, name, color, description;
-
- @JacksonInject
- private GitHub root;
-
- public GHLabelBuilder() {
- root = null;
- url = "";
- name = "";
- color = "";
- description = "";
- }
- }
-
public static class Builder extends BaseBuilder {
final GHRepository repository;
@@ -291,7 +271,7 @@ public Builder(GHLabel label, boolean immediate) throws IOException {
}
public Builder(GHRepository repository) throws IOException {
- super(repository.root, GHLabel.class, new GHLabel(new GHLabelBuilder()), false);
+ super(repository.root, GHLabel.class, new GHLabel(), false);
this.repository = repository;
}
From 134222fd692f3b1f731b2f42d08ea1fc71354986 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Mon, 2 Mar 2020 00:41:47 -0800
Subject: [PATCH 04/16] Minor cleanups
---
src/main/java/org/kohsuke/github/GHLabel.java | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index ecef433844..39ff979fb3 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -26,7 +26,7 @@ public class GHLabel {
*/
@Deprecated
public String getUrl() {
- return this.url();
+ return url();
}
/**
@@ -36,7 +36,7 @@ public String getUrl() {
*/
@Deprecated
public String getName() {
- return this.name();
+ return name();
}
/**
@@ -46,7 +46,7 @@ public String getName() {
*/
@Deprecated
public String getColor() {
- return this.color();
+ return color();
}
/**
@@ -56,7 +56,7 @@ public String getColor() {
*/
@Deprecated
public String getDescription() {
- return this.description();
+ return description();
}
/**
@@ -70,7 +70,7 @@ public String getDescription() {
*/
@Deprecated
public void setColor(String newColor) throws IOException {
- this.set().color(newColor);
+ set().color(newColor);
}
/**
@@ -84,7 +84,7 @@ public void setColor(String newColor) throws IOException {
*/
@Deprecated
public void setDescription(String newDescription) throws IOException {
- this.set().description(newDescription);
+ set().description(newDescription);
}
static Collection toNames(Collection labels) {
@@ -156,7 +156,7 @@ public static PagedIterable readAll(@Nonnull final GHRepository reposit
* @return the url
*/
public String url() {
- return this.url;
+ return url;
}
/**
@@ -165,7 +165,7 @@ public String url() {
* @return the name
*/
public String name() {
- return this.name;
+ return name;
}
/**
@@ -174,7 +174,7 @@ public String name() {
* @return the color
*/
public String color() {
- return this.color;
+ return color;
}
/**
@@ -183,12 +183,12 @@ public String color() {
* @return the description
*/
public String description() {
- return this.description;
+ return description;
}
GHLabel lateBind(GHRepository repo) {
if (repository == null) {
- this.repository = repo;
+ repository = repo;
}
return this;
}
From 98ef2cc640022464759bffa90971ff16dff9eb16 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Mon, 2 Mar 2020 01:43:09 -0800
Subject: [PATCH 05/16] Update-in-place and safer single or batch calculation
---
src/main/java/org/kohsuke/github/GHLabel.java | 86 +++++++++++++++----
1 file changed, 71 insertions(+), 15 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 39ff979fb3..1aa2617617 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -8,6 +8,7 @@
import java.util.List;
import java.util.Objects;
+import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
@@ -241,22 +242,22 @@ public int hashCode() {
}
public static class SingleUpdater extends Builder {
- private SingleUpdater(GHLabel base) throws IOException {
- super(base, true);
+ private SingleUpdater(@Nonnull GHLabel base) throws IOException {
+ super(GHLabel.class, base);
requester.method("PATCH").setRawUrlPath(base.url());
}
}
public static class BatchUpdater extends Builder {
- private BatchUpdater(GHLabel base) throws IOException {
- super(base, false);
+ private BatchUpdater(@Nonnull GHLabel base) throws IOException {
+ super(BatchUpdater.class, base);
requester.method("PATCH").setRawUrlPath(base.url());
}
}
public static class Creator extends Builder {
- private Creator(GHRepository repository) throws IOException {
- super(repository);
+ private Creator(@Nonnull GHRepository repository) throws IOException {
+ super(Creator.class, repository);
requester.method("POST").withUrlPath(repository.getApiTailUrl("labels"));
}
}
@@ -265,13 +266,13 @@ public static class Builder extends BaseBuilder {
final GHRepository repository;
- public Builder(GHLabel label, boolean immediate) throws IOException {
- super(label.root, GHLabel.class, label, immediate);
+ public Builder(@Nonnull Class builderType, @Nonnull GHLabel label) throws IOException {
+ super(label.root, builderType, GHLabel.class, label);
repository = label.repository;
}
- public Builder(GHRepository repository) throws IOException {
- super(repository.root, GHLabel.class, new GHLabel(), false);
+ public Builder(@Nonnull Class builderType, @Nonnull GHRepository repository) throws IOException {
+ super(repository.root, builderType, GHLabel.class, new GHLabel());
this.repository = repository;
}
@@ -297,7 +298,7 @@ protected void initialize(GHLabel base) throws IOException {
@Override
public GHLabel done() throws IOException {
- return requester.fetch(returnType).lateBind(repository);
+ return super.done().lateBind(repository);
}
}
@@ -310,21 +311,76 @@ public abstract static class BaseBuilder {
private final boolean initialized;
private final boolean immediate;
+
+ // TODO: Not sure how update-in-place behavior should be controlled, but
+ // it certainly can be controlled dynamically down to the instance level or inherited for all children of some
+ // connection.
+ protected boolean updateInPlace;
protected final Class returnType;
protected final Requester requester;
- protected BaseBuilder(GitHub root, Class returnType, T base, boolean immediate) throws IOException {
+ @CheckForNull
+ protected final T baseInstance;
+
+ protected BaseBuilder(@Nonnull GitHub root,
+ @Nonnull Class builderType,
+ @Nonnull Class returnType,
+ @CheckForNull T baseInstance) throws IOException {
this.requester = root.createRequest();
- this.immediate = immediate;
+ this.immediate = returnType.equals(builderType);
this.returnType = returnType;
- initialize(base);
+ this.baseInstance = baseInstance;
+ this.updateInPlace = false;
+ if (baseInstance != null) {
+ initialize(baseInstance);
+ }
this.initialized = true;
}
- public abstract T done() throws IOException;
+ /**
+ * Finishes an update, committing changes.
+ *
+ * This method may update-in-place or not. Either way it returns the resulting instance.
+ *
+ * @return an instance with updated current data
+ * @throws IOException
+ * if there is an I/O Exception
+ */
+ public T done() throws IOException {
+ T result;
+ if (updateInPlace && baseInstance != null) {
+ result = requester.fetchInto(baseInstance);
+ } else {
+ result = requester.fetch(returnType);
+ }
+ return result;
+ };
protected abstract void initialize(T base) throws IOException;
+ /**
+ * Applies a value to a name for this builder.
+ *
+ * The internals of this method look terrifying, but they they're actually basically safe due to previous
+ * comparison of U and T determined by comparing class instances passed in during construction.
+ *
+ * If U is the same as T, this cause the builder to commit changes after the first value change and return a T
+ * from done().
+ *
+ * If U is not the same as T, the builder will batch together multiple changes and let the user call done() when
+ * they are ready.
+ *
+ * This little bit of roughness in this base class means all inheriting builders get to create BatchUpdater and
+ * SingleUpdater classes from almost identical code. Creator can be implemented with significant code reuse as
+ * well.
+ *
+ * There is probably a cleaner way to implement this, but I'm not sure what it is right now.
+ *
+ * @param name
+ * @param value
+ * @return
+ * @throws IOException
+ */
protected U with(String name, Object value) throws IOException {
requester.with(name, value);
if (initialized) {
From f37e4bd76e4378b5f7e905813e0195bf2dea0393 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Mon, 2 Mar 2020 01:47:00 -0800
Subject: [PATCH 06/16] Private fields
---
src/main/java/org/kohsuke/github/GHLabel.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 1aa2617617..ba2ac26647 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -102,10 +102,10 @@ static Collection toNames(Collection labels) {
private String url, name, color, description;
@JacksonInject
- protected GitHub root;
+ private GitHub root;
// Late bind
- protected GHRepository repository;
+ private GHRepository repository;
GHLabel() {
url = "";
From 64a82f478542ed641d585403c304cd9b1b88e63d Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Mon, 2 Mar 2020 11:26:27 -0800
Subject: [PATCH 07/16] Clean up proposed API changes
---
.../org/kohsuke/github/AbstractBuilder.java | 106 +++++++++
src/main/java/org/kohsuke/github/GHLabel.java | 204 +++++-------------
.../org/kohsuke/github/GHLabelBuilder.java | 77 +++++++
3 files changed, 234 insertions(+), 153 deletions(-)
create mode 100644 src/main/java/org/kohsuke/github/AbstractBuilder.java
create mode 100644 src/main/java/org/kohsuke/github/GHLabelBuilder.java
diff --git a/src/main/java/org/kohsuke/github/AbstractBuilder.java b/src/main/java/org/kohsuke/github/AbstractBuilder.java
new file mode 100644
index 0000000000..b55a32af1f
--- /dev/null
+++ b/src/main/java/org/kohsuke/github/AbstractBuilder.java
@@ -0,0 +1,106 @@
+package org.kohsuke.github;
+
+import java.io.IOException;
+
+import javax.annotation.CheckForNull;
+import javax.annotation.Nonnull;
+
+/**
+ *
+ * @param
+ * Final return type for built by this builder returned when {@link #done()}} is called.
+ * @param
+ * Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S}
+ * the same as {@link R}, this builder will commit changes after each call to {@link #with(String, Object)}.
+ */
+abstract class AbstractBuilder {
+
+ // TODO: Not sure how update-in-place behavior should be controlled, but
+ // it certainly can be controlled dynamically down to the instance level or inherited for all children of some
+ // connection.
+ protected boolean updateInPlace;
+ private final Class returnType;
+ private final Class intermediateReturnType;
+ protected final Requester requester;
+
+ @CheckForNull
+ private final R baseInstance;
+
+ /**
+ * Creates a builder.
+ *
+ * @param root
+ * the GitHub instance to connect to.
+ * @param intermediateReturnType
+ * the intermediate return type returned by calls to {@link #with(String, Object)}.
+ * @param builtReturnType
+ * the final return type for built by this builder returned when {@link #done()}} is called.
+ * @param baseInstance
+ * optional instance on which to base this builder.
+ */
+ protected AbstractBuilder(@Nonnull GitHub root,
+ @Nonnull Class intermediateReturnType,
+ @Nonnull Class builtReturnType,
+ @CheckForNull R baseInstance) {
+ this.requester = root.createRequest();
+ this.returnType = builtReturnType;
+ this.intermediateReturnType = intermediateReturnType;
+ this.baseInstance = baseInstance;
+ this.updateInPlace = false;
+ }
+
+ /**
+ * Finishes an update, committing changes.
+ *
+ * This method may update-in-place or not. Either way it returns the resulting instance.
+ *
+ * @return an instance with updated current data
+ * @throws IOException
+ * if there is an I/O Exception
+ */
+ @Nonnull
+ public R done() throws IOException {
+ R result;
+ if (updateInPlace && baseInstance != null) {
+ result = requester.fetchInto(baseInstance);
+ } else {
+ result = requester.fetch(returnType);
+ }
+ return result;
+ }
+
+ /**
+ * Applies a value to a name for this builder.
+ *
+ * The internals of this method look terrifying, but they they're actually basically safe due to previous comparison
+ * of U and T determined by comparing class instances passed in during construction.
+ *
+ * If U is the same as T, this cause the builder to commit changes after the first value change and return a T from
+ * done().
+ *
+ * If U is not the same as T, the builder will batch together multiple changes and let the user call done() when
+ * they are ready.
+ *
+ * This little bit of roughness in this base class means all inheriting builders get to create Updater and Setter
+ * classes from almost identical code. Creator can be implemented with significant code reuse as well.
+ *
+ * There is probably a cleaner way to implement this, but I'm not sure what it is right now.
+ *
+ * @param name
+ * the name of the field
+ * @param value
+ * the value of the field
+ * @return either a continuing builder or an updated data record
+ * @throws IOException
+ * if an I/O error occurs
+ */
+ @Nonnull
+ protected S with(@Nonnull String name, Object value) throws IOException {
+ requester.with(name, value);
+ if (returnType.equals(intermediateReturnType)) {
+ return intermediateReturnType.cast(done());
+ } else {
+ return intermediateReturnType.cast(this);
+ }
+ }
+}
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index ba2ac26647..16bbeb42ae 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -8,7 +8,6 @@
import java.util.List;
import java.util.Objects;
-import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
@@ -115,8 +114,13 @@ static Collection toNames(Collection labels) {
}
/**
- * Creates a label in a repository.
+ * Begins the creation of a new instance.
*
+ * Consumer must call {@link Creator#done()} to commit changes.
+ *
+ * @param repository
+ * the repository in which the label will be created.
+ * @return a {@link Creator}
* @throws IOException
* the io exception
*/
@@ -125,8 +129,13 @@ public static Creator create(GHRepository repository) throws IOException {
}
/**
- * Creates a label in a repository.
+ * Reads a label from a repository.
*
+ * @param repository
+ * the repository to read from
+ * @param name
+ * the name of the label
+ * @return a label
* @throws IOException
* the io exception
*/
@@ -139,8 +148,11 @@ public static GHLabel read(@Nonnull GHRepository repository, @Nonnull String nam
}
/**
- * Creates a label in a repository.
+ * Reads all labels from a repository.
*
+ * @param repository
+ * the repository to read from
+ * @return iterable of all labels
* @throws IOException
* the io exception
*/
@@ -187,6 +199,7 @@ public String description() {
return description;
}
+ @Nonnull
GHLabel lateBind(GHRepository repo) {
if (repository == null) {
repository = repo;
@@ -195,23 +208,23 @@ GHLabel lateBind(GHRepository repo) {
}
/**
- * Modifies a label in a repository.
+ * Begins a batch update
*
- * @throws IOException
- * the io exception
+ * Consumer must call {@link Updater#done()} to commit changes.
+ *
+ * @return a {@link Updater}
*/
- public BatchUpdater update() throws IOException {
- return new BatchUpdater(this);
+ public Updater update() {
+ return new Updater(this);
}
/**
- * Modifies a label in a repository.
- *
- * @throws IOException
- * the io exception
+ * Begins a single property update.
+ *
+ * @return a {@link Setter}
*/
- public SingleUpdater set() throws IOException {
- return new SingleUpdater(this);
+ public Setter set() {
+ return new Setter(this);
}
/**
@@ -241,155 +254,40 @@ public int hashCode() {
return Objects.hash(url, name, color, repository);
}
- public static class SingleUpdater extends Builder {
- private SingleUpdater(@Nonnull GHLabel base) throws IOException {
- super(GHLabel.class, base);
+ /**
+ * A {@link GHLabelBuilder} that updates a single property per request
+ *
+ * {@link #done()} is called automatically after the property is set.
+ */
+ public static class Setter extends GHLabelBuilder {
+ private Setter(@Nonnull GHLabel base) {
+ super(GHLabel.class, base.repository, base);
requester.method("PATCH").setRawUrlPath(base.url());
}
}
- public static class BatchUpdater extends Builder {
- private BatchUpdater(@Nonnull GHLabel base) throws IOException {
- super(BatchUpdater.class, base);
+ /**
+ * A {@link GHLabelBuilder} that allows multiple properties to be updated per request.
+ *
+ * Consumer must call {@link #done()} to commit changes.
+ */
+ public static class Updater extends GHLabelBuilder {
+ private Updater(@Nonnull GHLabel base) {
+ super(Updater.class, base.repository, base);
requester.method("PATCH").setRawUrlPath(base.url());
}
}
- public static class Creator extends Builder {
- private Creator(@Nonnull GHRepository repository) throws IOException {
- super(Creator.class, repository);
- requester.method("POST").withUrlPath(repository.getApiTailUrl("labels"));
- }
- }
-
- public static class Builder extends BaseBuilder {
-
- final GHRepository repository;
-
- public Builder(@Nonnull Class builderType, @Nonnull GHLabel label) throws IOException {
- super(label.root, builderType, GHLabel.class, label);
- repository = label.repository;
- }
-
- public Builder(@Nonnull Class builderType, @Nonnull GHRepository repository) throws IOException {
- super(repository.root, builderType, GHLabel.class, new GHLabel());
- this.repository = repository;
- }
-
- public U name(String value) throws IOException {
- return with("name", value);
- }
-
- public U color(String value) throws IOException {
- return with("color", value);
- }
-
- public U description(String value) throws IOException {
- return with("description", value);
- }
-
- @Override
- protected void initialize(GHLabel base) throws IOException {
- // Set initial values
- name(base.name());
- color(base.color());
- description(base.description());
- }
-
- @Override
- public GHLabel done() throws IOException {
- return super.done().lateBind(repository);
- }
- }
-
/**
+ * A {@link GHLabelBuilder} that creates a new {@link GHLabel}
*
- * @param
- * @param
+ * Consumer must call {@link #done()} to create the new instance.
*/
- public abstract static class BaseBuilder {
-
- private final boolean initialized;
- private final boolean immediate;
-
- // TODO: Not sure how update-in-place behavior should be controlled, but
- // it certainly can be controlled dynamically down to the instance level or inherited for all children of some
- // connection.
- protected boolean updateInPlace;
- protected final Class returnType;
- protected final Requester requester;
-
- @CheckForNull
- protected final T baseInstance;
-
- protected BaseBuilder(@Nonnull GitHub root,
- @Nonnull Class builderType,
- @Nonnull Class returnType,
- @CheckForNull T baseInstance) throws IOException {
- this.requester = root.createRequest();
- this.immediate = returnType.equals(builderType);
- this.returnType = returnType;
- this.baseInstance = baseInstance;
- this.updateInPlace = false;
- if (baseInstance != null) {
- initialize(baseInstance);
- }
- this.initialized = true;
- }
-
- /**
- * Finishes an update, committing changes.
- *
- * This method may update-in-place or not. Either way it returns the resulting instance.
- *
- * @return an instance with updated current data
- * @throws IOException
- * if there is an I/O Exception
- */
- public T done() throws IOException {
- T result;
- if (updateInPlace && baseInstance != null) {
- result = requester.fetchInto(baseInstance);
- } else {
- result = requester.fetch(returnType);
- }
- return result;
- };
-
- protected abstract void initialize(T base) throws IOException;
-
- /**
- * Applies a value to a name for this builder.
- *
- * The internals of this method look terrifying, but they they're actually basically safe due to previous
- * comparison of U and T determined by comparing class instances passed in during construction.
- *
- * If U is the same as T, this cause the builder to commit changes after the first value change and return a T
- * from done().
- *
- * If U is not the same as T, the builder will batch together multiple changes and let the user call done() when
- * they are ready.
- *
- * This little bit of roughness in this base class means all inheriting builders get to create BatchUpdater and
- * SingleUpdater classes from almost identical code. Creator can be implemented with significant code reuse as
- * well.
- *
- * There is probably a cleaner way to implement this, but I'm not sure what it is right now.
- *
- * @param name
- * @param value
- * @return
- * @throws IOException
- */
- protected U with(String name, Object value) throws IOException {
- requester.with(name, value);
- if (initialized) {
- if (immediate) {
- return (U) done();
- }
- return (U) this;
- }
- return null;
+ public static class Creator extends GHLabelBuilder {
+ private Creator(@Nonnull GHRepository repository) {
+ super(Creator.class, repository);
+ requester.method("POST").withUrlPath(repository.getApiTailUrl("labels"));
}
}
+
}
diff --git a/src/main/java/org/kohsuke/github/GHLabelBuilder.java b/src/main/java/org/kohsuke/github/GHLabelBuilder.java
new file mode 100644
index 0000000000..d139a33b21
--- /dev/null
+++ b/src/main/java/org/kohsuke/github/GHLabelBuilder.java
@@ -0,0 +1,77 @@
+package org.kohsuke.github;
+
+import java.io.IOException;
+
+import javax.annotation.Nonnull;
+
+/**
+ *
+ * @param
+ * Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S}
+ * the same as {@link GHLabel}, this builder will commit changes after each call to
+ * {@link #with(String, Object)}.
+ */
+class GHLabelBuilder extends AbstractBuilder {
+
+ @Nonnull
+ final GHRepository repository;
+
+ /**
+ *
+ * @param intermediateReturnType
+ * Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If
+ * {@link S} the same as {@link GHLabel}, this builder will commit changes after each call to
+ * {@link #with(String, Object)}.
+ * @param repository
+ * the repository for which the changes will be built.
+ */
+ GHLabelBuilder(@Nonnull Class intermediateReturnType, @Nonnull GHRepository repository) {
+ this(intermediateReturnType, repository, new GHLabel());
+ }
+
+ /**
+ *
+ * @param intermediateReturnType
+ * Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If
+ * {@link S} the same as {@link GHLabel}, this builder will commit changes after each call to
+ * {@link #with(String, Object)}.
+ * @param repository
+ * the repository for which the changes will be built.
+ * @param baseInstance
+ * instance on which to base this builder.
+ */
+ GHLabelBuilder(@Nonnull Class intermediateReturnType,
+ @Nonnull GHRepository repository,
+ @Nonnull GHLabel baseInstance) {
+ super(repository.root, intermediateReturnType, GHLabel.class, baseInstance);
+ this.repository = repository;
+
+ requester.with("name", baseInstance.name());
+ requester.with("color", baseInstance.color());
+ requester.with("description", baseInstance.description());
+ }
+
+ @Nonnull
+ public S name(String value) throws IOException {
+ return with("name", value);
+ }
+
+ @Nonnull
+ public S color(String value) throws IOException {
+ return with("color", value);
+ }
+
+ @Nonnull
+ public S description(String value) throws IOException {
+ return with("description", value);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ @Nonnull
+ public GHLabel done() throws IOException {
+ return super.done().lateBind(repository);
+ }
+}
From 9f1d7323c7f14b670d6881ca2a1dede9f9718e14 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Mon, 2 Mar 2020 14:22:20 -0800
Subject: [PATCH 08/16] Reverted getter changes to highlight the more important
set/update changes
---
src/main/java/org/kohsuke/github/GHIssue.java | 6 +-
src/main/java/org/kohsuke/github/GHLabel.java | 94 ++++++-------------
.../org/kohsuke/github/GHLabelBuilder.java | 6 +-
src/test/java/org/kohsuke/github/AppTest.java | 42 ++++-----
.../kohsuke/github/GHEventPayloadTest.java | 4 +-
.../org/kohsuke/github/GHPullRequestTest.java | 2 +-
6 files changed, 58 insertions(+), 96 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java
index c8cc79324a..30cfd89b6f 100644
--- a/src/main/java/org/kohsuke/github/GHIssue.java
+++ b/src/main/java/org/kohsuke/github/GHIssue.java
@@ -352,7 +352,7 @@ private void _addLabels(Collection names) throws IOException {
List newLabels = new ArrayList();
for (GHLabel label : getLabels()) {
- newLabels.add(label.name());
+ newLabels.add(label.getName());
}
for (String name : names) {
if (!newLabels.contains(name)) {
@@ -403,8 +403,8 @@ private void _removeLabels(Collection names) throws IOException {
List newLabels = new ArrayList();
for (GHLabel l : getLabels()) {
- if (!names.contains(l.name())) {
- newLabels.add(l.name());
+ if (!names.contains(l.getName())) {
+ newLabels.add(l.getName());
}
}
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 16bbeb42ae..c0d3cf2697 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -19,14 +19,30 @@
*/
public class GHLabel {
+ @Nonnull
+ private String url, name, color, description;
+
+ @JacksonInject
+ private GitHub root;
+
+ // Late bind
+ private GHRepository repository;
+
+ GHLabel() {
+ url = "";
+ name = "";
+ color = "";
+ description = "";
+ }
+
/**
* Gets url.
*
* @return the url
*/
- @Deprecated
+ @Nonnull
public String getUrl() {
- return url();
+ return url;
}
/**
@@ -34,9 +50,9 @@ public String getUrl() {
*
* @return the name
*/
- @Deprecated
+ @Nonnull
public String getName() {
- return name();
+ return name;
}
/**
@@ -44,9 +60,9 @@ public String getName() {
*
* @return the color
*/
- @Deprecated
+ @Nonnull
public String getColor() {
- return color();
+ return color;
}
/**
@@ -54,9 +70,9 @@ public String getColor() {
*
* @return the description
*/
- @Deprecated
+ @Nonnull
public String getDescription() {
- return description();
+ return description;
}
/**
@@ -90,29 +106,11 @@ public void setDescription(String newDescription) throws IOException {
static Collection toNames(Collection labels) {
List r = new ArrayList<>();
for (GHLabel l : labels) {
- r.add(l.name());
+ r.add(l.getName());
}
return r;
}
- // NEW IMPLEMENTATION STARTS HERE
-
- @Nonnull
- private String url, name, color, description;
-
- @JacksonInject
- private GitHub root;
-
- // Late bind
- private GHRepository repository;
-
- GHLabel() {
- url = "";
- name = "";
- color = "";
- description = "";
- }
-
/**
* Begins the creation of a new instance.
*
@@ -163,42 +161,6 @@ public static PagedIterable readAll(@Nonnull final GHRepository reposit
}
- /**
- * Gets url.
- *
- * @return the url
- */
- public String url() {
- return url;
- }
-
- /**
- * Gets name.
- *
- * @return the name
- */
- public String name() {
- return name;
- }
-
- /**
- * Color code without leading '#', such as 'f29513'
- *
- * @return the color
- */
- public String color() {
- return color;
- }
-
- /**
- * Purpose of Label
- *
- * @return the description
- */
- public String description() {
- return description;
- }
-
@Nonnull
GHLabel lateBind(GHRepository repo) {
if (repository == null) {
@@ -235,7 +197,7 @@ public Setter set() {
* the io exception
*/
public void delete() throws IOException {
- root.createRequest().method("DELETE").setRawUrlPath(url()).send();
+ root.createRequest().method("DELETE").setRawUrlPath(getUrl()).send();
}
@Override
@@ -262,7 +224,7 @@ public int hashCode() {
public static class Setter extends GHLabelBuilder {
private Setter(@Nonnull GHLabel base) {
super(GHLabel.class, base.repository, base);
- requester.method("PATCH").setRawUrlPath(base.url());
+ requester.method("PATCH").setRawUrlPath(base.getUrl());
}
}
@@ -274,7 +236,7 @@ private Setter(@Nonnull GHLabel base) {
public static class Updater extends GHLabelBuilder {
private Updater(@Nonnull GHLabel base) {
super(Updater.class, base.repository, base);
- requester.method("PATCH").setRawUrlPath(base.url());
+ requester.method("PATCH").setRawUrlPath(base.getUrl());
}
}
diff --git a/src/main/java/org/kohsuke/github/GHLabelBuilder.java b/src/main/java/org/kohsuke/github/GHLabelBuilder.java
index d139a33b21..8fec3d0672 100644
--- a/src/main/java/org/kohsuke/github/GHLabelBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHLabelBuilder.java
@@ -46,9 +46,9 @@ class GHLabelBuilder extends AbstractBuilder {
super(repository.root, intermediateReturnType, GHLabel.class, baseInstance);
this.repository = repository;
- requester.with("name", baseInstance.name());
- requester.with("color", baseInstance.color());
- requester.with("description", baseInstance.description());
+ requester.with("name", baseInstance.getName());
+ requester.with("color", baseInstance.getColor());
+ requester.with("description", baseInstance.getDescription());
}
@Nonnull
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index f91de42ab6..dfe9828a10 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -797,47 +797,47 @@ public void testRepoLabel() throws IOException {
}
assertTrue(lst.size() > 5);
GHLabel e = r.getLabel("enhancement");
- assertEquals("enhancement", e.name());
- assertNotNull(e.url());
- assertTrue(Pattern.matches("[0-9a-fA-F]{6}", e.color()));
+ assertEquals("enhancement", e.getName());
+ assertNotNull(e.getUrl());
+ assertTrue(Pattern.matches("[0-9a-fA-F]{6}", e.getColor()));
GHLabel t = null;
GHLabel t2 = null;
try {// CRUD
t = r.createLabel("test", "123456");
t2 = r.getLabel("test");
- assertEquals(t.name(), t2.name());
- assertEquals(t.color(), "123456");
- assertEquals(t.color(), t2.color());
- assertEquals(t.description(), "");
- assertEquals(t.description(), t2.description());
- assertEquals(t.url(), t2.url());
+ assertEquals(t.getName(), t2.getName());
+ assertEquals(t.getColor(), "123456");
+ assertEquals(t.getColor(), t2.getColor());
+ assertEquals(t.getDescription(), "");
+ assertEquals(t.getDescription(), t2.getDescription());
+ assertEquals(t.getUrl(), t2.getUrl());
// update works on multiple changes in one call
// t.setColor("");
t2 = t.update().color("000000").description("It is dark!").done();
// instances are immutable, but update returns a new updated instance.
- assertEquals(t.color(), "123456");
- assertEquals(t.description(), "");
- assertEquals(t2.color(), "000000");
- assertEquals(t2.description(), "It is dark!");
+ assertEquals(t.getColor(), "123456");
+ assertEquals(t.getDescription(), "");
+ assertEquals(t2.getColor(), "000000");
+ assertEquals(t2.getDescription(), "It is dark!");
t = r.getLabel("test");
GHLabel t3 = t.set().description("this is also a test");
- assertEquals(t3.color(), "000000");
- assertEquals(t3.description(), "this is also a test");
+ assertEquals(t3.getColor(), "000000");
+ assertEquals(t3.getDescription(), "this is also a test");
t.delete();
t = r.createLabel("test2", "123457", "this is a different test");
t2 = r.getLabel("test2");
- assertEquals(t.name(), t2.name());
- assertEquals(t.color(), "123457");
- assertEquals(t.color(), t2.color());
- assertEquals(t.description(), "this is a different test");
- assertEquals(t.description(), t2.description());
- assertEquals(t.url(), t2.url());
+ assertEquals(t.getName(), t2.getName());
+ assertEquals(t.getColor(), "123457");
+ assertEquals(t.getColor(), t2.getColor());
+ assertEquals(t.getDescription(), "this is a different test");
+ assertEquals(t.getDescription(), t2.getDescription());
+ assertEquals(t.getUrl(), t2.getUrl());
} finally {
cleanupLabel("test");
cleanupLabel("test2");
diff --git a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java
index 1fa1ea5c57..a57251560e 100644
--- a/src/test/java/org/kohsuke/github/GHEventPayloadTest.java
+++ b/src/test/java/org/kohsuke/github/GHEventPayloadTest.java
@@ -114,7 +114,7 @@ public void issue_comment() throws Exception {
assertThat(event.getIssue().getTitle(), is("Spelling error in the README file"));
assertThat(event.getIssue().getState(), is(GHIssueState.OPEN));
assertThat(event.getIssue().getLabels().size(), is(1));
- assertThat(event.getIssue().getLabels().iterator().next().name(), is("bug"));
+ assertThat(event.getIssue().getLabels().iterator().next().getName(), is("bug"));
assertThat(event.getComment().getUser().getLogin(), is("baxterthehacker"));
assertThat(event.getComment().getBody(), is("You are totally right! I'll get this fixed right away."));
assertThat(event.getRepository().getName(), is("public-repo"));
@@ -130,7 +130,7 @@ public void issues() throws Exception {
assertThat(event.getIssue().getTitle(), is("Spelling error in the README file"));
assertThat(event.getIssue().getState(), is(GHIssueState.OPEN));
assertThat(event.getIssue().getLabels().size(), is(1));
- assertThat(event.getIssue().getLabels().iterator().next().name(), is("bug"));
+ assertThat(event.getIssue().getLabels().iterator().next().getName(), is("bug"));
assertThat(event.getRepository().getName(), is("public-repo"));
assertThat(event.getRepository().getOwner().getLogin(), is("baxterthehacker"));
assertThat(event.getSender().getLogin(), is("baxterthehacker"));
diff --git a/src/test/java/org/kohsuke/github/GHPullRequestTest.java b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
index 9e270a91aa..e277de4520 100644
--- a/src/test/java/org/kohsuke/github/GHPullRequestTest.java
+++ b/src/test/java/org/kohsuke/github/GHPullRequestTest.java
@@ -295,7 +295,7 @@ public void setLabels() throws Exception {
Collection labels = getRepository().getPullRequest(p.getNumber()).getLabels();
assertEquals(1, labels.size());
- assertEquals(label, labels.iterator().next().name());
+ assertEquals(label, labels.iterator().next().getName());
}
@Test
From 79a1bb3571cadc74ddaf42a93a6d7f3df1c1cffc Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Mon, 2 Mar 2020 14:24:24 -0800
Subject: [PATCH 09/16] Update src/test/java/org/kohsuke/github/AppTest.java
---
src/test/java/org/kohsuke/github/AppTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index dfe9828a10..c604900747 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -817,7 +817,7 @@ public void testRepoLabel() throws IOException {
// t.setColor("");
t2 = t.update().color("000000").description("It is dark!").done();
- // instances are immutable, but update returns a new updated instance.
+ // instances behave as immutable by default. Update returns a new updated instance.
assertEquals(t.getColor(), "123456");
assertEquals(t.getDescription(), "");
assertEquals(t2.getColor(), "000000");
From 863ad0f48691a8a42a9c425c29624e11cc66c042 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Tue, 3 Mar 2020 20:33:47 -0800
Subject: [PATCH 10/16] Clarify behavior
---
.../org/kohsuke/github/AbstractBuilder.java | 82 ++++++++++++++-----
1 file changed, 61 insertions(+), 21 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/AbstractBuilder.java b/src/main/java/org/kohsuke/github/AbstractBuilder.java
index b55a32af1f..2404430cfd 100644
--- a/src/main/java/org/kohsuke/github/AbstractBuilder.java
+++ b/src/main/java/org/kohsuke/github/AbstractBuilder.java
@@ -6,6 +6,31 @@
import javax.annotation.Nonnull;
/**
+ * An abstract data object builder/updater.
+ *
+ * This class can be use to make a Builder that supports both batch and single property changes.
+ *
+ * Batching looks like this:
+ *
+ *
+ * update().someName(value).otherName(value).done()
+ *
+ *
+ *
+ * Single changee look like this:
+ *
+ *
+ * set().someName(value);
+ * set().otherName(value);
+ *
+ *
+ *
+ * If S is the same as R, {@link #with(String, Object)} will commit changes after the first value change and return a R
+ * from {@link #done()}.
+ *
+ *
+ * If S is not the same as R, {@link #with(String, Object)} will batch together multiple changes and let the user call
+ * {@link #done()} when they are ready.
*
* @param
* Final return type for built by this builder returned when {@link #done()}} is called.
@@ -15,24 +40,34 @@
*/
abstract class AbstractBuilder {
- // TODO: Not sure how update-in-place behavior should be controlled, but
- // it certainly can be controlled dynamically down to the instance level or inherited for all children of some
- // connection.
- protected boolean updateInPlace;
+ @Nonnull
private final Class returnType;
+
+ @Nonnull
private final Class intermediateReturnType;
- protected final Requester requester;
+
+ private final boolean commitChangesImmediately;
@CheckForNull
private final R baseInstance;
+ @Nonnull
+ protected final Requester requester;
+
+ // TODO: Not sure how update-in-place behavior should be controlled, but
+ // it certainly can be controlled dynamically down to the instance level or inherited for all children of some
+ // connection.
+ protected boolean updateInPlace;
+
/**
* Creates a builder.
*
* @param root
* the GitHub instance to connect to.
* @param intermediateReturnType
- * the intermediate return type returned by calls to {@link #with(String, Object)}.
+ * the intermediate return type of type {@link S} returned by calls to {@link #with(String, Object)}.
+ * Must either be equal to {@code builtReturnType} or this instance must be castable to this class. If
+ * not, the constructor will throw {@link IllegalArgumentException}.
* @param builtReturnType
* the final return type for built by this builder returned when {@link #done()}} is called.
* @param baseInstance
@@ -45,8 +80,15 @@ protected AbstractBuilder(@Nonnull GitHub root,
this.requester = root.createRequest();
this.returnType = builtReturnType;
this.intermediateReturnType = intermediateReturnType;
+ this.commitChangesImmediately = returnType.equals(intermediateReturnType);
+ if (!commitChangesImmediately && !intermediateReturnType.isInstance(this)) {
+ throw new IllegalArgumentException(
+ "Argument \"intermediateReturnType\": This instance must be castable to intermediateReturnType or intermediateReturnType must be equal to builtReturnType.");
+ }
+
this.baseInstance = baseInstance;
this.updateInPlace = false;
+
}
/**
@@ -72,19 +114,11 @@ public R done() throws IOException {
/**
* Applies a value to a name for this builder.
*
- * The internals of this method look terrifying, but they they're actually basically safe due to previous comparison
- * of U and T determined by comparing class instances passed in during construction.
- *
- * If U is the same as T, this cause the builder to commit changes after the first value change and return a T from
- * done().
- *
- * If U is not the same as T, the builder will batch together multiple changes and let the user call done() when
- * they are ready.
- *
- * This little bit of roughness in this base class means all inheriting builders get to create Updater and Setter
- * classes from almost identical code. Creator can be implemented with significant code reuse as well.
+ * If S is the same as T, this method will commit changes after the first value change and return a T from
+ * {@link #done()}.
*
- * There is probably a cleaner way to implement this, but I'm not sure what it is right now.
+ * If S is not the same as T, this method will return an {@link S} and letting the caller batch together multiple
+ * changes and call {@link #done()} when they are ready.
*
* @param name
* the name of the field
@@ -97,10 +131,16 @@ public R done() throws IOException {
@Nonnull
protected S with(@Nonnull String name, Object value) throws IOException {
requester.with(name, value);
- if (returnType.equals(intermediateReturnType)) {
- return intermediateReturnType.cast(done());
+ // This little bit of roughness in this base class means all inheriting builders get to create Updater and
+ // Setter classes from almost identical code. Creator can often be implemented with significant code reuse as
+ // well.
+ if (commitChangesImmediately) {
+ // These casts look strange and risky, but they they're actually guaranteed safe due to the return path
+ // being
+ // based on the previous comparison of class instances passed to the constructor.
+ return (S) done();
} else {
- return intermediateReturnType.cast(this);
+ return (S) this;
}
}
}
From 09ec89bc2e060d9addac48d51746d01b693211f9 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Wed, 4 Mar 2020 13:38:22 -0800
Subject: [PATCH 11/16] Remove Repository member from GHLabel
It turns out GHLabel instances do not need a reference to their repo, just to root.
---
.../org/kohsuke/github/AbstractBuilder.java | 3 +-
src/main/java/org/kohsuke/github/GHLabel.java | 26 +++--------
.../org/kohsuke/github/GHLabelBuilder.java | 45 +++++--------------
3 files changed, 20 insertions(+), 54 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/AbstractBuilder.java b/src/main/java/org/kohsuke/github/AbstractBuilder.java
index 2404430cfd..a0e4f9f9c4 100644
--- a/src/main/java/org/kohsuke/github/AbstractBuilder.java
+++ b/src/main/java/org/kohsuke/github/AbstractBuilder.java
@@ -136,8 +136,7 @@ protected S with(@Nonnull String name, Object value) throws IOException {
// well.
if (commitChangesImmediately) {
// These casts look strange and risky, but they they're actually guaranteed safe due to the return path
- // being
- // based on the previous comparison of class instances passed to the constructor.
+ // being based on the previous comparison of class instances passed to the constructor.
return (S) done();
} else {
return (S) this;
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index c0d3cf2697..f7a72252a1 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -25,9 +25,6 @@ public class GHLabel {
@JacksonInject
private GitHub root;
- // Late bind
- private GHRepository repository;
-
GHLabel() {
url = "";
name = "";
@@ -140,8 +137,7 @@ public static Creator create(GHRepository repository) throws IOException {
public static GHLabel read(@Nonnull GHRepository repository, @Nonnull String name) throws IOException {
return repository.root.createRequest()
.withUrlPath(repository.getApiTailUrl("labels"), name)
- .fetch(GHLabel.class)
- .lateBind(repository);
+ .fetch(GHLabel.class);
}
@@ -157,16 +153,8 @@ public static GHLabel read(@Nonnull GHRepository repository, @Nonnull String nam
public static PagedIterable readAll(@Nonnull final GHRepository repository) throws IOException {
return repository.root.createRequest()
.withUrlPath(repository.getApiTailUrl("labels"))
- .toIterable(GHLabel[].class, item -> item.lateBind(repository));
-
- }
+ .toIterable(GHLabel[].class, null);
- @Nonnull
- GHLabel lateBind(GHRepository repo) {
- if (repository == null) {
- repository = repo;
- }
- return this;
}
/**
@@ -208,12 +196,12 @@ public boolean equals(final Object o) {
return false;
final GHLabel ghLabel = (GHLabel) o;
return Objects.equals(url, ghLabel.url) && Objects.equals(name, ghLabel.name)
- && Objects.equals(color, ghLabel.color) && Objects.equals(repository, ghLabel.repository);
+ && Objects.equals(color, ghLabel.color) && Objects.equals(description, ghLabel.description);
}
@Override
public int hashCode() {
- return Objects.hash(url, name, color, repository);
+ return Objects.hash(url, name, color, description);
}
/**
@@ -223,7 +211,7 @@ public int hashCode() {
*/
public static class Setter extends GHLabelBuilder {
private Setter(@Nonnull GHLabel base) {
- super(GHLabel.class, base.repository, base);
+ super(GHLabel.class, base.root, base);
requester.method("PATCH").setRawUrlPath(base.getUrl());
}
}
@@ -235,7 +223,7 @@ private Setter(@Nonnull GHLabel base) {
*/
public static class Updater extends GHLabelBuilder {
private Updater(@Nonnull GHLabel base) {
- super(Updater.class, base.repository, base);
+ super(Updater.class, base.root, base);
requester.method("PATCH").setRawUrlPath(base.getUrl());
}
}
@@ -247,7 +235,7 @@ private Updater(@Nonnull GHLabel base) {
*/
public static class Creator extends GHLabelBuilder {
private Creator(@Nonnull GHRepository repository) {
- super(Creator.class, repository);
+ super(Creator.class, repository.root, null);
requester.method("POST").withUrlPath(repository.getApiTailUrl("labels"));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHLabelBuilder.java b/src/main/java/org/kohsuke/github/GHLabelBuilder.java
index 8fec3d0672..97e07ca411 100644
--- a/src/main/java/org/kohsuke/github/GHLabelBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHLabelBuilder.java
@@ -2,6 +2,7 @@
import java.io.IOException;
+import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
@@ -13,38 +14,25 @@
*/
class GHLabelBuilder extends AbstractBuilder {
- @Nonnull
- final GHRepository repository;
-
/**
*
* @param intermediateReturnType
* Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If
* {@link S} the same as {@link GHLabel}, this builder will commit changes after each call to
* {@link #with(String, Object)}.
- * @param repository
- * the repository for which the changes will be built.
- */
- GHLabelBuilder(@Nonnull Class intermediateReturnType, @Nonnull GHRepository repository) {
- this(intermediateReturnType, repository, new GHLabel());
- }
-
- /**
- *
- * @param intermediateReturnType
- * Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If
- * {@link S} the same as {@link GHLabel}, this builder will commit changes after each call to
- * {@link #with(String, Object)}.
- * @param repository
- * the repository for which the changes will be built.
+ * @param root
+ * the GitHub instance to which updates will be sent
* @param baseInstance
- * instance on which to base this builder.
+ * instance on which to base this builder. If {@code null} a new instance will be created.
*/
- GHLabelBuilder(@Nonnull Class intermediateReturnType,
- @Nonnull GHRepository repository,
- @Nonnull GHLabel baseInstance) {
- super(repository.root, intermediateReturnType, GHLabel.class, baseInstance);
- this.repository = repository;
+ protected GHLabelBuilder(@Nonnull Class intermediateReturnType,
+ @Nonnull GitHub root,
+ @CheckForNull GHLabel baseInstance) {
+ super(root, intermediateReturnType, GHLabel.class, baseInstance);
+
+ if (baseInstance == null) {
+ baseInstance = new GHLabel();
+ }
requester.with("name", baseInstance.getName());
requester.with("color", baseInstance.getColor());
@@ -65,13 +53,4 @@ public S color(String value) throws IOException {
public S description(String value) throws IOException {
return with("description", value);
}
-
- /**
- * {@inheritDoc}
- */
- @Override
- @Nonnull
- public GHLabel done() throws IOException {
- return super.done().lateBind(repository);
- }
}
From fcb8d03a0f923e594d39ffd7c9a69919612bc297 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Wed, 4 Mar 2020 13:52:53 -0800
Subject: [PATCH 12/16] Ensure that Description is part of GHLabel comparision
---
src/test/java/org/kohsuke/github/AppTest.java | 25 ++++++++++++++++---
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index c604900747..61764c9a7d 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -803,9 +803,13 @@ public void testRepoLabel() throws IOException {
GHLabel t = null;
GHLabel t2 = null;
+ GHLabel t3 = null;
try {// CRUD
t = r.createLabel("test", "123456");
t2 = r.getLabel("test");
+ assertThat(t, not(sameInstance(t2)));
+ assertThat(t, equalTo(t2));
+
assertEquals(t.getName(), t2.getName());
assertEquals(t.getColor(), "123456");
assertEquals(t.getColor(), t2.getColor());
@@ -815,23 +819,36 @@ public void testRepoLabel() throws IOException {
// update works on multiple changes in one call
// t.setColor("");
- t2 = t.update().color("000000").description("It is dark!").done();
+ t3 = t.update().color("000000").description("It is dark!").done();
// instances behave as immutable by default. Update returns a new updated instance.
+ assertThat(t, not(sameInstance(t2)));
+ assertThat(t, equalTo(t2));
+
+ assertThat(t, not(sameInstance(t3)));
+ assertThat(t, not(equalTo(t3)));
+
assertEquals(t.getColor(), "123456");
assertEquals(t.getDescription(), "");
- assertEquals(t2.getColor(), "000000");
- assertEquals(t2.getDescription(), "It is dark!");
+ assertEquals(t3.getColor(), "000000");
+ assertEquals(t3.getDescription(), "It is dark!");
t = r.getLabel("test");
- GHLabel t3 = t.set().description("this is also a test");
+
+ t3 = t.set().description("this is also a test");
+
+ // instances behave as immutable by default. Update returns a new updated instance.
+ assertThat(t, not(sameInstance(t3)));
+ assertThat(t, not(equalTo(t3)));
assertEquals(t3.getColor(), "000000");
assertEquals(t3.getDescription(), "this is also a test");
+
t.delete();
t = r.createLabel("test2", "123457", "this is a different test");
t2 = r.getLabel("test2");
+
assertEquals(t.getName(), t2.getName());
assertEquals(t.getColor(), "123457");
assertEquals(t.getColor(), t2.getColor());
From b8180314d89fb1ccc9082f74f20b48313cf27be9 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Thu, 19 Mar 2020 12:07:53 -0700
Subject: [PATCH 13/16] Change to Preview for new builder pattern
---
src/main/java/org/kohsuke/github/GHLabel.java | 20 ++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index f7a72252a1..ee40c61ba2 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -81,7 +81,6 @@ public String getDescription() {
* the io exception
* @deprecated use {@link #set()} instead
*/
- @Deprecated
public void setColor(String newColor) throws IOException {
set().color(newColor);
}
@@ -95,7 +94,6 @@ public void setColor(String newColor) throws IOException {
* the io exception
* @deprecated use {@link #set()} instead
*/
- @Deprecated
public void setDescription(String newDescription) throws IOException {
set().description(newDescription);
}
@@ -119,7 +117,9 @@ static Collection toNames(Collection labels) {
* @throws IOException
* the io exception
*/
- public static Creator create(GHRepository repository) throws IOException {
+ @Preview
+ @Deprecated
+ static Creator create(GHRepository repository) throws IOException {
return new Creator(repository);
}
@@ -134,7 +134,7 @@ public static Creator create(GHRepository repository) throws IOException {
* @throws IOException
* the io exception
*/
- public static GHLabel read(@Nonnull GHRepository repository, @Nonnull String name) throws IOException {
+ static GHLabel read(@Nonnull GHRepository repository, @Nonnull String name) throws IOException {
return repository.root.createRequest()
.withUrlPath(repository.getApiTailUrl("labels"), name)
.fetch(GHLabel.class);
@@ -150,7 +150,7 @@ public static GHLabel read(@Nonnull GHRepository repository, @Nonnull String nam
* @throws IOException
* the io exception
*/
- public static PagedIterable readAll(@Nonnull final GHRepository repository) throws IOException {
+ static PagedIterable readAll(@Nonnull final GHRepository repository) throws IOException {
return repository.root.createRequest()
.withUrlPath(repository.getApiTailUrl("labels"))
.toIterable(GHLabel[].class, null);
@@ -164,6 +164,8 @@ public static PagedIterable readAll(@Nonnull final GHRepository reposit
*
* @return a {@link Updater}
*/
+ @Preview
+ @Deprecated
public Updater update() {
return new Updater(this);
}
@@ -173,6 +175,8 @@ public Updater update() {
*
* @return a {@link Setter}
*/
+ @Preview
+ @Deprecated
public Setter set() {
return new Setter(this);
}
@@ -209,6 +213,8 @@ public int hashCode() {
*
* {@link #done()} is called automatically after the property is set.
*/
+ @Preview
+ @Deprecated
public static class Setter extends GHLabelBuilder {
private Setter(@Nonnull GHLabel base) {
super(GHLabel.class, base.root, base);
@@ -221,6 +227,8 @@ private Setter(@Nonnull GHLabel base) {
*
* Consumer must call {@link #done()} to commit changes.
*/
+ @Preview
+ @Deprecated
public static class Updater extends GHLabelBuilder {
private Updater(@Nonnull GHLabel base) {
super(Updater.class, base.root, base);
@@ -233,6 +241,8 @@ private Updater(@Nonnull GHLabel base) {
*
* Consumer must call {@link #done()} to create the new instance.
*/
+ @Preview
+ @Deprecated
public static class Creator extends GHLabelBuilder {
private Creator(@Nonnull GHRepository repository) {
super(Creator.class, repository.root, null);
From b15e0d4c458bd55bcfe26b4c99b71fd55676ad85 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Fri, 20 Mar 2020 14:48:06 -0700
Subject: [PATCH 14/16] Cleanup and tweaks
---
.../org/kohsuke/github/AbstractBuilder.java | 57 ++++++++++++-------
src/main/java/org/kohsuke/github/GHLabel.java | 22 +++++--
.../org/kohsuke/github/GHLabelBuilder.java | 18 +++---
3 files changed, 66 insertions(+), 31 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/AbstractBuilder.java b/src/main/java/org/kohsuke/github/AbstractBuilder.java
index a0e4f9f9c4..462f7b4167 100644
--- a/src/main/java/org/kohsuke/github/AbstractBuilder.java
+++ b/src/main/java/org/kohsuke/github/AbstractBuilder.java
@@ -17,7 +17,7 @@
*
*
*
- * Single changee look like this:
+ * Single changes look like this:
*
*
* set().someName(value);
@@ -25,15 +25,15 @@
*
*
*
- * If S is the same as R, {@link #with(String, Object)} will commit changes after the first value change and return a R
+ * If {@link S} is the same as {@link R}, {@link #with(String, Object)} will commit changes after the first value change and return a {@link R}
* from {@link #done()}.
*
*
- * If S is not the same as R, {@link #with(String, Object)} will batch together multiple changes and let the user call
+ * If {@link S} is not the same as {@link R}, {@link #with(String, Object)} will batch together multiple changes and let the user call
* {@link #done()} when they are ready.
*
* @param
- * Final return type for built by this builder returned when {@link #done()}} is called.
+ * Final return type built by this builder returned when {@link #done()}} is called.
* @param
* Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S}
* the same as {@link R}, this builder will commit changes after each call to {@link #with(String, Object)}.
@@ -43,9 +43,6 @@ abstract class AbstractBuilder {
@Nonnull
private final Class returnType;
- @Nonnull
- private final Class intermediateReturnType;
-
private final boolean commitChangesImmediately;
@CheckForNull
@@ -54,8 +51,8 @@ abstract class AbstractBuilder {
@Nonnull
protected final Requester requester;
- // TODO: Not sure how update-in-place behavior should be controlled, but
- // it certainly can be controlled dynamically down to the instance level or inherited for all children of some
+ // TODO: Not sure how update-in-place behavior should be controlled
+ // However, it certainly can be controlled dynamically down to the instance level or inherited for all children of some
// connection.
protected boolean updateInPlace;
@@ -68,27 +65,25 @@ abstract class AbstractBuilder {
* the intermediate return type of type {@link S} returned by calls to {@link #with(String, Object)}.
* Must either be equal to {@code builtReturnType} or this instance must be castable to this class. If
* not, the constructor will throw {@link IllegalArgumentException}.
- * @param builtReturnType
+ * @param finalReturnType
* the final return type for built by this builder returned when {@link #done()}} is called.
* @param baseInstance
* optional instance on which to base this builder.
*/
- protected AbstractBuilder(@Nonnull GitHub root,
- @Nonnull Class intermediateReturnType,
- @Nonnull Class builtReturnType,
+ protected AbstractBuilder(@Nonnull Class finalReturnType,
+ @Nonnull Class intermediateReturnType,
+ @Nonnull GitHub root,
@CheckForNull R baseInstance) {
this.requester = root.createRequest();
- this.returnType = builtReturnType;
- this.intermediateReturnType = intermediateReturnType;
+ this.returnType = finalReturnType;
this.commitChangesImmediately = returnType.equals(intermediateReturnType);
if (!commitChangesImmediately && !intermediateReturnType.isInstance(this)) {
throw new IllegalArgumentException(
- "Argument \"intermediateReturnType\": This instance must be castable to intermediateReturnType or intermediateReturnType must be equal to builtReturnType.");
+ "Argument \"intermediateReturnType\": This instance must be castable to intermediateReturnType or finalReturnType must be equal to intermediateReturnType.");
}
this.baseInstance = baseInstance;
this.updateInPlace = false;
-
}
/**
@@ -101,6 +96,8 @@ protected AbstractBuilder(@Nonnull GitHub root,
* if there is an I/O Exception
*/
@Nonnull
+ @Preview
+ @Deprecated
public R done() throws IOException {
R result;
if (updateInPlace && baseInstance != null) {
@@ -114,10 +111,10 @@ public R done() throws IOException {
/**
* Applies a value to a name for this builder.
*
- * If S is the same as T, this method will commit changes after the first value change and return a T from
+ * If {@link S} is the same as {@link R}, this method will commit changes after the first value change and return a {@link R} from
* {@link #done()}.
*
- * If S is not the same as T, this method will return an {@link S} and letting the caller batch together multiple
+ * If {@link S} is not the same as {@link R}, this method will return an {@link S} and letting the caller batch together multiple
* changes and call {@link #done()} when they are ready.
*
* @param name
@@ -129,8 +126,30 @@ public R done() throws IOException {
* if an I/O error occurs
*/
@Nonnull
+ @Preview
+ @Deprecated
protected S with(@Nonnull String name, Object value) throws IOException {
requester.with(name, value);
+ return continueOrDone();
+ }
+
+ /**
+ * Chooses whether to return a continuing builder or an updated data record
+ *
+ * If {@link S} is the same as {@link R}, this method will commit changes after the first value change and return a {@link R} from
+ * {@link #done()}.
+ *
+ * If {@link S} is not the same as {@link R}, this method will return an {@link S} and letting the caller batch together multiple
+ * changes and call {@link #done()} when they are ready.
+ *
+ * @return either a continuing builder or an updated data record
+ * @throws IOException
+ * if an I/O error occurs
+ */
+ @Nonnull
+ @Preview
+ @Deprecated
+ protected S continueOrDone() throws IOException {
// This little bit of roughness in this base class means all inheriting builders get to create Updater and
// Setter classes from almost identical code. Creator can often be implemented with significant code reuse as
// well.
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index ee40c61ba2..9e2541317a 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -1,6 +1,7 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JacksonInject;
+import com.fasterxml.jackson.annotation.JsonCreator;
import java.io.IOException;
import java.util.ArrayList;
@@ -14,6 +15,7 @@
* The type GHLabel.
*
* @author Kohsuke Kawaguchi
+ * @see Labels
* @see GHIssue#getLabels() GHIssue#getLabels()
* @see GHRepository#listLabels() GHRepository#listLabels()
*/
@@ -22,16 +24,24 @@ public class GHLabel {
@Nonnull
private String url, name, color, description;
- @JacksonInject
- private GitHub root;
+ // Never null but not detectable at compile time
+ @Nonnull
+ private final GitHub root;
- GHLabel() {
+ @JsonCreator
+ private GHLabel(@JacksonInject GitHub root) {
+ this.root = root;
url = "";
name = "";
color = "";
description = "";
}
+ @Nonnull
+ GitHub getApiRoot() {
+ return Objects.requireNonNull(root);
+ }
+
/**
* Gets url.
*
@@ -81,6 +91,7 @@ public String getDescription() {
* the io exception
* @deprecated use {@link #set()} instead
*/
+ @Deprecated
public void setColor(String newColor) throws IOException {
set().color(newColor);
}
@@ -94,6 +105,7 @@ public void setColor(String newColor) throws IOException {
* the io exception
* @deprecated use {@link #set()} instead
*/
+ @Deprecated
public void setDescription(String newDescription) throws IOException {
set().description(newDescription);
}
@@ -217,7 +229,7 @@ public int hashCode() {
@Deprecated
public static class Setter extends GHLabelBuilder {
private Setter(@Nonnull GHLabel base) {
- super(GHLabel.class, base.root, base);
+ super(GHLabel.class, base.getApiRoot(), base);
requester.method("PATCH").setRawUrlPath(base.getUrl());
}
}
@@ -231,7 +243,7 @@ private Setter(@Nonnull GHLabel base) {
@Deprecated
public static class Updater extends GHLabelBuilder {
private Updater(@Nonnull GHLabel base) {
- super(Updater.class, base.root, base);
+ super(Updater.class, base.getApiRoot(), base);
requester.method("PATCH").setRawUrlPath(base.getUrl());
}
}
diff --git a/src/main/java/org/kohsuke/github/GHLabelBuilder.java b/src/main/java/org/kohsuke/github/GHLabelBuilder.java
index 97e07ca411..dabdb6ccd2 100644
--- a/src/main/java/org/kohsuke/github/GHLabelBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHLabelBuilder.java
@@ -28,28 +28,32 @@ class GHLabelBuilder extends AbstractBuilder {
protected GHLabelBuilder(@Nonnull Class intermediateReturnType,
@Nonnull GitHub root,
@CheckForNull GHLabel baseInstance) {
- super(root, intermediateReturnType, GHLabel.class, baseInstance);
+ super(GHLabel.class, intermediateReturnType, root, baseInstance);
- if (baseInstance == null) {
- baseInstance = new GHLabel();
+ if (baseInstance != null) {
+ requester.with("name", baseInstance.getName());
+ requester.with("color", baseInstance.getColor());
+ requester.with("description", baseInstance.getDescription());
}
-
- requester.with("name", baseInstance.getName());
- requester.with("color", baseInstance.getColor());
- requester.with("description", baseInstance.getDescription());
}
@Nonnull
+ @Preview
+ @Deprecated
public S name(String value) throws IOException {
return with("name", value);
}
@Nonnull
+ @Preview
+ @Deprecated
public S color(String value) throws IOException {
return with("color", value);
}
@Nonnull
+ @Preview
+ @Deprecated
public S description(String value) throws IOException {
return with("description", value);
}
From 2ab4eafee938d1113f34bddb158a11ec0992b532 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Mon, 23 Mar 2020 14:59:43 -0700
Subject: [PATCH 15/16] Tweaks and cleanup
---
.../org/kohsuke/github/AbstractBuilder.java | 31 ++++++++++---------
src/main/java/org/kohsuke/github/GHLabel.java | 1 -
src/test/java/org/kohsuke/github/AppTest.java | 1 +
...-test-org_test-labels_labels-5-ce07a3.json | 2 +-
4 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/src/main/java/org/kohsuke/github/AbstractBuilder.java b/src/main/java/org/kohsuke/github/AbstractBuilder.java
index 462f7b4167..f78e72633b 100644
--- a/src/main/java/org/kohsuke/github/AbstractBuilder.java
+++ b/src/main/java/org/kohsuke/github/AbstractBuilder.java
@@ -25,12 +25,12 @@
*
*
*
- * If {@link S} is the same as {@link R}, {@link #with(String, Object)} will commit changes after the first value change and return a {@link R}
- * from {@link #done()}.
+ * If {@link S} is the same as {@link R}, {@link #with(String, Object)} will commit changes after the first value change
+ * and return a {@link R} from {@link #done()}.
*
*
- * If {@link S} is not the same as {@link R}, {@link #with(String, Object)} will batch together multiple changes and let the user call
- * {@link #done()} when they are ready.
+ * If {@link S} is not the same as {@link R}, {@link #with(String, Object)} will batch together multiple changes and let
+ * the user call {@link #done()} when they are ready.
*
* @param
* Final return type built by this builder returned when {@link #done()}} is called.
@@ -52,7 +52,8 @@ abstract class AbstractBuilder {
protected final Requester requester;
// TODO: Not sure how update-in-place behavior should be controlled
- // However, it certainly can be controlled dynamically down to the instance level or inherited for all children of some
+ // However, it certainly can be controlled dynamically down to the instance level or inherited for all children of
+ // some
// connection.
protected boolean updateInPlace;
@@ -71,8 +72,8 @@ abstract class AbstractBuilder {
* optional instance on which to base this builder.
*/
protected AbstractBuilder(@Nonnull Class finalReturnType,
- @Nonnull Class intermediateReturnType,
- @Nonnull GitHub root,
+ @Nonnull Class intermediateReturnType,
+ @Nonnull GitHub root,
@CheckForNull R baseInstance) {
this.requester = root.createRequest();
this.returnType = finalReturnType;
@@ -111,11 +112,11 @@ public R done() throws IOException {
/**
* Applies a value to a name for this builder.
*
- * If {@link S} is the same as {@link R}, this method will commit changes after the first value change and return a {@link R} from
- * {@link #done()}.
+ * If {@link S} is the same as {@link R}, this method will commit changes after the first value change and return a
+ * {@link R} from {@link #done()}.
*
- * If {@link S} is not the same as {@link R}, this method will return an {@link S} and letting the caller batch together multiple
- * changes and call {@link #done()} when they are ready.
+ * If {@link S} is not the same as {@link R}, this method will return an {@link S} and letting the caller batch
+ * together multiple changes and call {@link #done()} when they are ready.
*
* @param name
* the name of the field
@@ -136,11 +137,11 @@ protected S with(@Nonnull String name, Object value) throws IOException {
/**
* Chooses whether to return a continuing builder or an updated data record
*
- * If {@link S} is the same as {@link R}, this method will commit changes after the first value change and return a {@link R} from
- * {@link #done()}.
+ * If {@link S} is the same as {@link R}, this method will commit changes after the first value change and return a
+ * {@link R} from {@link #done()}.
*
- * If {@link S} is not the same as {@link R}, this method will return an {@link S} and letting the caller batch together multiple
- * changes and call {@link #done()} when they are ready.
+ * If {@link S} is not the same as {@link R}, this method will return an {@link S} and letting the caller batch
+ * together multiple changes and call {@link #done()} when they are ready.
*
* @return either a continuing builder or an updated data record
* @throws IOException
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 9e2541317a..24957cc817 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -24,7 +24,6 @@ public class GHLabel {
@Nonnull
private String url, name, color, description;
- // Never null but not detectable at compile time
@Nonnull
private final GitHub root;
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index 61764c9a7d..10d3548856 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -787,6 +787,7 @@ public void testTreesRecursive() throws IOException {
@Test
public void testRepoLabel() throws IOException {
+
cleanupLabel("test");
cleanupLabel("test2");
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-ce07a3.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-ce07a3.json
index fc7b11e4b7..bdffdfe58a 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-ce07a3.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-ce07a3.json
@@ -6,7 +6,7 @@
"method": "POST",
"bodyPatterns": [
{
- "equalToJson": "{\"color\":\"123456\",\"name\":\"test\",\"description\":\"\"}",
+ "equalToJson": "{\"color\":\"123456\",\"name\":\"test\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
From 772272ff36f48424c99115970b481a33f5c49ae0 Mon Sep 17 00:00:00 2001
From: Liam Newman
Date: Mon, 23 Mar 2020 15:38:50 -0700
Subject: [PATCH 16/16] Re-record test for GHLabel
---
src/main/java/org/kohsuke/github/GHLabel.java | 19 ++++---
.../java/org/kohsuke/github/GHRepository.java | 2 +-
src/test/java/org/kohsuke/github/AppTest.java | 33 ++++++++++--
...47685ef9-9d9a-4e96-945b-b58a75e9807f.json} | 4 +-
...28c58b29-a050-4a83-b08e-bf202cff89a9.json} | 0
...a78a0f34-4527-48ba-88f8-16c319430bc6.json} | 12 ++---
...ub-api-test-org_test-labels-2-47685e.json} | 22 ++++----
...est-org_test-labels_labels-15-6c2ac6.json} | 37 +++++++------
...test-org_test-labels_labels-18-b1cf4b.json | 53 +++++++++++++++++++
...test-org_test-labels_labels-3-28c58b.json} | 23 ++++----
...test-org_test-labels_labels-5-154147.json} | 37 +++++++------
...t-labels_labels_enhancement-4-e1469d.json} | 21 ++++----
...org_test-labels_labels_test-10-cace49.json | 52 ++++++++++++++++++
...rg_test-labels_labels_test-11-e4b594.json} | 28 +++++-----
...rg_test-labels_labels_test-12-0dad57.json} | 37 +++++++------
...rg_test-labels_labels_test-13-09f51c.json} | 18 +++----
...org_test-labels_labels_test-14-331784.json | 42 +++++++++++++++
...org_test-labels_labels_test-6-bee660.json} | 25 +++++----
...org_test-labels_labels_test-7-528317.json} | 35 ++++++------
...-org_test-labels_labels_test-8-c772a0.json | 52 ++++++++++++++++++
...org_test-labels_labels_test-9-6aef5e.json} | 27 +++++-----
...g_test-labels_labels_test2-16-6ad140.json} | 27 +++++-----
...g_test-labels_labels_test2-17-7c5913.json} | 18 +++----
...{user-1-05a1d2.json => user-1-a78a0f.json} | 24 ++++-----
24 files changed, 430 insertions(+), 218 deletions(-)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/{repos_github-api-test-org_test-labels-fbcd5a5d-47a7-4817-bd69-cfe1afa2cdbd.json => repos_github-api-test-org_test-labels-47685ef9-9d9a-4e96-945b-b58a75e9807f.json} (98%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/{repos_github-api-test-org_test-labels_labels-82e6433c-0947-48bc-a15a-398eefcc3280.json => repos_github-api-test-org_test-labels_labels-28c58b29-a050-4a83-b08e-bf202cff89a9.json} (100%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/{user-05a1d265-edf9-4570-b398-a3eb7d3396e1.json => user-a78a0f34-4527-48ba-88f8-16c319430bc6.json} (90%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels-2-fbcd5a.json => repos_github-api-test-org_test-labels-2-47685e.json} (63%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels-12-b2265f.json => repos_github-api-test-org_test-labels_labels-15-6c2ac6.json} (67%)
create mode 100644 src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-18-b1cf4b.json
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels-3-82e643.json => repos_github-api-test-org_test-labels_labels-3-28c58b.json} (64%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels-5-ce07a3.json => repos_github-api-test-org_test-labels_labels-5-154147.json} (64%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_enhancement-4-ba366e.json => repos_github-api-test-org_test-labels_labels_enhancement-4-e1469d.json} (70%)
create mode 100644 src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-10-cace49.json
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_test-10-3ee113.json => repos_github-api-test-org_test-labels_labels_test-11-e4b594.json} (61%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_test-9-e4f1b8.json => repos_github-api-test-org_test-labels_labels_test-12-0dad57.json} (65%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_test-11-f2667d.json => repos_github-api-test-org_test-labels_labels_test-13-09f51c.json} (63%)
create mode 100644 src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-14-331784.json
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_test-6-6c1d5b.json => repos_github-api-test-org_test-labels_labels_test-6-bee660.json} (65%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_test-7-aceb5f.json => repos_github-api-test-org_test-labels_labels_test-7-528317.json} (66%)
create mode 100644 src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-c772a0.json
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_test-8-0dc6e2.json => repos_github-api-test-org_test-labels_labels_test-9-6aef5e.json} (60%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_test2-13-633a55.json => repos_github-api-test-org_test-labels_labels_test2-16-6ad140.json} (61%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{repos_github-api-test-org_test-labels_labels_test2-14-fc4fdf.json => repos_github-api-test-org_test-labels_labels_test2-17-7c5913.json} (63%)
rename src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/{user-1-05a1d2.json => user-1-a78a0f.json} (60%)
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 24957cc817..4bf573498f 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -9,6 +9,7 @@
import java.util.List;
import java.util.Objects;
+import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
@@ -22,18 +23,21 @@
public class GHLabel {
@Nonnull
- private String url, name, color, description;
+ private String url, name, color;
+
+ @CheckForNull
+ private String description;
@Nonnull
private final GitHub root;
@JsonCreator
- private GHLabel(@JacksonInject GitHub root) {
+ private GHLabel(@JacksonInject @Nonnull GitHub root) {
this.root = root;
url = "";
name = "";
color = "";
- description = "";
+ description = null;
}
@Nonnull
@@ -76,7 +80,7 @@ public String getColor() {
*
* @return the description
*/
- @Nonnull
+ @CheckForNull
public String getDescription() {
return description;
}
@@ -88,7 +92,7 @@ public String getDescription() {
* 6-letter hex color code, like "f29513"
* @throws IOException
* the io exception
- * @deprecated use {@link #set()} instead
+ * @deprecated use {@link #set()} or {@link #update()} instead
*/
@Deprecated
public void setColor(String newColor) throws IOException {
@@ -102,7 +106,7 @@ public void setColor(String newColor) throws IOException {
* Description of label
* @throws IOException
* the io exception
- * @deprecated use {@link #set()} instead
+ * @deprecated use {@link #set()} or {@link #update()} instead
*/
@Deprecated
public void setDescription(String newDescription) throws IOException {
@@ -193,8 +197,7 @@ public Setter set() {
}
/**
- * Delete this label from this repository. Made static to make it clearer that this deletes the label entirely -
- * different from adding removing labels from objects.
+ * Delete this label from the repository.
*
* @throws IOException
* the io exception
diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java
index 36f0734fd1..5ed437af3a 100644
--- a/src/main/java/org/kohsuke/github/GHRepository.java
+++ b/src/main/java/org/kohsuke/github/GHRepository.java
@@ -1900,7 +1900,7 @@ public GHLabel getLabel(String name) throws IOException {
* the io exception
*/
public GHLabel createLabel(String name, String color) throws IOException {
- return GHLabel.create(this).name(name).color(color).done();
+ return GHLabel.create(this).name(name).color(color).description("").done();
}
/**
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index 10d3548856..e61ef30331 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -10,6 +10,7 @@
import org.kohsuke.github.GHCommit.File;
import org.kohsuke.github.GHOrganization.Permission;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
@@ -787,14 +788,13 @@ public void testTreesRecursive() throws IOException {
@Test
public void testRepoLabel() throws IOException {
-
cleanupLabel("test");
cleanupLabel("test2");
GHRepository r = gitHub.getRepository("github-api-test-org/test-labels");
List lst = r.listLabels().toList();
for (GHLabel l : lst) {
- // System.out.println(l.getName());
+ assertThat(l.getUrl(), containsString(l.getName().replace(" ", "%20")));
}
assertTrue(lst.size() > 5);
GHLabel e = r.getLabel("enhancement");
@@ -819,7 +819,6 @@ public void testRepoLabel() throws IOException {
assertEquals(t.getUrl(), t2.getUrl());
// update works on multiple changes in one call
- // t.setColor("");
t3 = t.update().color("000000").description("It is dark!").done();
// instances behave as immutable by default. Update returns a new updated instance.
@@ -834,8 +833,21 @@ public void testRepoLabel() throws IOException {
assertEquals(t3.getColor(), "000000");
assertEquals(t3.getDescription(), "It is dark!");
+ // Test deprecated methods
+ t.setDescription("Deprecated");
+ t = r.getLabel("test");
+
+ // By using the old instance t when calling setDescription it also sets color to the old value
+ // this is a bad behavior, but it is expected
+ assertEquals(t.getColor(), "123456");
+ assertEquals(t.getDescription(), "Deprecated");
+
+ t.setColor("000000");
t = r.getLabel("test");
+ assertEquals(t.getColor(), "000000");
+ assertEquals(t.getDescription(), "Deprecated");
+ // set() makes a single change
t3 = t.set().description("this is also a test");
// instances behave as immutable by default. Update returns a new updated instance.
@@ -846,6 +858,12 @@ public void testRepoLabel() throws IOException {
assertEquals(t3.getDescription(), "this is also a test");
t.delete();
+ try {
+ t = r.getLabel("test");
+ fail("Test label should be deleted.");
+ } catch (IOException ex) {
+ assertThat(ex, instanceOf(FileNotFoundException.class));
+ }
t = r.createLabel("test2", "123457", "this is a different test");
t2 = r.getLabel("test2");
@@ -856,6 +874,13 @@ public void testRepoLabel() throws IOException {
assertEquals(t.getDescription(), "this is a different test");
assertEquals(t.getDescription(), t2.getDescription());
assertEquals(t.getUrl(), t2.getUrl());
+ t.delete();
+
+ // Allow null description
+ t = GHLabel.create(r).name("test2").color("123458").done();
+ assertThat(t.getName(), equalTo("test2"));
+ assertThat(t.getDescription(), is(nullValue()));
+
} finally {
cleanupLabel("test");
cleanupLabel("test2");
@@ -865,7 +890,7 @@ public void testRepoLabel() throws IOException {
void cleanupLabel(String name) {
if (mockGitHub.isUseProxy()) {
try {
- GHLabel t = getGitHubBeforeAfter().getRepository("github-api-test-org/test-labels").getLabel("test");
+ GHLabel t = getGitHubBeforeAfter().getRepository("github-api-test-org/test-labels").getLabel(name);
t.delete();
} catch (IOException e) {
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels-fbcd5a5d-47a7-4817-bd69-cfe1afa2cdbd.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels-47685ef9-9d9a-4e96-945b-b58a75e9807f.json
similarity index 98%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels-fbcd5a5d-47a7-4817-bd69-cfe1afa2cdbd.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels-47685ef9-9d9a-4e96-945b-b58a75e9807f.json
index 9cd54d11ef..491295ca14 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels-fbcd5a5d-47a7-4817-bd69-cfe1afa2cdbd.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels-47685ef9-9d9a-4e96-945b-b58a75e9807f.json
@@ -96,9 +96,11 @@
"push": true,
"pull": true
},
+ "temp_clone_token": "",
"allow_squash_merge": true,
"allow_merge_commit": true,
"allow_rebase_merge": true,
+ "delete_branch_on_merge": false,
"organization": {
"login": "github-api-test-org",
"id": 7544739,
@@ -120,5 +122,5 @@
"site_admin": false
},
"network_count": 0,
- "subscribers_count": 2
+ "subscribers_count": 1
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels_labels-82e6433c-0947-48bc-a15a-398eefcc3280.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels_labels-28c58b29-a050-4a83-b08e-bf202cff89a9.json
similarity index 100%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels_labels-82e6433c-0947-48bc-a15a-398eefcc3280.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/repos_github-api-test-org_test-labels_labels-28c58b29-a050-4a83-b08e-bf202cff89a9.json
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/user-05a1d265-edf9-4570-b398-a3eb7d3396e1.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/user-a78a0f34-4527-48ba-88f8-16c319430bc6.json
similarity index 90%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/user-05a1d265-edf9-4570-b398-a3eb7d3396e1.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/user-a78a0f34-4527-48ba-88f8-16c319430bc6.json
index 41fc9e3d00..05a796f5ba 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/user-05a1d265-edf9-4570-b398-a3eb7d3396e1.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/__files/user-a78a0f34-4527-48ba-88f8-16c319430bc6.json
@@ -24,14 +24,14 @@
"email": "bitwiseman@gmail.com",
"hireable": null,
"bio": "https://twitter.com/bitwiseman",
- "public_repos": 168,
- "public_gists": 4,
- "followers": 136,
+ "public_repos": 181,
+ "public_gists": 7,
+ "followers": 150,
"following": 9,
"created_at": "2012-07-11T20:38:33Z",
- "updated_at": "2019-09-24T19:32:29Z",
- "private_gists": 7,
- "total_private_repos": 9,
+ "updated_at": "2020-03-19T19:17:12Z",
+ "private_gists": 8,
+ "total_private_repos": 10,
"owned_private_repos": 0,
"disk_usage": 33697,
"collaborators": 0,
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels-2-fbcd5a.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels-2-47685e.json
similarity index 63%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels-2-fbcd5a.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels-2-47685e.json
index dccc4ebeaf..a159930cff 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels-2-fbcd5a.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels-2-47685e.json
@@ -1,5 +1,5 @@
{
- "id": "fbcd5a5d-47a7-4817-bd69-cfe1afa2cdbd",
+ "id": "47685ef9-9d9a-4e96-945b-b58a75e9807f",
"name": "repos_github-api-test-org_test-labels",
"request": {
"url": "/repos/github-api-test-org/test-labels",
@@ -12,37 +12,35 @@
},
"response": {
"status": 200,
- "bodyFileName": "repos_github-api-test-org_test-labels-fbcd5a5d-47a7-4817-bd69-cfe1afa2cdbd.json",
+ "bodyFileName": "repos_github-api-test-org_test-labels-47685ef9-9d9a-4e96-945b-b58a75e9807f.json",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:22 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:26 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4838",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4987",
+ "X-RateLimit-Reset": "1585080825",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"de5493a4e3cf3def2774a62ae9c04ee2\"",
+ "ETag": "W/\"6b3e989ed9af12ce6cd75038c1664ab5\"",
"Last-Modified": "Sun, 15 Feb 2015 14:49:09 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
"X-GitHub-Media-Type": "unknown, github.v3",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B940C:5AAD9C:5D982851"
+ "X-GitHub-Request-Id": "C6C5:5608:1232FC:1FE7E8:5E7A600D"
}
},
- "uuid": "fbcd5a5d-47a7-4817-bd69-cfe1afa2cdbd",
+ "uuid": "47685ef9-9d9a-4e96-945b-b58a75e9807f",
"persistent": true,
"insertionIndex": 2
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-12-b2265f.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-15-6c2ac6.json
similarity index 67%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-12-b2265f.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-15-6c2ac6.json
index 363814335d..47e1258536 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-12-b2265f.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-15-6c2ac6.json
@@ -1,54 +1,53 @@
{
- "id": "b2265f8b-180e-4664-b476-c9f195f07b5d",
+ "id": "6c2ac6d2-3f11-4386-bb61-17ff5f183285",
"name": "repos_github-api-test-org_test-labels_labels",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels",
"method": "POST",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ },
"bodyPatterns": [
{
"equalToJson": "{\"color\":\"123457\",\"name\":\"test2\",\"description\":\"this is a different test\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
- ],
- "headers": {
- "Accept": {
- "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
- }
- }
+ ]
},
"response": {
"status": 201,
- "body": "{\"id\":1596524813,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODEz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test2\",\"name\":\"test2\",\"color\":\"123457\",\"default\":false,\"description\":\"this is a different test\"}",
+ "body": "{\"id\":1932142041,\"node_id\":\"MDU6TGFiZWwxOTMyMTQyMDQx\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test2\",\"name\":\"test2\",\"color\":\"123457\",\"default\":false,\"description\":\"this is a different test\"}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:24 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:29 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "201 Created",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4828",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4974",
+ "X-RateLimit-Reset": "1585080825",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "\"cb7056d812cb1ca0296b75f5e48b462d\"",
+ "ETag": "\"c3c0744906ceb4103444a9bf92a50cd0\"",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "",
"Location": "https://api.github.com/repos/github-api-test-org/test-labels/labels/test2",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B942E:5AADD4:5D982854"
+ "X-GitHub-Request-Id": "C6C5:5608:123443:1FEB34:5E7A6011"
}
},
- "uuid": "b2265f8b-180e-4664-b476-c9f195f07b5d",
+ "uuid": "6c2ac6d2-3f11-4386-bb61-17ff5f183285",
"persistent": true,
- "insertionIndex": 12
+ "insertionIndex": 15
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-18-b1cf4b.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-18-b1cf4b.json
new file mode 100644
index 0000000000..3bc13f1e1f
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-18-b1cf4b.json
@@ -0,0 +1,53 @@
+{
+ "id": "b1cf4bdd-f563-4831-8d5d-057fbee3ac86",
+ "name": "repos_github-api-test-org_test-labels_labels",
+ "request": {
+ "url": "/repos/github-api-test-org/test-labels/labels",
+ "method": "POST",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ },
+ "bodyPatterns": [
+ {
+ "equalToJson": "{\"color\":\"123458\",\"name\":\"test2\"}",
+ "ignoreArrayOrder": true,
+ "ignoreExtraElements": true
+ }
+ ]
+ },
+ "response": {
+ "status": 201,
+ "body": "{\"id\":1932142052,\"node_id\":\"MDU6TGFiZWwxOTMyMTQyMDUy\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test2\",\"name\":\"test2\",\"color\":\"123458\",\"default\":false,\"description\":null}",
+ "headers": {
+ "Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:30 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Status": "201 Created",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4971",
+ "X-RateLimit-Reset": "1585080826",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding, Accept, X-Requested-With"
+ ],
+ "ETag": "\"32b583a258d93b9d778a1e45ae9b163a\"",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "Location": "https://api.github.com/repos/github-api-test-org/test-labels/labels/test2",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "C6C5:5608:12349A:1FEBBA:5E7A6012"
+ }
+ },
+ "uuid": "b1cf4bdd-f563-4831-8d5d-057fbee3ac86",
+ "persistent": true,
+ "insertionIndex": 18
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-3-82e643.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-3-28c58b.json
similarity index 64%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-3-82e643.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-3-28c58b.json
index 101046d057..9d464b7f51 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-3-82e643.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-3-28c58b.json
@@ -1,5 +1,5 @@
{
- "id": "82e6433c-0947-48bc-a15a-398eefcc3280",
+ "id": "28c58b29-a050-4a83-b08e-bf202cff89a9",
"name": "repos_github-api-test-org_test-labels_labels",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels",
@@ -12,35 +12,34 @@
},
"response": {
"status": 200,
- "bodyFileName": "repos_github-api-test-org_test-labels_labels-82e6433c-0947-48bc-a15a-398eefcc3280.json",
+ "bodyFileName": "repos_github-api-test-org_test-labels_labels-28c58b29-a050-4a83-b08e-bf202cff89a9.json",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:22 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:26 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4837",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4986",
+ "X-RateLimit-Reset": "1585080825",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"70c6bea1b42c9775915fdf6e8279aa26\"",
+ "ETag": "W/\"e7c4fba8fbd1312b7b8bc4cac1dfbc25\"",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B940E:5AADB0:5D982852"
+ "X-GitHub-Request-Id": "C6C5:5608:12330F:1FE940:5E7A600E"
}
},
- "uuid": "82e6433c-0947-48bc-a15a-398eefcc3280",
+ "uuid": "28c58b29-a050-4a83-b08e-bf202cff89a9",
"persistent": true,
"insertionIndex": 3
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-ce07a3.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-154147.json
similarity index 64%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-ce07a3.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-154147.json
index bdffdfe58a..366ec7772c 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-ce07a3.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels-5-154147.json
@@ -1,54 +1,53 @@
{
- "id": "ce07a349-37fc-4920-bdd1-0da90c5f95e3",
+ "id": "154147fd-99f6-4b3f-8fec-3e4ea72e9fc5",
"name": "repos_github-api-test-org_test-labels_labels",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels",
"method": "POST",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ },
"bodyPatterns": [
{
- "equalToJson": "{\"color\":\"123456\",\"name\":\"test\"}",
+ "equalToJson": "{\"color\":\"123456\",\"name\":\"test\",\"description\":\"\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
- ],
- "headers": {
- "Accept": {
- "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
- }
- }
+ ]
},
"response": {
"status": 201,
- "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"123456\",\"default\":false,\"description\":\"\"}",
+ "body": "{\"id\":1932141986,\"node_id\":\"MDU6TGFiZWwxOTMyMTQxOTg2\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"123456\",\"default\":false,\"description\":\"\"}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:23 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:27 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "201 Created",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4835",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4984",
+ "X-RateLimit-Reset": "1585080826",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "\"f933a77094471805d575559f23304c39\"",
+ "ETag": "\"746fc424803851d22aad5357c01c224f\"",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "",
"Location": "https://api.github.com/repos/github-api-test-org/test-labels/labels/test",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B9414:5AADB6:5D982853"
+ "X-GitHub-Request-Id": "C6C5:5608:123338:1FE97F:5E7A600F"
}
},
- "uuid": "ce07a349-37fc-4920-bdd1-0da90c5f95e3",
+ "uuid": "154147fd-99f6-4b3f-8fec-3e4ea72e9fc5",
"persistent": true,
"insertionIndex": 5
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_enhancement-4-ba366e.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_enhancement-4-e1469d.json
similarity index 70%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_enhancement-4-ba366e.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_enhancement-4-e1469d.json
index 59462342f1..9ca0baec64 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_enhancement-4-ba366e.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_enhancement-4-e1469d.json
@@ -1,5 +1,5 @@
{
- "id": "ba366e44-54d8-41e1-a12a-8024a7d41658",
+ "id": "e1469d4c-5c2e-4efc-8dc4-53336da555a8",
"name": "repos_github-api-test-org_test-labels_labels_enhancement",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/enhancement",
@@ -14,34 +14,33 @@
"status": 200,
"body": "{\"id\":177339106,\"node_id\":\"MDU6TGFiZWwxNzczMzkxMDY=\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/enhancement\",\"name\":\"enhancement\",\"color\":\"84b6eb\",\"default\":true,\"description\":null}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:23 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:27 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4836",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4985",
+ "X-RateLimit-Reset": "1585080826",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"ac69b781a1575715b24ee0357ce1e51e\"",
+ "ETag": "W/\"27ddcfc35bfde213e1754cfc9af09e7b\"",
"Last-Modified": "Sun, 15 Feb 2015 14:49:10 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B9412:5AADB3:5D982852"
+ "X-GitHub-Request-Id": "C6C5:5608:123322:1FE958:5E7A600E"
}
},
- "uuid": "ba366e44-54d8-41e1-a12a-8024a7d41658",
+ "uuid": "e1469d4c-5c2e-4efc-8dc4-53336da555a8",
"persistent": true,
"insertionIndex": 4
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-10-cace49.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-10-cace49.json
new file mode 100644
index 0000000000..24f08bdc92
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-10-cace49.json
@@ -0,0 +1,52 @@
+{
+ "id": "cace497a-c750-4a63-bfac-f0a8a155301c",
+ "name": "repos_github-api-test-org_test-labels_labels_test",
+ "request": {
+ "url": "/repos/github-api-test-org/test-labels/labels/test",
+ "method": "PATCH",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ },
+ "bodyPatterns": [
+ {
+ "equalToJson": "{\"color\":\"000000\",\"name\":\"test\",\"description\":\"Deprecated\"}",
+ "ignoreArrayOrder": true,
+ "ignoreExtraElements": true
+ }
+ ]
+ },
+ "response": {
+ "status": 200,
+ "body": "{\"id\":1932141986,\"node_id\":\"MDU6TGFiZWwxOTMyMTQxOTg2\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"Deprecated\"}",
+ "headers": {
+ "Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:28 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4979",
+ "X-RateLimit-Reset": "1585080826",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding, Accept, X-Requested-With"
+ ],
+ "ETag": "W/\"c2b4409465d0fa9da773d945ed7e93b7\"",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "C6C5:5608:1233C3:1FEA6A:5E7A6010"
+ }
+ },
+ "uuid": "cace497a-c750-4a63-bfac-f0a8a155301c",
+ "persistent": true,
+ "insertionIndex": 10
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-10-3ee113.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-11-e4b594.json
similarity index 61%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-10-3ee113.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-11-e4b594.json
index 664dbd9157..9388aa79f5 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-10-3ee113.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-11-e4b594.json
@@ -1,5 +1,5 @@
{
- "id": "3ee11377-21e9-477f-89c0-9debad44f92b",
+ "id": "e4b59465-556e-4ecc-9fb7-476a9681503b",
"name": "repos_github-api-test-org_test-labels_labels_test",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/test",
@@ -12,38 +12,38 @@
},
"response": {
"status": 200,
- "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"this is also a test\"}",
+ "body": "{\"id\":1932141986,\"node_id\":\"MDU6TGFiZWwxOTMyMTQxOTg2\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"Deprecated\"}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:23 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:28 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4830",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4978",
+ "X-RateLimit-Reset": "1585080825",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"cd828b300f3803bcda7512b44c762a69\"",
- "Last-Modified": "Sat, 05 Oct 2019 05:21:23 GMT",
+ "ETag": "W/\"c2b4409465d0fa9da773d945ed7e93b7\"",
+ "Last-Modified": "Tue, 24 Mar 2020 19:31:28 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B9425:5AADCB:5D982853"
+ "X-GitHub-Request-Id": "C6C5:5608:1233E5:1FEA9C:5E7A6010"
}
},
- "uuid": "3ee11377-21e9-477f-89c0-9debad44f92b",
+ "uuid": "e4b59465-556e-4ecc-9fb7-476a9681503b",
"persistent": true,
"scenarioName": "scenario-1-repos-github-api-test-org-test-labels-labels-test",
"requiredScenarioState": "scenario-1-repos-github-api-test-org-test-labels-labels-test-3",
- "insertionIndex": 10
+ "newScenarioState": "scenario-1-repos-github-api-test-org-test-labels-labels-test-4",
+ "insertionIndex": 11
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-9-e4f1b8.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-12-0dad57.json
similarity index 65%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-9-e4f1b8.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-12-0dad57.json
index d0c0f4518e..c5d00101b2 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-9-e4f1b8.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-12-0dad57.json
@@ -1,53 +1,52 @@
{
- "id": "e4f1b8e0-0a58-491b-9905-ac4093b64407",
+ "id": "0dad57a0-5328-486e-a9c6-c5d1fd10695e",
"name": "repos_github-api-test-org_test-labels_labels_test",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/test",
"method": "PATCH",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ },
"bodyPatterns": [
{
"equalToJson": "{\"color\":\"000000\",\"name\":\"test\",\"description\":\"this is also a test\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
- ],
- "headers": {
- "Accept": {
- "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
- }
- }
+ ]
},
"response": {
"status": 200,
- "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"this is also a test\"}",
+ "body": "{\"id\":1932141986,\"node_id\":\"MDU6TGFiZWwxOTMyMTQxOTg2\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"this is also a test\"}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:23 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:28 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4831",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4977",
+ "X-RateLimit-Reset": "1585080825",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"cd828b300f3803bcda7512b44c762a69\"",
+ "ETag": "W/\"70eb410be17b910e7f7ccbee623dc474\"",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B9422:5AADC8:5D982853"
+ "X-GitHub-Request-Id": "C6C5:5608:1233F8:1FEABA:5E7A6010"
}
},
- "uuid": "e4f1b8e0-0a58-491b-9905-ac4093b64407",
+ "uuid": "0dad57a0-5328-486e-a9c6-c5d1fd10695e",
"persistent": true,
- "insertionIndex": 9
+ "insertionIndex": 12
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-11-f2667d.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-13-09f51c.json
similarity index 63%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-11-f2667d.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-13-09f51c.json
index 7575baba9c..573fc9f2f2 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-11-f2667d.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-13-09f51c.json
@@ -1,5 +1,5 @@
{
- "id": "f2667d3c-85ff-4e42-b633-e677525d4b9c",
+ "id": "09f51c88-5e9c-4c62-9dac-790df8a09d5d",
"name": "repos_github-api-test-org_test-labels_labels_test",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/test",
@@ -13,28 +13,26 @@
"response": {
"status": 204,
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:24 GMT",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:29 GMT",
"Status": "204 No Content",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4829",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4976",
+ "X-RateLimit-Reset": "1585080826",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "",
"X-GitHub-Media-Type": "unknown, github.v3",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "Vary": "Accept-Encoding",
- "X-GitHub-Request-Id": "FC58:3C9A:4B942A:5AADCE:5D982853"
+ "Vary": "Accept-Encoding, Accept, X-Requested-With",
+ "X-GitHub-Request-Id": "C6C5:5608:12341A:1FEAEC:5E7A6010"
}
},
- "uuid": "f2667d3c-85ff-4e42-b633-e677525d4b9c",
+ "uuid": "09f51c88-5e9c-4c62-9dac-790df8a09d5d",
"persistent": true,
- "insertionIndex": 11
+ "insertionIndex": 13
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-14-331784.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-14-331784.json
new file mode 100644
index 0000000000..2f5ce5d3f6
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-14-331784.json
@@ -0,0 +1,42 @@
+{
+ "id": "331784da-76b5-4592-bdd3-54afa7ffe0e0",
+ "name": "repos_github-api-test-org_test-labels_labels_test",
+ "request": {
+ "url": "/repos/github-api-test-org/test-labels/labels/test",
+ "method": "GET",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ }
+ },
+ "response": {
+ "status": 404,
+ "body": "{\"message\":\"Not Found\",\"documentation_url\":\"https://developer.github.com/v3/issues/labels/#get-a-single-label\"}",
+ "headers": {
+ "Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:29 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Status": "404 Not Found",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4975",
+ "X-RateLimit-Reset": "1585080826",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "repo",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "Vary": "Accept-Encoding, Accept, X-Requested-With",
+ "X-GitHub-Request-Id": "C6C5:5608:123433:1FEB1F:5E7A6011"
+ }
+ },
+ "uuid": "331784da-76b5-4592-bdd3-54afa7ffe0e0",
+ "persistent": true,
+ "scenarioName": "scenario-1-repos-github-api-test-org-test-labels-labels-test",
+ "requiredScenarioState": "scenario-1-repos-github-api-test-org-test-labels-labels-test-4",
+ "insertionIndex": 14
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-6-6c1d5b.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-6-bee660.json
similarity index 65%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-6-6c1d5b.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-6-bee660.json
index abfaf066e2..d314eb6f15 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-6-6c1d5b.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-6-bee660.json
@@ -1,5 +1,5 @@
{
- "id": "6c1d5bb5-c427-4743-b1c2-0bc8113b155f",
+ "id": "bee66039-139a-45d5-b7a9-79a79ceb82eb",
"name": "repos_github-api-test-org_test-labels_labels_test",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/test",
@@ -12,36 +12,35 @@
},
"response": {
"status": 200,
- "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"123456\",\"default\":false,\"description\":\"\"}",
+ "body": "{\"id\":1932141986,\"node_id\":\"MDU6TGFiZWwxOTMyMTQxOTg2\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"123456\",\"default\":false,\"description\":\"\"}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:23 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:27 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4834",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4983",
+ "X-RateLimit-Reset": "1585080825",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"f933a77094471805d575559f23304c39\"",
- "Last-Modified": "Sat, 05 Oct 2019 05:21:23 GMT",
+ "ETag": "W/\"746fc424803851d22aad5357c01c224f\"",
+ "Last-Modified": "Tue, 24 Mar 2020 19:31:27 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B9415:5AADB7:5D982853"
+ "X-GitHub-Request-Id": "C6C5:5608:12336D:1FE9D0:5E7A600F"
}
},
- "uuid": "6c1d5bb5-c427-4743-b1c2-0bc8113b155f",
+ "uuid": "bee66039-139a-45d5-b7a9-79a79ceb82eb",
"persistent": true,
"scenarioName": "scenario-1-repos-github-api-test-org-test-labels-labels-test",
"requiredScenarioState": "Started",
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-aceb5f.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-528317.json
similarity index 66%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-aceb5f.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-528317.json
index 96c4616d0e..dc6f2fc2ef 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-aceb5f.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-7-528317.json
@@ -1,53 +1,52 @@
{
- "id": "aceb5f74-bf82-4d06-a87e-9b3294b127e4",
+ "id": "52831797-1300-4176-bdd4-255cf2fcffde",
"name": "repos_github-api-test-org_test-labels_labels_test",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/test",
"method": "PATCH",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ },
"bodyPatterns": [
{
"equalToJson": "{\"color\":\"000000\",\"name\":\"test\",\"description\":\"It is dark!\"}",
"ignoreArrayOrder": true,
"ignoreExtraElements": true
}
- ],
- "headers": {
- "Accept": {
- "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
- }
- }
+ ]
},
"response": {
"status": 200,
- "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"It is dark!\"}",
+ "body": "{\"id\":1932141986,\"node_id\":\"MDU6TGFiZWwxOTMyMTQxOTg2\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"It is dark!\"}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:23 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:27 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4833",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4982",
+ "X-RateLimit-Reset": "1585080825",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"b6be68c4a5dbc522147f58e4b1b1aed1\"",
+ "ETag": "W/\"77e815d99a6b367bfe8ac24c7089d0bc\"",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B9419:5AADBC:5D982853"
+ "X-GitHub-Request-Id": "C6C5:5608:12337A:1FE9F2:5E7A600F"
}
},
- "uuid": "aceb5f74-bf82-4d06-a87e-9b3294b127e4",
+ "uuid": "52831797-1300-4176-bdd4-255cf2fcffde",
"persistent": true,
"insertionIndex": 7
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-c772a0.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-c772a0.json
new file mode 100644
index 0000000000..ce5ba29fc5
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-c772a0.json
@@ -0,0 +1,52 @@
+{
+ "id": "c772a03f-74cd-4858-99dc-c0a66e87fa14",
+ "name": "repos_github-api-test-org_test-labels_labels_test",
+ "request": {
+ "url": "/repos/github-api-test-org/test-labels/labels/test",
+ "method": "PATCH",
+ "headers": {
+ "Accept": {
+ "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2"
+ }
+ },
+ "bodyPatterns": [
+ {
+ "equalToJson": "{\"color\":\"123456\",\"name\":\"test\",\"description\":\"Deprecated\"}",
+ "ignoreArrayOrder": true,
+ "ignoreExtraElements": true
+ }
+ ]
+ },
+ "response": {
+ "status": 200,
+ "body": "{\"id\":1932141986,\"node_id\":\"MDU6TGFiZWwxOTMyMTQxOTg2\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"123456\",\"default\":false,\"description\":\"Deprecated\"}",
+ "headers": {
+ "Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:28 GMT",
+ "Content-Type": "application/json; charset=utf-8",
+ "Status": "200 OK",
+ "X-RateLimit-Limit": "5000",
+ "X-RateLimit-Remaining": "4981",
+ "X-RateLimit-Reset": "1585080826",
+ "Cache-Control": "private, max-age=60, s-maxage=60",
+ "Vary": [
+ "Accept, Authorization, Cookie, X-GitHub-OTP",
+ "Accept-Encoding, Accept, X-Requested-With"
+ ],
+ "ETag": "W/\"69bac1389aaf32d0e34be0b0242c25ea\"",
+ "X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
+ "X-Accepted-OAuth-Scopes": "",
+ "X-GitHub-Media-Type": "unknown, github.v3",
+ "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
+ "X-Frame-Options": "deny",
+ "X-Content-Type-Options": "nosniff",
+ "X-XSS-Protection": "1; mode=block",
+ "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
+ "Content-Security-Policy": "default-src 'none'",
+ "X-GitHub-Request-Id": "C6C5:5608:12339C:1FEA21:5E7A600F"
+ }
+ },
+ "uuid": "c772a03f-74cd-4858-99dc-c0a66e87fa14",
+ "persistent": true,
+ "insertionIndex": 8
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-0dc6e2.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-9-6aef5e.json
similarity index 60%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-0dc6e2.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-9-6aef5e.json
index 951d3f11ef..8bed64e452 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-8-0dc6e2.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test-9-6aef5e.json
@@ -1,5 +1,5 @@
{
- "id": "0dc6e214-4dea-4643-b425-713afaa11098",
+ "id": "6aef5e0a-1161-41dc-b53e-7c8e9d40af50",
"name": "repos_github-api-test-org_test-labels_labels_test",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/test",
@@ -12,39 +12,38 @@
},
"response": {
"status": 200,
- "body": "{\"id\":1596524803,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODAz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"000000\",\"default\":false,\"description\":\"It is dark!\"}",
+ "body": "{\"id\":1932141986,\"node_id\":\"MDU6TGFiZWwxOTMyMTQxOTg2\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test\",\"name\":\"test\",\"color\":\"123456\",\"default\":false,\"description\":\"Deprecated\"}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:23 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:28 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4832",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4980",
+ "X-RateLimit-Reset": "1585080826",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"b6be68c4a5dbc522147f58e4b1b1aed1\"",
- "Last-Modified": "Sat, 05 Oct 2019 05:21:23 GMT",
+ "ETag": "W/\"69bac1389aaf32d0e34be0b0242c25ea\"",
+ "Last-Modified": "Tue, 24 Mar 2020 19:31:28 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B941E:5AADC4:5D982853"
+ "X-GitHub-Request-Id": "C6C5:5608:1233B5:1FEA4A:5E7A6010"
}
},
- "uuid": "0dc6e214-4dea-4643-b425-713afaa11098",
+ "uuid": "6aef5e0a-1161-41dc-b53e-7c8e9d40af50",
"persistent": true,
"scenarioName": "scenario-1-repos-github-api-test-org-test-labels-labels-test",
"requiredScenarioState": "scenario-1-repos-github-api-test-org-test-labels-labels-test-2",
"newScenarioState": "scenario-1-repos-github-api-test-org-test-labels-labels-test-3",
- "insertionIndex": 8
+ "insertionIndex": 9
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-13-633a55.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-16-6ad140.json
similarity index 61%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-13-633a55.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-16-6ad140.json
index 3d5769e026..bba2117df6 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-13-633a55.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-16-6ad140.json
@@ -1,5 +1,5 @@
{
- "id": "633a55b3-25a5-4c06-9b13-448fc6026aa8",
+ "id": "6ad14098-9364-4042-aa19-c6079f947dc4",
"name": "repos_github-api-test-org_test-labels_labels_test2",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/test2",
@@ -12,36 +12,35 @@
},
"response": {
"status": 200,
- "body": "{\"id\":1596524813,\"node_id\":\"MDU6TGFiZWwxNTk2NTI0ODEz\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test2\",\"name\":\"test2\",\"color\":\"123457\",\"default\":false,\"description\":\"this is a different test\"}",
+ "body": "{\"id\":1932142041,\"node_id\":\"MDU6TGFiZWwxOTMyMTQyMDQx\",\"url\":\"https://api.github.com/repos/github-api-test-org/test-labels/labels/test2\",\"name\":\"test2\",\"color\":\"123457\",\"default\":false,\"description\":\"this is a different test\"}",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:24 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:29 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4827",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4973",
+ "X-RateLimit-Reset": "1585080825",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"cb7056d812cb1ca0296b75f5e48b462d\"",
- "Last-Modified": "Sat, 05 Oct 2019 05:21:24 GMT",
+ "ETag": "W/\"c3c0744906ceb4103444a9bf92a50cd0\"",
+ "Last-Modified": "Tue, 24 Mar 2020 19:31:29 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
+ "X-GitHub-Media-Type": "unknown, github.v3",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B9433:5AADD8:5D982854"
+ "X-GitHub-Request-Id": "C6C5:5608:12346F:1FEB7B:5E7A6011"
}
},
- "uuid": "633a55b3-25a5-4c06-9b13-448fc6026aa8",
+ "uuid": "6ad14098-9364-4042-aa19-c6079f947dc4",
"persistent": true,
- "insertionIndex": 13
+ "insertionIndex": 16
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-14-fc4fdf.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-17-7c5913.json
similarity index 63%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-14-fc4fdf.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-17-7c5913.json
index 04565c364e..5417e8ed7a 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-14-fc4fdf.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/repos_github-api-test-org_test-labels_labels_test2-17-7c5913.json
@@ -1,5 +1,5 @@
{
- "id": "fc4fdfaa-2dc1-4fa7-bf63-8bd106717b77",
+ "id": "7c5913e1-8b58-46e6-807b-e65a006e215b",
"name": "repos_github-api-test-org_test-labels_labels_test2",
"request": {
"url": "/repos/github-api-test-org/test-labels/labels/test2",
@@ -13,28 +13,26 @@
"response": {
"status": 204,
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:24 GMT",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:30 GMT",
"Status": "204 No Content",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4826",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4972",
+ "X-RateLimit-Reset": "1585080826",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "",
"X-GitHub-Media-Type": "unknown, github.v3",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "Vary": "Accept-Encoding",
- "X-GitHub-Request-Id": "FC58:3C9A:4B9435:5AADDE:5D982854"
+ "Vary": "Accept-Encoding, Accept, X-Requested-With",
+ "X-GitHub-Request-Id": "C6C5:5608:123480:1FEB9D:5E7A6011"
}
},
- "uuid": "fc4fdfaa-2dc1-4fa7-bf63-8bd106717b77",
+ "uuid": "7c5913e1-8b58-46e6-807b-e65a006e215b",
"persistent": true,
- "insertionIndex": 14
+ "insertionIndex": 17
}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/user-1-05a1d2.json b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/user-1-a78a0f.json
similarity index 60%
rename from src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/user-1-05a1d2.json
rename to src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/user-1-a78a0f.json
index 0d83826e6d..46ef9c5a2f 100644
--- a/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/user-1-05a1d2.json
+++ b/src/test/resources/org/kohsuke/github/AppTest/wiremock/testRepoLabel/mappings/user-1-a78a0f.json
@@ -1,5 +1,5 @@
{
- "id": "05a1d265-edf9-4570-b398-a3eb7d3396e1",
+ "id": "a78a0f34-4527-48ba-88f8-16c319430bc6",
"name": "user",
"request": {
"url": "/user",
@@ -12,37 +12,35 @@
},
"response": {
"status": 200,
- "bodyFileName": "user-05a1d265-edf9-4570-b398-a3eb7d3396e1.json",
+ "bodyFileName": "user-a78a0f34-4527-48ba-88f8-16c319430bc6.json",
"headers": {
- "Date": "Sat, 05 Oct 2019 05:21:21 GMT",
- "Content-Type": "application/json; charset=utf-8",
"Server": "GitHub.com",
+ "Date": "Tue, 24 Mar 2020 19:31:25 GMT",
+ "Content-Type": "application/json; charset=utf-8",
"Status": "200 OK",
"X-RateLimit-Limit": "5000",
- "X-RateLimit-Remaining": "4844",
- "X-RateLimit-Reset": "1570253246",
+ "X-RateLimit-Remaining": "4993",
+ "X-RateLimit-Reset": "1585080826",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": [
"Accept, Authorization, Cookie, X-GitHub-OTP",
- "Accept-Encoding"
+ "Accept-Encoding, Accept, X-Requested-With"
],
- "ETag": "W/\"af0c41afcacb8ceee14b7d896719c3bd\"",
- "Last-Modified": "Tue, 24 Sep 2019 19:32:29 GMT",
+ "ETag": "W/\"6cede2c36b953eb0e7f982fbcb6eb76a\"",
+ "Last-Modified": "Thu, 19 Mar 2020 19:17:12 GMT",
"X-OAuth-Scopes": "admin:org, admin:org_hook, admin:public_key, admin:repo_hook, delete_repo, gist, notifications, repo, user, write:discussion",
"X-Accepted-OAuth-Scopes": "",
"X-GitHub-Media-Type": "unknown, github.v3",
- "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type",
- "Access-Control-Allow-Origin": "*",
"Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload",
"X-Frame-Options": "deny",
"X-Content-Type-Options": "nosniff",
"X-XSS-Protection": "1; mode=block",
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
- "X-GitHub-Request-Id": "FC58:3C9A:4B93FD:5AAD9A:5D982851"
+ "X-GitHub-Request-Id": "C6C5:5608:123237:1FE7CB:5E7A600C"
}
},
- "uuid": "05a1d265-edf9-4570-b398-a3eb7d3396e1",
+ "uuid": "a78a0f34-4527-48ba-88f8-16c319430bc6",
"persistent": true,
"insertionIndex": 1
}
\ No newline at end of file