Skip to content

@ubstream/ubstream-node-client-sdk / Exports / MediasAuthzClient

Class: MediasAuthzClient

This class provides access to methods to manage media authorizations.

Hierarchy

  • AbstractClient

MediasAuthzClient

Table of contents

Methods

Methods

listMediaAuthz

listMediaAuthz(mediaId): Promise<IPublicMediaAuthzData>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.

Returns

Promise<IPublicMediaAuthzData>

Promise object representing all media's authorizations.

Summary

Retrieve all media's authorizations.

Example

const allMediaAuthorizations = await client.medias.authz.listMediaAuthz("media_id");

listMediaAuthzEverybody

listMediaAuthzEverybody(mediaId): Promise<IPublicMediaAuthzEverybodyData>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.

Returns

Promise<IPublicMediaAuthzEverybodyData>

Promise object representing media's authorizations for everybody.

Summary

Retrieve media's authorizations for everybody.

Example

const everybodyAuthorizations = await client.medias.authz.listMediaAuthzEverybody("media_id");

listMediaAuthzGroup

listMediaAuthzGroup(mediaId, groupId): Promise<IPublicMediaAuthzGroupData>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.
groupId string The uuid of the targeted group mentioned in authorizations.

Returns

Promise<IPublicMediaAuthzGroupData>

Promise object representing a group mentioned in media's authorizations by its uuid, and its authorizations,

Summary

Retrieve a group mentioned in media's authorizations by its uuid.

Example

const groupAuthorizations = await client.medias.authz.listMediaAuthzGroup("media_id", "group_id");

listMediaAuthzGroups

listMediaAuthzGroups(mediaId): Promise<IPublicMediaAuthzGroupQuery>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.

Returns

Promise<IPublicMediaAuthzGroupQuery>

Promise object representing all groups mentioned in media's authorizations, and their authorizations,

Summary

Retrieve all groups mentioned in media's authorizations.

Example

const result = await client.medias.authz.listMediaAuthzGroups("media_id");
const groupsAuthorizations = result.$resources;

listMediaAuthzUser

listMediaAuthzUser(mediaId, userId): Promise<IPublicMediaAuthzUserData>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.
userId string The uuid of the targeted user mentioned in authorizations.

Returns

Promise<IPublicMediaAuthzUserData>

Promise object representing a user mentioned in media's authorizations by its uuid, and its authorizations

Summary

Retrieve a user mentioned in media's authorizations by its uuid.

Example

const userAuthorizations = await client.medias.authz.listMediaAuthzUser("media_id", "user_id");

listMediaAuthzUsers

listMediaAuthzUsers(mediaId): Promise<IPublicMediaAuthzUserQuery>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.

Returns

Promise<IPublicMediaAuthzUserQuery>

Promise object representing all users mentioned in media's authorizations, and their authorizations

Summary

Retrieve all users mentioned in media's authorizations.

Example

const result = await client.medias.authz.listMediaAuthzUsers("media_id");
const usersAuthorizations = result.$resources;

removeMediaAuthzGroup

removeMediaAuthzGroup(mediaId, groupId): Promise<void>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.
groupId string The uuid of the targeted group mentioned in authorizations.

Returns

Promise<void>

Summary

Remove a group authorization from a media.

Example

await client.medias.authz.removeMediaAuthzGroup("media_id", "group_id");

removeMediaAuthzUser

removeMediaAuthzUser(mediaId, userId): Promise<void>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.
userId string The uuid of the targeted user mentioned in authorizations.

Returns

Promise<void>

Summary

Remove a user authorization from a media.

Example

await client.medias.authz.removeMediaAuthzUser("media_id", "user_id");

setMediaAuthz

setMediaAuthz(mediaId, authzForm): Promise<IPublicMediaAuthzData>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.
authzForm IPublicMediaAuthzGridForm Authorizations to be modified.

Returns

Promise<IPublicMediaAuthzData>

Promise object representing all media's authorizations after modifications.

Summary

Create or modify all the authorizations of a media.

Example

const authorizationsForm : IPublicMediaAuthzGridForm {
     "hash": "hash",
     "everybody": {
         "scopes": []
     },
     "groups": [
         {
             "id": "group_id",
             "name": "group_name",
             "scopes": [
                 PublicMediaScope.MEDIA_ACCESS,
             ]
         }
     ],
     "users": [
         {
             "id": "user_id",
             "username": "user_name",
             "displayName": "user_displayName",
             "scopes": [
                 PublicMediaScope.MEDIA_ACCESS,
             ]
         },
     ]
}
const newAllMediaAuthorizations = await client.medias.authz.setMediaAuthz("media_id", authorizationsForm);

setMediaAuthzEverybody

setMediaAuthzEverybody(mediaId, authzEverybodyForm): Promise<IPublicMediaAuthzEverybodyData>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.
authzEverybodyForm IPublicMediaAuthzForm Authorizations to be modified.

Returns

Promise<IPublicMediaAuthzEverybodyData>

Promise object representing media's authorizations for everybody after modifications

Summary

Create or modify a everybody authorization in a media.

Example

const everybodyAuthorizationsForm : IPublicMediaAuthzForm {
     "hash": "hash",
     "scopes": [
         PublicMediaScope.MEDIA_ACCESS
     ]
}
const newEverybodyAuthorizations = await client.medias.authz.setMediaAuthzEverybody("media_id", everybodyAuthorizationsForm);

setMediaAuthzGroup

setMediaAuthzGroup(mediaId, groupId, authzGroupForm): Promise<IPublicMediaAuthzGroupData>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.
groupId string The uuid of the targeted group mentioned in authorizations.
authzGroupForm IPublicMediaAuthzForm Authorizations to be modified.

Returns

Promise<IPublicMediaAuthzGroupData>

Promise Promise object representing media's authorization, after modifications, for a specified group

Summary

Create or modify a group authorization in a media.

Example

const mediaAuthorizationsForm : IPublicMediaAuthzForm {
     "scopes": [
         PublicMediaScope.MEDIA_ACCESS,
     ],
     "hash": "hash"
}
const newGroupAuthorizations = await client.medias.authz.setMediaAuthzGroup("media_id", mediaAuthorizationsForm);

setMediaAuthzUser

setMediaAuthzUser(mediaId, userId, authzUserForm): Promise<IPublicMediaAuthzUserData>

Parameters

Name Type Description
mediaId string The uuid of the targeted media.
userId string The uuid of the targeted user mentioned in authorizations.
authzUserForm IPublicMediaAuthzForm Authorizations to be modified.

Returns

Promise<IPublicMediaAuthzUserData>

Promise object representing media's authorization, after modifications, for a user.

Summary

Create or modify a user authorization in a media.

Example

const userAuthorizationsForm : IPublicMediaAuthzForm {
     "scopes": [
         PublicMediaScope.MEDIA_ACCESS,
         PublicMediaScope.MEDIA_EDIT,
         PublicMediaScope.MEDIA_DELETE,
         PublicMediaScope.MEDIA_PERMISSIONS,
         PublicMediaScope.MEDIA_DOWNLOAD
     ],
     "hash": "df1f6c99ac2d72a1ed39e43f41db2d18500c6d47427b20aca92c96640db11183"
}
const newUserAuthorizations = await client.medias.authz.setMediaAuthzUser("media_id", userAuthorizationsForm);