Repository: hub4j/github-api (java)

Issue:
Any plan to support getting field suspended_at for get user api?
github api response includes filed `suspended_at`, which can be used to check if user is suspended or not I think
#### sample response at github doc
```
{
      "id": 3,
      "account": {
        "login": "octocat",
        "id": 2,
        "node_id": "MDQ6VXNlcjE=",
        "avatar_url": "https://github.com/images/error/octocat_happy.gif",
        "gravatar_id": "",
        "url": "https://api.github.com/users/octocat",
        "html_url": "https://github.com/octocat",
        "followers_url": "https://api.github.com/users/octocat/followers",
        "following_url": "https://api.github.com/users/octocat/following{/other_user}",
        "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
        "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
        "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
        "organizations_url": "https://api.github.com/users/octocat/orgs",
        "repos_url": "https://api.github.com/users/octocat/repos",
        "events_url": "https://api.github.com/users/octocat/events{/privacy}",
        "received_events_url": "https://api.github.com/users/octocat/received_events",
        "type": "User",
        "site_admin": false
      },
      "access_tokens_url": "https://api.github.com/app/installations/1/access_tokens",
      "repositories_url": "https://api.github.com/installation/repositories",
      "html_url": "https://github.com/organizations/github/settings/installations/1",
      "app_id": 1,
      "target_id": 1,
      "target_type": "Organization",
      "permissions": {
        "checks": "write",
        "metadata": "read",
        "contents": "read"
      },
      "events": [
        "push",
        "pull_request"
      ],
      "single_file_name": "config.yaml",
      "has_multiple_single_files": true,
      "single_file_paths": [
        "config.yml",
        ".github/issue_TEMPLATE.md"
      ],
      "repository_selection": "all",
      "created_at": "2017-07-08T16:18:44-04:00",
      "updated_at": "2017-07-08T16:18:44-04:00",
      "app_slug": "github-actions",
      "suspended_at": null,
      "suspended_by": null
    }
```
Any plan to support `getSuspendedAt` like `getUpdatedAt`?
https://github-api.kohsuke.org/apidocs/org/kohsuke/github/GHPerson.html#getUpdatedAt()

Pull request description:
add GHUser#suspendedAt
# Description
Add `GHUser#suspendedAt` to check whether user is suspended or not.
Fix #1796.

# Before submitting a PR:

- [x] Changes must not break binary backwards compatibility. If you are unclear on how to make the change you think is needed while maintaining backward compatibility, [CONTRIBUTING.md](CONTRIBUTING.md) for details.
- [x] Add JavaDocs and other comments explaining the behavior. 
- [x] When adding or updating methods that fetch entities, add `@link` JavaDoc entries to the relevant documentation on https://docs.github.com/en/rest . 
- [x] Add tests that cover any added or changed code. This generally requires capturing snapshot test data. See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
- [x] Run `mvn -D enable-ci clean install site` locally. If this command doesn't succeed, your change will not pass CI.
- [x] Push your changes to a branch other than `main`. You will create your PR from that branch.

# When creating a PR: 

- [x] Fill in the "Description" above with clear summary of the changes. This includes:
  - [x] If this PR fixes one or more issues, include "Fixes #<issue number>" lines for each issue. 
  - [x] Provide links to relevant documentation on https://docs.github.com/en/rest where possible. If not including links, explain why not.
- [x] All lines of new code should be covered by tests as reported by code coverage. Any lines that are not covered must have PR comments explaining why they cannot be covered. For example, "Reaching this particular exception is hard and is not a particular common scenario."
- [x] Enable "Allow edits from maintainers".


Patch:
diff --git a/src/main/java/org/kohsuke/github/GHUser.java b/src/main/java/org/kohsuke/github/GHUser.java
index d28ab697d..b072fc52c 100644
--- a/src/main/java/org/kohsuke/github/GHUser.java
+++ b/src/main/java/org/kohsuke/github/GHUser.java
@@ -39,6 +39,9 @@ public class GHUser extends GHPerson {
     /** The ldap dn. */
     protected String ldap_dn;
 
+    /** The suspended_at */
+    private String suspendedAt;
+
     /**
      * Gets keys.
      *
@@ -264,6 +267,17 @@ public class GHUser extends GHPerson {
         return Optional.ofNullable(ldap_dn);
     }
 
+    /**
+     * When was this user suspended?.
+     *
+     * @return updated date
+     * @throws IOException
+     *             on error
+     */
+    public Date getSuspendedAt() throws IOException {
+        return GitHubClient.parseDate(suspendedAt);
+    }
+
     /**
      * Hash code.
      *


Test patch:
diff --git a/src/test/java/org/kohsuke/github/GHUserTest.java b/src/test/java/org/kohsuke/github/GHUserTest.java
index 61a89a238..5e67bf645 100644
--- a/src/test/java/org/kohsuke/github/GHUserTest.java
+++ b/src/test/java/org/kohsuke/github/GHUserTest.java
@@ -3,6 +3,7 @@ package org.kohsuke.github;
 import org.junit.Test;
 
 import java.io.IOException;
+import java.time.Instant;
 import java.util.*;
 
 import static org.hamcrest.CoreMatchers.*;
@@ -227,4 +228,20 @@ public class GHUserTest extends AbstractGitHubWireMockTest {
         GHUser u = gitHub.getUser("kartikpatodi");
         assertThat(u.getLdapDn().orElse(""), not(emptyString()));
     }
+
+    /**
+     * Verify suspended_at.
+     *
+     * @throws IOException
+     *             Signals that an I/O exception has occurred.
+     */
+    @Test
+    public void verifySuspendedAt() throws IOException {
+        GHUser normal = gitHub.getUser("normal");
+        assertThat(normal.getSuspendedAt(), is(nullValue()));
+
+        GHUser suspended = gitHub.getUser("suspended");
+        Date suspendedAt = new Date(Instant.parse("2024-08-08T00:00:00Z").toEpochMilli());
+        assertThat(suspended.getSuspendedAt(), equalTo(suspendedAt));
+    }
 }
diff --git a/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/__files/1-users_normal.json b/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/__files/1-users_normal.json
new file mode 100644
index 000000000..11ffa2db9
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/__files/1-users_normal.json
@@ -0,0 +1,35 @@
+{
+  "login": "kartikpatodi",
+  "id": 23272937,
+  "node_id": "MDQ6VXNlcjIzMjcyOTM3",
+  "avatar_url": "https://avatars.githubusercontent.com/u/23272937?v=4",
+  "gravatar_id": "",
+  "url": "https://api.github.com/users/kartikpatodi",
+  "html_url": "https://github.com/kartikpatodi",
+  "followers_url": "https://api.github.com/users/kartikpatodi/followers",
+  "following_url": "https://api.github.com/users/kartikpatodi/following{/other_user}",
+  "gists_url": "https://api.github.com/users/kartikpatodi/gists{/gist_id}",
+  "starred_url": "https://api.github.com/users/kartikpatodi/starred{/owner}{/repo}",
+  "subscriptions_url": "https://api.github.com/users/kartikpatodi/subscriptions",
+  "organizations_url": "https://api.github.com/users/kartikpatodi/orgs",
+  "repos_url": "https://api.github.com/users/kartikpatodi/repos",
+  "events_url": "https://api.github.com/users/kartikpatodi/events{/privacy}",
+  "received_events_url": "https://api.github.com/users/kartikpatodi/received_events",
+  "type": "User",
+  "ldap_dn": "CN=kartikpatodi,OU=Users,DC=github,DC=com",
+  "site_admin": false,
+  "name": "Kartik Patodi",
+  "company": null,
+  "blog": "",
+  "location": "Nimbahera, Rajasthan, India",
+  "email": null,
+  "hireable": null,
+  "bio": null,
+  "twitter_username": "kartikpatodi",
+  "public_repos": 12,
+  "public_gists": 0,
+  "followers": 2,
+  "following": 7,
+  "created_at": "2016-11-05T05:01:41Z",
+  "updated_at": "2022-02-24T13:54:34Z"
+}
\ No newline at end of file
diff --git a/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/__files/1-users_suspended.json b/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/__files/1-users_suspended.json
new file mode 100644
index 000000000..74546e01f
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/__files/1-users_suspended.json
@@ -0,0 +1,36 @@
+{
+  "login": "kartikpatodi",
+  "id": 23272937,
+  "node_id": "MDQ6VXNlcjIzMjcyOTM3",
+  "avatar_url": "https://avatars.githubusercontent.com/u/23272937?v=4",
+  "gravatar_id": "",
+  "url": "https://api.github.com/users/kartikpatodi",
+  "html_url": "https://github.com/kartikpatodi",
+  "followers_url": "https://api.github.com/users/kartikpatodi/followers",
+  "following_url": "https://api.github.com/users/kartikpatodi/following{/other_user}",
+  "gists_url": "https://api.github.com/users/kartikpatodi/gists{/gist_id}",
+  "starred_url": "https://api.github.com/users/kartikpatodi/starred{/owner}{/repo}",
+  "subscriptions_url": "https://api.github.com/users/kartikpatodi/subscriptions",
+  "organizations_url": "https://api.github.com/users/kartikpatodi/orgs",
+  "repos_url": "https://api.github.com/users/kartikpatodi/repos",
+  "events_url": "https://api.github.com/users/kartikpatodi/events{/privacy}",
+  "received_events_url": "https://api.github.com/users/kartikpatodi/received_events",
+  "type": "User",
+  "ldap_dn": "CN=kartikpatodi,OU=Users,DC=github,DC=com",
+  "site_admin": false,
+  "name": "Kartik Patodi",
+  "company": null,
+  "blog": "",
+  "location": "Nimbahera, Rajasthan, India",
+  "email": null,
+  "hireable": null,
+  "bio": null,
+  "twitter_username": "kartikpatodi",
+  "public_repos": 12,
+  "public_gists": 0,
+  "followers": 2,
+  "following": 7,
+  "created_at": "2016-11-05T05:01:41Z",
+  "updated_at": "2022-02-24T13:54:34Z",
+  "suspended_at": "2024-08-08T00:00:00Z"
+}
diff --git a/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/mappings/1-users_normal.json b/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/mappings/1-users_normal.json
new file mode 100644
index 000000000..c9cdc7013
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/mappings/1-users_normal.json
@@ -0,0 +1,41 @@
+{
+  "name": "users_normal",
+  "request": {
+    "url": "/users/normal",
+    "method": "GET",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github+json"
+      }
+    }
+  },
+  "response": {
+    "status": 200,
+    "bodyFileName": "1-users_normal.json",
+    "headers": {
+      "server": "GitHub.com",
+      "date": "Mon, 04 Apr 2022 19:10:00 GMT",
+      "content-type": "application/json; charset=utf-8",
+      "status": "200 OK",
+      "cache-control": "public, max-age=60, s-maxage=60",
+      "vary": "Accept, Accept-Encoding, Accept, X-Requested-With",
+      "etag": "W/\"960f568b7a2dd1591a136e36748cc44e\"",
+      "last-modified": "Thu, 24 Feb 2022 13:54:34 GMT",
+      "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-Ratelimit-Limit": "60",
+      "X-Ratelimit-Remaining": "47",
+      "X-Ratelimit-Reset": "1649100347",
+      "Accept-Ranges": "bytes",
+      "X-GitHub-Request-Id": "45F4:0D15:1B4EE4:373E4C:624B4288"
+    }
+  },
+  "uuid": "39860a04-002b-45da-aae7-70c97031c79e",
+  "persistent": true,
+  "insertionIndex": 1
+}
diff --git a/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/mappings/1-users_suspended.json b/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/mappings/1-users_suspended.json
new file mode 100644
index 000000000..15654a081
--- /dev/null
+++ b/src/test/resources/org/kohsuke/github/GHUserTest/wiremock/verifySuspendedAt/mappings/1-users_suspended.json
@@ -0,0 +1,41 @@
+{
+  "name": "users_suspended",
+  "request": {
+    "url": "/users/suspended",
+    "method": "GET",
+    "headers": {
+      "Accept": {
+        "equalTo": "application/vnd.github+json"
+      }
+    }
+  },
+  "response": {
+    "status": 200,
+    "bodyFileName": "1-users_suspended.json",
+    "headers": {
+      "server": "GitHub.com",
+      "date": "Mon, 04 Apr 2022 19:10:00 GMT",
+      "content-type": "application/json; charset=utf-8",
+      "status": "200 OK",
+      "cache-control": "public, max-age=60, s-maxage=60",
+      "vary": "Accept, Accept-Encoding, Accept, X-Requested-With",
+      "etag": "W/\"960f568b7a2dd1591a136e36748cc44e\"",
+      "last-modified": "Thu, 24 Feb 2022 13:54:34 GMT",
+      "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-Ratelimit-Limit": "60",
+      "X-Ratelimit-Remaining": "47",
+      "X-Ratelimit-Reset": "1649100347",
+      "Accept-Ranges": "bytes",
+      "X-GitHub-Request-Id": "45F4:0D15:1B4EE4:373E4C:624B4288"
+    }
+  },
+  "uuid": "39860a04-002b-45da-aae7-70c97031c79e",
+  "persistent": true,
+  "insertionIndex": 1
+}