Xin Ge push. NET Server SDK rest api calling Library (v1.2), sdkv1.2
Xinyi push. NET Server SDK rest api call library-Introduction
This version is encapsulated when we push the v2 version based on Xin GE. we will share it with you first, and the encapsulation is still compatible. It does not depend on other http call parts and is only dependent on json serialized dll.
There are some encapsulated call libraries on the Internet, but none of them are your preferred call methods and encapsulation styles. The official website does not include encapsulation. only python, java, and php are supported. NET, why,
Therefore, we also encapsulate.
Tip: This version is encapsulated around months. Currently, many functions are added to pigeon, but the functions are not affected. You only need to download the source code, you can add some parameters to the object class and call several methods.
Call code example
[Push all devices]
QQXGProvider qqxg = new QQXGProvider (); XGPushAllDeviceParam xgp = new XGPushAllDeviceParam (); xgp. timestamp = null; // 1299865775; xgp. valid_time = 600; // 600; xgp. sign = null; // use the actual key, the following only demonstrates the function of testing key1 ================ xgp. access_id = 2100025233; // xgp. access_Key = "ARQ4CB14Q92X"; xgp. secret_Key = "6ae193c85570ad1cc8fc9540560093b1"; // ================ test key2 ======================/// xgp. access_id = 2100025346; // xgp. access_Key = "AUP1I5W741WJ"; // xgp. secret_Key = "f2391810bc98c0d7435ec7c96b8f524f"; xgp. message_type = 1; xgp. expire_time = 3600; xgp. message = new NotifyMessage () {Custom_content = new SerializableDictionary <string, string> () {"type", "123" },{ "type1", "456 "}}, // Accept_time = new System. collections. generic. list <AcceptTime> () {// new AcceptTime () {Start = new XGTime () {Hour = "18", Min = "02"}, End = new XGTime () {Hour = "18", Min = "30" }}//}, Clearable = 1, Title = "XGTestAllDevice-50 %", Content = "there are 10% Chinese characters, 1% and $ abcdef ", // test Vibrate = 1, Ring = 1, Action = new yymessageaction () {Action_type = 2, Browser = new NotifyMessageAction_Browser () {Url =" http://baidu.com ", Confirm = 0}, Intent =" http://baidu.com ", Activity =" XGPushDemo "}}; XGResult <XGPushResult> a = qqxg. PushAllDevices (xgp );
[Mobile Phone devices with a single Device_token]
QQXGProvider qqxg = new QQXGProvider (); XGPushSingleDeviceParam xgp = new XGPushSingleDeviceParam (); xgp. timestamp = null; xgp. valid_time = 600; // 600; xgp. sign = null; // =============== test DEMO ==================== xgp. access_id = 2100025233; // xgp. access_Key = "ARQ4CB14Q92X"; xgp. secret_Key = "6ae193c85570ad1cc8fc9540560093b1"; // ================ test DEMO ======================// xgp. access_id = 2100025346; // xgp. access_Key = "AUP1I5W741WJ"; // xgp. secret_Key = "f2391810bc98c0d7435ec7c96b8f524f"; xgp. message_type = 1; xgp. message = new NotifyMessage () {Title = "XGTestSingleDevice", Content = "XGTestSingleDevice", Vibrate = 1}; xgp. device_token = "ef8d1c5b866652d14e62bbee2aac3b28b7ed2bf9"; // export XGResult <string> a = qqxg. pushSingleDevice (xgp );Single Device_token Device
[Single account, push by TAG, get message status, get the number of devices added to the application, query tags, and cancel scheduled tasks]
QQXGProvider qqxg = new QQXGProvider (); XGPushSingleAccountParam xgp = new XGPushSingleAccountParam (); xgp. timestamp = null; xgp. valid_time = 600; // 600; xgp. sign = null; // ================ test DEMO ==========================/// xgp. access_id = 2100025233; // xgp. access_Key = "ARQ4CB14Q92X"; // xgp. secret_Key = "6ae193c85570ad1cc8fc9540560093b1"; // =============== test DEMO ========= xgp. access_id = 2100025346; // xgp. access_Key = "AUP1I5W741WJ"; xgp. secret_Key = "f2391810bc98c0d7435ec7c96b8f524f"; xgp. message_type = 1; xgp. message = new NotifyMessage () {Title = "XGTestSingleAccount", Content = "XGTestSingleAccount", Vibrate = 1, Ring = 1}; xgp. account = "ffff"; // export XGResult <string> a = qqxg. pushSingleAccount (xgp );QQXGProvider qqxg = new QQXGProvider (); XGPushTagsDeviceParam xgp = new XGPushTagsDeviceParam (); xgp. timestamp = null; xgp. valid_time = 600; // 600; xgp. sign = null; // ================ test DEMO ==========================/// xgp. access_id = 2100025233; // xgp. access_Key = "ARQ4CB14Q92X"; // xgp. secret_Key = "6ae193c85570ad1cc8fc9540560093b1"; // =============== test DEMO ========= xgp. access_id = 2100025346; // xgp. access_Key = "AUP1I5W741WJ"; xgp. secret_Key = "f2391810bc98c0d7435ec7c96b8f524f"; xgp. message_type = 1; xgp. message = new NotifyMessage () {Title = "XGTestTagsDevice", Content = "XGTestTagsDevice", Vibrate = 1, Ring = 1}; xgp. tags_list = new System. collections. generic. list <string> (); xgp. tags_list.Add ("nature"); xgp. tags_op = "OR"; // export XGResult <XGPushResult> a = qqxg. pushTagsDevice (xgp); string a1 =. err_msg;Push QQXGProvider qqxg = new QQXGProvider () by TAG; XGPushGetMsgStatusParam xgp = new XGPushGetMsgStatusParam (); xgp. timestamp = null; xgp. valid_time = 600; // 600; xgp. sign = null; // ================ test DEMO ==========================/// xgp. access_id = 2100025233; // xgp. access_Key = "ARQ4CB14Q92X"; // xgp. secret_Key = "6ae193c85570ad1cc8fc9540560093b1"; // =============== test DEMO ========= xgp. access_id = 2100025346; // xgp. access_Key = "AUP1I5W741WJ"; xgp. secret_Key = "f2391810bc98c0d7435ec7c96b8f524f"; xgp. push_ids = new System. collections. generic. list <Push_Id_Obj> (); xgp. push_ids.Add (new Push_Id_Obj () {Push_id = "152947"}); xgp. push_ids.Add (new Push_Id_Obj () {Push_id = "152944"}); xgp. push_ids.Add (new Push_Id_Obj () {Push_id = "139303"}); XGResult <XGGetMsgStatusResult> a = qqxg. pushGetMsgStatus (xgp );Obtain the message status QQXGProvider qqxg = new QQXGProvider ("application"); XGPushGetAppDeviceNumParam xgp = new XGPushGetAppDeviceNumParam (); xgp. timestamp = null; xgp. valid_time = 600; // 600; xgp. sign = null; // ================ test DEMO ==========================/// xgp. access_id = 2100025233; // xgp. access_Key = "ARQ4CB14Q92X"; // xgp. secret_Key = "6ae193c85570ad1cc8fc9540560093b1"; // =============== test DEMO ========= xgp. access_id = 2100025346; // xgp. access_Key = "AUP1I5W741WJ"; xgp. secret_Key = "f2391810bc98c0d7435ec7c96b8f524f"; XGResult <XGDeviceNumResult> a = qqxg. getAppDeviceNum (xgp );Number of devices added to the application QQXGProvider qqxg = new QQXGProvider ("tags"); XGPushQueryAppTagsParam xgp = new XGPushQueryAppTagsParam (); xgp. timestamp = null; xgp. valid_time = 600; // 600; xgp. sign = null; // ================ test DEMO ==========================/// xgp. access_id = 2100025233; // xgp. access_Key = "ARQ4CB14Q92X"; // xgp. secret_Key = "6ae193c85570ad1cc8fc9540560093b1"; // =============== test DEMO ========= xgp. access_id = 2100025346; // xgp. access_Key = "AUP1I5W741WJ"; xgp. secret_Key = "f2391810bc98c0d7435ec7c96b8f524f"; XGResult <XGQueryAppTagsResult> a = qqxg. queryAppTags (xgp );Query the QQXGProvider qqxg = new QQXGProvider (); XGOtherCommonParam xgp = new XGOtherCommonParam (); xgp. timestamp = null; xgp. valid_time = 600; // 600; xgp. sign = null; // ================ test DEMO ==========================/// xgp. access_id = 2100025233; // xgp. access_Key = "ARQ4CB14Q92X"; // xgp. secret_Key = "6ae193c85570ad1cc8fc9540560093b1"; // =============== test DEMO ========= xgp. access_id = 2100025346; // xgp. access_Key = "AUP1I5W741WJ"; xgp. secret_Key = "f2391810bc98c0d7435ec7c96b8f524f"; xgp. push_id = "139303"; XGResult <XGStatusResult> a = qqxg. pushCancelTimingTask (xgp );Cancel a scheduled task
Open Source Code address
Https://github.com/jasnature/NSTool.XGPush