Skip to content

Commit f05d48b

Browse files
committed
refactor: update models to use nullable string parameters for uid and collection
1 parent 987b8af commit f05d48b

8 files changed

Lines changed: 96 additions & 96 deletions

File tree

Contentstack.Management.Core/Models/PublishRule.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace Contentstack.Management.Core.Models
66
{
77
public class PublishRule: BaseModel<PublishRuleModel>
88
{
9-
internal PublishRule(Stack stack, string uid)
9+
internal PublishRule(Stack stack, string? uid)
1010
: base(stack, "publishing_rule", uid)
1111
{
1212
resourcePath = uid == null ? "/workflows/publishing_rules" : $"/workflows/publishing_rules/{uid}";
@@ -23,7 +23,7 @@ internal PublishRule(Stack stack, string uid)
2323
/// </code></pre>
2424
/// </example>
2525
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
26-
public virtual ContentstackResponse FindAll(ParameterCollection collection = null)
26+
public virtual ContentstackResponse FindAll(ParameterCollection? collection = null)
2727
{
2828
stack.ThrowIfNotLoggedIn();
2929
ThrowIfUidNotEmpty();
@@ -43,7 +43,7 @@ public virtual ContentstackResponse FindAll(ParameterCollection collection = nul
4343
/// </code></pre>
4444
/// </example>
4545
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
46-
public virtual Task<ContentstackResponse> FindAllAsync(ParameterCollection collection = null)
46+
public virtual Task<ContentstackResponse> FindAllAsync(ParameterCollection? collection = null)
4747
{
4848
stack.ThrowIfNotLoggedIn();
4949
ThrowIfUidNotEmpty();
@@ -64,7 +64,7 @@ public virtual Task<ContentstackResponse> FindAllAsync(ParameterCollection colle
6464
/// </example>
6565
/// <param name="model">PublishRule Model for creating workflow.</param>
6666
/// <returns></returns>
67-
public override ContentstackResponse Create(PublishRuleModel model, ParameterCollection collection = null)
67+
public override ContentstackResponse Create(PublishRuleModel model, ParameterCollection? collection = null)
6868
{
6969
return base.Create(model, collection);
7070
}
@@ -81,7 +81,7 @@ public override ContentstackResponse Create(PublishRuleModel model, ParameterCol
8181
/// </example>
8282
/// <param name="model">PublishRule Model for creating workflow.</param>
8383
/// <returns></returns>
84-
public override Task<ContentstackResponse> CreateAsync(PublishRuleModel model, ParameterCollection collection = null)
84+
public override Task<ContentstackResponse> CreateAsync(PublishRuleModel model, ParameterCollection? collection = null)
8585
{
8686
return base.CreateAsync(model, collection);
8787
}
@@ -98,7 +98,7 @@ public override Task<ContentstackResponse> CreateAsync(PublishRuleModel model, P
9898
/// </example>
9999
/// <param name="model">PublishRule Model for updating Content Type.</param>
100100
/// <returns></returns>
101-
public override ContentstackResponse Update(PublishRuleModel model, ParameterCollection collection = null)
101+
public override ContentstackResponse Update(PublishRuleModel model, ParameterCollection? collection = null)
102102
{
103103
return base.Update(model, collection);
104104
}
@@ -115,7 +115,7 @@ public override ContentstackResponse Update(PublishRuleModel model, ParameterCol
115115
/// </example>
116116
/// <param name="model">PublishRule Model for updating Content Type.</param>
117117
/// <returns></returns>
118-
public override Task<ContentstackResponse> UpdateAsync(PublishRuleModel model, ParameterCollection collection = null)
118+
public override Task<ContentstackResponse> UpdateAsync(PublishRuleModel model, ParameterCollection? collection = null)
119119
{
120120
return base.UpdateAsync(model, collection);
121121
}
@@ -130,7 +130,7 @@ public override Task<ContentstackResponse> UpdateAsync(PublishRuleModel model, P
130130
/// </code></pre>
131131
/// </example>
132132
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
133-
public override ContentstackResponse Fetch(ParameterCollection collection = null)
133+
public override ContentstackResponse Fetch(ParameterCollection? collection = null)
134134
{
135135
return base.Fetch(collection);
136136
}
@@ -145,7 +145,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null
145145
/// </code></pre>
146146
/// </example>
147147
/// <returns>The Task.</returns>
148-
public override Task<ContentstackResponse> FetchAsync(ParameterCollection collection = null)
148+
public override Task<ContentstackResponse> FetchAsync(ParameterCollection? collection = null)
149149
{
150150
return base.FetchAsync(collection);
151151
}
@@ -160,7 +160,7 @@ public override Task<ContentstackResponse> FetchAsync(ParameterCollection collec
160160
/// </code></pre>
161161
/// </example>
162162
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
163-
public override ContentstackResponse Delete(ParameterCollection collection = null)
163+
public override ContentstackResponse Delete(ParameterCollection? collection = null)
164164
{
165165
return base.Delete(collection);
166166
}
@@ -175,7 +175,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul
175175
/// </code></pre>
176176
/// </example>
177177
/// <returns>The Task.</returns>
178-
public override Task<ContentstackResponse> DeleteAsync(ParameterCollection collection = null)
178+
public override Task<ContentstackResponse> DeleteAsync(ParameterCollection? collection = null)
179179
{
180180
return base.DeleteAsync(collection);
181181
}

Contentstack.Management.Core/Models/Stack.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ public Label Label(string uid = null)
718718
/// </code></pre>
719719
/// </example>
720720
/// <returns>The <see cref="Models.Taxonomy" /></returns>
721-
public Taxonomy Taxonomy(string uid = null)
721+
public Taxonomy Taxonomy(string? uid = null)
722722
{
723723
ThrowIfNotLoggedIn();
724724
ThrowIfAPIKeyEmpty();
@@ -758,7 +758,7 @@ public Environment Environment(string? uid = null)
758758
/// </code></pre>
759759
/// </example>
760760
/// <returns>The <see cref="Models.Token.DeliveryToken" /></returns>
761-
public DeliveryToken DeliveryToken(string uid = null)
761+
public DeliveryToken DeliveryToken(string? uid = null)
762762
{
763763
ThrowIfNotLoggedIn();
764764
ThrowIfAPIKeyEmpty();
@@ -778,7 +778,7 @@ public DeliveryToken DeliveryToken(string uid = null)
778778
/// </code></pre>
779779
/// </example>
780780
/// <returns>The <see cref="Models.Token.ManagementToken" /></returns>
781-
public ManagementToken ManagementTokens(string uid = null)
781+
public ManagementToken ManagementTokens(string? uid = null)
782782
{
783783
ThrowIfNotLoggedIn();
784784
ThrowIfAPIKeyEmpty();
@@ -843,7 +843,7 @@ public Release Release(string uid = null)
843843
/// </code></pre>
844844
/// </example>
845845
/// <returns>The <see cref="Models.Workflow" /></returns>
846-
public Workflow Workflow(string uid = null)
846+
public Workflow Workflow(string? uid = null)
847847
{
848848
ThrowIfNotLoggedIn();
849849
ThrowIfAPIKeyEmpty();
@@ -885,7 +885,7 @@ public PublishQueue PublishQueue(string uid = null)
885885
/// </code></pre>
886886
/// </example>
887887
/// <returns>The <see cref="Models.AuditLog" /></returns>
888-
public Webhook Webhook(string uid = null)
888+
public Webhook Webhook(string? uid = null)
889889
{
890890
ThrowIfNotLoggedIn();
891891
ThrowIfAPIKeyEmpty();

Contentstack.Management.Core/Models/Taxonomy.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Contentstack.Management.Core.Models
1010
/// </summary>
1111
public class Taxonomy : BaseModel<TaxonomyModel>
1212
{
13-
internal Taxonomy(Stack stack, string uid = null)
13+
internal Taxonomy(Stack stack, string? uid = null)
1414
: base(stack, "taxonomy", uid)
1515
{
1616
resourcePath = uid == null ? "/taxonomies" : $"/taxonomies/{uid}";
@@ -33,71 +33,71 @@ public Query Query()
3333
/// <summary>
3434
/// Create a taxonomy.
3535
/// </summary>
36-
public override ContentstackResponse Create(TaxonomyModel model, ParameterCollection collection = null)
36+
public override ContentstackResponse Create(TaxonomyModel model, ParameterCollection? collection = null)
3737
{
3838
return base.Create(model, collection);
3939
}
4040

4141
/// <summary>
4242
/// Create a taxonomy asynchronously.
4343
/// </summary>
44-
public override Task<ContentstackResponse> CreateAsync(TaxonomyModel model, ParameterCollection collection = null)
44+
public override Task<ContentstackResponse> CreateAsync(TaxonomyModel model, ParameterCollection? collection = null)
4545
{
4646
return base.CreateAsync(model, collection);
4747
}
4848

4949
/// <summary>
5050
/// Update an existing taxonomy.
5151
/// </summary>
52-
public override ContentstackResponse Update(TaxonomyModel model, ParameterCollection collection = null)
52+
public override ContentstackResponse Update(TaxonomyModel model, ParameterCollection? collection = null)
5353
{
5454
return base.Update(model, collection);
5555
}
5656

5757
/// <summary>
5858
/// Update an existing taxonomy asynchronously.
5959
/// </summary>
60-
public override Task<ContentstackResponse> UpdateAsync(TaxonomyModel model, ParameterCollection collection = null)
60+
public override Task<ContentstackResponse> UpdateAsync(TaxonomyModel model, ParameterCollection? collection = null)
6161
{
6262
return base.UpdateAsync(model, collection);
6363
}
6464

6565
/// <summary>
6666
/// Fetch a single taxonomy.
6767
/// </summary>
68-
public override ContentstackResponse Fetch(ParameterCollection collection = null)
68+
public override ContentstackResponse Fetch(ParameterCollection? collection = null)
6969
{
7070
return base.Fetch(collection);
7171
}
7272

7373
/// <summary>
7474
/// Fetch a single taxonomy asynchronously.
7575
/// </summary>
76-
public override Task<ContentstackResponse> FetchAsync(ParameterCollection collection = null)
76+
public override Task<ContentstackResponse> FetchAsync(ParameterCollection? collection = null)
7777
{
7878
return base.FetchAsync(collection);
7979
}
8080

8181
/// <summary>
8282
/// Delete a taxonomy.
8383
/// </summary>
84-
public override ContentstackResponse Delete(ParameterCollection collection = null)
84+
public override ContentstackResponse Delete(ParameterCollection? collection = null)
8585
{
8686
return base.Delete(collection);
8787
}
8888

8989
/// <summary>
9090
/// Delete a taxonomy asynchronously.
9191
/// </summary>
92-
public override Task<ContentstackResponse> DeleteAsync(ParameterCollection collection = null)
92+
public override Task<ContentstackResponse> DeleteAsync(ParameterCollection? collection = null)
9393
{
9494
return base.DeleteAsync(collection);
9595
}
9696

9797
/// <summary>
9898
/// Export taxonomy. GET {resourcePath}/export with optional query parameters.
9999
/// </summary>
100-
public ContentstackResponse Export(ParameterCollection collection = null)
100+
public ContentstackResponse Export(ParameterCollection? collection = null)
101101
{
102102
stack.ThrowIfNotLoggedIn();
103103
ThrowIfUidEmpty();
@@ -108,7 +108,7 @@ public ContentstackResponse Export(ParameterCollection collection = null)
108108
/// <summary>
109109
/// Export taxonomy asynchronously.
110110
/// </summary>
111-
public Task<ContentstackResponse> ExportAsync(ParameterCollection collection = null)
111+
public Task<ContentstackResponse> ExportAsync(ParameterCollection? collection = null)
112112
{
113113
stack.ThrowIfNotLoggedIn();
114114
ThrowIfUidEmpty();
@@ -119,7 +119,7 @@ public Task<ContentstackResponse> ExportAsync(ParameterCollection collection = n
119119
/// <summary>
120120
/// Get taxonomy locales. GET {resourcePath}/locales.
121121
/// </summary>
122-
public ContentstackResponse Locales(ParameterCollection collection = null)
122+
public ContentstackResponse Locales(ParameterCollection? collection = null)
123123
{
124124
stack.ThrowIfNotLoggedIn();
125125
ThrowIfUidEmpty();
@@ -130,7 +130,7 @@ public ContentstackResponse Locales(ParameterCollection collection = null)
130130
/// <summary>
131131
/// Get taxonomy locales asynchronously.
132132
/// </summary>
133-
public Task<ContentstackResponse> LocalesAsync(ParameterCollection collection = null)
133+
public Task<ContentstackResponse> LocalesAsync(ParameterCollection? collection = null)
134134
{
135135
stack.ThrowIfNotLoggedIn();
136136
ThrowIfUidEmpty();
@@ -141,7 +141,7 @@ public Task<ContentstackResponse> LocalesAsync(ParameterCollection collection =
141141
/// <summary>
142142
/// Localize taxonomy. POST to resourcePath with body { taxonomy: model } and query params (e.g. locale).
143143
/// </summary>
144-
public ContentstackResponse Localize(TaxonomyModel model, ParameterCollection collection = null)
144+
public ContentstackResponse Localize(TaxonomyModel model, ParameterCollection? collection = null)
145145
{
146146
stack.ThrowIfNotLoggedIn();
147147
ThrowIfUidEmpty();
@@ -152,7 +152,7 @@ public ContentstackResponse Localize(TaxonomyModel model, ParameterCollection co
152152
/// <summary>
153153
/// Localize taxonomy asynchronously.
154154
/// </summary>
155-
public Task<ContentstackResponse> LocalizeAsync(TaxonomyModel model, ParameterCollection collection = null)
155+
public Task<ContentstackResponse> LocalizeAsync(TaxonomyModel model, ParameterCollection? collection = null)
156156
{
157157
stack.ThrowIfNotLoggedIn();
158158
ThrowIfUidEmpty();
@@ -163,7 +163,7 @@ public Task<ContentstackResponse> LocalizeAsync(TaxonomyModel model, ParameterCo
163163
/// <summary>
164164
/// Import taxonomy. POST /taxonomies/import with multipart form (taxonomy file).
165165
/// </summary>
166-
public ContentstackResponse Import(TaxonomyImportModel model, ParameterCollection collection = null)
166+
public ContentstackResponse Import(TaxonomyImportModel model, ParameterCollection? collection = null)
167167
{
168168
stack.ThrowIfNotLoggedIn();
169169
ThrowIfUidNotEmpty();
@@ -175,7 +175,7 @@ public ContentstackResponse Import(TaxonomyImportModel model, ParameterCollectio
175175
/// <summary>
176176
/// Import taxonomy asynchronously.
177177
/// </summary>
178-
public Task<ContentstackResponse> ImportAsync(TaxonomyImportModel model, ParameterCollection collection = null)
178+
public Task<ContentstackResponse> ImportAsync(TaxonomyImportModel model, ParameterCollection? collection = null)
179179
{
180180
stack.ThrowIfNotLoggedIn();
181181
ThrowIfUidNotEmpty();
@@ -194,7 +194,7 @@ public Task<ContentstackResponse> ImportAsync(TaxonomyImportModel model, Paramet
194194
/// stack.Taxonomy("taxonomy_uid").Terms("term_uid").Fetch();
195195
/// </code>
196196
/// </example>
197-
public Term Terms(string termUid = null)
197+
public Term Terms(string? termUid = null)
198198
{
199199
ThrowIfUidEmpty();
200200
return new Term(stack, Uid, termUid);

0 commit comments

Comments
 (0)