Files
github-api/createorglevelresources.html
2021-06-02 11:09:28 -07:00

194 lines
4.7 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>GitHub API for Java &#x2013; </title>
<style type="text/css" media="all">
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/1024px.css");
@import url("./css/site.css");
</style>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div id="wrap2"><div id="wrap">
<div id="header">
<p id="toplinks">Skip to: <a href="#content">Content</a> | <a href="#sidebar">Navigation</a> | <a href="#footer">Footer</a></p>
<h1 id="bannerLeft">
<a href="./">
GitHub API for Java
</a>
</h1>
<p id="slogan">GitHub API for Java</p>
</div>
<div id="breadcrumbs">
<div class="xright"> </div>
<div class="clear">
<hr/>
</div>
</div>
<div id="sidebar">
<div id="navcolumn">
<h2>
Git Hub API for Java
</h2><ul>
<li class="none">
<a href="index.html">Introduction</a>
</li>
<li class="none">
<a href="https://mvnrepository.com/artifact/org.kohsuke/github-api">Download</a>
</li>
<li class="none">
<a href="https://github.com/hub4j/github-api">Source code</a>
</li>
<li class="none">
<a href="https://groups.google.com/forum/#!forum/github-api">Mailing List</a>
</li>
</ul>
<h2>
Guides
</h2><ul>
<li class="expanded">
<a href="githubappflow.html">GitHub App Auth Flow</a>
<ul>
<li class="none">
<a href="githubappjwtauth.html">JWT Authentication</a>
</li>
<li class="none">
<a href="githubappappinsttokenauth.html">App Installation Token</a>
</li>
</ul>
</li>
<li class="none">
<strong>Working with organizations</strong>
</li>
</ul>
<h2>
References
</h2><ul>
<li class="none">
<a href="apidocs/index.html">Javadoc</a>
</li>
</ul>
<h2>
Project Documentation
</h2><ul>
<li class="collapsed">
<a href="project-info.html">Project Information</a>
</li>
<li class="collapsed">
<a href="project-reports.html">Project Reports</a>
</li>
</ul>
</div>
</div>
<div id="content">
<div id="contentBox">
<section>
<h2><a name="Creating_resources_at_the_organization_level"></a>Creating resources at the organization level</h2>
<p>In order to create resources in GitHub for a given organization, you must first create an object of type <code>GHOrganization</code>. As an example:</p>
<div class="source">
<pre>GHOrganization organizationClient(GitHub gitHub, String organizationName) throws IOException {
return gitHub.getOrganization(organizationName);
}</pre></div>
<p>Now you can easily work with the GHOrganization, and all methods that will create resources will create them in the given organization.</p>
<p>One of the most common use cases is to create a repository in a given organization:</p>
<div class="source">
<pre> void createRepository(GHOrganization organization) {
organization.createRepository(&quot;repository-name&quot;)
.private_(true)
.wiki(false)
.projects(false)
.description(&quot;Description&quot;)
.allowMergeCommit(true)
.allowSquashMerge(false)
.allowRebaseMerge(false)
.create()
}</pre></div></section>
</div>
</div>
<div id="footer">
<div class="xright">&#169;
2021
<a href="http://kohsuke.org/">Kohsuke Kawaguchi</a> and other contributors
&nbsp;| Last Published: 2021-06-02
&nbsp;| Version: 1.130
</div>
<div class="clear">
<hr/>
</div>
</div>
</div></div>
</body>
</html>