Class GHOrganisation
java.lang.Object
io.github.coho04.githubapi.bases.GHBase
io.github.coho04.githubapi.bases.ClassBase
io.github.coho04.githubapi.bases.EntityBase
io.github.coho04.githubapi.entities.GHOrganisation
- All Implemented Interfaces:
HttpRequestInterface
,JSONHelper
Represents a GitHub organization.
This class provides methods and properties to access information about an organization on GitHub.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
JSONHelper.JSONToObject<T>
-
Constructor Summary
ConstructorsConstructorDescriptionGHOrganisation
(Github github, org.json.JSONObject jsonObject, String name) Constructs a new GHOrganisation instance with the provided GitHub instance, JSON object, and name. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a member to the organization.Creates a hook in the organization.Creates a project in the organization.createProject
(String name, String body) Creates a project in the organization.Creates a team in the organization.createTeam
(String name) Creates a team in the organization.void
deleteHook
(Long id) Deletes a hook in the organization by its ID.boolean
deleteRepositoryFromSecret
(String secretName, String repoId) Deletes a repository from a specific secret in the organization by secret name and repository ID.boolean
deleteSecret
(String name) Deletes a specific secret in the organization by its name.findRepositoryByName
(String name) Finds a repository by its name within the organization.findTeamByName
(String name) Finds a team by its name within the organization.findTeamBySlug
(String slug) Finds a team by its slug within the organization.Returns the date and time when the organization was archived.Returns the billing email of the organization.getBlog()
Returns the blog URL of the organization.int
Returns the total active cache usage count for the organization.int
Returns the total active cache usage size in bytes for the organization.int
Returns the number of collaborators in the organization.Returns the company associated with the organization.Returns the creation date and time of the organization.Returns the default repository permission for the organization.Returns the description of the organization.long
Returns the disk usage of the organization.getEmail()
Returns the email of the organization.int
Returns the number of followers of the organization.int
Returns the number of following of the organization.Returns the GitHub instance associated with this organization.Returns the given name of the organization.getHook
(int id) Returns a specific hook in the organization by its ID.Returns a specific hook in the organization by its ID.getHooks()
Returns a list of hooks in the organization.Returns the URL for fetching hooks of the organization.Returns the URL for fetching issues of the organization.Returns the location of the organization.Returns the allowed repository creation type for members of the organization.Returns the URL for fetching members of the organization.getName()
Returns the name of the organization.static GHOrganisation
getOrganisation
(Github github, String name) Fetches a GitHub organization by its name.int
Returns the number of owned private repositories in the organization.getPackage
(String name, GHPackageType packageType) Returns a specific package in the organization by its name and package type.getPlan()
Returns the plan associated with the organization.int
Returns the number of private gists in the organization.int
Returns the number of public gists of the organization.Returns the public key for secrets in the organization.Returns the URL for fetching public members of the organization.int
Returns the number of public repositories of the organization.Returns a list of pull requests in the organization.Returns a list of repositories within the organization.Returns a list of repositories with open pull requests in the organization.Returns a specific secret in the organization by its name.Returns the custom link for secret scanning push protection.getTeams()
Returns a list of teams within the organization.int
Returns the total number of private repositories in the organization.Returns the Twitter username of the organization.Returns the last updated date and time of the organization.getVariable
(String name) Returns a specific variable in the organization by its name.Checks if a user is a member of the organization.hasPublicMember
(GHUser user) Checks if a user is a public member of the organization.boolean
Returns whether advanced security is enabled for new repositories in the organization.boolean
Returns whether Dependabot alerts are enabled for new repositories in the organization.boolean
Returns whether Dependabot security updates are enabled for new repositories in the organization.boolean
Returns whether the dependency graph is enabled for new repositories in the organization.boolean
Returns whether the organization has organization projects enabled.boolean
Returns whether the organization has repository projects enabled.boolean
Returns whether members can create internal repositories in the organization.boolean
Returns whether members can create pages in the organization.boolean
Returns whether members can create private pages in the organization.boolean
Returns whether members can create private repositories in the organization.boolean
Returns whether members can create public pages in the organization.boolean
Returns whether members can create public repositories in the organization.boolean
Returns whether members can create repositories in the organization.boolean
Returns whether members can fork private repositories in the organization.boolean
Returns whether secret scanning is enabled for new repositories in the organization.boolean
Returns whether the custom link for secret scanning push protection is enabled.boolean
Returns whether secret scanning push protection is enabled for new repositories in the organization.boolean
Returns whether secret scanning validity checks are enabled.boolean
Returns whether two-factor authentication is required for members of the organization.boolean
Returns whether the organization is verified.boolean
Returns whether web commit signoff is required for the organization.Returns a list of Docker conflict packages in the organization.Returns a list of events in the organization.Returns a list of members of the organization.Returns a list of outside collaborators of the organization.listPackages
(GHPackageType packageType) Returns a list of packages in the organization filtered by package type.Returns a list of projects in the organization.Returns a list of public members of the organization.Returns a list of repository caches in the organization.Returns a list of repositories associated with a specific secret in the organization.Returns a list of secrets in the organization.Returns a list of secret scanning alerts in the organization.Returns a list of teams within the organization.Returns a list of repositories associated with a specific variable in the organization.Returns a list of variables in the organization.void
removeMember
(@NotNull GHUser user) Removes a member from the organization.org.json.JSONObject
Converts this organization instance to a JSONObject.Methods inherited from class io.github.coho04.githubapi.bases.EntityBase
getAvatarUrl, getLogin, getReposUrl, getType, getUsername
Methods inherited from class io.github.coho04.githubapi.bases.ClassBase
getEventsUrl, getHtmlUrl, getId, getNodeId, getUrl
Methods inherited from class io.github.coho04.githubapi.bases.GHBase
fetchArrayData, fetchArrayData, fetchPaginatedData, fetchPaginatedData, fetchPaginatedData, getBaseUrl
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.coho04.githubapi.interfaces.HttpRequestInterface
extractNextPageUrl, sendDeleteRequest, sendDeleteRequestWithResponseCode, sendGetRequest, sendGetRequestWithLinkHeader, sendGetRequestWithResponseCode, sendPatchRequest, sendPostRequest, sendPutRequest
Methods inherited from interface io.github.coho04.githubapi.interfaces.JSONHelper
getArrayOrNull, getBooleanOrNull, getIntOrNull, getJSONArrayToStringList, getJSONObjectOrNull, getLocalDateOrNull, getLongOrNull, getStringOrNull
-
Constructor Details
-
GHOrganisation
Constructs a new GHOrganisation instance with the provided GitHub instance, JSON object, and name.- Parameters:
github
- the GitHub instancejsonObject
- the JSON object containing the organization dataname
- the name of the organization
-
-
Method Details
-
getOrganisation
Fetches a GitHub organization by its name.- Parameters:
github
- the GitHub instancename
- the name of the organization to fetch- Returns:
- a GHOrganisation instance representing the fetched organization
-
findRepositoryByName
Finds a repository by its name within the organization.- Parameters:
name
- the name of the repository to find- Returns:
- a GHRepository instance representing the found repository
-
getRepositories
Returns a list of repositories within the organization.- Returns:
- a list of GHRepository instances
-
getName
Returns the name of the organization.- Returns:
- the name of the organization
-
getDescription
Returns the description of the organization.- Returns:
- the description of the organization
-
getGithub
Returns the GitHub instance associated with this organization.- Returns:
- the GitHub instance
-
getCompany
Returns the company associated with the organization.- Returns:
- the company associated with the organization
-
getHooksUrl
Returns the URL for fetching hooks of the organization.- Returns:
- the hooks URL
-
getIssuesUrl
Returns the URL for fetching issues of the organization.- Returns:
- the issues URL
-
getMembersUrl
Returns the URL for fetching members of the organization.- Returns:
- the members URL
-
getPublicMembersUrl
Returns the URL for fetching public members of the organization.- Returns:
- the public members URL
-
getFollowers
public int getFollowers()Returns the number of followers of the organization.- Returns:
- the number of followers
-
getBlog
Returns the blog URL of the organization.- Returns:
- the blog URL
-
getFollowing
public int getFollowing()Returns the number of following of the organization.- Returns:
- the number of following
-
getPublicGists
public int getPublicGists()Returns the number of public gists of the organization.- Returns:
- the number of public gists
-
getPublicRepos
public int getPublicRepos()Returns the number of public repositories of the organization.- Returns:
- the number of public repositories
-
getEmail
Returns the email of the organization.- Returns:
- the email of the organization
-
getArchivedAt
Returns the date and time when the organization was archived.- Returns:
- the archived date and time
-
getLocation
Returns the location of the organization.- Returns:
- the location of the organization
-
getCreatedAt
Returns the creation date and time of the organization.- Returns:
- the creation date and time
-
getTwitterUsername
Returns the Twitter username of the organization.- Returns:
- the Twitter username
-
getUpdatedAt
Returns the last updated date and time of the organization.- Returns:
- the last updated date and time
-
isHasOrganizationProjects
public boolean isHasOrganizationProjects()Returns whether the organization has organization projects enabled.- Returns:
- true if organization projects are enabled, false otherwise
-
isHasRepositoryProjects
public boolean isHasRepositoryProjects()Returns whether the organization has repository projects enabled.- Returns:
- true if repository projects are enabled, false otherwise
-
isVerified
public boolean isVerified()Returns whether the organization is verified.- Returns:
- true if the organization is verified, false otherwise
-
getPlan
Returns the plan associated with the organization.- Returns:
- the plan associated with the organization
-
getCollaborators
public int getCollaborators()Returns the number of collaborators in the organization.- Returns:
- the number of collaborators
-
getOwnedPrivateRepos
public int getOwnedPrivateRepos()Returns the number of owned private repositories in the organization.- Returns:
- the number of owned private repositories
-
getPrivateGists
public int getPrivateGists()Returns the number of private gists in the organization.- Returns:
- the number of private gists
-
getTotalPrivateRepos
public int getTotalPrivateRepos()Returns the total number of private repositories in the organization.- Returns:
- the total number of private repositories
-
getDiskUsage
public long getDiskUsage()Returns the disk usage of the organization.- Returns:
- the disk usage
-
getBillingEmail
Returns the billing email of the organization.- Returns:
- the billing email
-
getDefaultRepositoryPermission
Returns the default repository permission for the organization.- Returns:
- the default repository permission
-
getMembersAllowedRepositoryCreationType
Returns the allowed repository creation type for members of the organization.- Returns:
- the allowed repository creation type for members
-
getSecretScanningPushProtectionCustomLink
Returns the custom link for secret scanning push protection.- Returns:
- the custom link for secret scanning push protection
-
isAdvancedSecurityEnabledForNewRepositories
public boolean isAdvancedSecurityEnabledForNewRepositories()Returns whether advanced security is enabled for new repositories in the organization.- Returns:
- true if advanced security is enabled for new repositories, false otherwise
-
isDependabotAlertsEnabledForNewRepositories
public boolean isDependabotAlertsEnabledForNewRepositories()Returns whether Dependabot alerts are enabled for new repositories in the organization.- Returns:
- true if Dependabot alerts are enabled for new repositories, false otherwise
-
isDependabotSecurityUpdatesEnabledForNewRepositories
public boolean isDependabotSecurityUpdatesEnabledForNewRepositories()Returns whether Dependabot security updates are enabled for new repositories in the organization.- Returns:
- true if Dependabot security updates are enabled for new repositories, false otherwise
-
isDependencyGraphEnabledForNewRepositories
public boolean isDependencyGraphEnabledForNewRepositories()Returns whether the dependency graph is enabled for new repositories in the organization.- Returns:
- true if the dependency graph is enabled for new repositories, false otherwise
-
isMembersCanCreateInternalRepositories
public boolean isMembersCanCreateInternalRepositories()Returns whether members can create internal repositories in the organization.- Returns:
- true if members can create internal repositories, false otherwise
-
isMembersCanCreatePages
public boolean isMembersCanCreatePages()Returns whether members can create pages in the organization.- Returns:
- true if members can create pages, false otherwise
-
isMembersCanCreatePrivatePages
public boolean isMembersCanCreatePrivatePages()Returns whether members can create private pages in the organization.- Returns:
- true if members can create private pages, false otherwise
-
isMembersCanCreatePrivateRepositories
public boolean isMembersCanCreatePrivateRepositories()Returns whether members can create private repositories in the organization.- Returns:
- true if members can create private repositories, false otherwise
-
isMembersCanCreatePublicPages
public boolean isMembersCanCreatePublicPages()Returns whether members can create public pages in the organization.- Returns:
- true if members can create public pages, false otherwise
-
isMembersCanCreatePublicRepositories
public boolean isMembersCanCreatePublicRepositories()Returns whether members can create public repositories in the organization.- Returns:
- true if members can create public repositories, false otherwise
-
isMembersCanCreateRepositories
public boolean isMembersCanCreateRepositories()Returns whether members can create repositories in the organization.- Returns:
- true if members can create repositories, false otherwise
-
isMembersCanForkPrivateRepositories
public boolean isMembersCanForkPrivateRepositories()Returns whether members can fork private repositories in the organization.- Returns:
- true if members can fork private repositories, false otherwise
-
isSecretScanningEnabledForNewRepositories
public boolean isSecretScanningEnabledForNewRepositories()Returns whether secret scanning is enabled for new repositories in the organization.- Returns:
- true if secret scanning is enabled for new repositories, false otherwise
-
isSecretScanningPushProtectionCustomLinkEnabled
public boolean isSecretScanningPushProtectionCustomLinkEnabled()Returns whether the custom link for secret scanning push protection is enabled.- Returns:
- true if the custom link for secret scanning push protection is enabled, false otherwise
-
isSecretScanningPushProtectionEnabledForNewRepositories
public boolean isSecretScanningPushProtectionEnabledForNewRepositories()Returns whether secret scanning push protection is enabled for new repositories in the organization.- Returns:
- true if secret scanning push protection is enabled for new repositories, false otherwise
-
isSecretScanningValidityChecksEnabled
public boolean isSecretScanningValidityChecksEnabled()Returns whether secret scanning validity checks are enabled.- Returns:
- true if secret scanning validity checks are enabled, false otherwise
-
isTwoFactorRequirementEnabled
public boolean isTwoFactorRequirementEnabled()Returns whether two-factor authentication is required for members of the organization.- Returns:
- true if two-factor authentication is required, false otherwise
-
isWebCommitSignoffRequired
public boolean isWebCommitSignoffRequired()Returns whether web commit signoff is required for the organization.- Returns:
- true if web commit signoff is required, false otherwise
-
getGivenName
Returns the given name of the organization.- Returns:
- the given name of the organization
-
toJSONObject
public org.json.JSONObject toJSONObject()Converts this organization instance to a JSONObject.- Overrides:
toJSONObject
in classEntityBase
- Returns:
- a JSONObject representation of this organization
-
getTeams
Returns a list of teams within the organization.- Returns:
- a list of GHTeam instances
-
listTeams
Returns a list of teams within the organization.- Returns:
- a list of GHTeam instances
-
findTeamByName
Finds a team by its name within the organization.- Parameters:
name
- the name of the team to find- Returns:
- a GHTeam instance representing the found team
-
findTeamBySlug
Finds a team by its slug within the organization.- Parameters:
slug
- the slug of the team to find- Returns:
- a GHTeam instance representing the found team
-
hasMember
Checks if a user is a member of the organization.- Parameters:
user
- the user to check- Returns:
- true if the user is a member, false otherwise
-
addMember
Adds a member to the organization. This method sends a POST request to the GitHub API to add a member to the organization. The member is identified by their email, and the role they should have in the organization is specified. The member is also added to specific teams within the organization, identified by their IDs.- Parameters:
email
- the email of the member to addrole
- the role the member should have in the organizationteamIds
- the IDs of the teams the member should be added to
-
removeMember
Removes a member from the organization.- Parameters:
user
- the user to remove
-
hasPublicMember
Checks if a user is a public member of the organization.- Parameters:
user
- the user to check- Returns:
- true if the user is a public member, false otherwise
-
listMembers
Returns a list of members of the organization.- Returns:
- a list of GHUser instances
-
listPublicMembers
Returns a list of public members of the organization.- Returns:
- a list of GHUser instances
-
listOutsideCollaborators
Returns a list of outside collaborators of the organization.- Returns:
- a list of GHUser instances
-
listProjects
Returns a list of projects in the organization.- Returns:
- a list of GHProject instances
-
createProject
Creates a project in the organization. -
createProject
Creates a project in the organization. -
createTeam
Creates a team in the organization.- Parameters:
name
- the name of the team to create
-
createTeam
Creates a team in the organization.- Returns:
- a TeamBuilder instance to build the team
-
getRepositorysWithOpenPullRequests
Returns a list of repositories with open pull requests in the organization.- Returns:
- a list of GHRepository instances
-
getPullRequests
Returns a list of pull requests in the organization.- Returns:
- a list of GHRepository instances
-
listEvents
Returns a list of events in the organization.- Returns:
- a list of GHEvent instances
-
getHooks
Returns a list of hooks in the organization.- Returns:
- a list of GHHook instances
-
getHook
Returns a specific hook in the organization by its ID.- Parameters:
id
- the ID of the hook to fetch- Returns:
- a GHHook instance representing the fetched hook
-
getHook
Returns a specific hook in the organization by its ID.- Parameters:
id
- the ID of the hook to fetch- Returns:
- a GHHook instance representing the fetched hook
-
createHook
Creates a hook in the organization. -
deleteHook
Deletes a hook in the organization by its ID.- Parameters:
id
- the ID of the hook to delete
-
listDockerConflictsPackages
Returns a list of Docker conflict packages in the organization.- Returns:
- a list of GHPackage instances
-
listPackages
Returns a list of packages in the organization filtered by package type.- Parameters:
packageType
- the type of packages to list- Returns:
- a list of GHPackage instances
-
getPackage
Returns a specific package in the organization by its name and package type.- Parameters:
name
- the name of the packagepackageType
- the type of the package- Returns:
- a GHPackage instance representing the fetched package
-
listSecretScanningAlerts
Returns a list of secret scanning alerts in the organization.- Returns:
- a list of GHAlert instances
-
getCacheUsageActiveCount
public int getCacheUsageActiveCount()Returns the total active cache usage count for the organization.- Returns:
- the total active cache usage count
-
getCacheUsageSizeInBytes
public int getCacheUsageSizeInBytes()Returns the total active cache usage size in bytes for the organization.- Returns:
- the total active cache usage size in bytes
-
listRepositoryCaches
Returns a list of repository caches in the organization.- Returns:
- a list of GHRepositoryCache instances
-
listSecrets
Returns a list of secrets in the organization.- Returns:
- a list of GHSecret instances
-
getPublicKey
Returns the public key for secrets in the organization.- Returns:
- a GHPublicKey instance representing the public key
-
getSecret
Returns a specific secret in the organization by its name.- Parameters:
name
- the name of the secret to fetch- Returns:
- a GHSecret instance representing the fetched secret
-
deleteSecret
Deletes a specific secret in the organization by its name.- Parameters:
name
- the name of the secret to delete- Returns:
- true if the secret was deleted successfully, false otherwise
-
listSecretRepositorys
Returns a list of repositories associated with a specific secret in the organization.- Returns:
- a list of GHRepository instances
-
deleteRepositoryFromSecret
Deletes a repository from a specific secret in the organization by secret name and repository ID.- Parameters:
secretName
- the name of the secretrepoId
- the ID of the repository- Returns:
- true if the repository was deleted successfully, false otherwise
-
listVariables
Returns a list of variables in the organization.- Returns:
- a list of GHVariable instances
-
getVariable
Returns a specific variable in the organization by its name.- Parameters:
name
- the name of the variable to fetch- Returns:
- a GHVariable instance representing the fetched variable
-
listVariableRepositorys
Returns a list of repositories associated with a specific variable in the organization.- Parameters:
name
- the name of the variable- Returns:
- a list of GHRepository instances
-