Exemplo n.º 1
0
        public async Task <bool> PushSMS(CellNumber Number, string Message)
        {
            try {
                HttpClient client = new HttpClient();
                client.DefaultRequestHeaders.Add("Access-Token", this.Token);
                Uri url = new Uri(BaseUrl + "ephemerals");
                Dictionary <string, object> data = new Dictionary <string, object>();
                data.Add("type", "push");
                data.Add("push", new Dictionary <string, string> {
                    { "conversation_iden", Number },
                    { "message", Message },
                    { "package_name", "com.pushbullet.android" },
                    { "source_user_iden", this.userIden },
                    { "target_device_iden", this.cellIden },
                    { "type", "messaging_extension_reply" }
                });
                HttpContent         jsonContent = new StringContent(DEBUG_STRING = JsonConvert.SerializeObject(data, new KeyValuePairConverter()), System.Text.Encoding.UTF8, "application/json");
                HttpResponseMessage post        = await client.PostAsync(url, jsonContent);

                JsonConvert.DeserializeObject <PBData>(DEBUG_STRING = await post.Content.ReadAsStringAsync());
                return(true);
            } catch (Exception e) {
                Console.WriteLine(e.Data);
                return(false);
            }
        }
Exemplo n.º 2
0
 public PBClient(AccessToken token, AccessToken celltoken, CellNumber number) : this( token ) {
     this.cellIden = cellIden;
     this.Phone    = number;
 }