Example #1
0
        public async Task <Asset> Fetch()
        {
            Dictionary <String, Object> headers = GetHeader(_Headers);

            Dictionary <String, object> headerAll = new Dictionary <string, object>();
            Dictionary <string, object> mainJson  = new Dictionary <string, object>();

            //Dictionary<string, object> urlQueries = new Dictionary<string, object>();

            if (headers != null && headers.Count() > 0)
            {
                foreach (KeyValuePair <string, object> header in headers)
                {
                    headerAll.Add(header.Key, (String)header.Value);
                }
            }
            mainJson.Add("environment", this.StackInstance.Config.Environment);

            foreach (var kvp in UrlQueries)
            {
                mainJson.Add(kvp.Key, kvp.Value);
            }
            try
            {
                HttpRequestHandler RequestHandler = new HttpRequestHandler();
                var outputResult = await RequestHandler.ProcessRequest(_Url, headers, mainJson);

                JObject obj = JObject.Parse(ContentstackConvert.ToString(outputResult, "{}"));
                return(obj.SelectToken("$.asset").ToObject <Asset>(this.StackInstance.Serializer));
            }
            catch (Exception ex)
            {
                throw GetContentstackError(ex);
            }
        }
Example #2
0
        private async Task <JObject> Exec()
        {
            Dictionary <string, object> headers = GetHeader(_Headers);

            Dictionary <String, object> headerAll = new Dictionary <string, object>();
            Dictionary <string, object> mainJson  = new Dictionary <string, object>();

            //Dictionary<string, object> urlQueries = new Dictionary<string, object>();

            if (headers != null && headers.Count() > 0)
            {
                foreach (var header in headers)
                {
                    headerAll.Add(header.Key, (String)header.Value);
                }
            }

            mainJson.Add("environment", this.Stack.Config.Environment);

            foreach (var kvp in UrlQueries)
            {
                mainJson.Add(kvp.Key, kvp.Value);
            }
            try
            {
                HttpRequestHandler RequestHandler = new HttpRequestHandler();
                var outputResult = await RequestHandler.ProcessRequest(_Url, headers, mainJson);

                return(JObject.Parse(ContentstackConvert.ToString(outputResult, "{}")));
            }
            catch (Exception ex)
            {
                throw GetContentstackError(ex);
            }
        }
Example #3
0
 public DateTime GetDeleteAt()
 {
     try
     {
         String value = _ObjectAttributes["deleted_at"].ToString();
         return(ContentstackConvert.ToDateTime(value));
     }
     catch
     {
         // CSAppUtils.showLog(TAG, "-----------------getDeleteAt|" + e);
     }
     return(DateTime.MinValue);
 }
Example #4
0
 public DateTime GetDeleteAt()
 {
     try
     {
         String value = _ObjectAttributes["deleted_at"].ToString();
         return(ContentstackConvert.ToDateTime(value));
     }
     catch (Exception e)
     {
         if (e.Source != null)
         {
             Console.WriteLine("IOException source: {0}", e.Source);
         }
     }
     return(DateTime.MinValue);
 }