-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathDemoOrganizations.scala
More file actions
47 lines (42 loc) · 1.39 KB
/
DemoOrganizations.scala
File metadata and controls
47 lines (42 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import github.features.{Organizations, Repositories}
/**
* Create an organization and then a repository
*/
object DemoOrganizations extends App {
val gitHubCli = new github.Client(
"http://github.at.home/api/v3",
sys.env("TOKEN_GITHUB_ENTERPRISE")
) with Organizations
with Repositories
gitHubCli.createOrganization(
login = "PlanetEarth",
admin = "k33g",
profile_name = "PlanetEarth Organization"
).fold(
{errorMessage => println(s"Organization Error: $errorMessage")},
{
case Some(organizationData) =>
val organization = organizationData.asInstanceOf[Map[String, Any]]
println(organization)
println(organization.getOrElse("login","???"))
gitHubCli.createOrganizationRepository(
name = "my-little-tools",
description = "foo...",
organization = organization.getOrElse("login","???").toString,
isPrivate = false,
hasIssues = true
).fold(
{errorMessage => println(s"Repository Error: $errorMessage")},
{repositoryInformation:Option[Any] =>
println(
repositoryInformation
.map(repo => repo.asInstanceOf[Map[String, Any]])
.getOrElse("Huston? We've got a problem!")
)
}
)
case None =>
println("Huston? We've got a problem!")
}
)
}