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..7168724 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:"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. @@ -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 {