Class: WorkOS::UserManagementOrganizationMembershipGroups

Inherits:
Object
  • Object
show all
Defined in:
lib/workos/user_management_organization_membership_groups.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ UserManagementOrganizationMembershipGroups

Returns a new instance of UserManagementOrganizationMembershipGroups.



9
10
11
# File 'lib/workos/user_management_organization_membership_groups.rb', line 9

def initialize(client)
  @client = client
end

Instance Method Details

#list_organization_membership_groups(om_id:, before: nil, after: nil, limit: 10, order: "desc", request_options: {}) ⇒ WorkOS::Types::ListStruct<WorkOS::Group>

List groups

Parameters:

  • om_id (String)

    Unique identifier of the Organization Membership.

  • before (String, nil) (defaults to: nil)

    An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with "obj_123", your subsequent call can include before="obj_123" to fetch a new batch of objects before "obj_123".

  • after (String, nil) (defaults to: nil)

    An object ID that defines your place in the list. When the ID is not present, you are at the end of the list. For example, if you make a list request and receive 100 objects, ending with "obj_123", your subsequent call can include after="obj_123" to fetch a new batch of objects after "obj_123".

  • limit (Integer, nil) (defaults to: 10)

    Upper limit on the number of objects to return, between 1 and 100.

  • order (WorkOS::Types::PaginationOrder, nil) (defaults to: "desc")

    Order the results by the creation time. Supported values are "asc" (ascending), "desc" (descending), and "normal" (descending with reversed cursor semantics where before fetches older records and after fetches newer records). Defaults to descending.

  • request_options (Hash) (defaults to: {})

    (see WorkOS::Types::RequestOptions)

Returns:



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
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/workos/user_management_organization_membership_groups.rb', line 21

def list_organization_membership_groups(
  om_id:,
  before: nil,
  after: nil,
  limit: 10,
  order: "desc",
  request_options: {}
)
  params = {
    "before" => before,
    "after" => after,
    "limit" => limit,
    "order" => order
  }.compact
  response = @client.request(
    method: :get,
    path: "/user_management/organization_memberships/#{WorkOS::Util.encode_path(om_id)}/groups",
    auth: true,
    params: params,
    request_options: request_options
  )
  fetch_next = ->(cursor) {
    list_organization_membership_groups(
      om_id: om_id,
      before: before,
      after: cursor,
      limit: limit,
      order: order,
      request_options: request_options
    )
  }
  WorkOS::Types::ListStruct.from_response(
    response,
    model: WorkOS::Group,
    filters: {om_id: om_id, before: before, limit: limit, order: order},
    fetch_next: fetch_next
  )
end