Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace csclt
- {
- using System;
- using System.Collections.Generic;
- using Newtonsoft.Json;
- using Contentstack.Core;
- using Contentstack.Core.Configuration;
- using Contentstack.Core.Models;
- public class Program
- {
- public class AssetMetadata
- {
- public string Url { get; set; }
- }
- public class FieldTypesEntry
- {
- public List<string> StringField { get; set; }
- [JsonProperty(propertyName: "datefield")]
- public List<DateTime> DateTimeField { get; set; }
- public List<string> RichTextField { get; set; }
- [JsonProperty(propertyName: "asssetfield")]
- public List<AssetMetadata> AssetField { get; set; }
- [JsonProperty(propertyName: "numberfiel")]
- public List<double?> NumberField { get; set; }
- public void Render()
- {
- Console.WriteLine(GetType());
- foreach (double? number in NumberField)
- {
- Console.WriteLine("NumberField: " + number);
- }
- foreach (string value in StringField)
- {
- Console.WriteLine("StringField: " + value);
- }
- foreach (DateTime dt in DateTimeField)
- {
- Console.WriteLine("DateTimeField: " + dt);
- }
- foreach (string richText in RichTextField)
- {
- Console.WriteLine("RichTextField: " + richText);
- }
- foreach (AssetMetadata asset in AssetField)
- {
- Console.WriteLine("AssetField: " + asset.Url);
- }
- }
- }
- static void Main(string[] args)
- {
- ContentstackClient stack = new ContentstackClient(new ContentstackOptions()
- {
- ApiKey = "blt94519f01d8f92c86",
- AccessToken = "cs99af6674ef2a7a53770da6b7",
- Environment = "contentdelivery",
- });
- stack.ContentType("fieldtypes").Entry("blt63b6985324826b78"
- ).Fetch<FieldTypesEntry>().GetAwaiter().GetResult().Render();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement