class User extends Base (View source)

User management client for the rokka.io service.

Constants

DEFAULT_API_BASE_URL

DEFAULT_API_VERSION

API_KEY_HEADER

API_VERSION_HEADER

USER_RESOURCE

ORGANIZATION_RESOURCE

Properties

protected ClientInterface $client

Client to access Rokka.

from  Base

Methods

__construct(ClientInterface $client)

Constructor.

from  Base
setCredentials(string $key, string $secret)

Set the credentials.

from  Base
Response
call(string $method, string $path, array $options = [], bool $needsCredentials = true)

Call the API rokka endpoint.

from  Base
createUser(string $email)

Create a user.

createOrganization(string $name, string $billingMail, string $displayName = '')

Create an organization.

getOrganization(string $name)

Return an organization.

createMembership(string $organization, string $email, string $role = Membership::ROLE_READ)

Create a membership.

getMembership(string $organization, string $email)

Get the membership metadata for the given organization and user's email.

Details

__construct(ClientInterface $client)

Constructor.

Parameters

ClientInterface $client

Client instance

setCredentials(string $key, string $secret)

Set the credentials.

Parameters

string $key

API key

string $secret

API secret

protected Response call(string $method, string $path, array $options = [], bool $needsCredentials = true)

Call the API rokka endpoint.

Parameters

string $method

HTTP method to use

string $path

Path on the API

array $options

Request options

bool $needsCredentials

True if credentials are needed

Return Value

Response

User createUser(string $email)

Create a user.

Parameters

string $email Email

Return Value

User

Organization createOrganization(string $name, string $billingMail, string $displayName = '')

Create an organization.

Parameters

string $name

Organization name

string $billingMail

Billing mail

string $displayName

Optional display name

Return Value

Organization

Organization getOrganization(string $name)

Return an organization.

Parameters

string $name

Organization name

Return Value

Organization

Membership createMembership(string $organization, string $email, string $role = Membership::ROLE_READ)

Create a membership.

Parameters

string $organization Organization
string $email Email
string $role

Role to add

Return Value

Membership

Membership getMembership(string $organization, string $email)

Get the membership metadata for the given organization and user's email.

Parameters

string $organization Organization
string $email Email

Return Value

Membership