diff --git a/Contentstack.Management.Core.Tests/Contentstack.Management.Core.Tests.csproj b/Contentstack.Management.Core.Tests/Contentstack.Management.Core.Tests.csproj index ad6ede9..ddf7b54 100644 --- a/Contentstack.Management.Core.Tests/Contentstack.Management.Core.Tests.csproj +++ b/Contentstack.Management.Core.Tests/Contentstack.Management.Core.Tests.csproj @@ -58,9 +58,6 @@ - - - diff --git a/Contentstack.Management.Core.Tests/IntegrationTest/Contentstack020_WorkflowTest.cs b/Contentstack.Management.Core.Tests/IntegrationTest/Contentstack020_WorkflowTest.cs index 79bd43d..5bd16fa 100644 --- a/Contentstack.Management.Core.Tests/IntegrationTest/Contentstack020_WorkflowTest.cs +++ b/Contentstack.Management.Core.Tests/IntegrationTest/Contentstack020_WorkflowTest.cs @@ -1326,7 +1326,7 @@ public void Test005_Should_Update_Workflow_Properties() AssertLogger.IsTrue(response.IsSuccessStatusCode, $"Workflow update failed with status {(int)response.StatusCode}", "workflowUpdateSuccess"); AssertLogger.IsNotNull(responseJson["workflow"], "workflowObject"); AssertLogger.AreEqual(updatedName, responseJson["workflow"]["name"]?.ToString(), "updatedWorkflowName"); - AssertLogger.AreEqual(false, responseJson["workflow"]["enabled"]?.Value(), "updatedEnabledStatus"); + AssertLogger.AreEqual(false, responseJson["workflow"]["enabled"]?.GetValue(), "updatedEnabledStatus"); TestOutputLogger.LogContext("UpdatedWorkflowUid", workflowUid); } @@ -1600,7 +1600,7 @@ public async Task Test012_Should_Update_Publish_Rule() // Assert AssertLogger.IsNotNull(response, "publishRuleUpdateResponse"); AssertLogger.IsTrue(response.IsSuccessStatusCode, $"Publish rule update failed with status {(int)response.StatusCode}", "publishRuleUpdateSuccess"); - AssertLogger.AreEqual(true, responseJson["publishing_rule"]["disable_approver_publishing"]?.Value(), "updatedDisableApproval"); + AssertLogger.AreEqual(true, responseJson["publishing_rule"]["disable_approver_publishing"]?.GetValue(), "updatedDisableApproval"); TestOutputLogger.LogContext("UpdatedPublishRuleUid", publishRuleUid); } diff --git a/Contentstack.Management.Core.Unit.Tests/Contentstack.Management.Core.Unit.Tests.csproj b/Contentstack.Management.Core.Unit.Tests/Contentstack.Management.Core.Unit.Tests.csproj index 4af9382..b13cfb1 100644 --- a/Contentstack.Management.Core.Unit.Tests/Contentstack.Management.Core.Unit.Tests.csproj +++ b/Contentstack.Management.Core.Unit.Tests/Contentstack.Management.Core.Unit.Tests.csproj @@ -57,19 +57,13 @@ - - - - - - diff --git a/Contentstack.Management.Core.Unit.Tests/Models/DeliveryTokenTest.cs b/Contentstack.Management.Core.Unit.Tests/Models/DeliveryTokenTest.cs index 88a36a9..a01124d 100644 --- a/Contentstack.Management.Core.Unit.Tests/Models/DeliveryTokenTest.cs +++ b/Contentstack.Management.Core.Unit.Tests/Models/DeliveryTokenTest.cs @@ -32,12 +32,12 @@ public void Initialize_DeliveryToken() DeliveryToken token = new DeliveryToken(_stack); Assert.IsNull(token.Uid); Assert.AreEqual("stacks/delivery_tokens", token.resourcePath); - Assert.ThrowsException(() => token.Fetch()); - Assert.ThrowsExceptionAsync(() => token.FetchAsync()); - Assert.ThrowsException(() => token.Update(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => token.UpdateAsync(_fixture.Create())); - Assert.ThrowsException(() => token.Delete()); - Assert.ThrowsExceptionAsync(() => token.DeleteAsync()); + Assert.ThrowsException(() => token.Fetch()); + Assert.ThrowsExceptionAsync(() => token.FetchAsync()); + Assert.ThrowsException(() => token.Update(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => token.UpdateAsync(_fixture.Create())); + Assert.ThrowsException(() => token.Delete()); + Assert.ThrowsExceptionAsync(() => token.DeleteAsync()); Assert.AreEqual(token.Query().GetType(), typeof(Query)); } diff --git a/Contentstack.Management.Core.Unit.Tests/Models/PublishRuleTest.cs b/Contentstack.Management.Core.Unit.Tests/Models/PublishRuleTest.cs index 42d3790..6c83598 100644 --- a/Contentstack.Management.Core.Unit.Tests/Models/PublishRuleTest.cs +++ b/Contentstack.Management.Core.Unit.Tests/Models/PublishRuleTest.cs @@ -29,12 +29,12 @@ public void Initialize_PublishRule() Assert.IsNull(publishRule.Uid); Assert.AreEqual($"/workflows/publishing_rules", publishRule.resourcePath); - Assert.ThrowsException(() => publishRule.Fetch()); - Assert.ThrowsExceptionAsync(() => publishRule.FetchAsync()); - Assert.ThrowsException(() => publishRule.Update(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => publishRule.UpdateAsync(_fixture.Create())); - Assert.ThrowsException(() => publishRule.Delete()); - Assert.ThrowsExceptionAsync(() => publishRule.DeleteAsync()); + Assert.ThrowsException(() => publishRule.Fetch()); + Assert.ThrowsExceptionAsync(() => publishRule.FetchAsync()); + Assert.ThrowsException(() => publishRule.Update(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => publishRule.UpdateAsync(_fixture.Create())); + Assert.ThrowsException(() => publishRule.Delete()); + Assert.ThrowsExceptionAsync(() => publishRule.DeleteAsync()); } [TestMethod] @@ -57,7 +57,7 @@ public void Should_Create_PublishRule() ContentstackResponse response = _stack.Workflow().PublishRule().Create(new PublishRuleModel()); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -66,7 +66,7 @@ public async System.Threading.Tasks.Task Should_Create_PublishRule_Async() ContentstackResponse response = await _stack.Workflow().PublishRule().CreateAsync(new PublishRuleModel()); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -75,7 +75,7 @@ public void Should_Find_All_PublishRule() ContentstackResponse response = _stack.Workflow().PublishRule().FindAll(); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -84,7 +84,7 @@ public async System.Threading.Tasks.Task Should_Find_All_PublishRule_Async() ContentstackResponse response = await _stack.Workflow().PublishRule().FindAllAsync(); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -93,7 +93,7 @@ public void Should_Fetch_PublishRule() ContentstackResponse response = _stack.Workflow().PublishRule(_fixture.Create()).Fetch(); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -102,7 +102,7 @@ public async System.Threading.Tasks.Task Should_Find_PublishRule_Async() ContentstackResponse response = await _stack.Workflow().PublishRule(_fixture.Create()).FetchAsync(); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -111,7 +111,7 @@ public void Should_Update_PublishRule() ContentstackResponse response = _stack.Workflow().PublishRule(_fixture.Create()).Update(new PublishRuleModel()); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -120,7 +120,7 @@ public async System.Threading.Tasks.Task Should_Update_PublishRule_Async() ContentstackResponse response = await _stack.Workflow().PublishRule(_fixture.Create()).UpdateAsync(new PublishRuleModel()); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -129,7 +129,7 @@ public void Should_Delete_PublishRule() ContentstackResponse response = _stack.Workflow().PublishRule(_fixture.Create()).Delete(); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } [TestMethod] @@ -138,7 +138,7 @@ public async System.Threading.Tasks.Task Should_Delete_PublishRule_Async() ContentstackResponse response = await _stack.Workflow().PublishRule(_fixture.Create()).DeleteAsync(); Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse()); - Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString()); + Assert.AreEqual(_contentstackResponse.OpenJsonObjectResponse().ToString(), response.OpenJsonObjectResponse().ToString()); } } } diff --git a/Contentstack.Management.Core.Unit.Tests/Models/TaxonomyTest.cs b/Contentstack.Management.Core.Unit.Tests/Models/TaxonomyTest.cs index 38ac5c9..66f7240 100644 --- a/Contentstack.Management.Core.Unit.Tests/Models/TaxonomyTest.cs +++ b/Contentstack.Management.Core.Unit.Tests/Models/TaxonomyTest.cs @@ -33,13 +33,13 @@ public void Initialize_Taxonomy() Assert.IsNull(taxonomy.Uid); Assert.AreEqual("/taxonomies", taxonomy.resourcePath); - Assert.ThrowsException(() => taxonomy.Fetch()); - Assert.ThrowsExceptionAsync(() => taxonomy.FetchAsync()); - Assert.ThrowsException(() => taxonomy.Update(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => taxonomy.UpdateAsync(_fixture.Create())); - Assert.ThrowsException(() => taxonomy.Delete()); - Assert.ThrowsExceptionAsync(() => taxonomy.DeleteAsync()); - Assert.ThrowsException(() => taxonomy.Terms()); + Assert.ThrowsException(() => taxonomy.Fetch()); + Assert.ThrowsExceptionAsync(() => taxonomy.FetchAsync()); + Assert.ThrowsException(() => taxonomy.Update(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => taxonomy.UpdateAsync(_fixture.Create())); + Assert.ThrowsException(() => taxonomy.Delete()); + Assert.ThrowsExceptionAsync(() => taxonomy.DeleteAsync()); + Assert.ThrowsException(() => taxonomy.Terms()); Assert.AreEqual(typeof(Query), taxonomy.Query().GetType()); } @@ -136,22 +136,22 @@ public void Should_Get_Single_Term_From_Taxonomy() [TestMethod] public void Export_Throws_When_Uid_Is_Empty() { - Assert.ThrowsException(() => _stack.Taxonomy().Export()); - Assert.ThrowsExceptionAsync(() => _stack.Taxonomy().ExportAsync()); + Assert.ThrowsException(() => _stack.Taxonomy().Export()); + Assert.ThrowsExceptionAsync(() => _stack.Taxonomy().ExportAsync()); } [TestMethod] public void Locales_Throws_When_Uid_Is_Empty() { - Assert.ThrowsException(() => _stack.Taxonomy().Locales()); - Assert.ThrowsExceptionAsync(() => _stack.Taxonomy().LocalesAsync()); + Assert.ThrowsException(() => _stack.Taxonomy().Locales()); + Assert.ThrowsExceptionAsync(() => _stack.Taxonomy().LocalesAsync()); } [TestMethod] public void Localize_Throws_When_Uid_Is_Empty() { - Assert.ThrowsException(() => _stack.Taxonomy().Localize(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => _stack.Taxonomy().LocalizeAsync(_fixture.Create())); + Assert.ThrowsException(() => _stack.Taxonomy().Localize(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => _stack.Taxonomy().LocalizeAsync(_fixture.Create())); } [TestMethod] diff --git a/Contentstack.Management.Core.Unit.Tests/Models/TermTest.cs b/Contentstack.Management.Core.Unit.Tests/Models/TermTest.cs index 3267ab9..7191318 100644 --- a/Contentstack.Management.Core.Unit.Tests/Models/TermTest.cs +++ b/Contentstack.Management.Core.Unit.Tests/Models/TermTest.cs @@ -32,8 +32,8 @@ public void Initialize_Term_Collection() Assert.IsNull(term.Uid); Assert.AreEqual($"/taxonomies/{taxonomyUid}/terms", term.resourcePath); - Assert.ThrowsException(() => term.Fetch()); - Assert.ThrowsExceptionAsync(() => term.FetchAsync()); + Assert.ThrowsException(() => term.Fetch()); + Assert.ThrowsExceptionAsync(() => term.FetchAsync()); Assert.AreEqual(typeof(Query), term.Query().GetType()); } @@ -139,40 +139,40 @@ public async System.Threading.Tasks.Task Should_Search_Terms_Async() public void Ancestors_Throws_When_Term_Uid_Is_Empty() { string taxonomyUid = _fixture.Create(); - Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Ancestors()); - Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().AncestorsAsync()); + Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Ancestors()); + Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().AncestorsAsync()); } [TestMethod] public void Descendants_Throws_When_Term_Uid_Is_Empty() { string taxonomyUid = _fixture.Create(); - Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Descendants()); - Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().DescendantsAsync()); + Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Descendants()); + Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().DescendantsAsync()); } [TestMethod] public void Move_Throws_When_Term_Uid_Is_Empty() { string taxonomyUid = _fixture.Create(); - Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Move(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().MoveAsync(_fixture.Create())); + Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Move(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().MoveAsync(_fixture.Create())); } [TestMethod] public void Locales_Throws_When_Term_Uid_Is_Empty() { string taxonomyUid = _fixture.Create(); - Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Locales()); - Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().LocalesAsync()); + Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Locales()); + Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().LocalesAsync()); } [TestMethod] public void Localize_Throws_When_Term_Uid_Is_Empty() { string taxonomyUid = _fixture.Create(); - Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Localize(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().LocalizeAsync(_fixture.Create())); + Assert.ThrowsException(() => _stack.Taxonomy(taxonomyUid).Terms().Localize(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => _stack.Taxonomy(taxonomyUid).Terms().LocalizeAsync(_fixture.Create())); } } } diff --git a/Contentstack.Management.Core.Unit.Tests/Models/WebhookTest.cs b/Contentstack.Management.Core.Unit.Tests/Models/WebhookTest.cs index 2f5a905..1a85744 100644 --- a/Contentstack.Management.Core.Unit.Tests/Models/WebhookTest.cs +++ b/Contentstack.Management.Core.Unit.Tests/Models/WebhookTest.cs @@ -30,18 +30,18 @@ public void Initialize_Webhook() Assert.IsNull(webhook.Uid); Assert.AreEqual($"/webhooks", webhook.resourcePath); - Assert.ThrowsException(() => webhook.Fetch()); - Assert.ThrowsExceptionAsync(() => webhook.FetchAsync()); - Assert.ThrowsException(() => webhook.Update(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => webhook.UpdateAsync(_fixture.Create())); - Assert.ThrowsException(() => webhook.Delete()); - Assert.ThrowsExceptionAsync(() => webhook.DeleteAsync()); - Assert.ThrowsException(() => webhook.Executions()); - Assert.ThrowsExceptionAsync(() => webhook.ExecutionsAsync()); - Assert.ThrowsException(() => webhook.Retry(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => webhook.RetryAsync(_fixture.Create())); - Assert.ThrowsException(() => webhook.Logs(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => webhook.LogsAsync(_fixture.Create())); + Assert.ThrowsException(() => webhook.Fetch()); + Assert.ThrowsExceptionAsync(() => webhook.FetchAsync()); + Assert.ThrowsException(() => webhook.Update(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => webhook.UpdateAsync(_fixture.Create())); + Assert.ThrowsException(() => webhook.Delete()); + Assert.ThrowsExceptionAsync(() => webhook.DeleteAsync()); + Assert.ThrowsException(() => webhook.Executions()); + Assert.ThrowsExceptionAsync(() => webhook.ExecutionsAsync()); + Assert.ThrowsException(() => webhook.Retry(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => webhook.RetryAsync(_fixture.Create())); + Assert.ThrowsException(() => webhook.Logs(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => webhook.LogsAsync(_fixture.Create())); Assert.AreEqual(webhook.Query().GetType(), typeof(Query)); } diff --git a/Contentstack.Management.Core.Unit.Tests/Models/WorkflowTest.cs b/Contentstack.Management.Core.Unit.Tests/Models/WorkflowTest.cs index eb4b312..d4daaf7 100644 --- a/Contentstack.Management.Core.Unit.Tests/Models/WorkflowTest.cs +++ b/Contentstack.Management.Core.Unit.Tests/Models/WorkflowTest.cs @@ -29,12 +29,12 @@ public void Initialize_Workflow() Assert.IsNull(workflow.Uid); Assert.AreEqual($"/workflows", workflow.resourcePath); - Assert.ThrowsException(() => workflow.Fetch()); - Assert.ThrowsExceptionAsync(() => workflow.FetchAsync()); - Assert.ThrowsException(() => workflow.Update(_fixture.Create())); - Assert.ThrowsExceptionAsync(() => workflow.UpdateAsync(_fixture.Create())); - Assert.ThrowsException(() => workflow.Delete()); - Assert.ThrowsExceptionAsync(() => workflow.DeleteAsync()); + Assert.ThrowsException(() => workflow.Fetch()); + Assert.ThrowsExceptionAsync(() => workflow.FetchAsync()); + Assert.ThrowsException(() => workflow.Update(_fixture.Create())); + Assert.ThrowsExceptionAsync(() => workflow.UpdateAsync(_fixture.Create())); + Assert.ThrowsException(() => workflow.Delete()); + Assert.ThrowsExceptionAsync(() => workflow.DeleteAsync()); Assert.AreEqual(workflow.PublishRule().GetType(), typeof(PublishRule)); } diff --git a/Contentstack.Management.Core/Models/PublishRule.cs b/Contentstack.Management.Core/Models/PublishRule.cs index 60dabac..3cbd0e9 100644 --- a/Contentstack.Management.Core/Models/PublishRule.cs +++ b/Contentstack.Management.Core/Models/PublishRule.cs @@ -6,7 +6,7 @@ namespace Contentstack.Management.Core.Models { public class PublishRule: BaseModel { - internal PublishRule(Stack stack, string uid) + internal PublishRule(Stack stack, string? uid) : base(stack, "publishing_rule", uid) { resourcePath = uid == null ? "/workflows/publishing_rules" : $"/workflows/publishing_rules/{uid}"; @@ -23,12 +23,12 @@ internal PublishRule(Stack stack, string uid) /// /// /// The . - public virtual ContentstackResponse FindAll(ParameterCollection collection = null) + public virtual ContentstackResponse FindAll(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidNotEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath, collection: collection); + var service = new FetchDeleteService(stack, resourcePath, collection: collection); return stack.client.InvokeSync(service); } @@ -43,12 +43,12 @@ public virtual ContentstackResponse FindAll(ParameterCollection collection = nul /// /// /// The . - public virtual Task FindAllAsync(ParameterCollection collection = null) + public virtual Task FindAllAsync(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidNotEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath, collection: collection); + var service = new FetchDeleteService(stack, resourcePath, collection: collection); return stack.client.InvokeAsync(service); } @@ -64,7 +64,7 @@ public virtual Task FindAllAsync(ParameterCollection colle /// /// PublishRule Model for creating workflow. /// - public override ContentstackResponse Create(PublishRuleModel model, ParameterCollection collection = null) + public override ContentstackResponse Create(PublishRuleModel model, ParameterCollection? collection = null) { return base.Create(model, collection); } @@ -81,7 +81,7 @@ public override ContentstackResponse Create(PublishRuleModel model, ParameterCol /// /// PublishRule Model for creating workflow. /// - public override Task CreateAsync(PublishRuleModel model, ParameterCollection collection = null) + public override Task CreateAsync(PublishRuleModel model, ParameterCollection? collection = null) { return base.CreateAsync(model, collection); } @@ -98,7 +98,7 @@ public override Task CreateAsync(PublishRuleModel model, P /// /// PublishRule Model for updating Content Type. /// - public override ContentstackResponse Update(PublishRuleModel model, ParameterCollection collection = null) + public override ContentstackResponse Update(PublishRuleModel model, ParameterCollection? collection = null) { return base.Update(model, collection); } @@ -115,7 +115,7 @@ public override ContentstackResponse Update(PublishRuleModel model, ParameterCol /// /// PublishRule Model for updating Content Type. /// - public override Task UpdateAsync(PublishRuleModel model, ParameterCollection collection = null) + public override Task UpdateAsync(PublishRuleModel model, ParameterCollection? collection = null) { return base.UpdateAsync(model, collection); } @@ -130,7 +130,7 @@ public override Task UpdateAsync(PublishRuleModel model, P /// /// /// The . - public override ContentstackResponse Fetch(ParameterCollection collection = null) + public override ContentstackResponse Fetch(ParameterCollection? collection = null) { return base.Fetch(collection); } @@ -145,7 +145,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null /// /// /// The Task. - public override Task FetchAsync(ParameterCollection collection = null) + public override Task FetchAsync(ParameterCollection? collection = null) { return base.FetchAsync(collection); } @@ -160,7 +160,7 @@ public override Task FetchAsync(ParameterCollection collec /// /// /// The . - public override ContentstackResponse Delete(ParameterCollection collection = null) + public override ContentstackResponse Delete(ParameterCollection? collection = null) { return base.Delete(collection); } @@ -175,7 +175,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul /// /// /// The Task. - public override Task DeleteAsync(ParameterCollection collection = null) + public override Task DeleteAsync(ParameterCollection? collection = null) { return base.DeleteAsync(collection); } diff --git a/Contentstack.Management.Core/Models/Stack.cs b/Contentstack.Management.Core/Models/Stack.cs index 21ddf63..322ff9b 100644 --- a/Contentstack.Management.Core/Models/Stack.cs +++ b/Contentstack.Management.Core/Models/Stack.cs @@ -5,7 +5,7 @@ using Contentstack.Management.Core.Services.Stack; using Contentstack.Management.Core.Utils; using Contentstack.Management.Core.Models; -// using Contentstack.Management.Core.Models.Token; // Excluded for now +using Contentstack.Management.Core.Models.Token; namespace Contentstack.Management.Core.Models { @@ -665,7 +665,7 @@ public GlobalField GlobalField(string? uid = null, string? apiVersion = null) /* /// - /// let you create custom fields and custom widgets that lets you customize Contentstack's default UI and behavior. + /// let you create custom fields and custom widgets that lets you customize Contentstack's default UI and behavior. /// /// Optional, extension uid. /// @@ -685,7 +685,7 @@ public Extension Extension(string uid = null) } /// - /// allow you to group a collection of content within a stack. Using labels you can group content types that need to work together. + /// allow you to group a collection of content within a stack. Using labels you can group content types that need to work together. /// /// Optional, label uid. /// @@ -703,6 +703,7 @@ public Label Label(string uid = null) return new Label(this, uid); } + */ /// /// allows you to organize and categorize content using a hierarchical structure of terms. @@ -717,14 +718,13 @@ public Label Label(string uid = null) /// /// /// The - public Taxonomy Taxonomy(string uid = null) + public Taxonomy Taxonomy(string? uid = null) { ThrowIfNotLoggedIn(); ThrowIfAPIKeyEmpty(); return new Taxonomy(this, uid); } - */ /// /// A publishing corresponds to one or more deployment servers or a content delivery destination where the entries need to be published. @@ -746,7 +746,6 @@ public Environment Environment(string? uid = null) return new Environment(this, uid); } - /* /// /// You can use to authenticate Content Delivery API (CDA) requests and retrieve the published content of an environment. /// @@ -759,7 +758,7 @@ public Environment Environment(string? uid = null) /// /// /// The - public DeliveryToken DeliveryToken(string uid = null) + public DeliveryToken DeliveryToken(string? uid = null) { ThrowIfNotLoggedIn(); ThrowIfAPIKeyEmpty(); @@ -779,14 +778,13 @@ public DeliveryToken DeliveryToken(string uid = null) /// /// /// The - public ManagementToken ManagementTokens(string uid = null) + public ManagementToken ManagementTokens(string? uid = null) { ThrowIfNotLoggedIn(); ThrowIfAPIKeyEmpty(); return new ManagementToken(this, uid); } - */ /// /// A collection of permissions that will be applicable to all the users who are assigned this role. @@ -845,15 +843,13 @@ public Release Release(string uid = null) /// /// /// The - /* - public Workflow Workflow(string uid = null) + public Workflow Workflow(string? uid = null) { ThrowIfNotLoggedIn(); ThrowIfAPIKeyEmpty(); return new Workflow(this, uid); } - */ /// /// A displays the historical and current details of activities such as publish, unpublish, or delete that can be performed on entries and/or assets. @@ -889,15 +885,13 @@ public PublishQueue PublishQueue(string uid = null) /// /// /// The - /* - public Webhook Webhook(string uid = null) + public Webhook Webhook(string? uid = null) { ThrowIfNotLoggedIn(); ThrowIfAPIKeyEmpty(); return new Webhook(this, uid); } - */ /// /// A displays a record of all the activities performed in a stack and helps you keep a track of all published items, updates, deletes, and current status of the existing content. diff --git a/Contentstack.Management.Core/Models/Taxonomy.cs b/Contentstack.Management.Core/Models/Taxonomy.cs index dbbaa01..3614312 100644 --- a/Contentstack.Management.Core/Models/Taxonomy.cs +++ b/Contentstack.Management.Core/Models/Taxonomy.cs @@ -10,7 +10,7 @@ namespace Contentstack.Management.Core.Models /// public class Taxonomy : BaseModel { - internal Taxonomy(Stack stack, string uid = null) + internal Taxonomy(Stack stack, string? uid = null) : base(stack, "taxonomy", uid) { resourcePath = uid == null ? "/taxonomies" : $"/taxonomies/{uid}"; @@ -33,7 +33,7 @@ public Query Query() /// /// Create a taxonomy. /// - public override ContentstackResponse Create(TaxonomyModel model, ParameterCollection collection = null) + public override ContentstackResponse Create(TaxonomyModel model, ParameterCollection? collection = null) { return base.Create(model, collection); } @@ -41,7 +41,7 @@ public override ContentstackResponse Create(TaxonomyModel model, ParameterCollec /// /// Create a taxonomy asynchronously. /// - public override Task CreateAsync(TaxonomyModel model, ParameterCollection collection = null) + public override Task CreateAsync(TaxonomyModel model, ParameterCollection? collection = null) { return base.CreateAsync(model, collection); } @@ -49,7 +49,7 @@ public override Task CreateAsync(TaxonomyModel model, Para /// /// Update an existing taxonomy. /// - public override ContentstackResponse Update(TaxonomyModel model, ParameterCollection collection = null) + public override ContentstackResponse Update(TaxonomyModel model, ParameterCollection? collection = null) { return base.Update(model, collection); } @@ -57,7 +57,7 @@ public override ContentstackResponse Update(TaxonomyModel model, ParameterCollec /// /// Update an existing taxonomy asynchronously. /// - public override Task UpdateAsync(TaxonomyModel model, ParameterCollection collection = null) + public override Task UpdateAsync(TaxonomyModel model, ParameterCollection? collection = null) { return base.UpdateAsync(model, collection); } @@ -65,7 +65,7 @@ public override Task UpdateAsync(TaxonomyModel model, Para /// /// Fetch a single taxonomy. /// - public override ContentstackResponse Fetch(ParameterCollection collection = null) + public override ContentstackResponse Fetch(ParameterCollection? collection = null) { return base.Fetch(collection); } @@ -73,7 +73,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null /// /// Fetch a single taxonomy asynchronously. /// - public override Task FetchAsync(ParameterCollection collection = null) + public override Task FetchAsync(ParameterCollection? collection = null) { return base.FetchAsync(collection); } @@ -81,7 +81,7 @@ public override Task FetchAsync(ParameterCollection collec /// /// Delete a taxonomy. /// - public override ContentstackResponse Delete(ParameterCollection collection = null) + public override ContentstackResponse Delete(ParameterCollection? collection = null) { return base.Delete(collection); } @@ -89,7 +89,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul /// /// Delete a taxonomy asynchronously. /// - public override Task DeleteAsync(ParameterCollection collection = null) + public override Task DeleteAsync(ParameterCollection? collection = null) { return base.DeleteAsync(collection); } @@ -97,90 +97,90 @@ public override Task DeleteAsync(ParameterCollection colle /// /// Export taxonomy. GET {resourcePath}/export with optional query parameters. /// - public ContentstackResponse Export(ParameterCollection collection = null) + public ContentstackResponse Export(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/export", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/export", "GET", collection); return stack.client.InvokeSync(service); } /// /// Export taxonomy asynchronously. /// - public Task ExportAsync(ParameterCollection collection = null) + public Task ExportAsync(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/export", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/export", "GET", collection); return stack.client.InvokeAsync(service); } /// /// Get taxonomy locales. GET {resourcePath}/locales. /// - public ContentstackResponse Locales(ParameterCollection collection = null) + public ContentstackResponse Locales(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/locales", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/locales", "GET", collection); return stack.client.InvokeSync(service); } /// /// Get taxonomy locales asynchronously. /// - public Task LocalesAsync(ParameterCollection collection = null) + public Task LocalesAsync(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/locales", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/locales", "GET", collection); return stack.client.InvokeAsync(service); } /// /// Localize taxonomy. POST to resourcePath with body { taxonomy: model } and query params (e.g. locale). /// - public ContentstackResponse Localize(TaxonomyModel model, ParameterCollection collection = null) + public ContentstackResponse Localize(TaxonomyModel model, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new CreateUpdateService(stack.client.serializer, stack, resourcePath, model, "taxonomy", "POST", collection); + var service = new CreateUpdateService(stack, resourcePath, model, "taxonomy", "POST", collection); return stack.client.InvokeSync(service); } /// /// Localize taxonomy asynchronously. /// - public Task LocalizeAsync(TaxonomyModel model, ParameterCollection collection = null) + public Task LocalizeAsync(TaxonomyModel model, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new CreateUpdateService(stack.client.serializer, stack, resourcePath, model, "taxonomy", "POST", collection); + var service = new CreateUpdateService(stack, resourcePath, model, "taxonomy", "POST", collection); return stack.client.InvokeAsync, ContentstackResponse>(service); } /// /// Import taxonomy. POST /taxonomies/import with multipart form (taxonomy file). /// - public ContentstackResponse Import(TaxonomyImportModel model, ParameterCollection collection = null) + public ContentstackResponse Import(TaxonomyImportModel model, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidNotEmpty(); var path = resourcePath + "/import"; - var service = new UploadService(stack.client.serializer, stack, path, model, "POST", collection); + var service = new UploadService(stack, path, model, "POST", collection); return stack.client.InvokeSync(service); } /// /// Import taxonomy asynchronously. /// - public Task ImportAsync(TaxonomyImportModel model, ParameterCollection collection = null) + public Task ImportAsync(TaxonomyImportModel model, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidNotEmpty(); var path = resourcePath + "/import"; - var service = new UploadService(stack.client.serializer, stack, path, model, "POST", collection); + var service = new UploadService(stack, path, model, "POST", collection); return stack.client.InvokeAsync(service); } @@ -194,7 +194,7 @@ public Task ImportAsync(TaxonomyImportModel model, Paramet /// stack.Taxonomy("taxonomy_uid").Terms("term_uid").Fetch(); /// /// - public Term Terms(string termUid = null) + public Term Terms(string? termUid = null) { ThrowIfUidEmpty(); return new Term(stack, Uid, termUid); diff --git a/Contentstack.Management.Core/Models/Term.cs b/Contentstack.Management.Core/Models/Term.cs index e48df74..4b00ecc 100644 --- a/Contentstack.Management.Core/Models/Term.cs +++ b/Contentstack.Management.Core/Models/Term.cs @@ -12,7 +12,7 @@ public class Term : BaseModel { private readonly string _taxonomyUid; - internal Term(Stack stack, string taxonomyUid, string termUid = null) + internal Term(Stack stack, string taxonomyUid, string? termUid = null) : base(stack, "term", termUid) { _taxonomyUid = taxonomyUid ?? throw new ArgumentNullException(nameof(taxonomyUid)); @@ -33,7 +33,7 @@ public Query Query() /// /// Create a term in this taxonomy. /// - public override ContentstackResponse Create(TermModel model, ParameterCollection collection = null) + public override ContentstackResponse Create(TermModel model, ParameterCollection? collection = null) { return base.Create(model, collection); } @@ -41,7 +41,7 @@ public override ContentstackResponse Create(TermModel model, ParameterCollection /// /// Create a term asynchronously. /// - public override Task CreateAsync(TermModel model, ParameterCollection collection = null) + public override Task CreateAsync(TermModel model, ParameterCollection? collection = null) { return base.CreateAsync(model, collection); } @@ -49,7 +49,7 @@ public override Task CreateAsync(TermModel model, Paramete /// /// Update an existing term. /// - public override ContentstackResponse Update(TermModel model, ParameterCollection collection = null) + public override ContentstackResponse Update(TermModel model, ParameterCollection? collection = null) { return base.Update(model, collection); } @@ -57,7 +57,7 @@ public override ContentstackResponse Update(TermModel model, ParameterCollection /// /// Update an existing term asynchronously. /// - public override Task UpdateAsync(TermModel model, ParameterCollection collection = null) + public override Task UpdateAsync(TermModel model, ParameterCollection? collection = null) { return base.UpdateAsync(model, collection); } @@ -65,7 +65,7 @@ public override Task UpdateAsync(TermModel model, Paramete /// /// Fetch a single term. /// - public override ContentstackResponse Fetch(ParameterCollection collection = null) + public override ContentstackResponse Fetch(ParameterCollection? collection = null) { return base.Fetch(collection); } @@ -73,7 +73,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null /// /// Fetch a single term asynchronously. /// - public override Task FetchAsync(ParameterCollection collection = null) + public override Task FetchAsync(ParameterCollection? collection = null) { return base.FetchAsync(collection); } @@ -81,7 +81,7 @@ public override Task FetchAsync(ParameterCollection collec /// /// Delete a term. /// - public override ContentstackResponse Delete(ParameterCollection collection = null) + public override ContentstackResponse Delete(ParameterCollection? collection = null) { return base.Delete(collection); } @@ -89,7 +89,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul /// /// Delete a term asynchronously. /// - public override Task DeleteAsync(ParameterCollection collection = null) + public override Task DeleteAsync(ParameterCollection? collection = null) { return base.DeleteAsync(collection); } @@ -97,110 +97,110 @@ public override Task DeleteAsync(ParameterCollection colle /// /// Get ancestor terms of this term. GET {resourcePath}/ancestors. /// - public ContentstackResponse Ancestors(ParameterCollection collection = null) + public ContentstackResponse Ancestors(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/ancestors", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/ancestors", "GET", collection); return stack.client.InvokeSync(service); } /// /// Get ancestor terms asynchronously. /// - public Task AncestorsAsync(ParameterCollection collection = null) + public Task AncestorsAsync(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/ancestors", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/ancestors", "GET", collection); return stack.client.InvokeAsync(service); } /// /// Get descendant terms of this term. GET {resourcePath}/descendants. /// - public ContentstackResponse Descendants(ParameterCollection collection = null) + public ContentstackResponse Descendants(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/descendants", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/descendants", "GET", collection); return stack.client.InvokeSync(service); } /// /// Get descendant terms asynchronously. /// - public Task DescendantsAsync(ParameterCollection collection = null) + public Task DescendantsAsync(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/descendants", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/descendants", "GET", collection); return stack.client.InvokeAsync(service); } /// /// Move term to a new parent and/or order. PUT {resourcePath}/move with body { term: moveModel }. /// - public ContentstackResponse Move(TermMoveModel moveModel, ParameterCollection collection = null) + public ContentstackResponse Move(TermMoveModel moveModel, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new CreateUpdateService(stack.client.serializer, stack, resourcePath + "/move", moveModel, "term", "PUT", collection); + var service = new CreateUpdateService(stack, resourcePath + "/move", moveModel, "term", "PUT", collection); return stack.client.InvokeSync(service); } /// /// Move term asynchronously. /// - public Task MoveAsync(TermMoveModel moveModel, ParameterCollection collection = null) + public Task MoveAsync(TermMoveModel moveModel, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new CreateUpdateService(stack.client.serializer, stack, resourcePath + "/move", moveModel, "term", "PUT", collection); + var service = new CreateUpdateService(stack, resourcePath + "/move", moveModel, "term", "PUT", collection); return stack.client.InvokeAsync, ContentstackResponse>(service); } /// /// Get term locales. GET {resourcePath}/locales. /// - public ContentstackResponse Locales(ParameterCollection collection = null) + public ContentstackResponse Locales(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/locales", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/locales", "GET", collection); return stack.client.InvokeSync(service); } /// /// Get term locales asynchronously. /// - public Task LocalesAsync(ParameterCollection collection = null) + public Task LocalesAsync(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, resourcePath + "/locales", "GET", collection); + var service = new FetchDeleteService(stack, resourcePath + "/locales", "GET", collection); return stack.client.InvokeAsync(service); } /// /// Localize term. POST to resourcePath with body { term: model } and query params (e.g. locale). /// - public ContentstackResponse Localize(TermModel model, ParameterCollection collection = null) + public ContentstackResponse Localize(TermModel model, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new CreateUpdateService(stack.client.serializer, stack, resourcePath, model, "term", "POST", collection); + var service = new CreateUpdateService(stack, resourcePath, model, "term", "POST", collection); return stack.client.InvokeSync(service); } /// /// Localize term asynchronously. /// - public Task LocalizeAsync(TermModel model, ParameterCollection collection = null) + public Task LocalizeAsync(TermModel model, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new CreateUpdateService(stack.client.serializer, stack, resourcePath, model, "term", "POST", collection); + var service = new CreateUpdateService(stack, resourcePath, model, "term", "POST", collection); return stack.client.InvokeAsync, ContentstackResponse>(service); } @@ -209,26 +209,26 @@ public Task LocalizeAsync(TermModel model, ParameterCollec /// /// Search string for typeahead. /// Optional additional query parameters. - public ContentstackResponse Search(string typeahead, ParameterCollection collection = null) + public ContentstackResponse Search(string typeahead, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidNotEmpty(); var coll = collection ?? new ParameterCollection(); coll.Add("typeahead", typeahead ?? string.Empty); - var service = new FetchDeleteService(stack.client.serializer, stack, "/taxonomies/$all/terms", "GET", coll); + var service = new FetchDeleteService(stack, "/taxonomies/$all/terms", "GET", coll); return stack.client.InvokeSync(service); } /// /// Search terms across all taxonomies asynchronously. /// - public Task SearchAsync(string typeahead, ParameterCollection collection = null) + public Task SearchAsync(string typeahead, ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidNotEmpty(); var coll = collection ?? new ParameterCollection(); coll.Add("typeahead", typeahead ?? string.Empty); - var service = new FetchDeleteService(stack.client.serializer, stack, "/taxonomies/$all/terms", "GET", coll); + var service = new FetchDeleteService(stack, "/taxonomies/$all/terms", "GET", coll); return stack.client.InvokeAsync(service); } } diff --git a/Contentstack.Management.Core/Models/Token/DeliveryToken.cs b/Contentstack.Management.Core/Models/Token/DeliveryToken.cs index 3840bb0..a7f7d4d 100644 --- a/Contentstack.Management.Core/Models/Token/DeliveryToken.cs +++ b/Contentstack.Management.Core/Models/Token/DeliveryToken.cs @@ -6,7 +6,7 @@ namespace Contentstack.Management.Core.Models.Token { public class DeliveryToken : BaseModel { - internal DeliveryToken(Stack stack, string uid = null) + internal DeliveryToken(Stack stack, string? uid = null) : base(stack, "token", uid) { resourcePath = uid == null ? "stacks/delivery_tokens" : $"stacks/delivery_tokens/{uid}"; @@ -40,7 +40,7 @@ public Query Query() /// /// DeliveryToken Model for creating DeliveryToken. /// The . - public override ContentstackResponse Create(DeliveryTokenModel model, ParameterCollection collection = null) + public override ContentstackResponse Create(DeliveryTokenModel model, ParameterCollection? collection = null) { return base.Create(model, collection); } @@ -57,7 +57,7 @@ public override ContentstackResponse Create(DeliveryTokenModel model, ParameterC /// /// DeliveryToken Model for creating DeliveryToken. /// The Task. - public override Task CreateAsync(DeliveryTokenModel model, ParameterCollection collection = null) + public override Task CreateAsync(DeliveryTokenModel model, ParameterCollection? collection = null) { return base.CreateAsync(model, collection); } @@ -74,7 +74,7 @@ public override Task CreateAsync(DeliveryTokenModel model, /// /// DeliveryToken Model for creating DeliveryToken. /// The . - public override ContentstackResponse Update(DeliveryTokenModel model, ParameterCollection collection = null) + public override ContentstackResponse Update(DeliveryTokenModel model, ParameterCollection? collection = null) { return base.Update(model, collection); } @@ -91,7 +91,7 @@ public override ContentstackResponse Update(DeliveryTokenModel model, ParameterC /// /// DeliveryToken Model for creating DeliveryToken. /// The Task. - public override Task UpdateAsync(DeliveryTokenModel model, ParameterCollection collection = null) + public override Task UpdateAsync(DeliveryTokenModel model, ParameterCollection? collection = null) { return base.UpdateAsync(model, collection); } @@ -106,7 +106,7 @@ public override Task UpdateAsync(DeliveryTokenModel model, /// /// /// The . - public override ContentstackResponse Fetch(ParameterCollection collection = null) + public override ContentstackResponse Fetch(ParameterCollection? collection = null) { return base.Fetch(collection); } @@ -121,7 +121,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null /// /// /// The Task. - public override Task FetchAsync(ParameterCollection collection = null) + public override Task FetchAsync(ParameterCollection? collection = null) { return base.FetchAsync(collection); } @@ -136,7 +136,7 @@ public override Task FetchAsync(ParameterCollection collec /// /// /// The . - public override ContentstackResponse Delete(ParameterCollection collection = null) + public override ContentstackResponse Delete(ParameterCollection? collection = null) { return base.Delete(collection); } @@ -151,7 +151,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul /// /// /// The Task. - public override Task DeleteAsync(ParameterCollection collection = null) + public override Task DeleteAsync(ParameterCollection? collection = null) { return base.DeleteAsync(collection); } diff --git a/Contentstack.Management.Core/Models/Token/ManagementToken.cs b/Contentstack.Management.Core/Models/Token/ManagementToken.cs index f05a9b6..83f51b9 100644 --- a/Contentstack.Management.Core/Models/Token/ManagementToken.cs +++ b/Contentstack.Management.Core/Models/Token/ManagementToken.cs @@ -5,7 +5,7 @@ namespace Contentstack.Management.Core.Models.Token { public class ManagementToken : BaseModel { - internal ManagementToken(Stack stack, string uid = null) + internal ManagementToken(Stack stack, string? uid = null) : base(stack, "token", uid) { resourcePath = uid == null ? "/delivery_tokens" : $"/delivery_tokens/{uid}"; @@ -40,7 +40,7 @@ public Query Query() /// /// ManagementToken Model for creating ManagementToken. /// The . - public override ContentstackResponse Create(ManagementTokenModel model, ParameterCollection collection = null) + public override ContentstackResponse Create(ManagementTokenModel model, ParameterCollection? collection = null) { return base.Create(model, collection); } @@ -58,7 +58,7 @@ public override ContentstackResponse Create(ManagementTokenModel model, Paramete /// /// ManagementToken Model for creating ManagementToken. /// The Task. - public override Task CreateAsync(ManagementTokenModel model, ParameterCollection collection = null) + public override Task CreateAsync(ManagementTokenModel model, ParameterCollection? collection = null) { return base.CreateAsync(model, collection); } @@ -78,7 +78,7 @@ public override Task CreateAsync(ManagementTokenModel mode /// /// ManagementToken Model for creating ManagementToken. /// The . - public override ContentstackResponse Update(ManagementTokenModel model, ParameterCollection collection = null) + public override ContentstackResponse Update(ManagementTokenModel model, ParameterCollection? collection = null) { return base.Update(model, collection); } @@ -98,7 +98,7 @@ public override ContentstackResponse Update(ManagementTokenModel model, Paramete /// /// ManagementToken Model for creating ManagementToken. /// The Task. - public override Task UpdateAsync(ManagementTokenModel model, ParameterCollection collection = null) + public override Task UpdateAsync(ManagementTokenModel model, ParameterCollection? collection = null) { return base.UpdateAsync(model, collection); } @@ -113,7 +113,7 @@ public override Task UpdateAsync(ManagementTokenModel mode /// /// /// The . - public override ContentstackResponse Fetch(ParameterCollection collection = null) + public override ContentstackResponse Fetch(ParameterCollection? collection = null) { return base.Fetch(collection); } @@ -128,7 +128,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null /// /// /// The Task. - public override Task FetchAsync(ParameterCollection collection = null) + public override Task FetchAsync(ParameterCollection? collection = null) { return base.FetchAsync(collection); } @@ -143,7 +143,7 @@ public override Task FetchAsync(ParameterCollection collec /// /// /// The . - public override ContentstackResponse Delete(ParameterCollection collection = null) + public override ContentstackResponse Delete(ParameterCollection? collection = null) { return base.Delete(collection); } @@ -158,7 +158,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul /// /// /// The Task. - public override Task DeleteAsync(ParameterCollection collection = null) + public override Task DeleteAsync(ParameterCollection? collection = null) { return base.DeleteAsync(collection); } diff --git a/Contentstack.Management.Core/Models/Webhook.cs b/Contentstack.Management.Core/Models/Webhook.cs index 6c579ae..ba19425 100644 --- a/Contentstack.Management.Core/Models/Webhook.cs +++ b/Contentstack.Management.Core/Models/Webhook.cs @@ -6,7 +6,7 @@ namespace Contentstack.Management.Core.Models { public class Webhook : BaseModel { - internal Webhook(Stack stack, string uid = null) + internal Webhook(Stack stack, string? uid = null) : base(stack, "webhook", uid) { resourcePath = uid == null ? "/webhooks" : $"/webhooks/{uid}"; @@ -40,7 +40,7 @@ public Query Query() /// /// Webhook Model for creating Webhook. /// The . - public override ContentstackResponse Create(WebhookModel model, ParameterCollection collection = null) + public override ContentstackResponse Create(WebhookModel model, ParameterCollection? collection = null) { return base.Create(model, collection); } @@ -57,7 +57,7 @@ public override ContentstackResponse Create(WebhookModel model, ParameterCollect /// /// Webhook Model for creating Webhook. /// The Task. - public override Task CreateAsync(WebhookModel model, ParameterCollection collection = null) + public override Task CreateAsync(WebhookModel model, ParameterCollection? collection = null) { return base.CreateAsync(model, collection); } @@ -74,7 +74,7 @@ public override Task CreateAsync(WebhookModel model, Param /// /// Webhook Model for creating Webhook. /// The . - public override ContentstackResponse Update(WebhookModel model, ParameterCollection collection = null) + public override ContentstackResponse Update(WebhookModel model, ParameterCollection? collection = null) { return base.Update(model, collection); } @@ -91,7 +91,7 @@ public override ContentstackResponse Update(WebhookModel model, ParameterCollect /// /// Webhook Model for creating Webhook. /// The Task. - public override Task UpdateAsync(WebhookModel model, ParameterCollection collection = null) + public override Task UpdateAsync(WebhookModel model, ParameterCollection? collection = null) { return base.UpdateAsync(model, collection); } @@ -106,7 +106,7 @@ public override Task UpdateAsync(WebhookModel model, Param /// /// /// The . - public override ContentstackResponse Fetch(ParameterCollection collection = null) + public override ContentstackResponse Fetch(ParameterCollection? collection = null) { return base.Fetch(collection); } @@ -121,7 +121,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null /// /// /// The Task. - public override Task FetchAsync(ParameterCollection collection = null) + public override Task FetchAsync(ParameterCollection? collection = null) { return base.FetchAsync(collection); } @@ -136,7 +136,7 @@ public override Task FetchAsync(ParameterCollection collec /// /// /// The . - public override ContentstackResponse Delete(ParameterCollection collection = null) + public override ContentstackResponse Delete(ParameterCollection? collection = null) { return base.Delete(collection); } @@ -151,7 +151,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul /// /// /// The Task. - public override Task DeleteAsync(ParameterCollection collection = null) + public override Task DeleteAsync(ParameterCollection? collection = null) { return base.DeleteAsync(collection); } @@ -166,12 +166,12 @@ public override Task DeleteAsync(ParameterCollection colle /// /// /// The . - public ContentstackResponse Executions(ParameterCollection collection = null) + public ContentstackResponse Executions(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, $"{resourcePath}/executions", collection: collection); + var service = new FetchDeleteService(stack, $"{resourcePath}/executions", collection: collection); return stack.client.InvokeSync(service); } @@ -185,12 +185,12 @@ public ContentstackResponse Executions(ParameterCollection collection = null) /// /// /// The Task. - public Task ExecutionsAsync(ParameterCollection collection = null) + public Task ExecutionsAsync(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, $"{resourcePath}/executions", collection: collection); + var service = new FetchDeleteService(stack, $"{resourcePath}/executions", collection: collection); return stack.client.InvokeAsync(service); } @@ -211,7 +211,7 @@ public ContentstackResponse Retry(string executionUid) stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, $"/webhooks/{executionUid}/retry", httpMethod: "POST"); + var service = new FetchDeleteService(stack, $"/webhooks/{executionUid}/retry", httpMethod: "POST"); return stack.client.InvokeSync(service); } @@ -231,7 +231,7 @@ public Task RetryAsync(string executionUid) stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, $"/webhooks/{executionUid}/retry", httpMethod: "POST"); + var service = new FetchDeleteService(stack, $"/webhooks/{executionUid}/retry", httpMethod: "POST"); return stack.client.InvokeAsync(service); } @@ -252,7 +252,7 @@ public ContentstackResponse Logs(string executionUid) stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, $"/webhooks/{executionUid}/logs"); + var service = new FetchDeleteService(stack, $"/webhooks/{executionUid}/logs"); return stack.client.InvokeSync(service); } @@ -272,7 +272,7 @@ public Task LogsAsync(string executionUid) stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack, $"/webhooks/{executionUid}/logs"); + var service = new FetchDeleteService(stack, $"/webhooks/{executionUid}/logs"); return stack.client.InvokeAsync(service); } diff --git a/Contentstack.Management.Core/Models/Workflow.cs b/Contentstack.Management.Core/Models/Workflow.cs index 14a32d2..4f18302 100644 --- a/Contentstack.Management.Core/Models/Workflow.cs +++ b/Contentstack.Management.Core/Models/Workflow.cs @@ -8,7 +8,7 @@ namespace Contentstack.Management.Core.Models { public class Workflow: BaseModel { - internal Workflow(Stack stack, string uid) + internal Workflow(Stack stack, string? uid) : base(stack, "workflow", uid) { resourcePath = uid == null ? "/workflows" : $"/workflows/{uid}"; @@ -25,12 +25,12 @@ internal Workflow(Stack stack, string uid) /// /// /// The . - public virtual ContentstackResponse FindAll(ParameterCollection collection = null) + public virtual ContentstackResponse FindAll(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidNotEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack,resourcePath, collection: collection); + var service = new FetchDeleteService(stack,resourcePath, collection: collection); return stack.client.InvokeSync(service); } @@ -45,12 +45,12 @@ public virtual ContentstackResponse FindAll(ParameterCollection collection = nul /// /// /// The . - public virtual Task FindAllAsync(ParameterCollection collection = null) + public virtual Task FindAllAsync(ParameterCollection? collection = null) { stack.ThrowIfNotLoggedIn(); ThrowIfUidNotEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack,resourcePath, collection: collection); + var service = new FetchDeleteService(stack,resourcePath, collection: collection); return stack.client.InvokeAsync(service); } @@ -66,7 +66,7 @@ public virtual Task FindAllAsync(ParameterCollection colle /// /// Workflow Model for creating workflow. /// - public override ContentstackResponse Create(WorkflowModel model, ParameterCollection collection = null) + public override ContentstackResponse Create(WorkflowModel model, ParameterCollection? collection = null) { return base.Create(model, collection); } @@ -83,7 +83,7 @@ public override ContentstackResponse Create(WorkflowModel model, ParameterCollec /// /// Workflow Model for creating workflow. /// - public override Task CreateAsync(WorkflowModel model, ParameterCollection collection = null) + public override Task CreateAsync(WorkflowModel model, ParameterCollection? collection = null) { return base.CreateAsync(model, collection); } @@ -100,7 +100,7 @@ public override Task CreateAsync(WorkflowModel model, Para /// /// Workflow Model for updating Content Type. /// - public override ContentstackResponse Update(WorkflowModel model, ParameterCollection collection = null) + public override ContentstackResponse Update(WorkflowModel model, ParameterCollection? collection = null) { return base.Update(model, collection); } @@ -117,7 +117,7 @@ public override ContentstackResponse Update(WorkflowModel model, ParameterCollec /// /// Workflow Model for updating Content Type. /// - public override Task UpdateAsync(WorkflowModel model, ParameterCollection collection = null) + public override Task UpdateAsync(WorkflowModel model, ParameterCollection? collection = null) { return base.UpdateAsync(model, collection); } @@ -132,7 +132,7 @@ public override Task UpdateAsync(WorkflowModel model, Para /// /// /// The . - public override ContentstackResponse Fetch(ParameterCollection collection = null) + public override ContentstackResponse Fetch(ParameterCollection? collection = null) { return base.Fetch(collection); } @@ -147,7 +147,7 @@ public override ContentstackResponse Fetch(ParameterCollection collection = null /// /// /// The Task. - public override Task FetchAsync(ParameterCollection collection = null) + public override Task FetchAsync(ParameterCollection? collection = null) { return base.FetchAsync(collection); } @@ -162,7 +162,7 @@ public override Task FetchAsync(ParameterCollection collec /// /// /// The . - public override ContentstackResponse Delete(ParameterCollection collection = null) + public override ContentstackResponse Delete(ParameterCollection? collection = null) { return base.Delete(collection); } @@ -177,7 +177,7 @@ public override ContentstackResponse Delete(ParameterCollection collection = nul /// /// /// The Task. - public override Task DeleteAsync(ParameterCollection collection = null) + public override Task DeleteAsync(ParameterCollection? collection = null) { return base.DeleteAsync(collection); } @@ -197,7 +197,7 @@ public virtual ContentstackResponse Disable() stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack,$"{resourcePath}/disable"); + var service = new FetchDeleteService(stack,$"{resourcePath}/disable"); return stack.client.InvokeSync(service); } @@ -216,7 +216,7 @@ public virtual Task DisableAsync() stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack,$"{resourcePath}/disable"); + var service = new FetchDeleteService(stack,$"{resourcePath}/disable"); return stack.client.InvokeAsync(service); } @@ -235,7 +235,7 @@ public virtual ContentstackResponse Enable() stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack,$"{resourcePath}/enable"); + var service = new FetchDeleteService(stack,$"{resourcePath}/enable"); return stack.client.InvokeSync(service); } @@ -254,7 +254,7 @@ public virtual Task EnableAsync() stack.ThrowIfNotLoggedIn(); ThrowIfUidEmpty(); - var service = new FetchDeleteService(stack.client.serializer, stack,$"{resourcePath}/enable"); + var service = new FetchDeleteService(stack,$"{resourcePath}/enable"); return stack.client.InvokeAsync(service); } @@ -269,7 +269,7 @@ public virtual Task EnableAsync() /// /// Optional Publish rule uid for performing rule specific operation /// - public PublishRule PublishRule(string uid = null) + public PublishRule PublishRule(string? uid = null) { return new PublishRule(stack, uid); } @@ -292,7 +292,7 @@ public virtual ContentstackResponse GetPublishRule(string contentType, Parameter throw new ArgumentNullException("contentType", CSConstants.ContentTypeRequired); } - var service = new FetchDeleteService(stack.client.serializer, stack,$"/workflows/content_type/{contentType}", collection: collection); + var service = new FetchDeleteService(stack,$"/workflows/content_type/{contentType}", collection: collection); return stack.client.InvokeSync(service); } @@ -313,7 +313,7 @@ public virtual Task GetPublishRuleAsync(string contentType { throw new ArgumentNullException("contentType", CSConstants.ContentTypeRequired); } - var service = new FetchDeleteService(stack.client.serializer, stack,$"/workflows/content_type/{contentType}", collection: collection); + var service = new FetchDeleteService(stack,$"/workflows/content_type/{contentType}", collection: collection); return stack.client.InvokeAsync(service); } } diff --git a/Contentstack.Management.Core/contentstack.management.core.csproj b/Contentstack.Management.Core/contentstack.management.core.csproj index 9959fa9..2f881bc 100644 --- a/Contentstack.Management.Core/contentstack.management.core.csproj +++ b/Contentstack.Management.Core/contentstack.management.core.csproj @@ -88,17 +88,17 @@ - + - - + + - - + + @@ -110,7 +110,7 @@ - +