Last active
August 29, 2015 14:21
-
-
Save DalSoft/f3413caae03c36ae3112 to your computer and use it in GitHub Desktop.
DalSoft.RestClient - dynamic C# rest client in action PushWoosh SDK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method /createMessage https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-Method-messages-create | |
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3"); | |
var pushWooshResponse = await pushwoosh.CreateMessage.Post(new | |
{ | |
request = new | |
{ | |
application = "APPLICATION_CODE", | |
auth = "API_ACCESS_TOKEN", | |
notifications = new[] { new { | |
send_date = "now", // YYYY-MM-DD HH:mm OR 'now' | |
ignore_user_timezone = true, // or false | |
content = "your message", | |
// Optional. Not more than 1000 tokens in an array. If set, message will only be delivered to the devices in the list. Ignored if the applications group is used. Only lower case for iOS | |
devices = new[] { "dec301908b9ba8df85e57a58e40f96f523f4c2068674f5fe2ba25cdc250a2a41" } // | |
}} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method /deleteMessage https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-Method-messages-delete | |
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3"); | |
var response = await pushwoosh.DeleteMessage.Post(new | |
{ | |
request = new | |
{ | |
auth = "api_access_token", | |
message = "Message code obtained in createMessage" | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method /getNearestZone https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-MethodGetNearestZone | |
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3"); | |
var response = await pushwoosh.GetNearestZone.Post(new | |
{ | |
request = new | |
{ | |
application = "APPLICATION_CODE", | |
hwid = "hardware device id", | |
lat = 10.12345, | |
lng = 28.12345 | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method /pushStat https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-MethodPushStat | |
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3"); | |
var response = await pushwoosh.PushStat.Post(new | |
{ | |
request = new | |
{ | |
application = "APPLICATION_CODE", | |
hwid = "hardware device id", | |
hash = "hash" // received in the push notification in the "p" parameter | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method /registerDevice https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-MethodRegister | |
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3"); | |
var response = await pushwoosh.RegisterDevice.Post(new | |
{ | |
request = new | |
{ | |
application = "APPLICATION_CODE", | |
push_token = "DEVICE_PUSH_TOKEN", | |
hwid = "hardware device id", | |
device_type = 1 | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method /setBadge https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-MethodSetBadge | |
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3"); | |
var response = await pushwoosh.SetBadge.Post(new | |
{ | |
request = new | |
{ | |
application = "APPLICATION_CODE", | |
hwid = "hardware device id", | |
badge = 5 | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Method /unregisterDevice https://www.pushwoosh.com/programming-push-notification/pushwoosh-push-notification-remote-api/#PushserviceAPI-MethodUnregister | |
dynamic pushwoosh = new RestClient("https://cp.pushwoosh.com/json/1.3"); | |
var response = await pushwoosh.UnRegisterDevice.Post(new | |
{ | |
request = new | |
{ | |
application = "APPLICATION_CODE", | |
hwid = "hardware device id" | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment