Skip to content

Commit

Permalink
convert Integer to int and wrap to latebind
Browse files Browse the repository at this point in the history
  • Loading branch information
Alaurant committed Dec 4, 2024
1 parent 4a6dcdc commit 83cd723
Show file tree
Hide file tree
Showing 37 changed files with 266 additions and 266 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/kohsuke/github/GHAutolink.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
public class GHAutolink {

private Integer id;
private int id;
private String key_prefix;
private String url_template;
private boolean is_alphanumeric;
Expand All @@ -31,7 +31,7 @@ public GHAutolink() {
*
* @return the id
*/
public Integer getId() {
public int getId() {
return id;
}

Expand Down Expand Up @@ -93,7 +93,7 @@ public void delete() throws IOException {
* the repository that owns this autolink
* @return this instance
*/
GHAutolink wrap(GHRepository owner) {
GHAutolink lateBind(GHRepository owner) {
this.owner = owner;
return this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHAutolinkBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public GHAutolink create() throws IOException {
.withUrlPath(getApiTail())
.fetch(GHAutolink.class);

return autolink.wrap(repo);
return autolink.lateBind(repo);
}

}
10 changes: 5 additions & 5 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -3389,15 +3389,15 @@ public GHAutolinkBuilder createAutolink() {
* List all autolinks of a repo (admin only).
* (https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28#get-all-autolinks-of-a-repository)
*
* @return the autolinks
* @return all autolinks in the repo
* @throws IOException
* the io exception
*/
public PagedIterable<GHAutolink> listAutolinks() throws IOException {
return root().createRequest()
.withHeader("Accept", "application/vnd.github+json")
.withUrlPath(String.format("/repos/%s/%s/autolinks", getOwnerName(), getName()))
.toIterable(GHAutolink[].class, item -> item.wrap(this));
.toIterable(GHAutolink[].class, item -> item.lateBind(this));
}

/**
Expand All @@ -3410,12 +3410,12 @@ public PagedIterable<GHAutolink> listAutolinks() throws IOException {
* @throws IOException
* the io exception
*/
public GHAutolink readAutolink(Integer autolinkId) throws IOException {
public GHAutolink readAutolink(int autolinkId) throws IOException {
return root().createRequest()
.withHeader("Accept", "application/vnd.github+json")
.withUrlPath(String.format("/repos/%s/%s/autolinks/%d", getOwnerName(), getName(), autolinkId))
.fetch(GHAutolink.class)
.wrap(this);
.lateBind(this);
}

/**
Expand All @@ -3427,7 +3427,7 @@ public GHAutolink readAutolink(Integer autolinkId) throws IOException {
* @throws IOException
* the io exception
*/
public void deleteAutolink(Integer autolinkId) throws IOException {
public void deleteAutolink(int autolinkId) throws IOException {
root().createRequest()
.method("DELETE")
.withHeader("Accept", "application/vnd.github+json")
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/kohsuke/github/GHAutolinkTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@ public void testListAllAutolinks() throws Exception {

for (GHAutolink autolink : autolinkList) {

if (autolink.getId().equals(autolink1.getId())) {
if (autolink.getId() == autolink1.getId()) {
found1 = true;
assertThat(autolink.getKeyPrefix(), equalTo(autolink1.getKeyPrefix()));
assertThat(autolink.getUrlTemplate(), equalTo(autolink1.getUrlTemplate()));
assertThat(autolink.isAlphanumeric(), equalTo(autolink1.isAlphanumeric()));
}
if (autolink.getId().equals(autolink2.getId())) {
if (autolink.getId() == autolink2.getId()) {
found2 = true;
assertThat(autolink.getKeyPrefix(), equalTo(autolink2.getKeyPrefix()));
assertThat(autolink.getUrlTemplate(), equalTo(autolink2.getUrlTemplate()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"open_issues_count": 3,
"license": null,
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [],
"visibility": "private",
"forks": 0,
"open_issues": 0,
"open_issues": 3,
"watchers": 0,
"default_branch": "main",
"permissions": {
Expand All @@ -105,7 +105,7 @@
"triage": true,
"pull": true
},
"temp_clone_token": "AJ7BLWBKSYTW3I62UR7LF2DHJ23LK",
"temp_clone_token": "AJ7BLWEW6YP5EUIYTPGKLMDHJ6O5M",
"allow_squash_merge": true,
"allow_merge_commit": true,
"allow_rebase_merge": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "98d81ba5-ebd3-49e4-84f2-75f985bc47cc",
"id": "5efad309-8a6e-4bea-b5d3-f558468cde2f",
"name": "user",
"request": {
"url": "/user",
Expand All @@ -14,7 +14,7 @@
"status": 200,
"bodyFileName": "1-user.json",
"headers": {
"Date": "Tue, 03 Dec 2024 07:38:48 GMT",
"Date": "Wed, 04 Dec 2024 00:04:58 GMT",
"Content-Type": "application/json; charset=utf-8",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With",
Expand All @@ -26,9 +26,9 @@
"X-GitHub-Media-Type": "github.v3; format=json",
"x-github-api-version-selected": "2022-11-28",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4972",
"X-RateLimit-Reset": "1733215115",
"X-RateLimit-Used": "28",
"X-RateLimit-Remaining": "4964",
"X-RateLimit-Reset": "1733273750",
"X-RateLimit-Used": "36",
"X-RateLimit-Resource": "core",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
"Access-Control-Allow-Origin": "*",
Expand All @@ -39,10 +39,10 @@
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
"Server": "github.com",
"X-GitHub-Request-Id": "AA46:260E1D:699639:7B2A52:674EB588"
"X-GitHub-Request-Id": "AB4B:259AD1:AD6A0A:CCA3BA:674F9CA9"
}
},
"uuid": "98d81ba5-ebd3-49e4-84f2-75f985bc47cc",
"uuid": "5efad309-8a6e-4bea-b5d3-f558468cde2f",
"persistent": true,
"insertionIndex": 1
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "2fcf27db-2e76-4f6f-a79f-c9519c5d91ca",
"id": "7b4379d6-4382-4589-a8de-6c179a3b878e",
"name": "repos_alaurant_github-api-test",
"request": {
"url": "/repos/Alaurant/github-api-test",
Expand All @@ -14,21 +14,21 @@
"status": 200,
"bodyFileName": "2-r_a_github-api-test.json",
"headers": {
"Date": "Tue, 03 Dec 2024 07:38:49 GMT",
"Date": "Wed, 04 Dec 2024 00:04:58 GMT",
"Content-Type": "application/json; charset=utf-8",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With",
"ETag": "W/\"7e65dfd17dae8b0f5999ecf48b16504e24747c234146f1413401d052558f8f01\"",
"ETag": "W/\"94ad6f4d71086bda8c2640d1ba979adc705c9465218c4ca1e55dc20011962ee7\"",
"Last-Modified": "Thu, 28 Nov 2024 23:44:55 GMT",
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
"github-authentication-token-expiration": "2025-02-25 04:28:56 UTC",
"X-GitHub-Media-Type": "github.v3; format=json",
"x-github-api-version-selected": "2022-11-28",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4970",
"X-RateLimit-Reset": "1733215115",
"X-RateLimit-Used": "30",
"X-RateLimit-Remaining": "4962",
"X-RateLimit-Reset": "1733273750",
"X-RateLimit-Used": "38",
"X-RateLimit-Resource": "core",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
"Access-Control-Allow-Origin": "*",
Expand All @@ -39,10 +39,10 @@
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
"Server": "github.com",
"X-GitHub-Request-Id": "AA4A:275BE1:5DAE86:6CDB96:674EB589"
"X-GitHub-Request-Id": "AB4F:261CA8:B9F4DA:D92EA2:674F9CAA"
}
},
"uuid": "2fcf27db-2e76-4f6f-a79f-c9519c5d91ca",
"uuid": "7b4379d6-4382-4589-a8de-6c179a3b878e",
"persistent": true,
"insertionIndex": 2
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "8347f3dd-5be0-4a28-b01e-9e1405b46087",
"id": "72c0b399-ca4c-4934-bb37-204fb2eee65c",
"name": "repos_alaurant_github-api-test_autolinks",
"request": {
"url": "/repos/Alaurant/github-api-test/autolinks",
Expand All @@ -19,22 +19,22 @@
},
"response": {
"status": 201,
"body": "{\"id\":6208157,\"key_prefix\":\"EXAMPLE-\",\"url_template\":\"https://example.com/TICKET?q=<num>\",\"is_alphanumeric\":true}",
"body": "{\"id\":6214215,\"key_prefix\":\"EXAMPLE-\",\"url_template\":\"https://example.com/TICKET?q=<num>\",\"is_alphanumeric\":true}",
"headers": {
"Date": "Tue, 03 Dec 2024 07:38:49 GMT",
"Date": "Wed, 04 Dec 2024 00:04:59 GMT",
"Content-Type": "application/json; charset=utf-8",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With",
"ETag": "\"a36001f0fa64730b7452b1bc25ccdf888f1db06d9933656b99e2cff7b4e48b3a\"",
"ETag": "\"5957fc62ce793c3c3f204807841c0322d186ec5693b11e746a2a773ff4814345\"",
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
"github-authentication-token-expiration": "2025-02-25 04:28:56 UTC",
"X-GitHub-Media-Type": "github.v3; format=json",
"x-github-api-version-selected": "2022-11-28",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4969",
"X-RateLimit-Reset": "1733215115",
"X-RateLimit-Used": "31",
"X-RateLimit-Remaining": "4961",
"X-RateLimit-Reset": "1733273750",
"X-RateLimit-Used": "39",
"X-RateLimit-Resource": "core",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
"Access-Control-Allow-Origin": "*",
Expand All @@ -45,10 +45,10 @@
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
"Server": "github.com",
"X-GitHub-Request-Id": "AA4D:261CA8:67BCCF:795107:674EB589"
"X-GitHub-Request-Id": "AB50:25FB34:AFAC50:CEE61E:674F9CAB"
}
},
"uuid": "8347f3dd-5be0-4a28-b01e-9e1405b46087",
"uuid": "72c0b399-ca4c-4934-bb37-204fb2eee65c",
"persistent": true,
"insertionIndex": 3
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"id": "e3c2362c-a973-4ad6-91fa-5efe8aa8c05c",
"name": "repos_alaurant_github-api-test_autolinks_6208157",
"id": "e6f3b690-7bba-4fca-af09-bb9c36c226c2",
"name": "repos_alaurant_github-api-test_autolinks_6214215",
"request": {
"url": "/repos/Alaurant/github-api-test/autolinks/6208157",
"url": "/repos/Alaurant/github-api-test/autolinks/6214215",
"method": "DELETE",
"headers": {
"Accept": {
Expand All @@ -13,16 +13,16 @@
"response": {
"status": 204,
"headers": {
"Date": "Tue, 03 Dec 2024 07:38:50 GMT",
"Date": "Wed, 04 Dec 2024 00:05:00 GMT",
"X-OAuth-Scopes": "admin:gpg_key, admin:org, admin:org_hook, admin:public_key, admin:repo_hook, admin:ssh_signing_key, audit_log, codespace, delete:packages, delete_repo, gist, project, read:packages, repo, user, workflow, write:discussion",
"X-Accepted-OAuth-Scopes": "repo",
"github-authentication-token-expiration": "2025-02-25 04:28:56 UTC",
"X-GitHub-Media-Type": "github.v3; format=json",
"x-github-api-version-selected": "2022-11-28",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4968",
"X-RateLimit-Reset": "1733215115",
"X-RateLimit-Used": "32",
"X-RateLimit-Remaining": "4960",
"X-RateLimit-Reset": "1733273750",
"X-RateLimit-Used": "40",
"X-RateLimit-Resource": "core",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
"Access-Control-Allow-Origin": "*",
Expand All @@ -34,10 +34,10 @@
"Content-Security-Policy": "default-src 'none'",
"Vary": "Accept-Encoding, Accept, X-Requested-With",
"Server": "github.com",
"X-GitHub-Request-Id": "AA51:25CB59:664A36:77DE74:674EB589"
"X-GitHub-Request-Id": "AB54:25C9E5:B594DE:D4CE98:674F9CAC"
}
},
"uuid": "e3c2362c-a973-4ad6-91fa-5efe8aa8c05c",
"uuid": "e6f3b690-7bba-4fca-af09-bb9c36c226c2",
"persistent": true,
"insertionIndex": 4
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "46498eb6-0cf4-48a7-ae76-a13a64665a7d",
"id": "4e99e7cf-51c0-42eb-aac3-11c71370da7d",
"name": "repos_alaurant_github-api-test_autolinks",
"request": {
"url": "/repos/Alaurant/github-api-test/autolinks",
Expand All @@ -14,7 +14,7 @@
"status": 200,
"body": "[]",
"headers": {
"Date": "Tue, 03 Dec 2024 07:38:50 GMT",
"Date": "Wed, 04 Dec 2024 00:05:00 GMT",
"Content-Type": "application/json; charset=utf-8",
"Cache-Control": "private, max-age=60, s-maxage=60",
"Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With",
Expand All @@ -25,9 +25,9 @@
"X-GitHub-Media-Type": "github.v3; format=json",
"x-github-api-version-selected": "2022-11-28",
"X-RateLimit-Limit": "5000",
"X-RateLimit-Remaining": "4967",
"X-RateLimit-Reset": "1733215115",
"X-RateLimit-Used": "33",
"X-RateLimit-Remaining": "4959",
"X-RateLimit-Reset": "1733273750",
"X-RateLimit-Used": "41",
"X-RateLimit-Resource": "core",
"Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset",
"Access-Control-Allow-Origin": "*",
Expand All @@ -38,10 +38,10 @@
"Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin",
"Content-Security-Policy": "default-src 'none'",
"Server": "github.com",
"X-GitHub-Request-Id": "AA52:25C9E5:68E849:7A7C9A:674EB58A"
"X-GitHub-Request-Id": "AB58:2616CE:B40D89:D3475B:674F9CAC"
}
},
"uuid": "46498eb6-0cf4-48a7-ae76-a13a64665a7d",
"uuid": "4e99e7cf-51c0-42eb-aac3-11c71370da7d",
"persistent": true,
"insertionIndex": 5
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"open_issues_count": 3,
"license": null,
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [],
"visibility": "private",
"forks": 0,
"open_issues": 0,
"open_issues": 3,
"watchers": 0,
"default_branch": "main",
"permissions": {
Expand All @@ -105,7 +105,7 @@
"triage": true,
"pull": true
},
"temp_clone_token": "AJ7BLWEMCYWAPCY2SLWSCG3HJ23KQ",
"temp_clone_token": "AJ7BLWHAAPA4X3QOA36CYTLHJ6O4S",
"allow_squash_merge": true,
"allow_merge_commit": true,
"allow_rebase_merge": true,
Expand Down
Loading

0 comments on commit 83cd723

Please sign in to comment.