Skip to content

Commit

Permalink
feat: ✨ AddParam support added
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeem-cs committed May 23, 2024
1 parent 514d453 commit 07eb68d
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 7 deletions.
10 changes: 8 additions & 2 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ fileignoreconfig:
- filename: Contentstack.Core/Internals/HttpRequestHandler.cs
checksum: 93c1659f3bc7527956f0fd12db46441297fac3a4366d273bcbb3425d2351300e
- filename: Contentstack.Core/Models/Entry.cs
checksum: bc0da69dde3bebecf09aa319aa961f82d7637e200bb8539821fa6116c0129f1b
checksum: 79320b005882981fd7c79fe73832f28284db686927942e46b422ac9e88405023
- filename: Contentstack.Core/ContentstackClient.cs
checksum: 1cb7c9bd62881ae71406449c948b1e85aa865d0c7191013f77f9b9a60df700d9
checksum: 1cb7c9bd62881ae71406449c948b1e85aa865d0c7191013f77f9b9a60df700d9
- filename: Contentstack.Core/Models/AssetLibrary.cs
checksum: 023aed649cf09228d753a4dec2b3a9f126aad474f538ca0e21d03ee07e9f6129
- filename: Contentstack.Core/Models/Asset.cs
checksum: 98b819cb9b1e6a9a9e5394ac23c07bc642a41c0c7512d169afc63afe3baa6fb3
- filename: Contentstack.Core/Models/Query.cs
checksum: 9237bb4d3e862fad7f3c6d9bad47873758a18617dc9c90d28015dcea267fcd9e
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
### Version: 2.14.0
#### Date: May-07-2024
#### Date: May-28-2024

##### New Feature:
- GCP_NA region support added
- AddParam method added for Entry, Asset, AssetLibrary and Query

### Version: 2.13.0
#### Date: April-02-2024
Expand Down
27 changes: 24 additions & 3 deletions Contentstack.Core/Models/Asset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public void SetHeader(string key, string value)
/// });
/// </code>
/// </example>
public Asset includeFallback()
public Asset IncludeFallback()
{
this.UrlQueries.Add("include_fallback", "true");
return this;
Expand Down Expand Up @@ -216,18 +216,39 @@ public Asset IncludeMetadata()
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Asset asset = stack.Asset(&quot;asset_uid&quot;);
/// asset.includeBranch();
/// asset.IncludeBranch();
/// asset.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Asset includeBranch()
public Asset IncludeBranch()
{
this.UrlQueries.Add("include_branch", "true");
return this;
}


/// <summary>
/// Add param in URL query.
/// </summary>
/// <returns>Current instance of Asset, this will be useful for a chaining calls.</returns>
/// <example>
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Asset asset = stack.Asset(&quot;asset_uid&quot;);
/// asset.AddParam("include_branch", "true");
/// asset.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Asset AddParam(string key, string value)
{
this.UrlQueries.Add(key, value);
return this;
}

public void RemoveHeader(string key)
{
if (this._Headers.ContainsKey(key))
Expand Down
22 changes: 22 additions & 0 deletions Contentstack.Core/Models/AssetLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,28 @@ public AssetLibrary IncludeBranch()
return this;
}


/// <summary>
/// Add param in URL query.
/// </summary>
/// <returns>Current instance of Asset, this will be useful for a chaining calls.</returns>
/// <example>
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Asset asset = stack.Asset(&quot;asset_uid&quot;);
/// asset.AddParam("include_branch", "true");
/// asset.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public AssetLibrary AddParam(string key, string value)
{
UrlQueries.Add(key, value);

return this;
}

/// <summary>
/// Sets the locale.
/// </summary>
Expand Down
27 changes: 26 additions & 1 deletion Contentstack.Core/Models/Entry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,32 @@ public Entry IncludeMetadata()
}



/// <summary>
/// Add param in URL query.
/// </summary>
/// <returns>Current instance of Entry, this will be useful for a chaining calls.</returns>
/// <example>
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Entry entry = stack.ContentType(&quot;contentType_id&quot;).Entry(&quot;entry_uid&quot;);
/// entry.AddParam("include_branch", "true");
/// entry.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Entry AddParam(string key, string value)
{
try
{
UrlQueries.Add(key, value);
}
catch (Exception e)
{
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
}
return this;
}

/// <summary>
/// Include branch for publish content.
Expand Down
28 changes: 28 additions & 0 deletions Contentstack.Core/Models/Query.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,34 @@ public Query IncludeBranch()
return this;
}


/// <summary>
/// Add param in URL query.
/// </summary>
/// <returns>Current instance of Entry, this will be useful for a chaining calls.</returns>
/// <example>
/// <code>
/// ContentstackClient stack = new ContentstackClinet(&quot;api_key&quot;, &quot;delivery_token&quot;, &quot;environment&quot;);
/// Entry entry = stack.ContentType(&quot;contentType_id&quot;).Entry(&quot;entry_uid&quot;);
/// entry.AddParam("include_branch", "true");
/// entry.Fetch&lt;Product&gt;().ContinueWith((assetResult) =&gt; {
/// //Your callback code.
/// });
/// </code>
/// </example>
public Query AddParam(string key, string value)
{
try
{
UrlQueries.Add(key, value);
}
catch (Exception e)
{
throw new Exception(StackConstants.ErrorMessage_QueryFilterException, e);
}
return this;
}

/// <summary>
/// Include Embedded Objects (Entries and Assets) along with entry/entries details.
/// </summary>
Expand Down

0 comments on commit 07eb68d

Please sign in to comment.