cn.jpush.api.device.DeviceClient.updateDeviceTags C# (CSharp) Method

updateDeviceTags() public method

public updateDeviceTags ( String registrationId, HashSet tagsToAdd, HashSet tagsToRemove ) : cn.jpush.api.common.resp.DefaultResult
registrationId String
tagsToAdd HashSet
tagsToRemove HashSet
return cn.jpush.api.common.resp.DefaultResult
        public DefaultResult updateDeviceTags(String registrationId, HashSet<String> tagsToAdd, HashSet<String> tagsToRemove)
        {
            String url = HOST_NAME_SSL + DEVICES_PATH + "/" + registrationId;

            JObject top = new JObject();
            JObject tagObject = new JObject();
            if (tagsToAdd != null)
            {
                JArray tagsAdd = JArray.FromObject(tagsToAdd);
                if (tagsAdd.Count > 0)
                {
                    tagObject.Add("add", tagsAdd);
                }
            }
            if (tagsToRemove != null)
            {

                JArray tagsRemove = JArray.FromObject(tagsToRemove);
                if (tagsRemove.Count > 0)
                {
                    tagObject.Add("remove", tagsRemove);
                }
            }

            if (tagObject.Count > 0)
            {
                top.Add("tags", tagObject);
            }
            ResponseWrapper result = sendPost(url, Authorization(), top.ToString());
            return DefaultResult.fromResponse(result);
        }