Skip to content

Commit

Permalink
Added examples
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianMoyles committed Jul 18, 2024
1 parent b27d33c commit 073f979
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 16 deletions.
6 changes: 6 additions & 0 deletions docs/data-sources/conversations_messaging_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ description: |-

Genesys Cloud conversations messaging settings data source. Select an conversations messaging settings by name

## Example Usage

```terraform
data "genesyscloud_conversations_messaging_settings" "example-messaging-settings" {
name = "settings name"
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
34 changes: 31 additions & 3 deletions docs/resources/conversations_messaging_settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,37 @@ Genesys Cloud conversations messaging settings
## API Usage
The following Genesys Cloud APIs are used by this resource. Ensure your OAuth Client has been granted the necessary scopes and permissions to perform these operations:

**No APIs**


* [GET /api/v2/conversations/messaging/settings](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations-messaging-settings)
* [POST /api/v2/conversations/messaging/settings](https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-conversations-messaging-settings)
* [GET /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations-messaging-settings--messageSettingId-)
* [PATCH /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#patch-api-v2-conversations-messaging-settings--messageSettingId-)
* [DELETE /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#delete-api-v2-conversations-messaging-settings--messageSettingId-)

## Example Usage

```terraform
resource "genesyscloud_conversations_messaging_settings" "example-messaging-settings" {
name = "Sample Messaging Settings"
content {
story {
mention {
inbound = "Enabled"
}
reply {
inbound = "Enabled"
}
}
}
event {
typing {
on {
inbound = "Enabled"
outbound = "Enabled"
}
}
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
data "genesyscloud_conversations_messaging_settings" "example-messaging-settings" {
name = "settings name"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* [GET /api/v2/conversations/messaging/settings](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations-messaging-settings)
* [POST /api/v2/conversations/messaging/settings](https://developer.genesys.cloud/devapps/api-explorer#post-api-v2-conversations-messaging-settings)
* [GET /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#get-api-v2-conversations-messaging-settings--messageSettingId-)
* [PATCH /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#patch-api-v2-conversations-messaging-settings--messageSettingId-)
* [DELETE /api/v2/conversations/messaging/settings/{messageSettingId}](https://developer.genesys.cloud/devapps/api-explorer#delete-api-v2-conversations-messaging-settings--messageSettingId-)
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
resource "genesyscloud_conversations_messaging_settings" "example-messaging-settings" {
name = "Sample Messaging Settings"
content {
story {
mention {
inbound = "Enabled"
}
reply {
inbound = "Enabled"
}
}
}
event {
typing {
on {
inbound = "Enabled"
outbound = "Enabled"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/mypurecloud/platform-client-sdk-go/v133/platformclientv2"
)

func getAllAuthConversationsMessagingSettingss(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
func getAllAuthConversationsMessagingSettings(ctx context.Context, clientConfig *platformclientv2.Configuration) (resourceExporter.ResourceIDMetaMap, diag.Diagnostics) {
proxy := getConversationsMessagingSettingsProxy(clientConfig)
resources := make(resourceExporter.ResourceIDMetaMap)

Expand All @@ -28,7 +28,6 @@ func getAllAuthConversationsMessagingSettingss(ctx context.Context, clientConfig
}

for _, messagingSetting := range *messagingSettings {
log.Printf("Dealing with messaging setting id : %s", *messagingSetting.Id)
resources[*messagingSetting.Id] = &resourceExporter.ResourceMeta{Name: *messagingSetting.Name}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,20 @@ func ResourceConversationsMessagingSettings() *schema.Resource {
Type: schema.TypeString,
},
"content": {
Description: "Settings relating to message contents",
Optional: true,
Type: schema.TypeList,
MaxItems: 1,
Elem: contentSettingResource,
Description: "Settings relating to message contents",
Optional: true,
Type: schema.TypeList,
MaxItems: 1,
Elem: contentSettingResource,
AtLeastOneOf: []string{"content", "event"},
},
"event": {
Description: "Settings relating to events which may occur",
Optional: true,
Type: schema.TypeList,
MaxItems: 1,
Elem: eventSettingResource,
Description: "Settings relating to events which may occur",
Optional: true,
Type: schema.TypeList,
MaxItems: 1,
Elem: eventSettingResource,
AtLeastOneOf: []string{"content", "event"},
},
},
}
Expand All @@ -156,6 +158,6 @@ func DataSourceConversationsMessagingSettings() *schema.Resource {
// ConversationsMessagingSettingsExporter returns the resourceExporter object used to hold the genesyscloud_conversations_messaging_settings exporter's config
func ConversationsMessagingSettingsExporter() *resourceExporter.ResourceExporter {
return &resourceExporter.ResourceExporter{
GetResourcesFunc: provider.GetAllWithPooledClient(getAllAuthConversationsMessagingSettingss),
GetResourcesFunc: provider.GetAllWithPooledClient(getAllAuthConversationsMessagingSettings),
}
}

0 comments on commit 073f979

Please sign in to comment.