Ejemplo n.º 1
0
        public static Models.Doc ParseDocObjectFromStream(Stream stream)
        {
            string value;

            using (var reader = new StreamReader(stream, Encoding.UTF8))
            {
                value = reader.ReadToEnd();
            }
            Models.Doc RedepmtionList = JsonConvert.DeserializeObject <Models.Doc>(value);
            return(RedepmtionList);
        }
Ejemplo n.º 2
0
        void MarkStreamElementsRedemptionComplete(Models.Doc Doc)
        {
            string         jwtToken = Models.StreamElements.jwtToken;
            string         channel  = Models.StreamElements.channel;
            Uri            uri      = new Uri("https://api.streamelements.com/kappa/v2/" + "store" + "/" + channel + "/" + "redemptions" + "/" + Doc._id);
            HttpWebRequest request  = (HttpWebRequest)WebRequest.CreateDefault(uri);

            request.Headers["Authorization"] = ("Bearer " + jwtToken);
            request.Method      = "PUT";
            request.ContentType = "application/json; charset=utf-8";
            request.Accept      = "Accept=application/json";
            string serializedObject = JsonConvert.SerializeObject(new
                                                                  { completed = true });

            request.SendChunked   = false;
            request.ContentLength = serializedObject.Length;
            using (var writer = new StreamWriter(request.GetRequestStream()))
            {
                writer.Write(serializedObject);
            }
            var response = request.GetResponse() as HttpWebResponse;

            response.Close();
        }