hex_api_organization_member (hex_core v0.8.0) View Source

HTTP API - Organization Members.

Link to this section Summary

Functions

Adds an organization member.

Deletes an organization member.

Gets an organization member.

Lists the organization's members.

Updates an organization member's role.

Link to this section Types

Specs

role() :: :admin | :write | :read

Link to this section Functions

Link to this function

add(Config, UsernameOrEmail, Role)

View Source

Specs

add(:hex_core.config(), binary(), role()) :: :hex_api.response()

Adds an organization member.

Examples:

  > hex_api_organization_member:add(hex_core:default_config()#{api_organization => <<"acme">>}, <<"user">>, write).
  {ok, {200, ..., #{
       <<"email">> => <<"user@example.com">>,
       <<"role">> => <<"write">>,
       <<"url">> => <<"https://hex.pm/api/users/user">>,
       <<"username">> => <<"user">>
       }}}
Link to this function

delete(Config, UsernameOrEmail)

View Source

Specs

delete(:hex_core.config(), binary()) :: :hex_api.response()

Deletes an organization member.

Examples:

  > hex_api_organization_member:delete(hex_core:default_config()#{api_organization => <<"acme">>}, <<"user">>).
  {ok, {204, ..., nil}}
Link to this function

get(Config, UsernameOrEmail)

View Source

Specs

get(:hex_core.config(), binary()) :: :hex_api.response()

Gets an organization member.

Examples:

  > hex_api_organization_member:get(hex_core:default_config()#{api_organization => <<"acme">>}, <<"user">>).
  {ok, {200, ..., #{
       <<"email">> => <<"user@example.com">>,
       <<"role">> => <<"admin">>,
       <<"url">> => <<"https://hex.pm/api/users/user">>,
       <<"username">> => <<"user">>
       }}}

Specs

list(:hex_core.config()) :: :hex_api.response()

Lists the organization's members.

Examples:

  > hex_api_organization_member:list(hex_core:default_config()#{api_organization => <<"acme">>}).
  {ok, {200, ..., [#{
       <<"email">> => <<"user@example.com">>,
       <<"role">> => <<"admin">>,
       <<"url">> => <<"https://hex.pm/api/users/user">>,
       <<"username">> => <<"user">>
       }]}}
Link to this function

update(Config, UsernameOrEmail, Role)

View Source

Specs

update(:hex_core.config(), binary(), role()) :: :hex_api.response()

Updates an organization member's role.

Examples:

  > hex_api_organization_member:update(hex_core:default_config()#{api_organization => <<"acme">>}, <<"user">>, read).
  {ok, {200, ..., #{
       <<"email">> => <<"user@example.com">>,
       <<"role">> => <<"read">>,
       <<"url">> => <<"https://hex.pm/api/users/user">>,
       <<"username">> => <<"user">>
       }}}