Class SpaceSystem

Inheritance Relationships

Base Type

Class Documentation

class SpaceSystem : public csp::systems::SystemBase

Public facing system that allows interfacing with Magnopus Connected Services’ concept of a Group.

Offers methods for creating, deleting and joining spaces.

Helper Functions

void EnterSpace(const csp::common::String &SpaceId, NullResultCallback Callback)

Enter a space if you have permission to, based on the Space settings.

This includes setting scopes (and toggling event listening in order to set the scope). It also retrieves all entities in the space. Ensure Connect is called prior to this.

Parameters
  • SpaceSpace : space to enter into

  • Callback – EnterSpaceResultCallback : callback when asynchronous task finishes

void ExitSpace(NullResultCallback Callback)

Exits the space and deregisters from the space scope.

bool IsInSpace()

Get whether user is currently in a space.

Returns

Result of whether they are in a Space.

const Space &GetCurrentSpace() const

Get the user’s current space.

Returns

The space data object the user is currently in

Asynchronous Calls

These are methods that perform WebClient calls and therefore operate asynchronously and require a callback to be passed for a completion result

void CreateSpace(const csp::common::String &Name, const csp::common::String &Description, SpaceAttributes Attributes, const csp::common::Optional<InviteUserRoleInfoCollection> &InviteUsers, const csp::common::Map<csp::common::String, csp::common::String> &Metadata, const csp::common::Optional<csp::systems::FileAssetDataSource> &FileThumbnail, const csp::common::Optional<csp::common::Array<csp::common::String>> &Tags, SpaceResultCallback Callback)

Creates a new space.

Parameters
void CreateSpaceWithBuffer(const csp::common::String &Name, const csp::common::String &Description, SpaceAttributes Attributes, const csp::common::Optional<InviteUserRoleInfoCollection> &InviteUsers, const csp::common::Map<csp::common::String, csp::common::String> &Metadata, const csp::systems::BufferAssetDataSource &Thumbnail, const csp::common::Optional<csp::common::Array<csp::common::String>> &Tags, SpaceResultCallback Callback)

Creates a new space Using BufferAssetDataSource.

Parameters
void UpdateSpace(const csp::common::String &SpaceId, const csp::common::Optional<csp::common::String> &Name, const csp::common::Optional<csp::common::String> &Description, const csp::common::Optional<SpaceAttributes> &Type, BasicSpaceResultCallback Callback)

Updates the name and/or the description of a Space.

Parameters
  • SpaceSpace : the Space to update

  • Name – csp::common::Optional<csp::common::String> : if a new name is provided it will be used to update the Space name

  • Description – csp::common::Optional<csp::common::String> : if a new description is provided it will be used to update the Space description

  • Type – csp::common::Optional<csp::systems::SpaceType> : if a new type is provided it will be used to update the Space type

  • Callback – BasicSpaceResultCallback : callback when asynchronous task finishes

void DeleteSpace(const csp::common::String &SpaceId, NullResultCallback Callback)

Deletes a given space and the corresponding UserService group.

Parameters
  • SpaceSpace : space to delete

  • Callback – NullResultCallback : callback when asynchronous task finishes

void GetSpaces(SpacesResultCallback Callback)

Retrieves all spaces corresponding to the currently logged in user.

Parameters

Callback – SpacesResultCallback : callback when asynchronous task finishes

void GetSpacesByAttributes(const csp::common::Optional<bool> &IsDiscoverable, const csp::common::Optional<bool> &IsArchived, const csp::common::Optional<bool> &RequiresInvite, const csp::common::Optional<int> &ResultsSkip, const csp::common::Optional<int> &ResultsMax, BasicSpacesResultCallback Callback)

Retrieves basic space details for the spaces with the given attributes available to the logged in user.

Results pagination is supported through the use of ResultsSkip and ResultsMax.

Parameters
  • IsDiscoverable – csp::common::Optional<bool> : true or false to filter by IsDiscoverable attribute value.

  • IsArchived – csp::common::Optional<bool> : true or false to filter by IsArchived attribute value.

  • RequiresInvite – csp::common::Optional<bool> : true or false to filter by RequiresInvite attribute value.

  • ResultsSkip – csp::common::Optional<int> : number of result entries that will be skipped from the result. For no skip pass nullptr.

  • ResultsMax – csp::common::Optional<int> : maximum number of result entries to be retrieved. For all available result entries pass nullptr.

  • Callback – SpacesResultCallback : callback when asynchronous task finishes

void GetSpacesByIds(const csp::common::Array<csp::common::String> &RequestedSpaceIDs, SpacesResultCallback Callback)

Retrieves space details corresponding to the provided Space IDs.

Parameters
void GetSpacesForUserId(const csp::common::String &UserId, SpacesResultCallback Callback)

Retrieves all spaces corresponding to the provided user ID.

Parameters
  • UserIdcsp::common::String : unique ID of user

  • Callback – SpacesResultCallback : callback when asynchronous task finishes

void GetSpace(const csp::common::String &SpaceId, SpaceResultCallback Callback)

Retrieves a space by its unique ID.

Parameters
  • SpaceIdcsp::common::String : unique ID of Space

  • Callback – SpaceResultCallback : callback when asynchronous task finishes

void InviteToSpace(const csp::common::String &SpaceId, const csp::common::String &Email, const csp::common::Optional<bool> &IsModeratorRole, const csp::common::Optional<csp::common::String> &EmailLinkUrl, const csp::common::Optional<csp::common::String> &SignupUrl, NullResultCallback Callback)

Invites a given email to a specific space.

Parameters
  • SpaceSpace : space to invite to

  • Emailcsp::common::String : email to invite to space

  • IsModeratorRole – csp::common::Optional<bool> : if present and true sets the user’s role in the space to “Moderator”, pass false or nullptr to leave role as default

  • EmailLinkUrl – csp::common::Optional<csp::common::String> : link that will be provided in the invite email

  • SignupUrl – csp::common::Optional<csp::common::String> : destination link that will be provided in the invite email

  • Callback – NullResultCallback : callback when asynchronous task finishes

void BulkInviteToSpace(const csp::common::String &SpaceId, const InviteUserRoleInfoCollection &InviteUsers, NullResultCallback Callback)

Invites all the given emails to a specific space.

Parameters
  • SpaceSpace : space to invite to

  • InviteUsersInviteUserRoleInfoCollection : Collection containing the email link URL and the users to invite with their emails and roles

  • Callback – NullResultCallback : callback when asynchronous task finishes

void GetPendingUserInvites(const csp::common::String &SpaceId, PendingInvitesResultCallback Callback)

Returns an array of obfuscated email addresses, addresses of users that have not yet accepted the space invite.

Parameters
  • SpaceSpace : Space for which the invites where sent

  • Callback – PendingInvitesResultCallback : callback when asynchronous task finishes

void RemoveUserFromSpace(const csp::common::String &SpaceId, const csp::common::String &UserId, NullResultCallback Callback)

Removes a user from a space by the user’s unique ID.

Parameters
  • SpaceSpace : space to remove user from

  • UserIdcsp::common::String : unique ID of user

  • Callback – NullResultCallback : callback when asynchronous task finishes

void AddUserToSpace(const csp::common::String &SpaceId, const csp::common::String &UserId, SpaceResultCallback Callback)

Adds a user to a space by the user’s unique ID.

Parameters
  • SpaceSpace : space to add user to

  • UserIdcsp::common::String : unique ID of user

  • Callback – SpaceResultCallback : callback when asynchronous task finishes

void AddSiteInfo(const csp::common::String &SpaceId, Site &SiteInfo, SiteResultCallback Callback)

Creates new Site information and associates it with the Space.

Parameters
  • SpaceSpace : Space to associate the Site information with

  • SiteInfoSite : Site information to be added

  • Callback – SiteResultCallback : callback when asynchronous task finishes

void RemoveSiteInfo(const csp::common::String &SpaceId, Site &SiteInfo, NullResultCallback Callback)

Removes the Site information from the Space.

Parameters
  • SpaceSpace : Space for which to remove the associated Site information

  • SiteInfoSite : Site information to be removed

  • Callback – NullResultCallback : callback when asynchronous task

void GetSitesInfo(const csp::common::String &SpaceId, SitesCollectionResultCallback Callback)

Retrieves the Sites information associated with a Space.

Parameters
  • SpaceSpace : Space to be queried for Site information

  • Callback – SitesCollectionResultCallback : callback when asynchronous task finishes

void UpdateUserRole(const csp::common::String &SpaceId, const UserRoleInfo &NewUserRoleInfo, NullResultCallback Callback)

Updates the space role for a particular user.

Parameters
  • SpaceSpace : The space that the requested user is part of

  • NewUserRoleInfoUserRoleInfo : New user role information containing the new role for the specified user

  • Callback – NullResultCallback : callback when asynchronous task finishes

void GetUsersRoles(const csp::common::String &SpaceId, const csp::common::Array<csp::common::String> &RequestedUserIds, UserRoleCollectionCallback Callback)

Retrieves the User role information for the User Ids that have been passed in.

Parameters
  • SpaceSpace : Space for which the User Roles will be retrieved

  • RequestedUserIdscsp::common::Array<csp::common::String> : Array of User Ids for which the User Roles will be retrieved

  • Callback – UserRoleCollectionCallback : callback when asynchronous task finishes

void UpdateSpaceMetadata(const csp::common::String &SpaceId, const csp::common::Map<csp::common::String, csp::common::String> &NewMetadata, const csp::common::Optional<csp::common::Array<csp::common::String>> &Tags, NullResultCallback Callback)

Updates the Space metadata information with the new one provided.

Parameters
void GetSpacesMetadata(const csp::common::Array<csp::common::String> &Spaces, SpacesMetadataResultCallback Callback)

Retrieves Spaces metadata information.

Parameters
  • Spaces – csp::common::Array<Space> : Spaces for which metadata will be retrieved

  • Callback – SpacesMetadataResultCallback : callback when asynchronous task finishes

void GetSpaceMetadata(const csp::common::String &SpaceId, SpaceMetadataResultCallback Callback)

Retrieves the Space metadata information.

Parameters
  • SpaceSpace : Space for which the metadata will be retrieved

  • Callback – SpaceMetadataResultCallback : callback when asynchronous task finishes

void UpdateSpaceThumbnail(const csp::common::String &SpaceId, const csp::systems::FileAssetDataSource &NewThumbnail, NullResultCallback Callback)

Updates the Space thumbnail image or adds one if it didn’t have it previously using FileAssetDataSource.

Parameters
  • SpaceSpace : Space for which the thumbnail will be updated

  • NewThumbnailcsp::systems::FileAssetDataSource : New thumbnail information

  • Callback – NullResultCallback : callback when asynchronous task finishes

void UpdateSpaceThumbnailWithBuffer(const csp::common::String &SpaceId, const csp::systems::BufferAssetDataSource &NewThumbnail, NullResultCallback Callback)

Updates the Space thumbnail image or adds one if it didn’t have it previously using BufferAssetDataSource.

Parameters
void GetSpaceThumbnail(const csp::common::String &SpaceId, UriResultCallback Callback)

Retrieves the space thumbnail information associated with the space If the space does not have a thumbnail associated with it the result callback will be successful, the HTTP res code will be ResponseNotFound and the Uri field inside the UriResult will be empty.

Parameters
  • SpaceSpace : Space for which the thumbnail information will be retrieved

  • Callback – UriResultCallback : callback when asynchronous task finishes

void AddUserToSpaceBanList(const csp::common::String &SpaceId, const csp::common::String &RequestedUserId, NullResultCallback Callback)

Adds user to group banned list.

Banned list can be retrieved from the space

Parameters
  • SpaceSpace : Space for which the ban will be issued on

  • RequestedUserIdcsp::common::String : User id to be banned from the space

  • Callback – NullResultCallback : callback when asynchronous task finishes

void DeleteUserFromSpaceBanList(const csp::common::String &SpaceId, const csp::common::String &RequestedUserId, NullResultCallback Callback)

Deletes user from group banned list.

Banned list can be retrieved from the space

Parameters
  • SpaceSpace : Space for which the Space for which the ban will be removed on

  • RequestedUserIdcsp::common::String : User id to have ban removed from the space

  • Callback – NullResultCallback : callback when asynchronous task finishes

void UpdateSpaceGeoLocation(const csp::common::String &SpaceId, const csp::common::Optional<GeoLocation> &Location, const csp::common::Optional<float> &Orientation, const csp::common::Optional<csp::common::Array<GeoLocation>> &GeoFence, SpaceGeoLocationResultCallback Callback)

Add or update a GeoLocation for the space.

Parameters
  • SpaceIdcsp::common::String : Id of the space to udpate

  • Location – csp::common::Optional<GeoLocation> : The latitude and longitude of the geo location

  • Orientation – csp::common::Optional<double> : The compass direction the space points. Must be between 0 (north) and 360 (inclusive)

  • GeoFence – csp::common::Optional<csp::common::Array<GeoLocation>> : Array of points that creates a geo fence for the space. Must be in clockwise order and start and end with the same value.

  • Callback – SpaceGeoLocationResultCallback : callback when asynchronous task finishes

void GetSpaceGeoLocation(const csp::common::String &SpaceId, SpaceGeoLocationResultCallback Callback)

Get the geo location details for the given space id.

Parameters
  • SpaceIdcsp::common::String : Id of the space

  • Callback – NullResultCallback : callback when asynchronous task finishes

void DeleteSpaceGeoLocation(const csp::common::String &SpaceId, NullResultCallback Callback)

Delete the geo location information of the space.

Parameters
  • SpaceIdcsp::common::String : Id of the space to be udpated

  • Callback – NullResultCallback : callback when asynchronous task finishes

void DuplicateSpace(const csp::common::String &SpaceId, const csp::common::String &NewName, SpaceAttributes NewAttributes, const csp::common::Optional<csp::common::Array<csp::common::String>> &MemberGroupIds, bool ShallowCopy, SpaceResultCallback Callback)

Duplicate an existing space and assign it to the current user.

Parameters
  • SpaceIdcsp::common::String : Id of the space to duplicate.

  • NewNamecsp::common::String : A unique name for the duplicated space.

  • NewAttributescsp::systems::SpaceAttributes : Attributes to apply to the duplicated space.

  • MemberGroupIdscsp::common::Array<csp::common::String> : An optional array of group (space) IDs to copy users from.

  • ShallowCopy – bool : If true, the duplicated space will reference the assets of the original space. Otherwise, all assets will be duplicated.

  • Callback – NullResultCallback : callback when asynchronous task finishes