TenantService#

class TenantService[source]#

Methods

get_all

Get all tenants of an instance.

create

Create a new tenant.

get_all_tenant_coupons

Retrieves all visible tenant coupon for the tenant linked to the 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

Get a tenant by id.

patch

Update a tenant by id.

get_courses

Get the courses for this tenant.

get_logo

Get the logo of a tenant.

get_lti_providers

List all LTI providers for this tenant.

get_permissions

Get the permissions of the logged in user 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(*, with_statistics=False, extra_parameters=None)[source]#

Get all tenants of an instance.

Parameters:
  • with_statistics (bool) – Add statistics to returned tenants, if you have permission too see the statistics.

  • extra_parameters (Optional[Mapping[str, Union[str, bool, int, float]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.

Returns:

All the tenants of this instance.

Return type:

Sequence[ExtendedTenant]

create(multipart_data, *, extra_parameters=None)[source]#

Create a new tenant.

Parameters:
Returns:

The newly created tenant.

Return type:

ExtendedTenant

get_all_tenant_coupons(*, tenant_id, offset=Nothing, limit=Nothing, extra_parameters=None)[source]#

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

Parameters:
Returns:

The list of available coupons.

Return type:

Sequence[TenantCouponWithCode | TenantCouponWithoutCode]

create_tenant_coupon(json_body, *, tenant_id, extra_parameters=None)[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:

TenantCouponWithCode | TenantCouponWithoutCode

delete_tenant_coupon(*, tenant_id, coupon_id, extra_parameters=None)[source]#

Delete a coupon.

Parameters:
Returns:

Nothing

Return type:

None

update_tenant_coupon(json_body, *, tenant_id, coupon_id, extra_parameters=None)[source]#

Update the given coupon with new values.

Parameters:
Returns:

The updated coupon

Return type:

TenantCouponWithCode | TenantCouponWithoutCode

put_price(json_body, *, tenant_id, extra_parameters=None)[source]#

Update the price of the given course.

Parameters:
Returns:

The created or updated price.

Return type:

TenantPrice

delete_price(*, tenant_id, extra_parameters=None)[source]#

Update the price of the given course.

Parameters:
Returns:

Nothing.

Return type:

None

get(*, tenant_id, with_statistics=False, extra_parameters=None)[source]#

Get a tenant by id.

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

  • with_statistics (bool) – Add statistics to returned tenant, if you have permission too see the statistics.

  • extra_parameters (Optional[Mapping[str, Union[str, bool, int, float]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.

Returns:

The tenant with the given id.

Return type:

ExtendedTenant

patch(json_body, *, tenant_id, with_statistics=False, extra_parameters=None)[source]#

Update a tenant by id.

Parameters:
Returns:

The updated tenant.

Return type:

ExtendedTenant

get_courses(*, tenant_id, extra_parameters=None)[source]#

Get the courses for this tenant.

Parameters:
Returns:

The courses for this tenant.

Return type:

Sequence[ExtendedCourse]

Get the logo of a tenant.

Parameters:
  • tenant_id (str) – The id of the tenant for which you want to get the logo.

  • dark (bool) – If truhty the retrieved logo will be suited for the dark theme.

  • extra_parameters (Optional[Mapping[str, Union[str, bool, int, float]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.

Returns:

The logo of the tenant.

Return type:

bytes

get_lti_providers(*, tenant_id, extra_parameters=None)[source]#

List all LTI providers for this tenant.

Parameters:
Returns:

A list of all known LTI providers.

Return type:

Sequence[FinalizedLTI1p3Provider | NonFinalizedLTI1p3Provider | FinalizedLTI1p1Provider | NonFinalizedLTI1p1Provider]

get_permissions(*, tenant_id, extra_parameters=None)[source]#

Get the permissions of the logged in user for this tenant.

If the user does not have an associated role within the tenant, the global permissions of the user are returned.

Parameters:
Returns:

The courses for this tenant.

Return type:

TenantPermissions | NoPermissions

get_roles(*, tenant_id, extra_parameters=None)[source]#

Get all roles of this tenant with their permissions

Parameters:
Returns:

An array of roles.

Return type:

Sequence[TenantRoleAsJSONWithPerms]

get_settings(*, tenant_id, only_frontend=False, extra_parameters=None)[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.

  • extra_parameters (Optional[Mapping[str, Union[str, bool, int, float]]]) – The extra query parameters you might want to add. By default no extra query parameters are added.

Returns:

The settings for this tenant.

Return type:

AllSiteSettings

patch_settings(json_body, *, tenant_id, extra_parameters=None)[source]#

Update the settings for this tenant.

Parameters:
Returns:

The updated tenant settings.

Return type:

AllSiteSettings

get_stats(*, tenant_id, extra_parameters=None)[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, extra_parameters=None)[source]#

Update the Permission of a given TenantRole.

Parameters:
Returns:

An empty response with return code 204.

Return type:

None