Exemple #1
0
    public TagAliasResult getDeviceTagAlias(String registrationId)
    {
        String url  = HOST_NAME_SSL + DEVICES_PATH + "/" + registrationId;
        String auth = Base64.getBase64Encode(this.appKey + ":" + this.masterSecret);

        ResponseWrapper response = this.sendGet(url, auth, null);

        return(TagAliasResult.fromResponse(response));
    }
        public void testGetDeviceTagAlias_cleard()
        {
            testUpdateDeviceTagAlias_clear();
            JPushClient    pushClient = new JPushClient(APP_KEY, MASTER_SECRET);
            TagAliasResult result     = pushClient.getDeviceTagAlias(REGISTRATION_ID1);

            Assert.IsTrue(result.isResultOK());
            Assert.AreEqual(null, result.alias);
            Assert.AreEqual(0, result.tags.Count);
        }
Exemple #3
0
    public static TagAliasResult fromResponse(ResponseWrapper responseWrapper)
    {
        TagAliasResult tagAliasResult = new TagAliasResult();

        if (responseWrapper.isServerResponse())
        {
            tagAliasResult = JsonConvert.DeserializeObject <TagAliasResult>(responseWrapper.responseContent);
        }
        tagAliasResult.ResponseResult = responseWrapper;
        return(tagAliasResult);
    }
        public void testGetDeviceTagAlias_1()
        {
            testUpdateDeviceTagAlias_add_remove_tags();

            JPushClient    pushClient = new JPushClient(APP_KEY, MASTER_SECRET);
            TagAliasResult result     = pushClient.getDeviceTagAlias(REGISTRATION_ID1);

            Assert.IsTrue(result.isResultOK());
            Assert.AreEqual("alias1", result.alias);
            Assert.IsTrue(result.tags.Contains("tag1"));
            Assert.IsTrue(result.tags.Contains("tag2"));
            Assert.IsTrue(!result.tags.Contains("tag3"));
            Assert.IsTrue(!result.tags.Contains("tag4"));
        }