Skip to content
Merged
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
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## [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`
- `client.SerializerSettings` (`JsonSerializerSettings`) replaced by `client.SerializerOptions` (`JsonSerializerOptions`)
- `response.OpenJObjectResponse()` removed — use `response.OpenJsonObjectResponse()` (`JsonObject`) or `response.OpenTResponse<T>()` 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**
Expand Down Expand Up @@ -157,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)
## [v0.1.0](https://github.com/contentstack/contentstack-management-dotnet/tree/v0.1.0) (2022-10-19)
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.0.0-beta.2</Version>
<Version>1.0.0</Version>
</PropertyGroup>
</Project>
74 changes: 72 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -99,12 +101,80 @@ contentstackConfig.ProxyPort = 9000;
contentstackConfig.ProxyCredentials = new NetworkCredential(userName: "username", password: "password");
ContentstackClient client = new ContentstackClient(new OptionsWrapper<ContentstackClientOptions>(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("<AUTHTOKEN>", "<API_HOST>");

// Create a branch
BranchModel model = new BranchModel() { Uid = "my-branch", Source = "main" };
ContentstackResponse createResponse = client.Stack("<API_KEY>").Branch().Create(model);

// Fetch a branch
ContentstackResponse fetchResponse = client.Stack("<API_KEY>").Branch("my-branch").Fetch();

// Query all branches
ContentstackResponse queryResponse = client.Stack("<API_KEY>").Branch().Query().Find();

// Delete a branch
ContentstackResponse deleteResponse = client.Stack("<API_KEY>").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("<AUTHTOKEN>", "<API_HOST>");

// Create a preview token
PreviewTokenModel model = new PreviewTokenModel() { Name = "My Preview Token" };
ContentstackResponse createResponse = client.Stack("<API_KEY>").PreviewToken("<DELIVERY_TOKEN_UID>").Create(model);

// Delete a preview token
ContentstackResponse deleteResponse = client.Stack("<API_KEY>").PreviewToken("<DELIVERY_TOKEN_UID>").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("<API_KEY>").Fetch();

var response = contentstackResponse.OpenJObjectResponse();
var response = contentstackResponse.OpenJsonObjectResponse();
string title = response["title"]?.GetValue<string>();
// or
StackResponse model = contentstackResponse.OpenTResponse<StackResponse>();
```
Expand Down
Loading