From 0c2017a3fd922dd3d1b7e9c8df7b05a668ffd1c6 Mon Sep 17 00:00:00 2001 From: OMpawar-21 Date: Fri, 10 Jul 2026 09:52:01 +0530 Subject: [PATCH 1/2] feat: Update the Read me and version bump for Major Release --- CHANGELOG.md | 18 +++++++++++ Directory.Build.props | 2 +- README.md | 74 +++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 91 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a0704e..4e9530f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelog +## [v1.0.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0)(2026-07-10) + + - **Breaking Change** + - `Newtonsoft.Json` is no longer a dependency — all JSON serialisation now uses `System.Text.Json` + - `client.SerializerSettings` (`JsonSerializerSettings`) replaced by `client.SerializerOptions` (`JsonSerializerOptions`) + - `response.OpenJObjectResponse()` removed — use `response.OpenJsonObjectResponse()` (`JsonObject`) or `response.OpenTResponse()` instead + - `JObjectParameterValue` now accepts `System.Text.Json.Nodes.JsonNode` instead of `Newtonsoft.Json.Linq.JObject` + - All `[JsonProperty]` attributes replaced with `[JsonPropertyName]` + - Requires **.NET 10** or later + - **New** + - **Branch management**: `Branch` model with `Create`, `CreateAsync`, `Fetch`, `FetchAsync`, `Delete`, `DeleteAsync`, and `Query` operations via `Stack.Branch(uid?)` + - **Multi-region endpoint resolution** via `Endpoint.GetContentstackEndpoint(region, service)` — 7 regions (NA, EU, AU, Azure-NA, Azure-EU, GCP-NA, GCP-EU) and 18 service keys + - **OAuth auto token refresh** wired into the request pipeline + - **PreviewToken** support — `Create` and `Delete` operations + - **Image format upload**: JPEG, AVIF, and multi-format asset upload coverage + - **Migration Guide** + - See [Migrating from Newtonsoft.Json to System.Text.Json](https://www.contentstack.com/docs/developers/sdks/content-management-sdk/dot-net/migrate-dotnet-management-sdk-from-newtonsoft.json-to-system.text.json) for the full upgrade path from v0.x. + ## [v1.0.0-beta.2](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0-beta.2)(2026-06-22) - **Chore** diff --git a/Directory.Build.props b/Directory.Build.props index 2ad39e3..7986c2e 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,5 @@ - 1.0.0-beta.2 + 1.0.0 diff --git a/README.md b/README.md index 064cffb..f53aad3 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,9 @@ Note: By using CMA, you can execute GET requests for fetching content. However, ### Prerequisite -You need .NET installed on your machine to use the Contentstack .NET CMA SDK. +You need .NET 10 or above installed on your machine to use the Contentstack .NET CMA SDK. + +> **Migrating from v0.x?** Version 1.0.0 replaces Newtonsoft.Json with System.Text.Json and changes several public API signatures (e.g. `OpenJObjectResponse()` → `OpenJsonObjectResponse()`, `SerializerSettings` → `SerializerOptions`). See the [migration guide](https://www.contentstack.com/docs/developers/sdks/content-management-sdk/dot-net/migrate-dotnet-management-sdk-from-newtonsoft.json-to-system.text.json) before upgrading. ### Installation Open the terminal and install the contentstack module via ‘Package Manager’ command @@ -99,12 +101,80 @@ contentstackConfig.ProxyPort = 9000; contentstackConfig.ProxyCredentials = new NetworkCredential(userName: "username", password: "password"); ContentstackClient client = new ContentstackClient(new OptionsWrapper(options)); ``` +#### OAuth Authentication +As an alternative to Authtoken/Management Token authentication, you can use OAuth 2.0: +```c# +ContentstackClient client = new ContentstackClient(); +var oauthOptions = new OAuthOptions +{ + AppId = "your-app-id", + ClientId = "your-client-id", + RedirectUri = "http://localhost:8184" +}; +OAuthHandler oauthHandler = client.OAuth(oauthOptions); + +// Get authorization URL +string authUrl = oauthHandler.GetAuthorizationUrl(); + +// After user authorization, exchange code for tokens +var tokens = await oauthHandler.ExchangeCodeForTokenAsync("authorization_code"); +``` +> Note: Once authenticated, the SDK automatically refreshes expired OAuth tokens before making API calls — no manual token refresh required. + +#### Branch Management +Use the `Branch` model to create, fetch, delete, and query branches for a stack: +```c# +ContentstackClient client = new ContentstackClient("", ""); + +// Create a branch +BranchModel model = new BranchModel() { Uid = "my-branch", Source = "main" }; +ContentstackResponse createResponse = client.Stack("").Branch().Create(model); + +// Fetch a branch +ContentstackResponse fetchResponse = client.Stack("").Branch("my-branch").Fetch(); + +// Query all branches +ContentstackResponse queryResponse = client.Stack("").Branch().Query().Find(); + +// Delete a branch +ContentstackResponse deleteResponse = client.Stack("").Branch("my-branch").Delete(); +``` + +#### Preview Token +Use `PreviewToken` to create or delete a Preview Token for a Delivery Token (compatible only with the `rest-preview.contentstack.com` endpoint): +```c# +ContentstackClient client = new ContentstackClient("", ""); + +// Create a preview token +PreviewTokenModel model = new PreviewTokenModel() { Name = "My Preview Token" }; +ContentstackResponse createResponse = client.Stack("").PreviewToken("").Create(model); + +// Delete a preview token +ContentstackResponse deleteResponse = client.Stack("").PreviewToken("").Delete(); +``` + +#### Multi-region Endpoint Resolution +Use the `Endpoint` class to resolve Contentstack service URLs for any supported region without hardcoding hosts: +```c# +using Contentstack.Management.Core.Endpoints; // Endpoint + +// Resolve the Content Management endpoint for a region +string url = Endpoint.GetContentstackEndpoint("us", "contentManagement"); + +// Strip the https:// scheme — useful when passing the host directly to SDK configuration +var options = new ContentstackClientOptions +{ + Host = Endpoint.GetContentstackEndpoint("eu", "contentManagement", omitHttps: true) +}; +``` + #### Fetch Stack Detail Use the following lines of code to fetch your stack detail using this SDK: ```c# ContentstackResponse contentstackResponse = client.Stack("").Fetch(); -var response = contentstackResponse.OpenJObjectResponse(); +var response = contentstackResponse.OpenJsonObjectResponse(); +string title = response["title"]?.GetValue(); // or StackResponse model = contentstackResponse.OpenTResponse(); ``` From 05c9626d03c5c3bf5d12744e4213b84af79eae09 Mon Sep 17 00:00:00 2001 From: OM PAWAR Date: Fri, 10 Jul 2026 11:56:46 +0530 Subject: [PATCH 2/2] Fix release date for v1.0.0 Updated release date for version 1.0.0 in CHANGELOG. --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e9530f..bc356e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [v1.0.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0)(2026-07-10) +## [v1.0.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v1.0.0)(2026-07-13) - **Breaking Change** - `Newtonsoft.Json` is no longer a dependency — all JSON serialisation now uses `System.Text.Json` @@ -175,4 +175,4 @@ ## [v0.1.1](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.1.1) (2022-12-16) -## [v0.1.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.1.0) (2022-10-19) \ No newline at end of file +## [v0.1.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.1.0) (2022-10-19)