Skip to content

Commit 6586804

Browse files
committed
feat: fixed github warning - Cannot convert null literal to non-nullable reference type.
1 parent 7670f60 commit 6586804

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

Contentstack.Management.Core/Models/BaseModel.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public class BaseModel<T>
1515
public string Uid { get; set; }
1616

1717

18-
public BaseModel(Stack stack, string fieldName, string uid = null)
18+
public BaseModel(Stack stack, string fieldName, string? uid = null)
1919
{
2020
stack.ThrowIfAPIKeyEmpty();
2121
if (fieldName == null)
@@ -27,15 +27,15 @@ public BaseModel(Stack stack, string fieldName, string uid = null)
2727
Uid = uid;
2828
}
2929

30-
public virtual ContentstackResponse Create(T model, ParameterCollection collection = null)
30+
public virtual ContentstackResponse Create(T model, ParameterCollection? collection = null)
3131
{
3232
ThrowIfUidNotEmpty();
3333

3434
var service = new CreateUpdateService<T>(stack, resourcePath, model, this.fieldName, collection: collection, stjOptions: stack.client.SerializerOptions);
3535
return stack.client.InvokeSync(service);
3636
}
3737

38-
public virtual Task<ContentstackResponse> CreateAsync(T model, ParameterCollection collection = null)
38+
public virtual Task<ContentstackResponse> CreateAsync(T model, ParameterCollection? collection = null)
3939
{
4040
ThrowIfUidNotEmpty();
4141
stack.ThrowIfNotLoggedIn();
@@ -45,15 +45,15 @@ public virtual Task<ContentstackResponse> CreateAsync(T model, ParameterCollecti
4545
return stack.client.InvokeAsync<CreateUpdateService<T>, ContentstackResponse>(service);
4646
}
4747

48-
public virtual ContentstackResponse Update(T model, ParameterCollection collection = null)
48+
public virtual ContentstackResponse Update(T model, ParameterCollection? collection = null)
4949
{
5050
ThrowIfUidEmpty();
5151

5252
var service = new CreateUpdateService<T>(stack, resourcePath, model, this.fieldName, "PUT", collection: collection, stjOptions: stack.client.SerializerOptions);
5353
return stack.client.InvokeSync(service);
5454
}
5555

56-
public virtual Task<ContentstackResponse> UpdateAsync(T model, ParameterCollection collection = null)
56+
public virtual Task<ContentstackResponse> UpdateAsync(T model, ParameterCollection? collection = null)
5757
{
5858
stack.ThrowIfNotLoggedIn();
5959
ThrowIfUidEmpty();
@@ -63,7 +63,7 @@ public virtual Task<ContentstackResponse> UpdateAsync(T model, ParameterCollecti
6363
return stack.client.InvokeAsync<CreateUpdateService<T>, ContentstackResponse>(service);
6464
}
6565

66-
public virtual ContentstackResponse Fetch(ParameterCollection collection = null)
66+
public virtual ContentstackResponse Fetch(ParameterCollection? collection = null)
6767
{
6868
stack.ThrowIfNotLoggedIn();
6969
ThrowIfUidEmpty();
@@ -72,7 +72,7 @@ public virtual ContentstackResponse Fetch(ParameterCollection collection = null)
7272
return stack.client.InvokeSync(service);
7373
}
7474

75-
public virtual Task<ContentstackResponse> FetchAsync(ParameterCollection collection = null)
75+
public virtual Task<ContentstackResponse> FetchAsync(ParameterCollection? collection = null)
7676
{
7777
stack.ThrowIfNotLoggedIn();
7878
ThrowIfUidEmpty();
@@ -81,7 +81,7 @@ public virtual Task<ContentstackResponse> FetchAsync(ParameterCollection collect
8181
return stack.client.InvokeAsync<FetchDeleteService, ContentstackResponse>(service);
8282
}
8383

84-
public virtual ContentstackResponse Delete(ParameterCollection collection = null)
84+
public virtual ContentstackResponse Delete(ParameterCollection? collection = null)
8585
{
8686
stack.ThrowIfNotLoggedIn();
8787
ThrowIfUidEmpty();
@@ -90,7 +90,7 @@ public virtual ContentstackResponse Delete(ParameterCollection collection = null
9090
return stack.client.InvokeSync(service);
9191
}
9292

93-
public virtual Task<ContentstackResponse> DeleteAsync(ParameterCollection collection = null)
93+
public virtual Task<ContentstackResponse> DeleteAsync(ParameterCollection? collection = null)
9494
{
9595
stack.ThrowIfNotLoggedIn();
9696
ThrowIfUidEmpty();

Contentstack.Management.Core/Models/ContentType.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public Query Query()
3939
/// </example>
4040
/// <param name="model">IContentType for updating Content Type.</param>
4141
/// <returns></returns>
42-
public override ContentstackResponse Create(ContentModelling model, ParameterCollection collection = null)
42+
public override ContentstackResponse Create(ContentModelling model, ParameterCollection? collection = null)
4343
{
4444
return base.Create(model, collection);
4545
}
@@ -56,7 +56,7 @@ public override ContentstackResponse Create(ContentModelling model, ParameterCol
5656
/// </example>
5757
/// <param name="model">IContentType for updating Content Type.</param>
5858
/// <returns></returns>
59-
public override Task<ContentstackResponse> CreateAsync(ContentModelling model, ParameterCollection collection = null)
59+
public override Task<ContentstackResponse> CreateAsync(ContentModelling model, ParameterCollection? collection = null)
6060
{
6161
return base.CreateAsync(model, collection);
6262
}
@@ -73,7 +73,7 @@ public override Task<ContentstackResponse> CreateAsync(ContentModelling model, P
7373
/// </example>
7474
/// <param name="model">IContentType for updating Content Type.</param>
7575
/// <returns></returns>
76-
public override ContentstackResponse Update(ContentModelling model, ParameterCollection collection = null)
76+
public override ContentstackResponse Update(ContentModelling model, ParameterCollection? collection = null)
7777
{
7878
return base.Update(model, collection);
7979
}
@@ -90,7 +90,7 @@ public override ContentstackResponse Update(ContentModelling model, ParameterCol
9090
/// </example>
9191
/// <param name="model">IContentType for updating Content Type.</param>
9292
/// <returns></returns>
93-
public override Task<ContentstackResponse> UpdateAsync(ContentModelling model, ParameterCollection collection = null)
93+
public override Task<ContentstackResponse> UpdateAsync(ContentModelling model, ParameterCollection? collection = null)
9494
{
9595
return base.UpdateAsync(model, collection);
9696
}
@@ -105,7 +105,7 @@ public override Task<ContentstackResponse> UpdateAsync(ContentModelling model, P
105105
/// </code></pre>
106106
/// </example>
107107
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
108-
public override ContentstackResponse Fetch(ParameterCollection collection = null)
108+
public override ContentstackResponse Fetch(ParameterCollection? collection = null)
109109
{
110110
return base.Fetch(collection);
111111
}
@@ -120,7 +120,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null
120120
/// </code></pre>
121121
/// </example>
122122
/// <returns>The Task.</returns>
123-
public override Task<ContentstackResponse> FetchAsync(ParameterCollection collection = null)
123+
public override Task<ContentstackResponse> FetchAsync(ParameterCollection? collection = null)
124124
{
125125
return base.FetchAsync(collection);
126126
}
@@ -135,7 +135,7 @@ public override Task<ContentstackResponse> FetchAsync(ParameterCollection collec
135135
/// </code></pre>
136136
/// </example>
137137
/// <returns>The <see cref="ContentstackResponse"/>.</returns>
138-
public override ContentstackResponse Delete(ParameterCollection collection = null)
138+
public override ContentstackResponse Delete(ParameterCollection? collection = null)
139139
{
140140
return base.Delete(collection);
141141
}
@@ -150,7 +150,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul
150150
/// </code></pre>
151151
/// </example>
152152
/// <returns>The Task.</returns>
153-
public override Task<ContentstackResponse> DeleteAsync(ParameterCollection collection = null)
153+
public override Task<ContentstackResponse> DeleteAsync(ParameterCollection? collection = null)
154154
{
155155
return base.DeleteAsync(collection);
156156
}

0 commit comments

Comments
 (0)