Example #1
0
        /// <summary>
        /// Delete all members.
        /// </summary>
        /// <param name="memberStatusId">This is ‘a’ (active), ‘o’ (optout), or ‘e’ (error).</param>
        /// <returns>Returns true.</returns>
        /// <remarks></remarks>
        public bool DeleteAllMembers(MemberStatusShort memberStatusId)
        {
            var request = new RestRequest(Method.DELETE);
            request.Resource = "/{accountId}/members";
            request.AddParameter("member_status_id", memberStatusId.ToEnumString<MemberStatusShort>());

            return Execute<bool>(request);
        }
Example #2
0
        /// <summary>
        /// Change the status for an array of members. The members will have their member_status_id update
        /// </summary>
        /// <param name="memberIds">The array of member ids to change.</param>
        /// <param name="statusTo">The new status for the given members. Accepts one of ‘a’ (active), ‘e’ (error), ‘o’ (optout).</param>
        /// <returns>True if the members are successfully updated, otherwise False.</returns>
        /// <remarks></remarks>
        public bool ChangeMemberStatus(List <string> memberIds, MemberStatusShort statusTo)
        {
            var request = new RestRequest(Method.PUT);

            request.Resource = "/{accountId}/members/status";
            request.AddParameter("member_ids", memberIds);
            request.AddParameter("status_to", statusTo.ToEnumString <MemberStatusShort>());

            return(Execute <bool>(request));
        }
Example #3
0
        /// <summary>
        /// Delete all members in this group with the specified status. Then, remove those members from all active member groups as a background job. The member_status_id parameter must be set.
        /// </summary>
        /// <param name="memberGroupId">The Member Group Id to be retrieved.</param>
        /// <param name="status">A Member Status string. This is ‘a’ (active), ‘o’ (optout), or ‘e’ (error).</param>
        /// <returns>Returns true.</returns>
        /// <remarks>Http404 if the group does not exist.</remarks>
        public bool DeleteAllFromMemberGroupsByStatus(string memberGroupId, MemberStatusShort status)
        {
            var request = new RestRequest(Method.DELETE);

            request.Resource = "/{accountId}/groups/{memberGroupId}/members/remove";
            request.AddUrlSegment("memberGroupId", memberGroupId);

            request.AddParameter("member_status_id", status.ToEnumString <MemberStatusShort>());

            return(Execute <bool>(request));
        }
Example #4
0
        /// <summary>
        /// Update the status for a group of members, based on their current status. Valid statuses id are (‘a’,’e’, ‘f’, ‘o’) active, error, forwarded, optout.
        /// </summary>
        /// <param name="statusFrom">The current status of the members.</param>
        /// <param name="statusTo">The updated status of the members.</param>
        /// <param name="groupId">Optional. Limit the update to members of the specified group</param>
        /// <returns>True</returns>
        /// <remarks>Http400 if the specified status is invalid</remarks>
        public bool UpdateStatusOfGroupMembersBasedOnCurrentStatus(MemberStatusShort statusFrom, MemberStatusShort statusTo, string groupId = "")
        {
            var request = new RestRequest(Method.PUT);

            request.Resource = "/{accountId}/members/status/{statusFrom}/to/{statusTo}";
            request.AddUrlSegment("statusFrom", statusFrom.ToEnumString <MemberStatusShort>());
            request.AddUrlSegment("statusTo", statusTo.ToEnumString <MemberStatusShort>());

            if (!string.IsNullOrWhiteSpace(groupId))
            {
                request.AddParameter("group_id", groupId);
            }

            return(Execute <bool>(request));
        }
Example #5
0
        /// <summary>
        /// Update the status for a group of members, based on their current status. Valid statuses id are (‘a’,’e’, ‘f’, ‘o’) active, error, forwarded, optout.
        /// </summary>
        /// <param name="statusFrom">The current status of the members.</param>
        /// <param name="statusTo">The updated status of the members.</param>
        /// <param name="groupId">Optional. Limit the update to members of the specified group</param>
        /// <returns>True</returns>
        /// <remarks>Http400 if the specified status is invalid</remarks>
        public bool UpdateStatusOfGroupMembersBasedOnCurrentStatus(MemberStatusShort statusFrom, MemberStatusShort statusTo, string groupId = "")
        {
            var request = new RestRequest(Method.PUT);
            request.Resource = "/{accountId}/members/status/{statusFrom}/to/{statusTo}";
            request.AddUrlSegment("statusFrom", statusFrom.ToEnumString<MemberStatusShort>());
            request.AddUrlSegment("statusTo", statusTo.ToEnumString<MemberStatusShort>());

            if (!string.IsNullOrWhiteSpace(groupId))
            {
                request.RequestFormat = DataFormat.Json;
                request.JsonSerializer = new EmmaJsonSerializer();
                request.AddBody(new { group_id = groupId });
            }

            return Execute<bool>(request);
        }
Example #6
0
        /// <summary>
        /// Delete all members in this group with the specified status. Then, remove those members from all active member groups as a background job. The member_status_id parameter must be set.
        /// </summary>
        /// <param name="memberGroupId">The Member Group Id to be retrieved.</param>
        /// <param name="status">A Member Status string. This is ‘a’ (active), ‘o’ (optout), or ‘e’ (error).</param>
        /// <returns>Returns true.</returns>
        /// <remarks>Http404 if the group does not exist.</remarks>
        public bool DeleteAllFromMemberGroupsByStatus(string memberGroupId, MemberStatusShort status)
        {
            var request = new RestRequest(Method.DELETE);
            request.Resource = "/{accountId}/groups/{memberGroupId}/members/remove";
            request.AddUrlSegment("memberGroupId", memberGroupId);

            request.AddParameter("member_status_id", status.ToEnumString<MemberStatusShort>());

            return Execute<bool>(request);
        }
Example #7
0
        /// <summary>
        /// Remove all members from a single active member group.
        /// </summary>
        /// <param name="memberGroupId">The Member Group Id to be retrieved.</param>
        /// <param name="status">A Member Status string. Optional. This is ‘a’ (active), ‘o’ (optout), or ‘e’ (error).</param>
        /// <returns>Returns the number of members removed from the group.</returns>
        /// <remarks>Http404 if the group does not exist.</remarks>
        public int DeleteAllMembersFromGroup(string memberGroupId, MemberStatusShort? status = null)
        {
            var request = new RestRequest(Method.DELETE);
            request.Resource = "/{accountId}/groups/{memberGroupId}/members";
            request.AddUrlSegment("memberGroupId", memberGroupId);

            request.RequestFormat = DataFormat.Json;
            request.JsonSerializer = new EmmaJsonSerializer();

            if (status != null)
                request.AddParameter("member_status_id", status.ToEnumString<MemberStatusShort>());

            return Execute<int>(request);
        }
Example #8
0
        /// <summary>
        /// Update the status for a group of members, based on their current status. Valid statuses id are (‘a’,’e’, ‘f’, ‘o’) active, error, forwarded, optout.
        /// </summary>
        /// <param name="statusFrom">The current status of the members.</param>
        /// <param name="statusTo">The updated status of the members.</param>
        /// <param name="groupId">Optional. Limit the update to members of the specified group</param>
        /// <returns>True</returns>
        /// <remarks>Http400 if the specified status is invalid</remarks>
        public bool UpdateStatusOfGroupMembersBasedOnCurrentStatus(MemberStatusShort statusFrom, MemberStatusShort statusTo, string groupId = "")
        {
            var request = new RestRequest(Method.PUT);
            request.Resource = "/{accountId}/members/status/{statusFrom}/to/{statusTo}";
            request.AddUrlSegment("statusFrom", statusFrom.ToEnumString<MemberStatusShort>());
            request.AddUrlSegment("statusTo", statusTo.ToEnumString<MemberStatusShort>());

            if (!string.IsNullOrWhiteSpace(groupId))
                request.AddParameter("group_id", groupId);

            return Execute<bool>(request);
        }
Example #9
0
        /// <summary>
        /// Delete all members.
        /// </summary>
        /// <param name="memberStatusId">This is ‘a’ (active), ‘o’ (optout), or ‘e’ (error).</param>
        /// <returns>Returns true.</returns>
        /// <remarks></remarks>
        public bool DeleteAllMembers(MemberStatusShort memberStatusId)
        {
            var request = new RestRequest(Method.DELETE);
            request.Resource = "/{accountId}/members";
            request.AddParameter("member_status_id", memberStatusId.ToEnumString<MemberStatusShort>());

            return Execute<bool>(request);
        }
Example #10
0
        /// <summary>
        /// Change the status for an array of members. The members will have their member_status_id update
        /// </summary>
        /// <param name="memberIds">The array of member ids to change.</param>
        /// <param name="statusTo">The new status for the given members. Accepts one of ‘a’ (active), ‘e’ (error), ‘o’ (optout).</param>
        /// <returns>True if the members are successfully updated, otherwise False.</returns>
        /// <remarks></remarks>
        public bool ChangeMemberStatus(List<string> memberIds, MemberStatusShort statusTo)
        {
            var request = new RestRequest(Method.PUT);
            request.Resource = "/{accountId}/members/status";
            request.AddParameter("member_ids", memberIds);
            request.AddParameter("status_to", statusTo.ToEnumString<MemberStatusShort>());

            return Execute<bool>(request);
        }