list method

Stream<Organization> list(
  1. [String? userName]
)

Lists all of the memberships in organizations for the given userName. If userName is not specified we list the memberships in organizations for the authenticated user.

API docs: : https://developer.github.com/v3/orgs/#list-user-organizations

Implementation

Stream<Organization> list([String? userName]) {
  var requestPath = '/users/$userName/orgs';
  if (userName == null) {
    requestPath = '/user/orgs';
  }
  return PaginationHelper(github)
      .objects('GET', requestPath, (dynamic i) => Organization.fromJson(i));
}