Exemple #1
0
        public async Task <bool> TestMessage(string message)
        {
            const string route = "/api/dev/json";

            if (_token == null || !_token.IsValid)
            {
                return(false);
            }

            SendTest testS    = new SendTest(message);
            string   json     = JsonConvert.SerializeObject(testS);
            string   response = await Post(json, route);

            GetTest testG = null;

            try
            {
                testG = JsonConvert.DeserializeObject <GetTest>(response);
            }
            catch (Exception)
            {
                return(false);
            }

            return(testG.Success);
        }
        public async Task <TestSent> SendTestAsync(int id, SendTest input)
        {
            var requestBody = new StringContent(JsonConvert.SerializeObject(input), Encoding.UTF8, "application/json");

            return(Deserialize <TestSent>(await PostAsync($"campaigns/{id}/actions/send", requestBody)));
        }