From 498781068cbc7c609a2c8c8cf5e4777b199a4eee Mon Sep 17 00:00:00 2001 From: Preety Papneja Date: Wed, 13 Sep 2023 12:33:48 +0530 Subject: [PATCH 1/2] feat: Consent feature --- .idea/analytics-go.iml | 8 ++++++++ .idea/modules.xml | 8 ++++++++ context.go | 10 ++++++++++ 3 files changed, 26 insertions(+) create mode 100644 .idea/analytics-go.iml create mode 100644 .idea/modules.xml diff --git a/.idea/analytics-go.iml b/.idea/analytics-go.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/analytics-go.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..3a72248 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/context.go b/context.go index 99968e9..2f48d28 100644 --- a/context.go +++ b/context.go @@ -25,6 +25,7 @@ type Context struct { Timezone string `json:"timezone,omitempty"` UserAgent string `json:"userAgent,omitempty"` Traits Traits `json:"traits,omitempty"` + Consent Consent `json:"traits,omitempty"` // This map is used to allow extensions to the context specifications that // may not be documented or could be introduced in the future. @@ -42,6 +43,15 @@ type AppInfo struct { Namespace string `json:"namespace,omitempty"` } +// This type provides the representation of the `context.consent` object as defined +// in https://segment.com/docs/spec/common/#context +type Consent struct { + CategoryPreferences CategoryPreferences `json:"categoryPreferences,omitempty"` +} + +// The specifications can be found at https://segment.com/docs/spec/identify/#traits +type CategoryPreferences map[string]bool + // This type provides the representation of the `context.campaign` object as // defined in https://segment.com/docs/spec/common/#context type CampaignInfo struct { From 2eca1608bf9489720e96fe53214d1e57b9916e31 Mon Sep 17 00:00:00 2001 From: Preety Papneja Date: Wed, 13 Sep 2023 12:44:37 +0530 Subject: [PATCH 2/2] feat: Consent filter --- context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/context.go b/context.go index 2f48d28..7168724 100644 --- a/context.go +++ b/context.go @@ -25,7 +25,7 @@ type Context struct { Timezone string `json:"timezone,omitempty"` UserAgent string `json:"userAgent,omitempty"` Traits Traits `json:"traits,omitempty"` - Consent Consent `json:"traits,omitempty"` + Consent Consent `json:"consent,omitempty"` // This map is used to allow extensions to the context specifications that // may not be documented or could be introduced in the future.