ContentstackClient
ContentstackClient
| Name | Type | Description |
|---|---|---|
| SerializerOptions | JsonSerializerOptions | Gets or sets the options that should be used for deserialization. |
ContentstackClient
Initializes an instance of the ContentstackClient class.
| Name | Type | Description |
|---|---|---|
| apiKey | string | API Key of your stack on Contentstack. |
| deliveryToken | string | Delivery token of your stack on Contentstack. |
| environment | string | Environment from where you want to fetch content. |
| host | string | Specifies the base URL for the Contentstack API. Default: cdn.contentstack.io |
| region | ContentstackRegion | Specifies the database region for your stack. You can choose from the following: NA, EU, AU, Azure NA, Azure EU, and GCP NA. Default: ContentstackRegion.US |
| version | string | Specifies the version of the Contentstack API to use. Default: v3 |
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");| Name | Type | Description |
|---|---|---|
| options | ContentstackOptions | used to get stack details via class ContentstackOptions to create client. |
var options = new ContentstackOptions()
{
ApiKey = "api_key",
DeliveryToken = "delivery_token"
Environment = "environment"
}
ContentstackClient stack = new ContentstackClient(options);GetVersion
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
String url = stack.GetVersion();Asset
Represents a Asset. Creates Asset Instance.
| Name | Type | Description |
|---|---|---|
| Uid | string | This is Asset Uid of an Asset. |
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
Asset asset = stack.Asset("asset_uid");AssetLibrary
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
AssetLibrary assetLibrary = stack.AssetLibrary();ContentType
| Name | Type | Description |
|---|---|---|
| contentTypeUid | string | ContentType UID. |
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
ContentType contentType = stack.ContentType("content_type_uid");GetApplicationKey
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
String apiKey = stack.GetApplicationKey();GetAccessToken
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
String accessToken = stack.GetAccessToken();GetEnvironment
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
String environment = stack.GetEnvironment();GetContentTypes
| Name | Type | Description |
|---|---|---|
| param | Dictionary<string, object> | dictionary of additional parameter |
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
var param = new Dictionary<string, object>();
param.Add("include_global_field_schema",true);
param.Add("limit", 10);
param.Add("skip", 10);
param.Add("include_count", "true");
var result = await stack.GetContentTypes(param);LivePreviewQuery
| Name | Type | Description |
|---|---|---|
| query | Dictionary<string, string> | Query parameter containing hash and content type UID |
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
await client.LivePreviewQueryAsync(new System.Collections.Generic.Dictionary<string, string>()
{
{"live_preview" , "live_preview_hash_from_url_query" },
{"content_type_uid", "content_type_uid<span>_from_url_query</span>" },
{"entry_uid", "entry_uid<span>_from_url_query</span>" }
});RemoveHeader
| Name | Type | Description |
|---|---|---|
| key | string | key to be remove from header |
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
stack.RemoveHeader("custom_header_key")SyncToken
| Name | Type | Description |
|---|---|---|
| SyncToken | string | Sync token. |
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncToken("sync_token");SyncRecursive
| Name | Type | Description |
|---|---|---|
| Locale | string | Locale |
| SyncType | SyncType | Sync type. |
| ContentTypeUid | string | Content type uid. |
| StartFrom | DateTime | Start from. |
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive();using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive(SyncType: SyncType.AssetPublished);using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive(ContentTypeUid: "source");using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive(StartFrom:DateTime.Now);using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await client.SyncRecursive(SyncType: SyncType.EntryPublished, ContentTypeUid: "source");SyncPaginationToken
| Name | Type | Description |
|---|---|---|
| paginationToken | string | Pagination token. |
using Contentstack.Core;
using Contentstack.Core.Models;
ContentstackClient stack = new ContentstackClient("api_key", "delivery_token", "environment");
SyncStack result = await stack.SyncPaginationTokenn("pagination_token");