Skip to content

Commit 4ff479a

Browse files
committed
Test case updated for Asset, Api doc updated
1 parent e0631e7 commit 4ff479a

8 files changed

Lines changed: 109 additions & 19 deletions

File tree

Contentstack.AspNetCore/Contentstack.AspNetCore.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PackageId>contentstack.aspnetcore</PackageId>
77
<Authors>Contentstack</Authors>
88
<Owners>Contentstack</Owners>
9-
<ReleaseVersion>1.1.0</ReleaseVersion>
9+
<ReleaseVersion>2.0</ReleaseVersion>
1010
<PackageVersion>1.0.0</PackageVersion>
1111
<Description>Main release</Description>
1212
<Copyright>Copyright (c) 2012-2019 Contentstack (http://app.contentstack.com). All Rights Reserved

Contentstack.Core.Tests/AssetTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ await asset.Fetch().ContinueWith((t) =>
2727
}
2828
else
2929
{
30-
Assert.True(asset.FileName.Length > 0);
30+
Assert.True(result.FileName.Length > 0);
3131
}
3232
});
3333
}

Contentstack.Core.Tests/Contentstack.Core.Tests.csproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netcoreapp2.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
7-
<ReleaseVersion>1.1.0</ReleaseVersion>
7+
<ReleaseVersion>2.0</ReleaseVersion>
88
</PropertyGroup>
99

1010
<ItemGroup>
@@ -36,9 +36,11 @@
3636
<None Remove="TestResults\_Uttams-MacBook-Pro_2018-09-29_00_07_58.trx" />
3737
<None Remove="TestResults\_Uttams-MacBook-Pro_2018-09-29_19_54_44.trx" />
3838
<None Remove="appSetting.xml" />
39+
<None Remove="appsetting.json" />
3940
</ItemGroup>
4041
<ItemGroup>
4142
<ProjectReference Include="..\ContentStack.Core\Contentstack.Core.csproj" />
43+
<ProjectReference Include="..\Contentstack.AspNetCore\Contentstack.AspNetCore.csproj" />
4244
</ItemGroup>
4345
<ItemGroup>
4446
<Folder Include="Models\" />

Contentstack.Core.Tests/EntryTest.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
using Xunit;
33
using Contentstack.Core.Models;
44
using System.Threading.Tasks;
5-
using Contentstack.Core.Configuration;
65
using System.Collections.Generic;
76
using System.Linq;
87
using System.Text.RegularExpressions;
9-
using System.Collections;
108
using Contentstack.Core.Tests.Models;
119
namespace Contentstack.Core.Tests
1210
{
13-
11+
1412
public class EntryTest
1513
{
1614
ContentstackClient client = StackConfig.GetStack();

Contentstack.Core/Contentstack.Core.csproj

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
<PackageId>contentstack.csharp</PackageId>
66
<Authors>Contentstack</Authors>
77
<Description>.NET SDK for the Contentstack Content Delivery API.</Description>
8-
<PackageVersion>1.1.0</PackageVersion>
8+
<PackageVersion>2.0</PackageVersion>
99
<Owners>Contentstack</Owners>
10-
<PackageReleaseNotes>Fetching Content-Type schema
11-
Stack Sync implemented </PackageReleaseNotes>
12-
<ReleaseVersion>1.1.0</ReleaseVersion>
10+
<PackageReleaseNotes>Query Find method, Entry Fetch method returns ContentstackCollection of Model.</PackageReleaseNotes>
11+
<ReleaseVersion>2.0</ReleaseVersion>
1312
<Copyright>Copyright © 2012-2019 Contentstack. All Rights Reserved
1413
</Copyright>
1514
<PackOnBuild>true</PackOnBuild>
16-
<PackageTags>v1.1.0</PackageTags>
15+
<PackageTags>v2.0</PackageTags>
1716
</PropertyGroup>
1817

1918
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">

Contentstack.Net.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,6 @@ Global
132132
$0.XmlFormattingPolicy = $9
133133
$9.scope = application/xml
134134
$0.StandardHeader = $10
135-
version = 1.1.0
135+
version = 2.0
136136
EndGlobalSection
137137
EndGlobal

docfx_project/api/index.md

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Contentstack - .Net SDK
32

43
.NET SDK for Contentstack's Content Delivery API
@@ -19,28 +18,74 @@ The .Net SDK provided by contentstack.io is available for Xamarin, Windows Phone
1918

2019
Open the terminal and install the contentstack module via 'Package Manager' command
2120

21+
``` console
22+
PM> Install-Package contentstack.csharp
23+
```
2224
And via ‘.Net CLI’
23-
25+
``` console
26+
dotnet add package contentstack.csharp
27+
```
2428
To use the module in your application, you need to first Add Namespace to your class
25-
29+
``` cs
30+
using Contentstack.Core; // ContentstackClient
31+
using Contentstack.Core.Models; // Stack, Query, Entry, Asset, ContentType, ContentstackCollection
32+
using Contentstack.Core.Configuration; // ContentstackOptions
33+
```
2634
## Initialize SDK
2735

2836
You will need to specify the API key, Access token, and Environment Name of your stack to initialize the SDK:
2937

38+
``` cs
39+
// Initialize the Contentstack
40+
ContentstackClient stack = new ContentstackClient("api_key", "access_token", "enviroment_name");
41+
```
42+
3043
or:
3144

45+
``` cs
46+
//
47+
var options = new ContentstackOptions()
48+
{
49+
ApiKey = "<api_key>",
50+
AccessToken = "<access_token>"
51+
Environment = "<environment>"
52+
}
53+
ContentstackClient stack = new ContentstackClient(options);
54+
```
55+
3256
Once you have initialized the SDK, you can start getting content in your app.
3357

3458
## Basic Queries
3559

3660
### Get a Single Entry
3761

3862
To retrieve a single entry from a content type, use the code snippet given below:
63+
``` cs
64+
Entry entry = client.ContentType("blog").Entry("blta464e9fbd048668c");
65+
entry.Fetch<Product>().ContinueWith((t) => {
66+
if (!t.IsFaulted) {
67+
Console.WriteLine("entry:" + t.Result);
68+
}
69+
});
70+
```
3971

4072
### Get Multiple Entries
4173

4274
To retrieve multiple entries of a particular content type, use the code snippet given below:
43-
75+
``` cs
76+
77+
Query query = client.ContentType("blog").Query();
78+
query.Where("title", "welcome");
79+
query.IncludeSchema();
80+
query.IncludeCount();
81+
query.ToJSON();
82+
query.Find<Product>().ContinueWith((t) => {
83+
if (!t.IsFaulted) {
84+
ContentstackCollection<Product> result = t.Result;
85+
Console.WriteLine("result" + result.items);
86+
}
87+
});
88+
```
4489
## Example
4590

4691
To help you get started, we have created a sample console application that is powered by Contentstack .NET SDK. Click on the link below to read the tutorial of the app.

docfx_project/index.md

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,74 @@ The .Net SDK provided by contentstack.io is available for Xamarin, Windows Phone
1919

2020
Open the terminal and install the contentstack module via 'Package Manager' command
2121

22+
``` console
23+
PM> Install-Package contentstack.csharp
24+
```
2225
And via ‘.Net CLI’
23-
26+
``` console
27+
dotnet add package contentstack.csharp
28+
```
2429
To use the module in your application, you need to first Add Namespace to your class
25-
30+
``` cs
31+
using Contentstack.Core; // ContentstackClient
32+
using Contentstack.Core.Models; // Stack, Query, Entry, Asset, ContentType, ContentstackCollection
33+
using Contentstack.Core.Configuration; // ContentstackOptions
34+
```
2635
## Initialize SDK
2736

2837
You will need to specify the API key, Access token, and Environment Name of your stack to initialize the SDK:
2938

39+
``` cs
40+
// Initialize the Contentstack
41+
ContentstackClient stack = new ContentstackClient("api_key", "access_token", "enviroment_name");
42+
```
43+
3044
or:
3145

46+
``` cs
47+
//
48+
var options = new ContentstackOptions()
49+
{
50+
ApiKey = "<api_key>",
51+
AccessToken = "<access_token>"
52+
Environment = "<environment>"
53+
}
54+
ContentstackClient stack = new ContentstackClient(options);
55+
```
56+
3257
Once you have initialized the SDK, you can start getting content in your app.
3358

3459
## Basic Queries
3560

3661
### Get a Single Entry
3762

3863
To retrieve a single entry from a content type, use the code snippet given below:
64+
``` cs
65+
Entry entry = client.ContentType("blog").Entry("blta464e9fbd048668c");
66+
entry.Fetch<Product>().ContinueWith((t) => {
67+
if (!t.IsFaulted) {
68+
Console.WriteLine("entry:" + t.Result);
69+
}
70+
});
71+
```
3972

4073
### Get Multiple Entries
4174

4275
To retrieve multiple entries of a particular content type, use the code snippet given below:
43-
76+
``` cs
77+
78+
Query query = client.ContentType("blog").Query();
79+
query.Where("title", "welcome");
80+
query.IncludeSchema();
81+
query.IncludeCount();
82+
query.ToJSON();
83+
query.Find<Product>().ContinueWith((t) => {
84+
if (!t.IsFaulted) {
85+
ContentstackCollection<Product> result = t.Result;
86+
Console.WriteLine("result" + result.items);
87+
}
88+
});
89+
```
4490
## Example
4591

4692
To help you get started, we have created a sample console application that is powered by Contentstack .NET SDK. Click on the link below to read the tutorial of the app.

0 commit comments

Comments
 (0)