-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
František Záhora
authored and
František Záhora
committed
Nov 25, 2024
1 parent
5fe5eb1
commit ae3078e
Showing
5 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// DocSection: cm_api_v2_delete_custom_app | ||
// Tip: Find more about .NET SDKs at https://kontent.ai/learn/net | ||
using Kontent.Ai.Management; | ||
|
||
var client = new ManagementClient(new ManagementOptions | ||
{ | ||
ApiKey = "<YOUR_API_KEY>", | ||
ProjectId = "<YOUR_PROJECT_ID>" | ||
}); | ||
|
||
var identifier = Reference.ById(Guid.Parse("f4b3fc05-e988-4dae-9ac1-a94aba566474"); | ||
//var identifier = Reference.ByCodename("my_custom_app"); | ||
|
||
var response = await client.DeleteCustomAppAsync(identifier); | ||
// EndDocSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// DocSection: cm_api_v2_get_custom_app | ||
// Tip: Find more about .NET SDKs at https://kontent.ai/learn/net | ||
using Kontent.Ai.Management; | ||
|
||
var client = new ManagementClient(new ManagementOptions | ||
{ | ||
ApiKey = "<YOUR_API_KEY>", | ||
ProjectId = "<YOUR_PROJECT_ID>" | ||
}); | ||
|
||
var identifier = Reference.ById(Guid.Parse("f4b3fc05-e988-4dae-9ac1-a94aba566474"); | ||
//var identifier = Reference.ByCodename("my_custom_app"); | ||
|
||
var response = await client.GetCustomAppAsync(identifier); | ||
// EndDocSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// DocSection: cm_api_v2_get_custom_apps | ||
// Tip: Find more about .NET SDKs at https://kontent.ai/learn/net | ||
using Kontent.Ai.Management; | ||
|
||
var client = new ManagementClient(new ManagementOptions | ||
{ | ||
ApiKey = "<YOUR_API_KEY>", | ||
ProjectId = "<YOUR_PROJECT_ID>" | ||
}); | ||
|
||
var response = await client.ListCustomAppsAsync(); | ||
// EndDocSection |
61 changes: 61 additions & 0 deletions
61
net/management-api-v2/cm_api_v2_patch_modify_custom_app.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// DocSection: cm_api_v2_patch_modify_custom_app | ||
// Tip: Find more about .NET SDKs at https://kontent.ai/learn/net | ||
using Kontent.Ai.Management; | ||
|
||
var client = new ManagementClient(new ManagementOptions | ||
{ | ||
ApiKey = "<YOUR_API_KEY>", | ||
ProjectId = "<YOUR_PROJECT_ID>" | ||
}); | ||
|
||
var changes = new CustomAppOperationBaseModel[] | ||
{ | ||
new CustomAppAddIntoPatchModel() | ||
{ | ||
PropertyName = PropertyName.AllowedRoles, | ||
Value = new[] | ||
{ | ||
Reference.ByCodename("new_allowed_role_codename_to_be_add_into") | ||
} | ||
}, | ||
new CustomAppRemovePatchModel() | ||
{ | ||
PropertyName = PropertyName.AllowedRoles, | ||
Value = new[] | ||
{ | ||
Reference.ByCodename("allowed_role_codename_to_be_removed") | ||
} | ||
}, | ||
new CustomAppReplacePatchModel() | ||
{ | ||
PropertyName = PropertyName.Name, | ||
Value = "New Custom App Name" | ||
}, | ||
new CustomAppReplacePatchModel() | ||
{ | ||
PropertyName = PropertyName.Codename, | ||
Value = "new_custom_app_codename" | ||
}, | ||
new CustomAppReplacePatchModel() | ||
{ | ||
PropertyName = PropertyName.SourceUrl, | ||
Value = "https://newcustomapplication.net" | ||
}, | ||
new CustomAppReplacePatchModel() | ||
{ | ||
PropertyName = PropertyName.Config, | ||
Value = "{ .. }" | ||
}, | ||
new CustomAppReplacePatchModel() | ||
{ | ||
PropertyName = PropertyName.AllowedRoles, | ||
Value = new[] | ||
{ | ||
Reference.ByCodename("allowed_role_codename"), | ||
Reference.ById(new Guid("f8f0b5cb-f5b7-42e8-af85-fbdab3ddfacf")) | ||
} | ||
} | ||
}; | ||
|
||
var response = await client.ModifyCustomAppAsync(customAppCreateModel); | ||
// EndDocSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// DocSection: cm_api_v2_post_create_sutom_app | ||
// Tip: Find more about .NET SDKs at https://kontent.ai/learn/net | ||
using Kontent.Ai.Management; | ||
|
||
var client = new ManagementClient(new ManagementOptions | ||
{ | ||
ApiKey = "<YOUR_API_KEY>", | ||
ProjectId = "<YOUR_PROJECT_ID>" | ||
}); | ||
|
||
var customAppCreateModel = new CustomAppCreateModel | ||
{ | ||
Name = "Custom App Name", | ||
Codename = "custom_app_codename", | ||
SourceUrl = "https://customapp.net", | ||
Config = "{ .. }", | ||
AllowedRoles = = [ | ||
Reference.ById(Guid.Parse("7740a768-bfa5-4f64-bab4-d77cc0791d4c")), | ||
Reference.ById(Guid.Parse("7a51d721-7302-4a85-b4ce-a6a3f3cce4a6")) | ||
] | ||
}; | ||
|
||
var response = await client.GetCustomAppAsync(customAppCreateModel); | ||
// EndDocSection |