TenantService

class TenantService[source]

Methods

get_all

Get all tenants of an instance.

create

Create a new tenant.

create_tenant_coupon

Create a new coupon valid to redeem any course in a tenant, by Tenant id.

delete_tenant_coupon

Delete a coupon.

update_tenant_coupon

Update the given coupon with new values.

put_price

Update the price of the given course.

delete_price

Update the price of the given course.

get_all_tenant_coupons

Retrieves all visible tenant coupon for the tenant linked to the tenant.

get

Get a tenant by id.

patch

Update a tenant by id.

get_lti_providers

List all LTI providers for this tenant.

get_roles

Get all roles of this tenant with their permissions

get_settings

Get the settings for this tenant.

patch_settings

Update the settings for this tenant.

get_stats

Get the statistics of a tenant.

patch_role

Update the Permission of a given TenantRole.

get_all(*, q='', page_size=10)[source]

Get all tenants of an instance.

Parameters:
  • q (str) – Only find tenants with a name matching this search query.

  • page_size (int) – The size of a single page, maximum is 100.

Returns:

All the tenants of this instance that the user is allowed to see.

Return type:

Response[Tenant]

create(json_body)[source]

Create a new tenant.

Parameters:
Returns:

The newly created tenant.

Return type:

ExtendedTenant

create_tenant_coupon(json_body, *, tenant_id)[source]

Create a new coupon valid to redeem any course in a tenant, by Tenant id.

Parameters:
Returns:

The coupon created for this tenant.

Return type:

TenantCoupon

delete_tenant_coupon(*, tenant_id, coupon_id)[source]

Delete a coupon.

Parameters:
Returns:

Nothing

Return type:

None

update_tenant_coupon(json_body, *, tenant_id, coupon_id)[source]

Update the given coupon with new values.

Parameters:
Returns:

The updated coupon

Return type:

TenantCoupon

put_price(json_body, *, tenant_id)[source]

Update the price of the given course.

Parameters:
Returns:

The created or updated price.

Return type:

TenantPrice

delete_price(*, tenant_id)[source]

Update the price of the given course.

Parameters:
Returns:

Nothing.

Return type:

None

get_all_tenant_coupons(*, tenant_id, page_size=20)[source]

Retrieves all visible tenant coupon for the tenant linked to the tenant.

Parameters:
Returns:

The list of available coupons.

Return type:

Response[TenantCoupon]

get(*, tenant_id)[source]

Get a tenant by id.

Parameters:

tenant_id (str) – The id of the tenant you want to retrieve.

Returns:

The tenant with the given id.

Return type:

ExtendedTenant

patch(json_body, *, tenant_id)[source]

Update a tenant by id.

Parameters:
Returns:

The updated tenant.

Return type:

ExtendedTenant

get_lti_providers(*, tenant_id, page_size=20)[source]

List all LTI providers for this tenant.

Parameters:
Returns:

A list of all known LTI providers.

Return type:

Response[LTIProviderBase]

get_roles(*, tenant_id, page_size=20)[source]

Get all roles of this tenant with their permissions

Parameters:
Returns:

An array of roles.

Return type:

Response[TenantRoleAsJSONWithPerms]

get_settings(*, tenant_id, only_frontend=False)[source]

Get the settings for this tenant.

Parameters:
  • tenant_id (str) – The tenant for which to get the settings.

  • only_frontend (bool) – Get only the frontend settings. When True the returned mapping will contain all frontend settings, even those that only have a global value.

Returns:

The settings for this tenant.

Return type:

AllSiteSettings

patch_settings(json_body, *, tenant_id)[source]

Update the settings for this tenant.

Parameters:
Returns:

The updated tenant settings.

Return type:

AllSiteSettings

get_stats(*, tenant_id)[source]

Get the statistics of a tenant.

Parameters:
Returns:

The statistics of the specified tenant.

Return type:

TenantStatistics

patch_role(json_body, *, tenant_id, role_id)[source]

Update the Permission of a given TenantRole.

Parameters:
Returns:

An empty response with return code 204.

Return type:

None