project demos fetching single records, multiple records, filtering, and posting new records
Showing
542 changed files
with
2679 additions
and
0 deletions
.gitignore
0 → 100644
| 1 | +[Ll]ibrary/ | ||
| 2 | +[Tt]emp/ | ||
| 3 | +[Oo]bj/ | ||
| 4 | +[Bb]uild/ | ||
| 5 | + | ||
| 6 | +# Autogenerated VS/MD solution and project files | ||
| 7 | +*.csproj | ||
| 8 | +*.unityproj | ||
| 9 | +*.sln | ||
| 10 | +*.suo | ||
| 11 | +*.user | ||
| 12 | +*.userprefs | ||
| 13 | +*.pidb | ||
| 14 | +*.booproj | ||
| 15 | + | ||
| 16 | +#Unity3D Generated File On Crash Reports | ||
| 17 | +sysinfo.txt | ||
| 18 | +Build.zip | ||
| 19 | + | ||
| 20 | +.DS_Store | ||
| 21 | +bin | ||
| 22 | +obj | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
No preview for this file type
File mode changed
No preview for this file type
No preview for this file type
No preview for this file type
ContentfulExample/Assets/DatabaseManager.cs
0 → 100644
| 1 | +using Contentful.Core; | ||
| 2 | +using Contentful.Core.Configuration; | ||
| 3 | +using Contentful.Core.Models; | ||
| 4 | +using Contentful.Core.Search; | ||
| 5 | +using Newtonsoft.Json; | ||
| 6 | +using Newtonsoft.Json.Linq; | ||
| 7 | +using System.Collections; | ||
| 8 | +using System.Collections.Generic; | ||
| 9 | +using System.Linq; | ||
| 10 | +using System.Net.Http; | ||
| 11 | +using UnityEngine; | ||
| 12 | +using WebKit; | ||
| 13 | +using Sirenix.OdinInspector; | ||
| 14 | + | ||
| 15 | +[System.Serializable] | ||
| 16 | +public class User | ||
| 17 | +{ | ||
| 18 | + [JsonProperty("sys")] | ||
| 19 | + public SystemProperties sys { get; set; } | ||
| 20 | + | ||
| 21 | + public string firstName; | ||
| 22 | + public string lastName; | ||
| 23 | + public string email; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +[System.Serializable] | ||
| 27 | +public class Race | ||
| 28 | +{ | ||
| 29 | + [JsonProperty("sys")] | ||
| 30 | + public SystemProperties sys { get; set; } | ||
| 31 | + | ||
| 32 | + public string time; | ||
| 33 | + public string fuckinIdk; | ||
| 34 | +} | ||
| 35 | + | ||
| 36 | + | ||
| 37 | +public class DatabaseManager : MonoBehaviour | ||
| 38 | +{ | ||
| 39 | + [FoldoutGroup("Contentful Initializer")] | ||
| 40 | + [SerializeField] | ||
| 41 | + private string _spaceId, _deliveryToken, _managementToken; | ||
| 42 | + | ||
| 43 | + private ContentfulClient _client; | ||
| 44 | + private ContentfulManagementClient _mClient; | ||
| 45 | + | ||
| 46 | + void Start() | ||
| 47 | + { | ||
| 48 | + ContentfulOptions options = new ContentfulOptions() | ||
| 49 | + { | ||
| 50 | + ManagementApiKey = _managementToken, | ||
| 51 | + DeliveryApiKey = _deliveryToken, | ||
| 52 | + SpaceId = _spaceId | ||
| 53 | + }; | ||
| 54 | + | ||
| 55 | + _client = new ContentfulClient(new HttpClient(), options); | ||
| 56 | + _mClient = new ContentfulManagementClient(new HttpClient(), options); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + | ||
| 62 | + #region GetSingle | ||
| 63 | + | ||
| 64 | + [FoldoutGroup("Get Single User")] | ||
| 65 | + [Button("Get Just Dave")] | ||
| 66 | + public void FetchUser() | ||
| 67 | + { | ||
| 68 | + StartCoroutine(GetSpecificUserCoroutine("dave@globacore.com")); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + private IEnumerator GetSpecificUserCoroutine(string email) | ||
| 72 | + { | ||
| 73 | + var query = new QueryBuilder<User>().ContentTypeIs("user").FieldEquals(userLambda => userLambda.email, email); | ||
| 74 | + var fetchUserRequest = _client.GetEntries(query); | ||
| 75 | + | ||
| 76 | + while (!fetchUserRequest.IsCompleted) yield return null; | ||
| 77 | + | ||
| 78 | + fetchedUser = fetchUserRequest.Result.First(); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + [FoldoutGroup("Get Single User")] | ||
| 82 | + [SerializeField] | ||
| 83 | + private User fetchedUser; | ||
| 84 | + | ||
| 85 | + #endregion | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + | ||
| 89 | + #region GetAll | ||
| 90 | + | ||
| 91 | + [FoldoutGroup("Get All Users")] | ||
| 92 | + [Button("Get All Users As List")] | ||
| 93 | + public void GetAllUsers() | ||
| 94 | + { | ||
| 95 | + StartCoroutine(GetAllUserCoroutine()); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + private IEnumerator GetAllUserCoroutine() | ||
| 99 | + { | ||
| 100 | + var query = new QueryBuilder<User>().ContentTypeIs("user"); | ||
| 101 | + var fetchUsersRequest = _client.GetEntries(query); | ||
| 102 | + | ||
| 103 | + while (!fetchUsersRequest.IsCompleted) yield return null; | ||
| 104 | + | ||
| 105 | + allUsers = fetchUsersRequest.Result.ToList(); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + [FoldoutGroup("Get All Users")] | ||
| 109 | + [SerializeField] | ||
| 110 | + private List<User> allUsers; | ||
| 111 | + | ||
| 112 | + #endregion | ||
| 113 | + | ||
| 114 | + | ||
| 115 | + | ||
| 116 | + | ||
| 117 | + #region Create | ||
| 118 | + | ||
| 119 | + [FoldoutGroup("Create New User")] | ||
| 120 | + [SerializeField] | ||
| 121 | + public User userToCreate = new User(); | ||
| 122 | + | ||
| 123 | + [FoldoutGroup("Create New User")] | ||
| 124 | + [Button("Create User")] | ||
| 125 | + public void CreateUser() | ||
| 126 | + { | ||
| 127 | + StartCoroutine(CreateUserCoroutine()); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + private IEnumerator CreateUserCoroutine() | ||
| 131 | + { | ||
| 132 | + var userEntry = new Entry<dynamic>(); | ||
| 133 | + userEntry.SystemProperties = new SystemProperties(); | ||
| 134 | + userEntry.SystemProperties.Id = "User"; | ||
| 135 | + | ||
| 136 | + userEntry.Fields = new | ||
| 137 | + { | ||
| 138 | + firstName = new Dictionary<string, string>() | ||
| 139 | + { | ||
| 140 | + {"en-US", userToCreate.firstName } | ||
| 141 | + }, | ||
| 142 | + lastName = new Dictionary<string, string>() | ||
| 143 | + { | ||
| 144 | + {"en-US", userToCreate.lastName } | ||
| 145 | + }, | ||
| 146 | + email = new Dictionary<string, string>() | ||
| 147 | + { | ||
| 148 | + {"en-US", userToCreate.email } | ||
| 149 | + }, | ||
| 150 | + }; | ||
| 151 | + | ||
| 152 | + var createEntry = _mClient.CreateEntry(userEntry, "user"); | ||
| 153 | + while (!createEntry.IsCompleted) yield return null; | ||
| 154 | + | ||
| 155 | + var createdEntry = createEntry.Result; | ||
| 156 | + | ||
| 157 | + var publishEntry = _mClient.PublishEntry(createdEntry.SystemProperties.Id, 1); | ||
| 158 | + while (!publishEntry.IsCompleted) yield return null; | ||
| 159 | + | ||
| 160 | + print("dun did it"); | ||
| 161 | + } | ||
| 162 | + | ||
| 163 | + #endregion | ||
| 164 | +} |
ContentfulExample/Assets/Packages.meta
0 → 100644
| 1 | +# Change Log | ||
| 2 | +All notable changes to this project will be documented in this file. | ||
| 3 | +This project adheres to [Semantic Versioning](http://semver.org/). | ||
| 4 | + | ||
| 5 | +## Version [1.2.0] | ||
| 6 | +- Adds method `CreateEntryForLocaleAsync` to the management client. | ||
| 7 | + | ||
| 8 | +## Version [1.1.1] | ||
| 9 | +- Adds missing properties for the `SystemProperties` object. | ||
| 10 | + | ||
| 11 | +## Version [1.1.0] | ||
| 12 | +- Adds convenience methods to `ContentfulManagementClient` for retrieveing, creating and updating entries without having to use `Entry<dynamic>`. | ||
| 13 | + | ||
| 14 | +## Version [1.0.0] | ||
| 15 | +- Initial stable release on NetStandard 2.0 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +We appreciate any community contributions to this project, whether in the form of issues or Pull Requests. | ||
| 2 | + | ||
| 3 | +This document outlines what we'd like you to follow in terms of commit messages and code style. | ||
| 4 | + | ||
| 5 | +It also explains what to do in case you want to setup the project locally and run tests. | ||
| 6 | + | ||
| 7 | +# Setup | ||
| 8 | + | ||
| 9 | +This project is written using Visual Studio 2017 RC and the latest dotnet core SDKs. Clone the repository, run `dotnet restore` | ||
| 10 | +and then `dotnet build` to compile. | ||
| 11 | + | ||
| 12 | +# Code style | ||
| 13 | + | ||
| 14 | +This project uses Microsoft standard code styles. They can be found in the `editorstyles.config` file. Read more at [editorconfig.org](http://EditorConfig.org) | ||
| 15 | + | ||
| 16 | +# Running tests | ||
| 17 | + | ||
| 18 | +To run the tests for this solution, either start the runner from within visual studio or run `dotnet test` in the test project directories. |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Configuration/AssetJsonConverter.cs
0 → 100644
| 1 | +using Contentful.Core.Models; | ||
| 2 | +using Newtonsoft.Json; | ||
| 3 | +using Newtonsoft.Json.Linq; | ||
| 4 | +using System; | ||
| 5 | +using System.Collections.Generic; | ||
| 6 | +using System.Linq; | ||
| 7 | +using System.Threading.Tasks; | ||
| 8 | + | ||
| 9 | +namespace Contentful.Core.Configuration | ||
| 10 | +{ | ||
| 11 | + /// <summary> | ||
| 12 | + /// JsonConverter for converting Contentful assets into a simpler <see cref="Asset"/> structure. | ||
| 13 | + /// </summary> | ||
| 14 | + public class AssetJsonConverter : JsonConverter | ||
| 15 | + { | ||
| 16 | + /// <summary> | ||
| 17 | + /// Determines whether this instance can convert the specified object type. | ||
| 18 | + /// </summary> | ||
| 19 | + /// <param name="objectType">The type to convert to.</param> | ||
| 20 | + public override bool CanConvert(Type objectType) => objectType == typeof(Asset); | ||
| 21 | + | ||
| 22 | + /// <summary> | ||
| 23 | + /// Gets a value indicating whether this JsonConverter can write JSON. | ||
| 24 | + /// </summary> | ||
| 25 | + public override bool CanWrite => false; | ||
| 26 | + | ||
| 27 | + /// <summary> | ||
| 28 | + /// Reads the JSON representation of the object. | ||
| 29 | + /// </summary> | ||
| 30 | + /// <param name="reader">The reader to use.</param> | ||
| 31 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 32 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 33 | + /// <param name="serializer">The serializer to use.</param> | ||
| 34 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 35 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 36 | + { | ||
| 37 | + if (reader.TokenType == JsonToken.Null) { | ||
| 38 | + return null; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + var asset = new Asset(); | ||
| 42 | + | ||
| 43 | + var jObject = JObject.Load(reader); | ||
| 44 | + JToken refId; | ||
| 45 | + if (jObject.TryGetValue("$ref", out refId)) | ||
| 46 | + { | ||
| 47 | + return serializer.ReferenceResolver.ResolveReference(serializer, ((JValue) refId).Value.ToString()); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + asset.SystemProperties = jObject.SelectToken("$.sys")?.ToObject<SystemProperties>(); | ||
| 51 | + | ||
| 52 | + if (!string.IsNullOrEmpty(asset.SystemProperties.Locale)) | ||
| 53 | + { | ||
| 54 | + asset.Title = jObject.SelectToken("$.fields.title")?.ToString(); | ||
| 55 | + asset.TitleLocalized = new Dictionary<string, string>(); | ||
| 56 | + asset.TitleLocalized.Add(asset.SystemProperties.Locale, asset.Title); | ||
| 57 | + asset.Description = jObject.SelectToken("$.fields.description")?.ToString(); | ||
| 58 | + asset.DescriptionLocalized = new Dictionary<string, string>(); | ||
| 59 | + asset.DescriptionLocalized.Add(asset.SystemProperties.Locale, asset.Description); | ||
| 60 | + asset.File = jObject.SelectToken("$.fields.file")?.ToObject<File>(); | ||
| 61 | + asset.FilesLocalized = new Dictionary<string, File>(); | ||
| 62 | + asset.FilesLocalized.Add(asset.SystemProperties.Locale, asset.File); | ||
| 63 | + } | ||
| 64 | + else | ||
| 65 | + { | ||
| 66 | + asset.TitleLocalized = jObject.SelectToken("$.fields.title")?.ToObject<Dictionary<string, string>>(); | ||
| 67 | + asset.DescriptionLocalized = jObject.SelectToken("$.fields.description")?.ToObject<Dictionary<string, string>>(); | ||
| 68 | + asset.FilesLocalized = jObject.SelectToken("$.fields.file")?.ToObject<Dictionary<string, File>>(); | ||
| 69 | + } | ||
| 70 | + if (!serializer.ReferenceResolver.IsReferenced(serializer, asset)) | ||
| 71 | + { | ||
| 72 | + serializer.ReferenceResolver.AddReference(serializer, asset.SystemProperties.Id, asset); | ||
| 73 | + } | ||
| 74 | + return asset; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + /// <summary> | ||
| 78 | + /// Writes the JSON representation of the object. | ||
| 79 | + /// **NOTE: This method is not implemented and will throw an exception.** | ||
| 80 | + /// </summary> | ||
| 81 | + /// <param name="writer"></param> | ||
| 82 | + /// <param name="value"></param> | ||
| 83 | + /// <param name="serializer"></param> | ||
| 84 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 85 | + { | ||
| 86 | + throw new NotImplementedException(); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | +} |
| 1 | +using Contentful.Core.Models; | ||
| 2 | +using Contentful.Core.Models.Management; | ||
| 3 | +using Newtonsoft.Json; | ||
| 4 | +using Newtonsoft.Json.Linq; | ||
| 5 | +using System; | ||
| 6 | +using System.Collections.Generic; | ||
| 7 | +using System.Linq; | ||
| 8 | +using System.Text; | ||
| 9 | + | ||
| 10 | +namespace Contentful.Core.Configuration | ||
| 11 | +{ | ||
| 12 | + /// <summary> | ||
| 13 | + /// JsonConverter for converting <see cref="Contentful.Core.Models.Management.IConstraint"/>. | ||
| 14 | + /// </summary> | ||
| 15 | + public class ConstraintJsonConverter : JsonConverter | ||
| 16 | + { | ||
| 17 | + /// <summary> | ||
| 18 | + /// Determines whether this instance can convert the specified object type. | ||
| 19 | + /// </summary> | ||
| 20 | + /// <param name="objectType">The type to convert to.</param> | ||
| 21 | + public override bool CanConvert(Type objectType) => objectType == typeof(IConstraint); | ||
| 22 | + | ||
| 23 | + /// <summary> | ||
| 24 | + /// Reads the JSON representation of the object. | ||
| 25 | + /// </summary> | ||
| 26 | + /// <param name="reader">The reader to use.</param> | ||
| 27 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 28 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 29 | + /// <param name="serializer">The serializer to use.</param> | ||
| 30 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 31 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 32 | + { | ||
| 33 | + if (reader.TokenType == JsonToken.Null) | ||
| 34 | + { | ||
| 35 | + return null; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + var jObject = JObject.Load(reader); | ||
| 39 | + | ||
| 40 | + return ConvertJsonToConstraint(jObject); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + /// <summary> | ||
| 44 | + /// Writes the JSON representation of the object. | ||
| 45 | + /// </summary> | ||
| 46 | + /// <param name="writer"></param> | ||
| 47 | + /// <param name="value"></param> | ||
| 48 | + /// <param name="serializer"></param> | ||
| 49 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 50 | + { | ||
| 51 | + var constraint = value as IConstraint; | ||
| 52 | + | ||
| 53 | + if (constraint == null) | ||
| 54 | + return; | ||
| 55 | + | ||
| 56 | + serializer.Serialize(writer, ConvertConstraintToDynamic(constraint)); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + private IConstraint ConvertJsonToConstraint(JObject jObject) | ||
| 60 | + { | ||
| 61 | + if (jObject["and"] != null) | ||
| 62 | + { | ||
| 63 | + var andConstraint = new AndConstraint(); | ||
| 64 | + foreach(var item in jObject["and"]) | ||
| 65 | + { | ||
| 66 | + andConstraint.Add(ConvertJsonToConstraint((item as JObject))); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + return andConstraint; | ||
| 70 | + } | ||
| 71 | + if(jObject["or"] != null) | ||
| 72 | + { | ||
| 73 | + var orConstraint = new OrConstraint(); | ||
| 74 | + foreach (var item in jObject["or"]) | ||
| 75 | + { | ||
| 76 | + orConstraint.Add(ConvertJsonToConstraint((item as JObject))); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + return orConstraint; | ||
| 80 | + | ||
| 81 | + } | ||
| 82 | + if(jObject["equals"] != null) | ||
| 83 | + { | ||
| 84 | + var equalsConstraint = new EqualsConstraint(); | ||
| 85 | + | ||
| 86 | + equalsConstraint.Property = jObject["equals"][0]["doc"]?.ToString(); | ||
| 87 | + equalsConstraint.ValueToEqual = jObject["equals"][1]?.ToString(); | ||
| 88 | + | ||
| 89 | + return equalsConstraint; | ||
| 90 | + } | ||
| 91 | + if(jObject["paths"] != null) | ||
| 92 | + { | ||
| 93 | + var pathsConstraint = new PathConstraint(); | ||
| 94 | + | ||
| 95 | + pathsConstraint.Fields = jObject["paths"][0]["doc"]?.ToString(); | ||
| 96 | + | ||
| 97 | + return pathsConstraint; | ||
| 98 | + } | ||
| 99 | + if (jObject["not"] != null) | ||
| 100 | + { | ||
| 101 | + var notConstraint = new NotConstraint(); | ||
| 102 | + | ||
| 103 | + notConstraint.ConstraintToInvert = ConvertJsonToConstraint(jObject["not"] as JObject); | ||
| 104 | + | ||
| 105 | + return notConstraint; | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + return null; | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + private dynamic ConvertConstraintToDynamic(IConstraint constraint) | ||
| 112 | + { | ||
| 113 | + if (constraint is AndConstraint) | ||
| 114 | + { | ||
| 115 | + return new { and = (constraint as AndConstraint).Select(c => ConvertConstraintToDynamic(c)) }; | ||
| 116 | + } | ||
| 117 | + if(constraint is OrConstraint) | ||
| 118 | + { | ||
| 119 | + return new { or = (constraint as AndConstraint).Select(c => ConvertConstraintToDynamic(c)) }; | ||
| 120 | + } | ||
| 121 | + if(constraint is EqualsConstraint) | ||
| 122 | + { | ||
| 123 | + return new { equals = new dynamic[] { new { doc = (constraint as EqualsConstraint).Property }, (constraint as EqualsConstraint).ValueToEqual } }; | ||
| 124 | + } | ||
| 125 | + if(constraint is NotConstraint) | ||
| 126 | + { | ||
| 127 | + return new { not = ConvertConstraintToDynamic((constraint as NotConstraint).ConstraintToInvert) }; | ||
| 128 | + } | ||
| 129 | + if (constraint is PathConstraint) | ||
| 130 | + { | ||
| 131 | + return new { paths = new dynamic[] { new { doc = (constraint as PathConstraint).Fields } } }; | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + return null; | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Configuration/ContentfulOptions.cs
0 → 100644
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | +using Contentful.Core.Errors; | ||
| 6 | + | ||
| 7 | +namespace Contentful.Core.Configuration | ||
| 8 | +{ | ||
| 9 | + /// <summary> | ||
| 10 | + /// Represents a set of options to configure a <see cref="ContentfulClient"/>. | ||
| 11 | + /// </summary> | ||
| 12 | + public class ContentfulOptions | ||
| 13 | + { | ||
| 14 | + /// <summary> | ||
| 15 | + /// The api key used when communicating with the Contentful delivery API. | ||
| 16 | + /// </summary> | ||
| 17 | + public string DeliveryApiKey { get; set; } | ||
| 18 | + | ||
| 19 | + /// <summary> | ||
| 20 | + /// The api key used when communicating with the Contentful preview API. | ||
| 21 | + /// <remarks> | ||
| 22 | + /// To use the preview API the <see cref="UsePreviewApi"/> property must be set to true. | ||
| 23 | + /// </remarks> | ||
| 24 | + /// </summary> | ||
| 25 | + public string PreviewApiKey { get; set; } | ||
| 26 | + | ||
| 27 | + /// <summary> | ||
| 28 | + /// The api key used when communicating with the Contentful management API. | ||
| 29 | + /// </summary> | ||
| 30 | + public string ManagementApiKey { get; set; } | ||
| 31 | + | ||
| 32 | + /// <summary> | ||
| 33 | + /// The ID of the space that you wish to get or manipulate content for. | ||
| 34 | + /// </summary> | ||
| 35 | + public string SpaceId { get; set; } | ||
| 36 | + | ||
| 37 | + /// <summary> | ||
| 38 | + /// Whether or not to use the Preview API for requests. | ||
| 39 | + /// If this is set to true the preview API key needs to be used for <see cref="DeliveryApiKey"/>. | ||
| 40 | + /// </summary> | ||
| 41 | + public bool UsePreviewApi { get; set; } | ||
| 42 | + | ||
| 43 | + /// <summary> | ||
| 44 | + /// If set the client will evaluate the class to serialize into and only serialize the parts that are part of the class structure. | ||
| 45 | + /// </summary> | ||
| 46 | + public bool ResolveEntriesSelectively { get; set; } | ||
| 47 | + | ||
| 48 | + /// <summary> | ||
| 49 | + /// Sets the default number of times to retry after hitting a <see cref="Contentful.Core.Errors.ContentfulRateLimitException"/>. | ||
| 50 | + /// 0 means that no retries will be made. Maximum is 10. | ||
| 51 | + /// </summary> | ||
| 52 | + public int MaxNumberOfRateLimitRetries { get; set; } | ||
| 53 | + } | ||
| 54 | +} |
| 1 | +using Contentful.Core.Models; | ||
| 2 | +using Contentful.Core.Models.Management; | ||
| 3 | +using Newtonsoft.Json; | ||
| 4 | +using Newtonsoft.Json.Linq; | ||
| 5 | +using System; | ||
| 6 | +using System.Collections.Generic; | ||
| 7 | +using System.Text; | ||
| 8 | + | ||
| 9 | +namespace Contentful.Core.Configuration | ||
| 10 | +{ | ||
| 11 | + /// <summary> | ||
| 12 | + /// JsonConverter for converting <see cref="Contentful.Core.Models.Management.EditorInterface"/>. | ||
| 13 | + /// </summary> | ||
| 14 | + public class EditorInterfaceControlJsonConverter : JsonConverter | ||
| 15 | + { | ||
| 16 | + /// <summary> | ||
| 17 | + /// Determines whether this instance can convert the specified object type. | ||
| 18 | + /// </summary> | ||
| 19 | + /// <param name="objectType">The type to convert to.</param> | ||
| 20 | + public override bool CanConvert(Type objectType) => objectType == typeof(EditorInterfaceControl); | ||
| 21 | + | ||
| 22 | + /// <summary> | ||
| 23 | + /// Gets a value indicating whether this JsonConverter can write JSON. | ||
| 24 | + /// </summary> | ||
| 25 | + public override bool CanWrite => false; | ||
| 26 | + | ||
| 27 | + /// <summary> | ||
| 28 | + /// Reads the JSON representation of the object. | ||
| 29 | + /// </summary> | ||
| 30 | + /// <param name="reader">The reader to use.</param> | ||
| 31 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 32 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 33 | + /// <param name="serializer">The serializer to use.</param> | ||
| 34 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 35 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 36 | + { | ||
| 37 | + if (reader.TokenType == JsonToken.Null) | ||
| 38 | + return null; | ||
| 39 | + | ||
| 40 | + var jsonObject = JObject.Load(reader); | ||
| 41 | + var settings = new EditorInterfaceControlSettings(); | ||
| 42 | + | ||
| 43 | + var editorInterfaceControl = new EditorInterfaceControl() | ||
| 44 | + { | ||
| 45 | + FieldId = jsonObject["fieldId"]?.ToString(), | ||
| 46 | + WidgetId = jsonObject["widgetId"]?.ToString() | ||
| 47 | + }; | ||
| 48 | + | ||
| 49 | + if (jsonObject["settings"] == null) | ||
| 50 | + { | ||
| 51 | + return editorInterfaceControl; | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + if (jsonObject["widgetId"]?.ToString() == "boolean") | ||
| 55 | + { | ||
| 56 | + var boolSettings = new BooleanEditorInterfaceControlSettings() | ||
| 57 | + { | ||
| 58 | + FalseLabel = jsonObject["settings"]?["falseLabel"]?.ToString(), | ||
| 59 | + TrueLabel = jsonObject["settings"]?["trueLabel"]?.ToString() | ||
| 60 | + }; | ||
| 61 | + settings = boolSettings; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + if (jsonObject["widgetId"]?.ToString() == "rating") | ||
| 65 | + { | ||
| 66 | + var ratingSettings = new RatingEditorInterfaceControlSettings(); | ||
| 67 | + | ||
| 68 | + var stars = 0; | ||
| 69 | + | ||
| 70 | + if (!int.TryParse(jsonObject["settings"]?["stars"]?.ToString(), out stars)) | ||
| 71 | + { | ||
| 72 | + stars = 5; | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + ratingSettings.NumberOfStars = stars; | ||
| 76 | + | ||
| 77 | + settings = ratingSettings; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + if (jsonObject["widgetId"]?.ToString() == "datePicker") | ||
| 81 | + { | ||
| 82 | + var dateSettings = new DatePickerEditorInterfaceControlSettings() | ||
| 83 | + { | ||
| 84 | + ClockFormat = jsonObject["settings"]?["ampm"]?.ToString(), | ||
| 85 | + DateFormat = (EditorInterfaceDateFormat)Enum.Parse(typeof(EditorInterfaceDateFormat), jsonObject["settings"]?["format"]?.ToString(), true) | ||
| 86 | + }; | ||
| 87 | + settings = dateSettings; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + settings.HelpText = jsonObject["settings"]?["helpText"]?.ToString(); | ||
| 91 | + | ||
| 92 | + editorInterfaceControl.Settings = settings; | ||
| 93 | + | ||
| 94 | + return editorInterfaceControl; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + /// <summary> | ||
| 98 | + /// Writes the JSON representation of the object. | ||
| 99 | + /// **NOTE: This method is not implemented and will throw an exception.** | ||
| 100 | + /// </summary> | ||
| 101 | + /// <param name="writer"></param> | ||
| 102 | + /// <param name="value"></param> | ||
| 103 | + /// <param name="serializer"></param> | ||
| 104 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 105 | + { | ||
| 106 | + throw new NotImplementedException(); | ||
| 107 | + } | ||
| 108 | + } | ||
| 109 | +} |
| 1 | +using Contentful.Core.Models; | ||
| 2 | +using Contentful.Core.Models.Management; | ||
| 3 | +using Newtonsoft.Json; | ||
| 4 | +using Newtonsoft.Json.Linq; | ||
| 5 | +using System; | ||
| 6 | +using System.Collections.Generic; | ||
| 7 | +using System.Linq; | ||
| 8 | +using System.Text; | ||
| 9 | + | ||
| 10 | +namespace Contentful.Core.Configuration | ||
| 11 | +{ | ||
| 12 | + /// <summary> | ||
| 13 | + /// JsonConverter for converting <see cref="Contentful.Core.Models.Management.UiExtension"/>. | ||
| 14 | + /// </summary> | ||
| 15 | + public class ExtensionJsonConverter : JsonConverter | ||
| 16 | + { | ||
| 17 | + /// <summary> | ||
| 18 | + /// Determines whether this instance can convert the specified object type. | ||
| 19 | + /// </summary> | ||
| 20 | + /// <param name="objectType">The type to convert to.</param> | ||
| 21 | + public override bool CanConvert(Type objectType) => objectType == typeof(UiExtension); | ||
| 22 | + | ||
| 23 | + /// <summary> | ||
| 24 | + /// Gets a value indicating whether this JsonConverter can write JSON. | ||
| 25 | + /// </summary> | ||
| 26 | + public override bool CanWrite => true; | ||
| 27 | + | ||
| 28 | + /// <summary> | ||
| 29 | + /// Reads the JSON representation of the object. | ||
| 30 | + /// </summary> | ||
| 31 | + /// <param name="reader">The reader to use.</param> | ||
| 32 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 33 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 34 | + /// <param name="serializer">The serializer to use.</param> | ||
| 35 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 36 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 37 | + { | ||
| 38 | + if (reader.TokenType == JsonToken.Null) | ||
| 39 | + { | ||
| 40 | + return null; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + var jObject = JObject.Load(reader); | ||
| 44 | + var extensionProperties = jObject.SelectToken("$.extension"); | ||
| 45 | + | ||
| 46 | + var extension = new UiExtension(); | ||
| 47 | + | ||
| 48 | + extension.SystemProperties = jObject["sys"].ToObject<SystemProperties>(); | ||
| 49 | + extension.Src = extensionProperties["src"]?.ToString(); | ||
| 50 | + extension.Name = extensionProperties["name"]?.ToString(); | ||
| 51 | + extension.Sidebar = extensionProperties["sidebar"]?.Value<bool>() ?? false; | ||
| 52 | + extension.FieldTypes = extensionProperties["fieldTypes"]?.Values<dynamic>()?.Select(c => c.type.ToString())?.Cast<string>().ToList(); | ||
| 53 | + extension.SrcDoc = extensionProperties["srcDoc"]?.ToString(); | ||
| 54 | + | ||
| 55 | + return extension; | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + /// <summary> | ||
| 59 | + /// Writes the JSON representation of the object. | ||
| 60 | + /// </summary> | ||
| 61 | + /// <param name="writer"></param> | ||
| 62 | + /// <param name="value"></param> | ||
| 63 | + /// <param name="serializer"></param> | ||
| 64 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 65 | + { | ||
| 66 | + var extension = value as UiExtension; | ||
| 67 | + | ||
| 68 | + if (extension == null) | ||
| 69 | + { | ||
| 70 | + return; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + serializer.Serialize(writer, | ||
| 74 | + new { | ||
| 75 | + sys = extension.SystemProperties, | ||
| 76 | + extension = new { | ||
| 77 | + src = extension.Src, | ||
| 78 | + name = extension.Name, | ||
| 79 | + fieldTypes = extension.FieldTypes, | ||
| 80 | + srcDoc = extension.SrcDoc, | ||
| 81 | + sidebar = extension.Sidebar } }); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Configuration/IContentTypeResolver.cs
0 → 100644
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Text; | ||
| 4 | + | ||
| 5 | +namespace Contentful.Core.Configuration | ||
| 6 | +{ | ||
| 7 | + /// <summary> | ||
| 8 | + /// An interface for a contenttype resolver to allow resolving contenttypes to concrete CLR types. | ||
| 9 | + /// </summary> | ||
| 10 | + public interface IContentTypeResolver | ||
| 11 | + { | ||
| 12 | + /// <summary> | ||
| 13 | + /// Resolves a content type id to a concrete type. | ||
| 14 | + /// </summary> | ||
| 15 | + /// <param name="contentTypeId">The contenttype id to resolve.</param> | ||
| 16 | + /// <returns>The type for the provided contenttype id.</returns> | ||
| 17 | + Type Resolve(string contentTypeId); | ||
| 18 | + } | ||
| 19 | +} |
| 1 | +using Contentful.Core.Models; | ||
| 2 | +using Contentful.Core.Models.Management; | ||
| 3 | +using Newtonsoft.Json; | ||
| 4 | +using Newtonsoft.Json.Linq; | ||
| 5 | +using System; | ||
| 6 | +using System.Collections.Generic; | ||
| 7 | +using System.Text; | ||
| 8 | + | ||
| 9 | +namespace Contentful.Core.Configuration | ||
| 10 | +{ | ||
| 11 | + /// <summary> | ||
| 12 | + /// JsonConverter for converting <see cref="Contentful.Core.Models.Management.ManagementAsset"/>. | ||
| 13 | + /// </summary> | ||
| 14 | + public class ManagementAssetJsonConverter : JsonConverter | ||
| 15 | + { | ||
| 16 | + /// <summary> | ||
| 17 | + /// Determines whether this instance can convert the specified object type. | ||
| 18 | + /// </summary> | ||
| 19 | + /// <param name="objectType">The type to convert to.</param> | ||
| 20 | + public override bool CanConvert(Type objectType) => objectType == typeof(ManagementAsset); | ||
| 21 | + | ||
| 22 | + /// <summary> | ||
| 23 | + /// Reads the JSON representation of the object. | ||
| 24 | + /// </summary> | ||
| 25 | + /// <param name="reader">The reader to use.</param> | ||
| 26 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 27 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 28 | + /// <param name="serializer">The serializer to use.</param> | ||
| 29 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 30 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 31 | + { | ||
| 32 | + if (reader.TokenType == JsonToken.Null) | ||
| 33 | + { | ||
| 34 | + return null; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + var asset = new ManagementAsset(); | ||
| 38 | + | ||
| 39 | + var jObject = JObject.Load(reader); | ||
| 40 | + | ||
| 41 | + asset.Title = jObject.SelectToken("$.fields.title")?.ToObject<Dictionary<string, string>>(); | ||
| 42 | + asset.Description = jObject.SelectToken("$.fields.description")?.ToObject<Dictionary<string, string>>(); | ||
| 43 | + asset.Files = jObject.SelectToken("$.fields.file")?.ToObject<Dictionary<string, File>>(); | ||
| 44 | + asset.SystemProperties = jObject.SelectToken("$.sys")?.ToObject<SystemProperties>(); | ||
| 45 | + | ||
| 46 | + return asset; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /// <summary> | ||
| 50 | + /// Writes the JSON representation of the object. | ||
| 51 | + /// </summary> | ||
| 52 | + /// <param name="writer"></param> | ||
| 53 | + /// <param name="value"></param> | ||
| 54 | + /// <param name="serializer"></param> | ||
| 55 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 56 | + { | ||
| 57 | + if (value == null) | ||
| 58 | + return; | ||
| 59 | + | ||
| 60 | + var asset = value as ManagementAsset; | ||
| 61 | + | ||
| 62 | + serializer.Serialize(writer, new { sys = asset.SystemProperties, | ||
| 63 | + fields = new { title = asset.Title, description = asset.Description, file = asset.Files } }); | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Configuration/SnapshotJsonConverter.cs
0 → 100644
| 1 | +using Contentful.Core.Models; | ||
| 2 | +using Contentful.Core.Models.Management; | ||
| 3 | +using Newtonsoft.Json; | ||
| 4 | +using Newtonsoft.Json.Linq; | ||
| 5 | +using System; | ||
| 6 | +using System.Collections.Generic; | ||
| 7 | +using System.Text; | ||
| 8 | + | ||
| 9 | +namespace Contentful.Core.Configuration | ||
| 10 | +{ | ||
| 11 | + /// <summary> | ||
| 12 | + /// JsonConverter for converting <see cref="Contentful.Core.Models.Management.Snapshot"/>. | ||
| 13 | + /// </summary> | ||
| 14 | + public class SnapshotJsonConverter : JsonConverter | ||
| 15 | + { | ||
| 16 | + /// <summary> | ||
| 17 | + /// Determines whether this instance can convert the specified object type. | ||
| 18 | + /// </summary> | ||
| 19 | + /// <param name="objectType">The type to convert to.</param> | ||
| 20 | + public override bool CanConvert(Type objectType) => objectType == typeof(Snapshot); | ||
| 21 | + | ||
| 22 | + /// <summary> | ||
| 23 | + /// Gets a value indicating whether this JsonConverter can write JSON. | ||
| 24 | + /// </summary> | ||
| 25 | + public override bool CanWrite => false; | ||
| 26 | + | ||
| 27 | + /// <summary> | ||
| 28 | + /// Reads the JSON representation of the object. | ||
| 29 | + /// </summary> | ||
| 30 | + /// <param name="reader">The reader to use.</param> | ||
| 31 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 32 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 33 | + /// <param name="serializer">The serializer to use.</param> | ||
| 34 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 35 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 36 | + { | ||
| 37 | + if (reader.TokenType == JsonToken.Null) | ||
| 38 | + { | ||
| 39 | + return null; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + var jObject = JObject.Load(reader); | ||
| 43 | + var fields = jObject.SelectToken("$.snapshot.fields"); | ||
| 44 | + | ||
| 45 | + var snapshot = new Snapshot(); | ||
| 46 | + | ||
| 47 | + snapshot.SystemProperties = jObject["sys"].ToObject<SystemProperties>(); | ||
| 48 | + snapshot.Fields = fields.ToObject<Dictionary<string, Dictionary<string, dynamic>>>(); | ||
| 49 | + | ||
| 50 | + return snapshot; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + /// <summary> | ||
| 54 | + /// Writes the JSON representation of the object. | ||
| 55 | + /// **NOTE: This method is not implemented and will throw an exception.** | ||
| 56 | + /// </summary> | ||
| 57 | + /// <param name="writer"></param> | ||
| 58 | + /// <param name="value"></param> | ||
| 59 | + /// <param name="serializer"></param> | ||
| 60 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 61 | + { | ||
| 62 | + throw new NotImplementedException(); | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | +} |
| 1 | +using Contentful.Core.Models; | ||
| 2 | +using Contentful.Core.Models.Management; | ||
| 3 | +using Newtonsoft.Json; | ||
| 4 | +using Newtonsoft.Json.Linq; | ||
| 5 | +using System; | ||
| 6 | +using System.Collections.Generic; | ||
| 7 | +using System.Linq; | ||
| 8 | +using System.Text; | ||
| 9 | + | ||
| 10 | +namespace Contentful.Core.Configuration | ||
| 11 | +{ | ||
| 12 | + /// <summary> | ||
| 13 | + /// JsonConverter for converting <see cref="Contentful.Core.Models.Management.SpaceMembership"/>. | ||
| 14 | + /// </summary> | ||
| 15 | + public class SpaceMembershipJsonConverter : JsonConverter | ||
| 16 | + { | ||
| 17 | + /// <summary> | ||
| 18 | + /// Determines whether this instance can convert the specified object type. | ||
| 19 | + /// </summary> | ||
| 20 | + /// <param name="objectType">The type to convert to.</param> | ||
| 21 | + public override bool CanConvert(Type objectType) => objectType == typeof(SpaceMembership); | ||
| 22 | + | ||
| 23 | + /// <summary> | ||
| 24 | + /// Reads the JSON representation of the object. | ||
| 25 | + /// </summary> | ||
| 26 | + /// <param name="reader">The reader to use.</param> | ||
| 27 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 28 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 29 | + /// <param name="serializer">The serializer to use.</param> | ||
| 30 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 31 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 32 | + { | ||
| 33 | + if (reader.TokenType == JsonToken.Null) | ||
| 34 | + { | ||
| 35 | + return null; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + var jObject = JObject.Load(reader); | ||
| 39 | + | ||
| 40 | + var spaceMembership = new SpaceMembership(); | ||
| 41 | + | ||
| 42 | + spaceMembership.SystemProperties = jObject["sys"]?.ToObject<SystemProperties>(); | ||
| 43 | + spaceMembership.Admin = jObject.Value<bool>("admin"); | ||
| 44 | + spaceMembership.Roles = jObject.SelectTokens("$.roles..id")?.Values<string>().ToList(); | ||
| 45 | + | ||
| 46 | + return spaceMembership; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /// <summary> | ||
| 50 | + /// Writes the JSON representation of the object. | ||
| 51 | + /// **NOTE: This method is not implemented and will throw an exception.** | ||
| 52 | + /// </summary> | ||
| 53 | + /// <param name="writer"></param> | ||
| 54 | + /// <param name="value"></param> | ||
| 55 | + /// <param name="serializer"></param> | ||
| 56 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 57 | + { | ||
| 58 | + var spaceMembership = value as SpaceMembership; | ||
| 59 | + | ||
| 60 | + if(spaceMembership == null) | ||
| 61 | + { | ||
| 62 | + return; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + var jArray = new JArray(); | ||
| 66 | + | ||
| 67 | + if (spaceMembership.Roles != null) | ||
| 68 | + { | ||
| 69 | + foreach (var role in spaceMembership.Roles) | ||
| 70 | + { | ||
| 71 | + jArray.Add(new JObject( | ||
| 72 | + new JProperty("type", "Link"), | ||
| 73 | + new JProperty("linkType", "Role"), | ||
| 74 | + new JProperty("id", role.ToString()) | ||
| 75 | + )); | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + var jObject = new JObject( | ||
| 80 | + new JProperty("admin", spaceMembership.Admin), | ||
| 81 | + new JProperty("roles", jArray) | ||
| 82 | + ); | ||
| 83 | + | ||
| 84 | + jObject.WriteTo(writer); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | +} |
| 1 | +using Contentful.Core.Models; | ||
| 2 | +using Newtonsoft.Json; | ||
| 3 | +using Newtonsoft.Json.Linq; | ||
| 4 | +using System; | ||
| 5 | +using System.Collections.Generic; | ||
| 6 | +using System.Text; | ||
| 7 | + | ||
| 8 | +namespace Contentful.Core.Configuration | ||
| 9 | +{ | ||
| 10 | + /// <summary> | ||
| 11 | + /// JsonConverter to convert a list of string to a Contentful representation. | ||
| 12 | + /// </summary> | ||
| 13 | + public class StringAllToListJsonConverter : JsonConverter | ||
| 14 | + { | ||
| 15 | + /// <summary> | ||
| 16 | + /// Determines whether this instance can convert the specified object type. | ||
| 17 | + /// </summary> | ||
| 18 | + /// <param name="objectType">The type to convert to.</param> | ||
| 19 | + public override bool CanConvert(Type objectType) => objectType == typeof(List<string>); | ||
| 20 | + | ||
| 21 | + /// <summary> | ||
| 22 | + /// Reads the JSON representation of the object. | ||
| 23 | + /// </summary> | ||
| 24 | + /// <param name="reader">The reader to use.</param> | ||
| 25 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 26 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 27 | + /// <param name="serializer">The serializer to use.</param> | ||
| 28 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 29 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 30 | + { | ||
| 31 | + if (reader.TokenType == JsonToken.Null) | ||
| 32 | + { | ||
| 33 | + return null; | ||
| 34 | + } | ||
| 35 | + | ||
| 36 | + var jToken = JToken.Load(reader); | ||
| 37 | + | ||
| 38 | + if ((jToken.Type == JTokenType.String) && jToken.ToString() == "all") | ||
| 39 | + { | ||
| 40 | + return new List<string>() | ||
| 41 | + { | ||
| 42 | + "all" | ||
| 43 | + }; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + return new List<string>((jToken as JArray).Values<string>()); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + /// <summary> | ||
| 50 | + /// Writes the JSON representation of the object. | ||
| 51 | + /// </summary> | ||
| 52 | + /// <param name="writer"></param> | ||
| 53 | + /// <param name="value"></param> | ||
| 54 | + /// <param name="serializer"></param> | ||
| 55 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 56 | + { | ||
| 57 | + var list = value as List<string>; | ||
| 58 | + | ||
| 59 | + if(list == null) | ||
| 60 | + { | ||
| 61 | + return; | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + JToken token = JToken.FromObject(value); | ||
| 65 | + | ||
| 66 | + if (list.Count == 1 && list[0] == "all") | ||
| 67 | + { | ||
| 68 | + writer.WriteValue("all"); | ||
| 69 | + }else | ||
| 70 | + { | ||
| 71 | + token.WriteTo(writer); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | +} |
| 1 | +using Contentful.Core.Extensions; | ||
| 2 | +using Contentful.Core.Models; | ||
| 3 | +using Contentful.Core.Models.Management; | ||
| 4 | +using Contentful.Core.Search; | ||
| 5 | +using Newtonsoft.Json; | ||
| 6 | +using Newtonsoft.Json.Linq; | ||
| 7 | +using System; | ||
| 8 | +using System.Collections.Generic; | ||
| 9 | +using System.Linq; | ||
| 10 | +using System.Text; | ||
| 11 | + | ||
| 12 | +namespace Contentful.Core.Configuration | ||
| 13 | +{ | ||
| 14 | + /// <summary> | ||
| 15 | + /// JsonConverter for converting <see cref="Contentful.Core.Models.Management.IFieldValidator"/>. | ||
| 16 | + /// </summary> | ||
| 17 | + public class ValidationsJsonConverter : JsonConverter | ||
| 18 | + { | ||
| 19 | + /// <summary> | ||
| 20 | + /// Determines whether this instance can convert the specified object type. | ||
| 21 | + /// </summary> | ||
| 22 | + /// <param name="objectType">The type to convert to.</param> | ||
| 23 | + public override bool CanConvert(Type objectType) | ||
| 24 | + { | ||
| 25 | + return objectType is IFieldValidator; | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + /// <summary> | ||
| 29 | + /// Reads the JSON representation of the object. | ||
| 30 | + /// </summary> | ||
| 31 | + /// <param name="reader">The reader to use.</param> | ||
| 32 | + /// <param name="objectType">The object type to serialize into.</param> | ||
| 33 | + /// <param name="existingValue">The current value of the property.</param> | ||
| 34 | + /// <param name="serializer">The serializer to use.</param> | ||
| 35 | + /// <returns>The deserialized <see cref="Asset"/>.</returns> | ||
| 36 | + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| 37 | + { | ||
| 38 | + var jsonObject = JObject.Load(reader); | ||
| 39 | + | ||
| 40 | + JToken jToken = null; | ||
| 41 | + if (jsonObject.TryGetValue("size", out jToken)) | ||
| 42 | + { | ||
| 43 | + return new SizeValidator( | ||
| 44 | + jToken["min"].ToNullableInt(), | ||
| 45 | + jToken["max"].ToNullableInt(), | ||
| 46 | + jsonObject["message"]?.ToString()); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + if (jsonObject.TryGetValue("range", out jToken)) | ||
| 50 | + { | ||
| 51 | + return new RangeValidator( | ||
| 52 | + jToken["min"].ToNullableInt(), | ||
| 53 | + jToken["max"].ToNullableInt(), | ||
| 54 | + jsonObject["message"]?.ToString()); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + if (jsonObject.TryGetValue("in", out jToken)) | ||
| 58 | + { | ||
| 59 | + return new InValuesValidator(jToken.Values<string>(), jsonObject["message"]?.ToString()); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + if (jsonObject.TryGetValue("linkMimetypeGroup", out jToken)) | ||
| 63 | + { | ||
| 64 | + if(jToken is JValue) | ||
| 65 | + { | ||
| 66 | + //single string value returned for mime type field. This seems to be an inconsistency in the API that needs to be handled. | ||
| 67 | + | ||
| 68 | + var type = jToken.Value<string>(); | ||
| 69 | + return new MimeTypeValidator(new[] { (MimeTypeRestriction)Enum.Parse(typeof(MimeTypeRestriction), type, true) }, | ||
| 70 | + jsonObject["message"]?.ToString()); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + var types = jToken.Values<string>(); | ||
| 74 | + return new MimeTypeValidator(types.Select(c => (MimeTypeRestriction)Enum.Parse(typeof(MimeTypeRestriction), c, true)), | ||
| 75 | + jsonObject["message"]?.ToString()); | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + if (jsonObject.TryGetValue("linkContentType", out jToken)) | ||
| 79 | + { | ||
| 80 | + return new LinkContentTypeValidator(jToken.Values<string>(), jsonObject["message"]?.ToString()); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + if (jsonObject.TryGetValue("regexp", out jToken)) | ||
| 84 | + { | ||
| 85 | + return new RegexValidator(jToken["pattern"]?.ToString(), jToken["flags"]?.ToString(), jsonObject["message"]?.ToString()); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + if (jsonObject.TryGetValue("unique", out jToken)) | ||
| 89 | + { | ||
| 90 | + return new UniqueValidator(); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + if (jsonObject.TryGetValue("dateRange", out jToken)) | ||
| 94 | + { | ||
| 95 | + return new DateRangeValidator( | ||
| 96 | + jToken["min"]?.ToString(), | ||
| 97 | + jToken["max"]?.ToString(), | ||
| 98 | + jsonObject["message"]?.ToString()); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + if (jsonObject.TryGetValue("assetFileSize", out jToken)) | ||
| 102 | + { | ||
| 103 | + return new FileSizeValidator( | ||
| 104 | + jToken["min"].ToNullableInt(), | ||
| 105 | + jToken["max"].ToNullableInt(), | ||
| 106 | + SystemFileSizeUnits.Bytes, | ||
| 107 | + SystemFileSizeUnits.Bytes, | ||
| 108 | + jsonObject["message"]?.ToString()); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + if (jsonObject.TryGetValue("assetImageDimensions", out jToken)) | ||
| 112 | + { | ||
| 113 | + int? minWidth = null; | ||
| 114 | + int? maxWidth = null; | ||
| 115 | + int? minHeight = null; | ||
| 116 | + int? maxHeight = null; | ||
| 117 | + if (jToken["width"] != null) | ||
| 118 | + { | ||
| 119 | + var width = jToken["width"]; | ||
| 120 | + minWidth = width["min"].ToNullableInt(); | ||
| 121 | + maxWidth = width["max"].ToNullableInt(); | ||
| 122 | + } | ||
| 123 | + if (jToken["height"] != null) | ||
| 124 | + { | ||
| 125 | + var height = jToken["height"]; | ||
| 126 | + minHeight = height["min"].ToNullableInt(); | ||
| 127 | + maxHeight = height["max"].ToNullableInt(); | ||
| 128 | + } | ||
| 129 | + return new ImageSizeValidator(minWidth, maxWidth, minHeight, maxHeight, jsonObject["message"]?.ToString()); | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + return Activator.CreateInstance(objectType); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /// <summary> | ||
| 136 | + /// Writes the JSON representation of the object. | ||
| 137 | + /// </summary> | ||
| 138 | + /// <param name="writer"></param> | ||
| 139 | + /// <param name="value"></param> | ||
| 140 | + /// <param name="serializer"></param> | ||
| 141 | + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| 142 | + { | ||
| 143 | + serializer.Serialize(writer, (value as IFieldValidator).CreateValidator()); | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | +} |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/ContentfulManagementClient.cs
0 → 100644
This diff could not be displayed because it is too large.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Errors/ContentfulException.cs
0 → 100644
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | +using Contentful.Core.Models; | ||
| 6 | + | ||
| 7 | +namespace Contentful.Core.Errors | ||
| 8 | +{ | ||
| 9 | + /// <summary> | ||
| 10 | + /// Represents errors that occurr when calling the Contentful APIs. | ||
| 11 | + /// </summary> | ||
| 12 | + public class ContentfulException : Exception | ||
| 13 | + { | ||
| 14 | + /// <summary> | ||
| 15 | + /// Initializes a new instance of the <see cref="ContentfulException"/> class. | ||
| 16 | + /// </summary> | ||
| 17 | + /// <param name="statusCode">The http status code of the exception.</param> | ||
| 18 | + /// <param name="message">The message of the exception.</param> | ||
| 19 | + public ContentfulException(int statusCode, string message) : base(message) | ||
| 20 | + { | ||
| 21 | + StatusCode = statusCode; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /// <summary> | ||
| 25 | + /// The http status code of the exception. | ||
| 26 | + /// </summary> | ||
| 27 | + public int StatusCode { get; set; } | ||
| 28 | + | ||
| 29 | + /// <summary> | ||
| 30 | + /// Common system managed metadata properties. | ||
| 31 | + /// </summary> | ||
| 32 | + public SystemProperties SystemProperties { get; set; } | ||
| 33 | + | ||
| 34 | + /// <summary> | ||
| 35 | + /// The details of the exception. | ||
| 36 | + /// </summary> | ||
| 37 | + public ErrorDetails ErrorDetails { get; set; } | ||
| 38 | + | ||
| 39 | + /// <summary> | ||
| 40 | + /// The ID of the request to the Contentful API. | ||
| 41 | + /// </summary> | ||
| 42 | + public string RequestId { get; set; } | ||
| 43 | + } | ||
| 44 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Errors/ContentfulRateLimitException.cs
0 → 100644
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Text; | ||
| 4 | + | ||
| 5 | +namespace Contentful.Core.Errors | ||
| 6 | +{ | ||
| 7 | + /// <summary> | ||
| 8 | + /// Represents errors that occurr when a call hit the rate limit of the API. | ||
| 9 | + /// </summary> | ||
| 10 | + public class ContentfulRateLimitException : ContentfulException | ||
| 11 | + { | ||
| 12 | + /// <summary> | ||
| 13 | + /// Initializes a new instance of <see cref="Contentful.Core.Errors.ContentfulRateLimitException"/>. | ||
| 14 | + /// </summary> | ||
| 15 | + /// <param name="message">The message of the exception.</param> | ||
| 16 | + public ContentfulRateLimitException(string message) : base(429, message) | ||
| 17 | + { | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + /// <summary> | ||
| 21 | + /// The number of seconds until the next request can be made to the API. | ||
| 22 | + /// </summary> | ||
| 23 | + public int SecondsUntilNextRequest { get; set; } | ||
| 24 | + } | ||
| 25 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Errors | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Represents detailed information about a <see cref="ContentfulException"/> | ||
| 10 | + /// </summary> | ||
| 11 | + public class ErrorDetails | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// The dynamic representation of errors returned from the API. | ||
| 15 | + /// </summary> | ||
| 16 | + public dynamic Errors { get; set; } | ||
| 17 | + } | ||
| 18 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Extensions/JTokenExtensions.cs
0 → 100644
| 1 | +using Newtonsoft.Json.Linq; | ||
| 2 | +using System; | ||
| 3 | +using System.Collections.Generic; | ||
| 4 | +using System.Text; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Extensions | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Extensionmethods for JToken | ||
| 10 | + /// </summary> | ||
| 11 | + public static class JTokenExtensions | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// Checks whether a JToken is null or of null type. | ||
| 15 | + /// </summary> | ||
| 16 | + /// <param name="token">The token to validate.</param> | ||
| 17 | + /// <returns>Whether the token is null or not.</returns> | ||
| 18 | + public static bool IsNull(this JToken token) | ||
| 19 | + { | ||
| 20 | + return token == null || token.Type == JTokenType.Null; | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + /// <summary> | ||
| 24 | + /// Returns an int value from a JToken. | ||
| 25 | + /// </summary> | ||
| 26 | + /// <param name="token">The token to retrieve a value from.</param> | ||
| 27 | + /// <returns>The int value.</returns> | ||
| 28 | + public static int ToInt(this JToken token) | ||
| 29 | + { | ||
| 30 | + if (token.IsNull()) | ||
| 31 | + { | ||
| 32 | + return 0; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + return int.Parse(token.ToString()); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + /// <summary> | ||
| 39 | + /// Returns a nullable int value from a JToken. | ||
| 40 | + /// </summary> | ||
| 41 | + /// <param name="token">The token to retrieve a value from.</param> | ||
| 42 | + /// <returns>The nullable int value.</returns> | ||
| 43 | + public static int? ToNullableInt(this JToken token) | ||
| 44 | + { | ||
| 45 | + if (token.IsNull()) | ||
| 46 | + { | ||
| 47 | + return new int?(); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + return new int?(token.ToInt()); | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | +} |
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/IContentfulManagementClient.cs
0 → 100644
This diff is collapsed.
Click to expand it.
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Text; | ||
| 4 | + | ||
| 5 | +namespace Contentful.Core.Images | ||
| 6 | +{ | ||
| 7 | + /// <summary> | ||
| 8 | + /// Represents the different kinds of areas to focus an image on when using the <see cref="ImageResizeBehaviour.Thumb"/>. | ||
| 9 | + /// </summary> | ||
| 10 | + public enum ImageFocusArea | ||
| 11 | + { | ||
| 12 | + /// <summary> | ||
| 13 | + /// Center of image. | ||
| 14 | + /// </summary> | ||
| 15 | + Default, | ||
| 16 | + /// <summary> | ||
| 17 | + /// Top of the image. | ||
| 18 | + /// </summary> | ||
| 19 | + Top, | ||
| 20 | + /// <summary> | ||
| 21 | + /// Right side of the image. | ||
| 22 | + /// </summary> | ||
| 23 | + Right, | ||
| 24 | + /// <summary> | ||
| 25 | + /// Left side of the image. | ||
| 26 | + /// </summary> | ||
| 27 | + Left, | ||
| 28 | + /// <summary> | ||
| 29 | + /// Bottom side of the image. | ||
| 30 | + /// </summary> | ||
| 31 | + Bottom, | ||
| 32 | + /// <summary> | ||
| 33 | + /// Top right of the image. | ||
| 34 | + /// </summary> | ||
| 35 | + Top_Right, | ||
| 36 | + /// <summary> | ||
| 37 | + /// Top left of the image. | ||
| 38 | + /// </summary> | ||
| 39 | + Top_Left, | ||
| 40 | + /// <summary> | ||
| 41 | + /// Bottom right of the image. | ||
| 42 | + /// </summary> | ||
| 43 | + Bottom_Right, | ||
| 44 | + /// <summary> | ||
| 45 | + /// Bottom left of the image. | ||
| 46 | + /// </summary> | ||
| 47 | + Bottom_Left, | ||
| 48 | + /// <summary> | ||
| 49 | + /// Focuses on a face of an image using face detection. | ||
| 50 | + /// </summary> | ||
| 51 | + Face, | ||
| 52 | + /// <summary> | ||
| 53 | + /// Focuses on multiple faces of an image using face detection. | ||
| 54 | + /// </summary> | ||
| 55 | + Faces | ||
| 56 | + } | ||
| 57 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Text; | ||
| 4 | + | ||
| 5 | +namespace Contentful.Core.Images | ||
| 6 | +{ | ||
| 7 | + /// <summary> | ||
| 8 | + /// An enumeration representing the different kind of image formats available for images in Contentful. | ||
| 9 | + /// </summary> | ||
| 10 | + public enum ImageFormat | ||
| 11 | + { | ||
| 12 | + /// <summary> | ||
| 13 | + /// Keeps the original image format. | ||
| 14 | + /// </summary> | ||
| 15 | + Default, | ||
| 16 | + /// <summary> | ||
| 17 | + /// Turns the image into a JPG. | ||
| 18 | + /// </summary> | ||
| 19 | + Jpg, | ||
| 20 | + /// <summary> | ||
| 21 | + /// Turns the image into a PNG. | ||
| 22 | + /// </summary> | ||
| 23 | + Png, | ||
| 24 | + /// <summary> | ||
| 25 | + /// Turns the image into a WEBP. | ||
| 26 | + /// </summary> | ||
| 27 | + Webp | ||
| 28 | + } | ||
| 29 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Images/ImageResizeBehaviour.cs
0 → 100644
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Text; | ||
| 4 | + | ||
| 5 | +namespace Contentful.Core.Images | ||
| 6 | +{ | ||
| 7 | + /// <summary> | ||
| 8 | + /// Represents the different kinds of resizing behaviours for images available. | ||
| 9 | + /// </summary> | ||
| 10 | + public enum ImageResizeBehaviour | ||
| 11 | + { | ||
| 12 | + /// <summary> | ||
| 13 | + /// Resizes the image to fit within the bounding box specified by the width and height parameters, while maintaining aspect ratio. | ||
| 14 | + /// </summary> | ||
| 15 | + Default, | ||
| 16 | + /// <summary> | ||
| 17 | + /// Pads the image so that the resulting image has the exact size of the width and height parameters. | ||
| 18 | + /// </summary> | ||
| 19 | + Pad, | ||
| 20 | + /// <summary> | ||
| 21 | + /// Crops the image to match the specified size. | ||
| 22 | + /// </summary> | ||
| 23 | + Crop, | ||
| 24 | + /// <summary> | ||
| 25 | + /// Crops the image to match the specified size, if the original image is smaller it will be upscaled. | ||
| 26 | + /// </summary> | ||
| 27 | + Fill, | ||
| 28 | + /// <summary> | ||
| 29 | + /// Creates a thumbnail from an image based on a focus area. | ||
| 30 | + /// </summary> | ||
| 31 | + Thumb, | ||
| 32 | + /// <summary> | ||
| 33 | + /// Scale the image regardless of original aspect ratio. | ||
| 34 | + /// </summary> | ||
| 35 | + Scale | ||
| 36 | + } | ||
| 37 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Text; | ||
| 4 | + | ||
| 5 | +namespace Contentful.Core.Images | ||
| 6 | +{ | ||
| 7 | + /// <summary> | ||
| 8 | + /// Utility builder class to construct a correct image manipulation query string for a Contentful image. | ||
| 9 | + /// </summary> | ||
| 10 | + public class ImageUrlBuilder | ||
| 11 | + { | ||
| 12 | + private readonly List<KeyValuePair<string, string>> _querystringValues = new List<KeyValuePair<string, string>>(); | ||
| 13 | + | ||
| 14 | + /// <summary> | ||
| 15 | + /// Creates a new instance of an ImageUrlBuilder. | ||
| 16 | + /// </summary> | ||
| 17 | + /// <returns>The created <see cref="ImageUrlBuilder"/>.</returns> | ||
| 18 | + public static ImageUrlBuilder New() | ||
| 19 | + { | ||
| 20 | + return new ImageUrlBuilder(); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + /// <summary> | ||
| 24 | + /// Sets the format of the image returned. | ||
| 25 | + /// </summary> | ||
| 26 | + /// <param name="format">The <see cref="ImageFormat"/> of the image returned.</param> | ||
| 27 | + /// <returns>The <see cref="ImageUrlBuilder"/> instance.</returns> | ||
| 28 | + public ImageUrlBuilder SetFormat(ImageFormat format) | ||
| 29 | + { | ||
| 30 | + if(format == ImageFormat.Default) | ||
| 31 | + { | ||
| 32 | + return this; | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + _querystringValues.Add(new KeyValuePair<string, string>("fm", format.ToString().ToLower())); | ||
| 36 | + return this; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + /// <summary> | ||
| 40 | + /// Sets the quality of the jpg image returned. | ||
| 41 | + /// </summary> | ||
| 42 | + /// <param name="quality">The quality as a percentage between 0 and 100.</param> | ||
| 43 | + /// <returns>The <see cref="ImageUrlBuilder"/> instance.</returns> | ||
| 44 | + public ImageUrlBuilder SetJpgQuality(int quality) | ||
| 45 | + { | ||
| 46 | + _querystringValues.Add(new KeyValuePair<string, string>("q", quality.ToString())); | ||
| 47 | + return this; | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + /// <summary> | ||
| 51 | + /// Sets the returned jpg to be progressive. | ||
| 52 | + /// </summary> | ||
| 53 | + /// <returns>The <see cref="ImageUrlBuilder"/> instance.</returns> | ||
| 54 | + public ImageUrlBuilder UseProgressiveJpg() | ||
| 55 | + { | ||
| 56 | + _querystringValues.Add(new KeyValuePair<string, string>("fl", "progressive")); | ||
| 57 | + return this; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + /// <summary> | ||
| 61 | + /// Sets the width of the returned image. | ||
| 62 | + /// </summary> | ||
| 63 | + /// <param name="width">The width of the image.</param> | ||
| 64 | + /// <returns>The <see cref="ImageUrlBuilder"/> instance.</returns> | ||
| 65 | + public ImageUrlBuilder SetWidth(int width) | ||
| 66 | + { | ||
| 67 | + _querystringValues.Add(new KeyValuePair<string, string>("w", width.ToString())); | ||
| 68 | + return this; | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + /// <summary> | ||
| 72 | + /// Sets the height of the returned image. | ||
| 73 | + /// </summary> | ||
| 74 | + /// <param name="height">The height of the image.</param> | ||
| 75 | + /// <returns>The <see cref="ImageUrlBuilder"/> instance.</returns> | ||
| 76 | + public ImageUrlBuilder SetHeight(int height) | ||
| 77 | + { | ||
| 78 | + _querystringValues.Add(new KeyValuePair<string, string>("h", height.ToString())); | ||
| 79 | + return this; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + /// <summary> | ||
| 83 | + /// Sets how an image should be resized to fit inside the height and width specified. | ||
| 84 | + /// </summary> | ||
| 85 | + /// <param name="resizeBehaviour">The resizebehaviour.</param> | ||
| 86 | + /// <returns>The <see cref="ImageUrlBuilder"/> instance.</returns> | ||
| 87 | + public ImageUrlBuilder SetResizingBehaviour(ImageResizeBehaviour resizeBehaviour) | ||
| 88 | + { | ||
| 89 | + if(resizeBehaviour == ImageResizeBehaviour.Default) | ||
| 90 | + { | ||
| 91 | + return this; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + _querystringValues.Add(new KeyValuePair<string, string>("fit", resizeBehaviour.ToString().ToLower())); | ||
| 95 | + return this; | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + /// <summary> | ||
| 99 | + /// Sets what focus area should be used when resizing. | ||
| 100 | + /// </summary> | ||
| 101 | + /// <param name="focusArea">The area to focus the image on.</param> | ||
| 102 | + /// <returns>The <see cref="ImageUrlBuilder"/> instance.</returns> | ||
| 103 | + public ImageUrlBuilder SetFocusArea(ImageFocusArea focusArea) | ||
| 104 | + { | ||
| 105 | + if(focusArea == ImageFocusArea.Default) | ||
| 106 | + { | ||
| 107 | + return this; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + _querystringValues.Add(new KeyValuePair<string, string>("f", focusArea.ToString().ToLower())); | ||
| 111 | + return this; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + /// <summary> | ||
| 115 | + /// Set the corner radius of the image. | ||
| 116 | + /// </summary> | ||
| 117 | + /// <param name="radius">The radius to set.</param> | ||
| 118 | + /// <returns>The <see cref="ImageUrlBuilder"/> instance.</returns> | ||
| 119 | + public ImageUrlBuilder SetCornerRadius(int radius) | ||
| 120 | + { | ||
| 121 | + _querystringValues.Add(new KeyValuePair<string, string>("r", radius.ToString())); | ||
| 122 | + return this; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + /// <summary> | ||
| 126 | + /// Sets the background color when using <see cref="ImageResizeBehaviour.Pad"/> or <see cref="SetCornerRadius"/>. | ||
| 127 | + /// </summary> | ||
| 128 | + /// <param name="rgbColor">The background color in RGB format, starts with "rgb:" or "#" e.g. rgb:000080 or #000080.</param> | ||
| 129 | + /// <returns></returns> | ||
| 130 | + public ImageUrlBuilder SetBackgroundColor(string rgbColor) | ||
| 131 | + { | ||
| 132 | + if (string.IsNullOrEmpty(rgbColor)) | ||
| 133 | + { | ||
| 134 | + return this; | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + if (rgbColor.StartsWith("#")) | ||
| 138 | + { | ||
| 139 | + rgbColor = "rgb:" + rgbColor.Substring(1); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + _querystringValues.Add(new KeyValuePair<string, string>("bg", rgbColor)); | ||
| 143 | + | ||
| 144 | + return this; | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + /// <summary> | ||
| 148 | + /// Builds the query and returns the formatted querystring. | ||
| 149 | + /// </summary> | ||
| 150 | + /// <returns>The formatted querystring.</returns> | ||
| 151 | + public string Build() | ||
| 152 | + { | ||
| 153 | + var sb = new StringBuilder(); | ||
| 154 | + var hasQuery = false; | ||
| 155 | + | ||
| 156 | + foreach (var parameter in _querystringValues) | ||
| 157 | + { | ||
| 158 | + sb.Append(hasQuery ? '&' : '?'); | ||
| 159 | + sb.Append(parameter.Key); | ||
| 160 | + sb.Append('='); | ||
| 161 | + sb.Append(parameter.Value); | ||
| 162 | + hasQuery = true; | ||
| 163 | + } | ||
| 164 | + | ||
| 165 | + return sb.ToString(); | ||
| 166 | + } | ||
| 167 | + } | ||
| 168 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | +using Newtonsoft.Json; | ||
| 6 | + | ||
| 7 | +namespace Contentful.Core.Models | ||
| 8 | +{ | ||
| 9 | + /// <summary> | ||
| 10 | + /// Represents a single asset of a <see cref="Space"/>. | ||
| 11 | + /// </summary> | ||
| 12 | + public class Asset : IContentfulResource | ||
| 13 | + { | ||
| 14 | + /// <summary> | ||
| 15 | + /// Common system managed metadata properties. | ||
| 16 | + /// </summary> | ||
| 17 | + [JsonProperty("sys")] | ||
| 18 | + public SystemProperties SystemProperties { get; set; } | ||
| 19 | + | ||
| 20 | + /// <summary> | ||
| 21 | + /// The description of the asset. | ||
| 22 | + /// </summary> | ||
| 23 | + public string Description { get; set; } | ||
| 24 | + | ||
| 25 | + /// <summary> | ||
| 26 | + /// The title of the asset. | ||
| 27 | + /// </summary> | ||
| 28 | + public string Title { get; set; } | ||
| 29 | + | ||
| 30 | + /// <summary> | ||
| 31 | + /// Encapsulates information about the binary file of the asset. | ||
| 32 | + /// </summary> | ||
| 33 | + public File File { get; set; } | ||
| 34 | + | ||
| 35 | + /// <summary> | ||
| 36 | + /// The titles of the asset per locale. | ||
| 37 | + /// </summary> | ||
| 38 | + public Dictionary<string, string> TitleLocalized { get; set; } | ||
| 39 | + | ||
| 40 | + /// <summary> | ||
| 41 | + /// The descriptions of the asset per locale. | ||
| 42 | + /// </summary> | ||
| 43 | + public Dictionary<string, string> DescriptionLocalized { get; set; } | ||
| 44 | + | ||
| 45 | + /// <summary> | ||
| 46 | + /// Information about the file in respective language. | ||
| 47 | + /// </summary> | ||
| 48 | + public Dictionary<string, File> FilesLocalized { get; set; } | ||
| 49 | + } | ||
| 50 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | +using Newtonsoft.Json; | ||
| 6 | + | ||
| 7 | +namespace Contentful.Core.Models | ||
| 8 | +{ | ||
| 9 | + /// <summary> | ||
| 10 | + /// Represents a single content type. | ||
| 11 | + /// </summary> | ||
| 12 | + public class ContentType : IContentfulResource | ||
| 13 | + { | ||
| 14 | + /// <summary> | ||
| 15 | + /// Common system managed metadata properties. | ||
| 16 | + /// </summary> | ||
| 17 | + [JsonProperty("sys")] | ||
| 18 | + public SystemProperties SystemProperties { get; set; } | ||
| 19 | + | ||
| 20 | + /// <summary> | ||
| 21 | + /// The name of the content type. | ||
| 22 | + /// </summary> | ||
| 23 | + public string Name { get; set; } | ||
| 24 | + | ||
| 25 | + /// <summary> | ||
| 26 | + /// The description of the content type. | ||
| 27 | + /// </summary> | ||
| 28 | + public string Description { get; set; } | ||
| 29 | + | ||
| 30 | + /// <summary> | ||
| 31 | + /// The ID of the main field used for display. | ||
| 32 | + /// </summary> | ||
| 33 | + public string DisplayField { get; set; } | ||
| 34 | + | ||
| 35 | + /// <summary> | ||
| 36 | + /// List of <seealso cref="Field"/> this content type contains. | ||
| 37 | + /// </summary> | ||
| 38 | + public List<Field> Fields { get; set; } | ||
| 39 | + } | ||
| 40 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/ContentfulCollection.cs
0 → 100644
| 1 | +using System; | ||
| 2 | +using System.Collections; | ||
| 3 | +using System.Collections.Generic; | ||
| 4 | +using System.Linq; | ||
| 5 | +using System.Threading.Tasks; | ||
| 6 | +using Newtonsoft.Json; | ||
| 7 | + | ||
| 8 | +namespace Contentful.Core.Models | ||
| 9 | +{ | ||
| 10 | + /// <summary> | ||
| 11 | + /// Represents a collection of contentful resources with additional medadata regarding, skip, limit and total amount of items. | ||
| 12 | + /// </summary> | ||
| 13 | + /// <typeparam name="T">The type to serialize the items array from the API response into.</typeparam> | ||
| 14 | + [JsonObject] | ||
| 15 | + public class ContentfulCollection<T> : IEnumerable<T> | ||
| 16 | + { | ||
| 17 | + /// <summary> | ||
| 18 | + /// Common system managed metadata properties. | ||
| 19 | + /// </summary> | ||
| 20 | + [JsonProperty("sys")] | ||
| 21 | + public SystemProperties SystemProperties { get; set; } | ||
| 22 | + | ||
| 23 | + /// <summary> | ||
| 24 | + /// The number of items skipped in this resultset. | ||
| 25 | + /// </summary> | ||
| 26 | + public int Skip { get; set; } | ||
| 27 | + | ||
| 28 | + /// <summary> | ||
| 29 | + /// The maximum number of items returned in this result. | ||
| 30 | + /// </summary> | ||
| 31 | + public int Limit { get; set; } | ||
| 32 | + | ||
| 33 | + /// <summary> | ||
| 34 | + /// The total number of items available. | ||
| 35 | + /// </summary> | ||
| 36 | + public int Total { get; set; } | ||
| 37 | + | ||
| 38 | + /// <summary> | ||
| 39 | + /// The <see cref="IEnumerable{T}"/> of items to be serialized from the API response. | ||
| 40 | + /// </summary> | ||
| 41 | + public IEnumerable<T> Items { get; set; } | ||
| 42 | + | ||
| 43 | + /// <summary> | ||
| 44 | + /// The <see cref="IEnumerable{Entry}" /> of included referenced entries | ||
| 45 | + /// </summary> | ||
| 46 | + public IEnumerable<Entry<dynamic>> IncludedEntries { get; set; } | ||
| 47 | + | ||
| 48 | + /// <summary> | ||
| 49 | + /// The <see cref="IEnumerable{Asset}" /> of included referenced assets | ||
| 50 | + /// </summary> | ||
| 51 | + public IEnumerable<Asset> IncludedAssets { get; set; } | ||
| 52 | + | ||
| 53 | + /// <summary> | ||
| 54 | + /// An enumerable of errors while deserializing. Will be null if no errors are present. | ||
| 55 | + /// </summary> | ||
| 56 | + public IEnumerable<ContentfulError> Errors { get; set; } | ||
| 57 | + | ||
| 58 | + /// <summary> | ||
| 59 | + /// Returns an enumerator that iterates through the <see cref="Items"/> collection | ||
| 60 | + /// </summary> | ||
| 61 | + public IEnumerator<T> GetEnumerator() | ||
| 62 | + { | ||
| 63 | + return Items.GetEnumerator(); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + /// <summary> | ||
| 67 | + /// Returns an enumerator that iterates through the <see cref="Items"/> collection | ||
| 68 | + /// </summary> | ||
| 69 | + IEnumerator IEnumerable.GetEnumerator() | ||
| 70 | + { | ||
| 71 | + return GetEnumerator(); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | +} |
| 1 | +using Newtonsoft.Json; | ||
| 2 | +using System; | ||
| 3 | +using System.Collections.Generic; | ||
| 4 | +using System.Text; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Models | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Encapsulates an error returned from the Contentful API. | ||
| 10 | + /// </summary> | ||
| 11 | + public class ContentfulError : IContentfulResource | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// Common system managed metadata properties. | ||
| 15 | + /// </summary> | ||
| 16 | + [JsonProperty("sys")] | ||
| 17 | + public SystemProperties SystemProperties { get; set; } | ||
| 18 | + | ||
| 19 | + /// <summary> | ||
| 20 | + /// Encapsulates the details of the error. | ||
| 21 | + /// </summary> | ||
| 22 | + public ContentfulErrorDetails Details { get; set; } | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + /// <summary> | ||
| 26 | + /// Encapsulates detailed information about an error returned by the Contentful API. | ||
| 27 | + /// </summary> | ||
| 28 | + public class ContentfulErrorDetails | ||
| 29 | + { | ||
| 30 | + /// <summary> | ||
| 31 | + /// The type of error. | ||
| 32 | + /// </summary> | ||
| 33 | + public string Type { get; set; } | ||
| 34 | + | ||
| 35 | + /// <summary> | ||
| 36 | + /// The type of link causing the error. | ||
| 37 | + /// </summary> | ||
| 38 | + public string LinkType { get; set; } | ||
| 39 | + | ||
| 40 | + /// <summary> | ||
| 41 | + /// The id of the resource causing issues. | ||
| 42 | + /// </summary> | ||
| 43 | + public string Id { get; set; } | ||
| 44 | + } | ||
| 45 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | +using Newtonsoft.Json; | ||
| 6 | + | ||
| 7 | +namespace Contentful.Core.Models | ||
| 8 | +{ | ||
| 9 | + /// <summary> | ||
| 10 | + /// Represents a single entry of a <seealso cref="ContentType"/> in a <seealso cref="Space"/>. | ||
| 11 | + /// </summary> | ||
| 12 | + /// <typeparam name="T">The type the fields of the entry should be serialized into.</typeparam> | ||
| 13 | + public class Entry<T> : IEntry<T> | ||
| 14 | + { | ||
| 15 | + /// <summary> | ||
| 16 | + /// Common system managed metadata properties. | ||
| 17 | + /// </summary> | ||
| 18 | + [JsonProperty("sys")] | ||
| 19 | + public SystemProperties SystemProperties { get; set; } | ||
| 20 | + | ||
| 21 | + /// <summary> | ||
| 22 | + /// The fields of the entry deserialized to the type T. | ||
| 23 | + /// </summary> | ||
| 24 | + public T Fields { get; set; } | ||
| 25 | + } | ||
| 26 | +} |
| 1 | +using Contentful.Core.Models.Management; | ||
| 2 | +using System; | ||
| 3 | +using System.Collections.Generic; | ||
| 4 | +using System.Linq; | ||
| 5 | +using System.Threading.Tasks; | ||
| 6 | + | ||
| 7 | +namespace Contentful.Core.Models | ||
| 8 | +{ | ||
| 9 | + /// <summary> | ||
| 10 | + /// Represents a field in a <seealso cref="ContentType"/>. Note that this is not the representation of a field with | ||
| 11 | + /// actual value in an <seealso cref="Entry{T}"/> or <seealso cref="Asset"/>, but merely a representation of the fields data structure. | ||
| 12 | + /// </summary> | ||
| 13 | + public class Field | ||
| 14 | + { | ||
| 15 | + /// <summary> | ||
| 16 | + /// The ID of the field. It must be unique among all fields of the <seealso cref="ContentType"/>. | ||
| 17 | + /// </summary> | ||
| 18 | + public string Id { get; set; } | ||
| 19 | + | ||
| 20 | + /// <summary> | ||
| 21 | + /// The name of the field. This will be the label of the field in the Contentful web app. | ||
| 22 | + /// </summary> | ||
| 23 | + public string Name { get; set; } | ||
| 24 | + | ||
| 25 | + /// <summary> | ||
| 26 | + /// The type of field. Determines what type of data can be stored in the field. | ||
| 27 | + /// </summary> | ||
| 28 | + public string Type { get; set; } | ||
| 29 | + | ||
| 30 | + /// <summary> | ||
| 31 | + /// Whether this field is mandatory or not. | ||
| 32 | + /// </summary> | ||
| 33 | + public bool Required { get; set; } | ||
| 34 | + | ||
| 35 | + /// <summary> | ||
| 36 | + /// Whether this field supports different values for different locales. | ||
| 37 | + /// </summary> | ||
| 38 | + public bool Localized { get; set; } | ||
| 39 | + | ||
| 40 | + /// <summary> | ||
| 41 | + /// The type of link, if any. Normally Asset or Entry. | ||
| 42 | + /// </summary> | ||
| 43 | + public string LinkType { get; set; } | ||
| 44 | + | ||
| 45 | + /// <summary> | ||
| 46 | + /// Whether this field is disabled. Disabled fields are not visible in the Contentful web app. | ||
| 47 | + /// </summary> | ||
| 48 | + public bool Disabled { get; set; } | ||
| 49 | + | ||
| 50 | + /// <summary> | ||
| 51 | + /// Whether this field is omitted in the response from the Content Delivery and Preview APIs. | ||
| 52 | + /// </summary> | ||
| 53 | + public bool Omitted { get; set; } | ||
| 54 | + | ||
| 55 | + /// <summary> | ||
| 56 | + /// Defines a schema for the elements of an array field. Will be null for other types. | ||
| 57 | + /// </summary> | ||
| 58 | + public Schema Items { get; set; } | ||
| 59 | + | ||
| 60 | + /// <summary> | ||
| 61 | + /// The validations that should be applied to the field. | ||
| 62 | + /// </summary> | ||
| 63 | + public List<IFieldValidator> Validations { get; set; } | ||
| 64 | + } | ||
| 65 | +} |
| 1 | +using Contentful.Core.Configuration; | ||
| 2 | +using Contentful.Core.Models.Management; | ||
| 3 | +using Newtonsoft.Json; | ||
| 4 | +using System; | ||
| 5 | +using System.Collections.Generic; | ||
| 6 | +using System.Linq; | ||
| 7 | +using System.Threading.Tasks; | ||
| 8 | + | ||
| 9 | +namespace Contentful.Core.Models | ||
| 10 | +{ | ||
| 11 | + /// <summary> | ||
| 12 | + /// Represents information about the actual binary file of an <see cref="Asset"/>. | ||
| 13 | + /// </summary> | ||
| 14 | + public class File | ||
| 15 | + { | ||
| 16 | + /// <summary> | ||
| 17 | + /// The original name of the file. | ||
| 18 | + /// </summary> | ||
| 19 | + public string FileName { get; set; } | ||
| 20 | + /// <summary> | ||
| 21 | + /// The content type of the data contained within this file. | ||
| 22 | + /// </summary> | ||
| 23 | + public string ContentType { get; set; } | ||
| 24 | + /// <summary> | ||
| 25 | + /// An absolute URL to this file. | ||
| 26 | + /// </summary> | ||
| 27 | + public string Url { get; set; } | ||
| 28 | + /// <summary> | ||
| 29 | + /// The url to upload this file from. | ||
| 30 | + /// </summary> | ||
| 31 | + [JsonProperty("upload")] | ||
| 32 | + public string UploadUrl { get; set; } | ||
| 33 | + /// <summary> | ||
| 34 | + /// A reference to a SystemProperties metadata object with a type of upload. | ||
| 35 | + /// </summary> | ||
| 36 | + [JsonProperty("uploadFrom")] | ||
| 37 | + public UploadReference UploadReference { get; set; } | ||
| 38 | + /// <summary> | ||
| 39 | + /// Detailed information about the file stored by Contentful. | ||
| 40 | + /// </summary> | ||
| 41 | + public FileDetails Details { get; set; } | ||
| 42 | + } | ||
| 43 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Models | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Represents detailed information about a <see cref="File"/>. | ||
| 10 | + /// </summary> | ||
| 11 | + public class FileDetails | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// The size of the file in bytes. | ||
| 15 | + /// </summary> | ||
| 16 | + public long Size { get; set; } | ||
| 17 | + | ||
| 18 | + /// <summary> | ||
| 19 | + /// The image details of the file if applicable, will be null for non image types. | ||
| 20 | + /// </summary> | ||
| 21 | + public ImageDetails Image { get; set; } | ||
| 22 | + | ||
| 23 | + } | ||
| 24 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/IContentfulResource.cs
0 → 100644
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Models | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Represents a single Contentful resource. | ||
| 10 | + /// </summary> | ||
| 11 | + public interface IContentfulResource | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// Common system managed metadata properties. | ||
| 15 | + /// </summary> | ||
| 16 | + SystemProperties SystemProperties { get; set; } | ||
| 17 | + } | ||
| 18 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Models | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Represents a Contentful entry resource. | ||
| 10 | + /// </summary> | ||
| 11 | + /// <typeparam name="T">The type the fields of the entry should be serialized into.</typeparam> | ||
| 12 | + public interface IEntry<T> : IContentfulResource | ||
| 13 | + { | ||
| 14 | + /// <summary> | ||
| 15 | + /// The fields of the entry deserialized to the type T. | ||
| 16 | + /// </summary> | ||
| 17 | + T Fields { get; set; } | ||
| 18 | + } | ||
| 19 | +} |
| 1 | +using System; | ||
| 2 | +using System.Collections.Generic; | ||
| 3 | +using System.Linq; | ||
| 4 | +using System.Threading.Tasks; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Models | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Represents details about an image <see cref="File"/>. | ||
| 10 | + /// </summary> | ||
| 11 | + public class ImageDetails | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// The original height of the image. | ||
| 15 | + /// </summary> | ||
| 16 | + public int Height { get; set; } | ||
| 17 | + | ||
| 18 | + /// <summary> | ||
| 19 | + /// The original width of the image. | ||
| 20 | + /// </summary> | ||
| 21 | + public int Width { get; set; } | ||
| 22 | + } | ||
| 23 | +} |
| 1 | +using System; | ||
| 2 | + | ||
| 3 | +namespace Contentful.Core.Models | ||
| 4 | +{ | ||
| 5 | + /// <summary> | ||
| 6 | + /// Represents a location field in a <seealso cref="Space"/>. | ||
| 7 | + /// </summary> | ||
| 8 | + public class Location | ||
| 9 | + { | ||
| 10 | + /// <summary> | ||
| 11 | + /// The latitude of the location. | ||
| 12 | + /// </summary> | ||
| 13 | + public double Lat { get; set; } | ||
| 14 | + | ||
| 15 | + /// <summary> | ||
| 16 | + /// The longitude of the location. | ||
| 17 | + /// </summary> | ||
| 18 | + public double Lon { get; set; } | ||
| 19 | + } | ||
| 20 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/ApiKey.cs
0 → 100644
| 1 | +using Newtonsoft.Json; | ||
| 2 | +using System; | ||
| 3 | +using System.Collections.Generic; | ||
| 4 | +using System.Text; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Models.Management | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Represents an api key for the Contentful Content Delivery API. | ||
| 10 | + /// </summary> | ||
| 11 | + public class ApiKey : IContentfulResource | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// Common system managed metadata properties. | ||
| 15 | + /// </summary> | ||
| 16 | + [JsonProperty("sys", NullValueHandling = NullValueHandling.Ignore)] | ||
| 17 | + public SystemProperties SystemProperties { get; set; } | ||
| 18 | + | ||
| 19 | + /// <summary> | ||
| 20 | + /// The name of the API key. | ||
| 21 | + /// </summary> | ||
| 22 | + public string Name { get; set; } | ||
| 23 | + | ||
| 24 | + /// <summary> | ||
| 25 | + /// The description of the API key. | ||
| 26 | + /// </summary> | ||
| 27 | + public string Description { get; set; } | ||
| 28 | + | ||
| 29 | + /// <summary> | ||
| 30 | + /// The access token for the API key. | ||
| 31 | + /// </summary> | ||
| 32 | + public string AccessToken { get; set; } | ||
| 33 | + } | ||
| 34 | +} |
| 1 | +using Contentful.Core.Configuration; | ||
| 2 | +using Newtonsoft.Json; | ||
| 3 | +using System; | ||
| 4 | +using System.Collections.Generic; | ||
| 5 | +using System.Text; | ||
| 6 | + | ||
| 7 | +namespace Contentful.Core.Models.Management | ||
| 8 | +{ | ||
| 9 | + /// <summary> | ||
| 10 | + /// Represents a collection of permissions for different parts of the Contentful APIs. | ||
| 11 | + /// </summary> | ||
| 12 | + public class ContentfulPermissions | ||
| 13 | + { | ||
| 14 | + /// <summary> | ||
| 15 | + /// Adds permissions to modify the content model. | ||
| 16 | + /// </summary> | ||
| 17 | + [JsonProperty("ContentModel")] | ||
| 18 | + [JsonConverter(typeof(StringAllToListJsonConverter))] | ||
| 19 | + public List<string> ContentModel { get; set; } | ||
| 20 | + | ||
| 21 | + /// <summary> | ||
| 22 | + /// Adds permissions to modify settings. | ||
| 23 | + /// </summary> | ||
| 24 | + [JsonProperty("Settings")] | ||
| 25 | + [JsonConverter(typeof(StringAllToListJsonConverter))] | ||
| 26 | + public List<string> Settings { get; set; } | ||
| 27 | + | ||
| 28 | + /// <summary> | ||
| 29 | + /// Adds permissions to access the Content Delivery. | ||
| 30 | + /// </summary> | ||
| 31 | + [JsonProperty("ContentDelivery")] | ||
| 32 | + [JsonConverter(typeof(StringAllToListJsonConverter))] | ||
| 33 | + public List<string> ContentDelivery { get; set; } | ||
| 34 | + } | ||
| 35 | +} |
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/EditorInterface.cs
0 → 100644
| 1 | +using Newtonsoft.Json; | ||
| 2 | +using System; | ||
| 3 | +using System.Collections.Generic; | ||
| 4 | +using System.Text; | ||
| 5 | + | ||
| 6 | +namespace Contentful.Core.Models.Management | ||
| 7 | +{ | ||
| 8 | + /// <summary> | ||
| 9 | + /// Represents the editor interface of a <see cref="ContentType"/>. | ||
| 10 | + /// </summary> | ||
| 11 | + public class EditorInterface : IContentfulResource | ||
| 12 | + { | ||
| 13 | + /// <summary> | ||
| 14 | + /// Common system managed metadata properties. | ||
| 15 | + /// </summary> | ||
| 16 | + [JsonProperty("sys")] | ||
| 17 | + public SystemProperties SystemProperties { get; set; } | ||
| 18 | + | ||
| 19 | + /// <summary> | ||
| 20 | + /// List of <see cref="EditorInterfaceControl"/> representing the type of editor interface for each field of a <see cref="ContentType"/>. | ||
| 21 | + /// </summary> | ||
| 22 | + public List<EditorInterfaceControl> Controls { get; set; } | ||
| 23 | + } | ||
| 24 | +} |
| 1 | +using Contentful.Core.Configuration; | ||
| 2 | +using Newtonsoft.Json; | ||
| 3 | +using System; | ||
| 4 | +using System.Collections.Generic; | ||
| 5 | +using System.Text; | ||
| 6 | + | ||
| 7 | +namespace Contentful.Core.Models.Management | ||
| 8 | +{ | ||
| 9 | + /// <summary> | ||
| 10 | + /// Represents how a specific field of a <see cref="ContentType"/> should be represented visually. | ||
| 11 | + /// </summary> | ||
| 12 | + [JsonConverter(typeof(EditorInterfaceControlJsonConverter))] | ||
| 13 | + public class EditorInterfaceControl | ||
| 14 | + { | ||
| 15 | + /// <summary> | ||
| 16 | + /// The id of the field that this control represents. | ||
| 17 | + /// </summary> | ||
| 18 | + public string FieldId { get; set; } | ||
| 19 | + | ||
| 20 | + /// <summary> | ||
| 21 | + /// The id of the type of widget to use for this field. See also <seealso cref="SystemWidgetIds"/> for a list of system widget ids. | ||
| 22 | + /// </summary> | ||
| 23 | + public string WidgetId { get; set; } | ||
| 24 | + | ||
| 25 | + /// <summary> | ||
| 26 | + /// Represents custom settings for a widget. | ||
| 27 | + /// </summary> | ||
| 28 | + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] | ||
| 29 | + public EditorInterfaceControlSettings Settings { get; set; } | ||
| 30 | + } | ||
| 31 | +} |
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/IFieldValidation.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Locale.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Locale.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/ManagementAsset.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/ManagementToken.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Organization.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Organization.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Policy.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Policy.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Reference.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Reference.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/Role.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/SnapShot.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/SnapShot.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/SpaceMembership.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/SystemFieldTypes.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/SystemLinkTypes.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/SystemWidgetIds.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/UiExtension.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/UiExtension.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/UploadReference.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/User.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/WebHook.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/WebHook.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/WebHookRequest.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/Management/WebHookResponse.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Models/SystemProperties.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Properties/AssemblyInfo.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Search/FieldHelpers.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Search/MimeTypeRestriction.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Search/MimeTypeRestriction.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Search/QueryBuilder.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/ContentfulSource/Search/SortOrderBuilder.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Microsoft.Extensions.Options.1.1.2.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Microsoft.Extensions.Primitives.1.1.1.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Microsoft.NETCore.Platforms.1.1.0.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Microsoft.NETCore.Platforms.1.1.0/lib.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Microsoft.Win32.Primitives.4.3.0.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Microsoft.Win32.Primitives.4.3.0/lib.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Microsoft.Win32.Primitives.4.3.0/ref.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Newtonsoft.Json.10.0.3/LICENSE.md
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Newtonsoft.Json.10.0.3/LICENSE.md.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Newtonsoft.Json.10.0.3/lib.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Newtonsoft.Json.10.0.3/lib/net45.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Newtonsoft.Json.10.0.3/tools.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Contentful/dependancies/Newtonsoft.Json.10.0.3/tools/install.ps1
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Globatools/Utility/RestSharp/Extensions/MonoHttp/Helpers.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Globatools/Utility/RestSharp/Extensions/MonoHttp/Helpers.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Globatools/Utility/RestSharp/Extensions/MonoHttp/HtmlEncoder.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Packages/Globatools/Utility/RestSharp/Extensions/MonoHttp/HttpUtility.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEditor/Sirenix.Serialization.dll.mdb
0 → 100644
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEditor/Sirenix.Serialization.dll.mdb.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEditor/Sirenix.Serialization.dll.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEditor/Sirenix.Utilities.dll.mdb.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEmitAndNoEditor/Sirenix.Serialization.dll
0 → 100644
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEmitAndNoEditor/Sirenix.Serialization.dll.mdb
0 → 100644
No preview for this file type
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEmitAndNoEditor/Sirenix.Serialization.dll.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEmitAndNoEditor/Sirenix.Utilities.dll
0 → 100644
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEmitAndNoEditor/Sirenix.Utilities.dll.mdb
0 → 100644
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEmitAndNoEditor/Sirenix.Utilities.dll.mdb.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/NoEmitAndNoEditor/Sirenix.Utilities.dll.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.OdinInspector.Attributes.dll.mdb
0 → 100644
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.OdinInspector.Attributes.dll.mdb.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.OdinInspector.Attributes.dll.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff could not be displayed because it is too large.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.OdinInspector.Attributes.xml.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.OdinInspector.Editor.dll.mdb.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.OdinInspector.Editor.dll.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff could not be displayed because it is too large.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.OdinInspector.Editor.xml.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.Serialization.Config.dll.mdb.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.Serialization.Config.dll.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.Serialization.Config.xml.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Assemblies/Sirenix.Utilities.Editor.dll.mdb.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed.
Click to expand it.
No preview for this file type
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
No preview for this file type
ContentfulExample/Assets/Plugins/Sirenix/Demos/Custom Attribute Processors.unitypackage.meta
0 → 100644
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Assets/Editor/Odin Inspector Logo.png
0 → 100644
22.7 KB
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Assets/Editor/Odin Inspector Logo.png.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/GeneralDrawerConfig.asset
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/GeneralDrawerConfig.asset.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/InspectorConfig.asset
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Config/Editor/InspectorConfig.asset.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/BuildAOTAutomation.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/BuildAOTAutomation.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/EnsureOdinInspectorDefine.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/SyncListDrawer.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/SyncVarAttributeDrawer.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntDrawers.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntDrawers.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/SerializedNetworkBehaviour.cs
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/SerializedNetworkBehaviour.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Plugins/Sirenix/Odin Inspector/Scripts/VectorIntFormatters.cs.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
No preview for this file type
This diff is collapsed.
Click to expand it.
ContentfulExample/Assets/Scenes.meta
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
ContentfulExample/Logs/Packages-Update.log
0 → 100644
This diff is collapsed.
Click to expand it.
ContentfulExample/Packages/manifest.json
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
-
Please register or sign in to post a comment