Ltix.MembershipsService.MembershipContainer (Ltix v0.1.0)

Copy Markdown View Source

A roster response from the memberships service.

Contains the context (course/section) information and a list of members. Implements Enumerable, so you can pipe it directly into Enum or Stream functions to iterate over members.

Examples

{:ok, roster} = Ltix.MembershipsService.get_members(client)

roster.context.id
#=> "course-123"

roster
|> Enum.filter(&(&1.status == :active))
|> Enum.map(& &1.email)

Enum.count(roster)

Summary

Functions

Parse a membership container from a decoded JSON response body.

Types

t()

@type t() :: %Ltix.MembershipsService.MembershipContainer{
  context: Ltix.LaunchClaims.Context.t(),
  id: String.t() | nil,
  members: [Ltix.MembershipsService.Member.t()]
}

Functions

from_json(json)

@spec from_json(map()) :: {:ok, t()} | {:error, Exception.t()}

Parse a membership container from a decoded JSON response body.

Returns {:ok, container} on success or {:error, exception} if the context is missing or a member fails to parse.