/// <summary> /// Grants permissions to a user on a given stream. /// </summary> /// <param name="streamId">Id of the stream to grant permissions to</param> /// <param name="userId">Id of the user to grant permissions to</param> /// <param name="role">Role to give the user on this stream</param> /// <returns></returns> public async Task <bool> StreamGrantPermission(CancellationToken cancellationToken, StreamGrantPermissionInput permissionInput) { try { var request = new GraphQLRequest { Query = @" mutation streamGrantPermission($permissionParams: StreamGrantPermissionInput!) { streamGrantPermission(permissionParams:$permissionParams) }", Variables = new { permissionParams = permissionInput } }; var res = await GQLClient.SendMutationAsync <Dictionary <string, object> >(request).ConfigureAwait(false); if (res.Errors != null) { throw new SpeckleException("Could not grant permission", res.Errors); } return((bool)res.Data["streamGrantPermission"]); } catch (Exception e) { throw new SpeckleException(e.Message, e); } }
/// <summary> /// Grants permissions to a user on a given stream. /// </summary> /// <param name="streamId">Id of the stream to grant permissions to</param> /// <param name="userId">Id of the user to grant permissions to</param> /// <param name="role">Role to give the user on this stream</param> /// <returns></returns> public Task <bool> StreamGrantPermission(StreamGrantPermissionInput permissionInput) { return(StreamGrantPermission(CancellationToken.None, permissionInput)); }