Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
# Changelog

## [v1.0.0-beta.5](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0-beta.5)
- **Environment & Global Field STJ Migration**
- Migrated Environment and Global Field modules from Newtonsoft.Json to System.Text.Json
- Updated service constructors to use JsonSerializerOptions and Utf8JsonWriter serialization
- Re-enabled Environment() and GlobalField() methods in Stack class

## [v1.0.0-beta.4](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0-beta.4)
- **Assets STJ Migration Complete**
- Fully migrated Assets module from Newtonsoft.Json to System.Text.Json
- Updated Asset.cs, AssetModel.cs, Folder.cs, and Version.cs with STJ service integration
- Migrated UploadService, CreateUpdateFolderService, FetchReferencesService, PublishUnpublishService, and VersionService to use Utf8JsonWriter and JsonSerializerOptions
- Re-enabled Stack.Asset() method for asset operations

## [v1.0.0-beta.3](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0-beta.3)
- **ContentType & QueryService STJ Migration**
- **✅ ContentType Module**: Fully migrated ContentType model and dependencies to System.Text.Json
- **✅ QueryService Migration**: Re-enabled and migrated QueryService for content type listing
- **✅ Field System**: Converted core Field models (FieldMetadata, Field, FieldRules) to STJ
- **✅ ContentModelling**: Updated ContentModelling and Option classes with STJ attributes
- **✅ Service Layer**: Migrated CreateUpdateService, FetchDeleteService, and DeleteService
- **✅ Web App Integration**: Complete ContentType CRUD interface with modern UI
- **✅ Schema Validation**: Added default "Title" field to prevent 422 API errors
- **✅ Error Handling**: Enhanced error reporting with detailed API validation messages
- **✅ Navigation**: Integrated ContentType management into Stack workflow

## [v1.0.0-beta.2](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0-beta.2)
- **System.Text.Json Migration Complete (Beta)**
- **✅ Core Modules STJ-Only**: Client, User, Organization, and Stack modules fully migrated
Expand Down
2 changes: 1 addition & 1 deletion Contentstack.Management.Core/ContentstackClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected void Initialize(HttpClient? httpClient = null)
SerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
SerializerOptions.PropertyNameCaseInsensitive = true;

// SerializerOptions.Converters.Add(new FieldJsonConverter()); // Excluded for now
SerializerOptions.Converters.Add(new FieldJsonConverter()); // Re-enabled for ContentType support
SerializerOptions.Converters.Add(new NodeJsonConverter());
SerializerOptions.Converters.Add(new TextNodeJsonConverter());
}
Expand Down
56 changes: 28 additions & 28 deletions Contentstack.Management.Core/Models/Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Asset

internal string resourcePath;

internal Asset(Stack stack, string uid = null)
internal Asset(Stack stack, string? uid = null)
{
stack.ThrowIfAPIKeyEmpty();

Expand Down Expand Up @@ -49,7 +49,7 @@ public Query Query()
/// </code></pre>
/// </example>
/// <returns>The <see cref="Models.Folder"/></returns>
public Folder Folder(string uid = null)
public Folder Folder(string? uid = null)
{
ThrowIfUidNotEmpty();
return new Folder(stack, uid);
Expand Down Expand Up @@ -83,11 +83,11 @@ public Version Version(int? versionNumber = null)
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual ContentstackResponse Create(AssetModel model, ParameterCollection collection = null)
public virtual ContentstackResponse Create(AssetModel model, ParameterCollection? collection = null)
{
ThrowIfUidNotEmpty();

var service = new UploadService(stack.client.serializer, stack, resourcePath, model);
var service = new UploadService(stack, resourcePath, model, stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeSync(service);
}

Expand All @@ -104,12 +104,12 @@ public virtual ContentstackResponse Create(AssetModel model, ParameterCollection
/// </code></pre>
/// </example>
/// <returns>The Task.</returns>
public virtual Task<ContentstackResponse> CreateAsync(AssetModel model, ParameterCollection collection = null)
public virtual Task<ContentstackResponse> CreateAsync(AssetModel model, ParameterCollection? collection = null)
{
ThrowIfUidNotEmpty();
stack.ThrowIfNotLoggedIn();

var service = new UploadService(stack.client.serializer, stack, resourcePath, model);
var service = new UploadService(stack, resourcePath, model, stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeAsync<UploadService, ContentstackResponse>(service, true);
}

Expand All @@ -126,11 +126,11 @@ public virtual Task<ContentstackResponse> CreateAsync(AssetModel model, Paramete
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual ContentstackResponse Update(AssetModel model, ParameterCollection collection = null)
public virtual ContentstackResponse Update(AssetModel model, ParameterCollection? collection = null)
{
ThrowIfUidEmpty();

var service = new UploadService(stack.client.serializer, stack, resourcePath, model, "PUT");
var service = new UploadService(stack, resourcePath, model, "PUT", stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeSync(service);
}

Expand All @@ -147,12 +147,12 @@ public virtual ContentstackResponse Update(AssetModel model, ParameterCollection
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual Task<ContentstackResponse> UpdateAsync(AssetModel model, ParameterCollection collection = null)
public virtual Task<ContentstackResponse> UpdateAsync(AssetModel model, ParameterCollection? collection = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new UploadService(stack.client.serializer, stack, resourcePath, model, "PUT");
var service = new UploadService(stack, resourcePath, model, "PUT", stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeAsync<UploadService, ContentstackResponse>(service, true);
}

Expand All @@ -167,12 +167,12 @@ public virtual Task<ContentstackResponse> UpdateAsync(AssetModel model, Paramete
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual ContentstackResponse Fetch(ParameterCollection collection = null)
public virtual ContentstackResponse Fetch(ParameterCollection? collection = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath, collection: collection);
var service = new FetchDeleteService(stack, resourcePath, collection: collection);
return stack.client.InvokeSync(service);
}

Expand All @@ -187,12 +187,12 @@ public virtual ContentstackResponse Fetch(ParameterCollection collection = null)
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual Task<ContentstackResponse> FetchAsync(ParameterCollection collection = null)
public virtual Task<ContentstackResponse> FetchAsync(ParameterCollection? collection = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath, collection: collection);
var service = new FetchDeleteService(stack, resourcePath, collection: collection);
return stack.client.InvokeAsync<FetchDeleteService, ContentstackResponse>(service, true);
}

Expand All @@ -212,7 +212,7 @@ public virtual ContentstackResponse Delete()
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath, "DELETE");
var service = new FetchDeleteService(stack, resourcePath, "DELETE");
return stack.client.InvokeSync(service);
}

Expand All @@ -232,7 +232,7 @@ public virtual Task<ContentstackResponse> DeleteAsync()
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath, "DELETE");
var service = new FetchDeleteService(stack, resourcePath, "DELETE");
return stack.client.InvokeAsync<FetchDeleteService, ContentstackResponse>(service, true);
}

Expand All @@ -247,12 +247,12 @@ public virtual Task<ContentstackResponse> DeleteAsync()
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual ContentstackResponse Publish(PublishUnpublishDetails details, string apiVersion = null)
public virtual ContentstackResponse Publish(PublishUnpublishDetails details, string? apiVersion = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new PublishUnpublishService(stack.client.serializer, stack, details, $"{resourcePath}/publish", "asset");
var service = new PublishUnpublishService(stack, details, $"{resourcePath}/publish", "asset", stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeSync(service, apiVersion: apiVersion);
}

Expand All @@ -267,12 +267,12 @@ public virtual ContentstackResponse Publish(PublishUnpublishDetails details, str
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual Task<ContentstackResponse> PublishAsync(PublishUnpublishDetails details, string apiVersion = null)
public virtual Task<ContentstackResponse> PublishAsync(PublishUnpublishDetails details, string? apiVersion = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new PublishUnpublishService(stack.client.serializer, stack, details, $"{resourcePath}/publish", "asset");
var service = new PublishUnpublishService(stack, details, $"{resourcePath}/publish", "asset", stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeAsync<PublishUnpublishService, ContentstackResponse>(service, apiVersion: apiVersion);
}

Expand All @@ -287,12 +287,12 @@ public virtual Task<ContentstackResponse> PublishAsync(PublishUnpublishDetails d
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual ContentstackResponse Unpublish(PublishUnpublishDetails details, string apiVersion = null)
public virtual ContentstackResponse Unpublish(PublishUnpublishDetails details, string? apiVersion = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new PublishUnpublishService(stack.client.serializer, stack, details, $"{resourcePath}/unpublish", "asset");
var service = new PublishUnpublishService(stack, details, $"{resourcePath}/unpublish", "asset", stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeSync(service, apiVersion: apiVersion);
}

Expand All @@ -307,12 +307,12 @@ public virtual ContentstackResponse Unpublish(PublishUnpublishDetails details, s
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual Task<ContentstackResponse> UnpublishAsync(PublishUnpublishDetails details, string apiVersion = null)
public virtual Task<ContentstackResponse> UnpublishAsync(PublishUnpublishDetails details, string? apiVersion = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new PublishUnpublishService(stack.client.serializer, stack, details, $"{resourcePath}/unpublish", "asset");
var service = new PublishUnpublishService(stack, details, $"{resourcePath}/unpublish", "asset", stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeAsync<PublishUnpublishService, ContentstackResponse>(service, apiVersion: apiVersion);
}

Expand All @@ -326,12 +326,12 @@ public virtual Task<ContentstackResponse> UnpublishAsync(PublishUnpublishDetails
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual ContentstackResponse References(ParameterCollection collection = null)
public virtual ContentstackResponse References(ParameterCollection? collection = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new FetchReferencesService(stack.client.serializer, stack, resourcePath, collection: collection);
var service = new FetchReferencesService(stack, resourcePath, collection: collection, stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeSync(service);
}

Expand All @@ -345,12 +345,12 @@ public virtual ContentstackResponse References(ParameterCollection collection =
/// </code></pre>
/// </example>
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
public virtual Task<ContentstackResponse> ReferencesAsync(ParameterCollection collection = null)
public virtual Task<ContentstackResponse> ReferencesAsync(ParameterCollection? collection = null)
{
stack.ThrowIfNotLoggedIn();
ThrowIfUidEmpty();

var service = new FetchReferencesService(stack.client.serializer, stack, resourcePath, collection: collection);
var service = new FetchReferencesService(stack, resourcePath, collection: collection, stjOptions: stack.client.SerializerOptions);
return stack.client.InvokeAsync<FetchReferencesService, ContentstackResponse>(service);
}

Expand Down
Loading
Loading