EndPointBlank.Management.Clients (end_point_blank_elixir v0.11.0)

Copy Markdown View Source

/api/v1/clients: your clients (the organizations you provide APIs to), pending invites and accepted ones.

A client is %{"id", "name", "status" => "pending" | "accepted", "accepted_at", "managed", "claimed_at", "client_organization", "inserted_at", "updated_at"}, plus "invite_code" while it is pending (write keys only: whoever redeems it becomes this client, so treat it as a secret). get/2 and create/3 add "contacts" and "pre_assignments".

What a client holds is EndPointBlank.Management.ClientPackages and EndPointBlank.Management.ClientGrants; a managed client's own applications, environments and credentials are reached through EndPointBlank.Management.for_managed_client/2.

Summary

Functions

Invites a client, or creates a managed one. Counts against your plan's client limit ("plan_limit", HTTP 402).

Removes a client: %{"id", "deleted" => true}. With your last accepted invite for that organization, also takes away every package and grant it holds from you. An unclaimed managed client that still has credentials is refused with "managed_client_has_credentials".

One client.

One page of your clients. Options: limit:, after:.

Every client, a page at a time. Raises EndPointBlank.Management.Error.

Updates client id (PATCH /api/v1/clients/:id). attrs

Functions

create(client, attrs, opts \\ [])

Invites a client, or creates a managed one. Counts against your plan's client limit ("plan_limit", HTTP 402).

attrs:

  • name (required)
  • contacts -- your contacts to share with the client: [%{email:, first_name:, last_name:, title:, phone_number:}]
  • packages -- API packages to assign when the client accepts: [%{api_package_id:, environment_id:}]
  • grants -- direct grants to make when it accepts: [%{target_application_id:, target_endpoint_id:, environment_id:}]
  • managed -- true creates the client's organization now, for you to run until your customer claims it. Not together with packages or grants ("invalid_managed"): assign those afterwards.
  • owner_email -- with managed: true, the email address of the person at your customer who will own the managed client. Change it later with update/3.

Options: idempotency_key:.

delete(client, id)

Removes a client: %{"id", "deleted" => true}. With your last accepted invite for that organization, also takes away every package and grant it holds from you. An unclaimed managed client that still has credentials is refused with "managed_client_has_credentials".

get(client, id)

One client.

list(client, opts \\ [])

One page of your clients. Options: limit:, after:.

stream(client, opts \\ [])

@spec stream(
  EndPointBlank.Management.t(),
  keyword()
) :: Enumerable.t()

Every client, a page at a time. Raises EndPointBlank.Management.Error.

update(client, id, attrs)

Updates client id (PATCH /api/v1/clients/:id). attrs:

  • owner_email -- the email address of the person at your customer who will own a managed client.