Example #1
0
        /// <summary>
        /// Create a group entity.
        /// </summary>
        /// <remarks>
        /// Service Name - group
        /// Service Operation - CREATE_GROUP_ENTITY
        /// </remarks>
        /// <param name="groupId">
        /// ID of the group.
        /// </param>
        /// <param name="isOwnedByGroupMember">
        /// true if entity is owned by a member; false if owned by the entire group.
        /// </param>
        /// <param name="type">
        /// Type of the group entity.
        /// </param>
        /// <param name="acl">
        /// Access control list for the group entity.
        /// </param>
        /// <param name="jsonData">
        /// Custom application data.
        /// </param>
        /// <param name="success">The success callback</param>
        /// <param name="failure">The failure callback</param>
        /// <param name="cbObject">The callback object</param>
        public void CreateGroupEntity(
            string groupId,
            string entityType,
            bool?isOwnedByGroupMember,
            GroupACL acl,
            string jsonData,
            SuccessCallback success = null,
            FailureCallback failure = null,
            object cbObject         = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            data[OperationParam.GroupId.Value] = groupId;
            if (!string.IsNullOrEmpty(entityType))
            {
                data[OperationParam.GroupEntityType.Value] = entityType;
            }
            if (isOwnedByGroupMember.HasValue)
            {
                data[OperationParam.GroupIsOwnedByGroupMember.Value] = isOwnedByGroupMember.Value;
            }
            if (acl != null)
            {
                data[OperationParam.GroupAcl.Value] = JsonReader.Deserialize(acl.ToJsonString());
            }
            if (!string.IsNullOrEmpty(jsonData))
            {
                data[OperationParam.GroupData.Value] = JsonReader.Deserialize(jsonData);
            }

            SendRequest(ServiceOperation.CreateGroupEntity, success, failure, cbObject, data);
        }
Example #2
0
        /// <summary>
        /// Create a group. With additional summary data
        /// </summary>
        /// <remarks>
        /// Service Name - group
        /// Service Operation - CREATE_GROUP
        /// </remarks>
        /// <param name="name">
        /// Name of the group.
        /// </param>
        /// <param name="groupType">
        /// Name of the type of group.
        /// </param>
        /// <param name="isOpenGroup">
        /// true if group is open; false if closed.
        /// </param>
        /// <param name="acl">
        /// The group's access control list. A null ACL implies default.
        /// </param>
        /// <param name="jsonOwnerAttributes">
        /// Attributes for the group owner (current user).
        /// </param>
        /// <param name="jsonDefaultMemberAttributes">
        /// Default attributes for group members.
        /// </param>
        /// <param name="jsonData">
        /// Custom application data.
        /// </param>
        /// </param>
        /// <param name="jsonSummaryData">
        /// Custom application data.
        /// </param>
        /// <param name="success">The success callback</param>
        /// <param name="failure">The failure callback</param>
        /// <param name="cbObject">The callback object</param>
        public void CreateGroup(
            string name,
            string groupType,
            bool?isOpenGroup,
            GroupACL acl,
            string jsonData,
            string jsonOwnerAttributes,
            string jsonDefaultMemberAttributes,
            string jsonSummaryData,
            SuccessCallback success = null,
            FailureCallback failure = null,
            object cbObject         = null)
        {
            Dictionary <string, object> data = new Dictionary <string, object>();

            if (!string.IsNullOrEmpty(name))
            {
                data[OperationParam.GroupName.Value] = name;
            }
            data[OperationParam.GroupType.Value] = groupType;
            if (isOpenGroup.HasValue)
            {
                data[OperationParam.GroupIsOpenGroup.Value] = isOpenGroup.Value;
            }
            if (acl != null)
            {
                data[OperationParam.GroupAcl.Value] = JsonReader.Deserialize(acl.ToJsonString());
            }
            if (!string.IsNullOrEmpty(jsonData))
            {
                data[OperationParam.GroupData.Value] = JsonReader.Deserialize(jsonData);
            }
            if (!string.IsNullOrEmpty(jsonOwnerAttributes))
            {
                data[OperationParam.GroupOwnerAttributes.Value] = JsonReader.Deserialize(jsonOwnerAttributes);
            }
            if (!string.IsNullOrEmpty(jsonDefaultMemberAttributes))
            {
                data[OperationParam.GroupDefaultMemberAttributes.Value] = JsonReader.Deserialize(jsonDefaultMemberAttributes);
            }
            if (!string.IsNullOrEmpty(jsonSummaryData))
            {
                data[OperationParam.GroupSummaryData.Value] = JsonReader.Deserialize(jsonSummaryData);
            }

            SendRequest(ServiceOperation.CreateGroup, success, failure, cbObject, data);
        }