4848import java .util .Date ;
4949import java .util .HashMap ;
5050import java .util .HashSet ;
51- import java .util .Hashtable ;
5251import java .util .List ;
5352import java .util .Map ;
5453import java .util .Set ;
@@ -424,6 +423,9 @@ protected GHUser getUser(GHUser orig) {
424423 return u ;
425424 }
426425
426+ /**
427+ * Gets {@link GHOrganization} specified by name.
428+ */
427429 public GHOrganization getOrganization (String name ) throws IOException {
428430 GHOrganization o = orgs .get (name );
429431 if (o ==null ) {
@@ -433,6 +435,35 @@ public GHOrganization getOrganization(String name) throws IOException {
433435 return o ;
434436 }
435437
438+ /**
439+ * Gets a list of all organizations.
440+ */
441+ public PagedIterable <GHOrganization > listOrganizations () {
442+ return listOrganizations (null );
443+ }
444+
445+ /**
446+ * Gets a list of all organizations starting after the organization identifier specified by 'since'.
447+ *
448+ * @see <a href="https://developer.github.com/v3/orgs/#parameters">List All Orgs - Parameters</a>
449+ */
450+ public PagedIterable <GHOrganization > listOrganizations (final String since ) {
451+ return new PagedIterable <GHOrganization >() {
452+ @ Override
453+ public PagedIterator <GHOrganization > _iterator (int pageSize ) {
454+ System .out .println ("page size: " + pageSize );
455+ return new PagedIterator <GHOrganization >(retrieve ().with ("since" ,since )
456+ .asIterator ("/organizations" , GHOrganization [].class , pageSize )) {
457+ @ Override
458+ protected void wrapUp (GHOrganization [] page ) {
459+ for (GHOrganization c : page )
460+ c .wrapUp (GitHub .this );
461+ }
462+ };
463+ }
464+ };
465+ }
466+
436467 /**
437468 * Gets the repository object from 'user/reponame' string that GitHub calls as "repository name"
438469 *
0 commit comments