Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions providers/hubspot/internal/core/objects.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package core

import "github.com/amp-labs/connectors/internal/datautils"
import (
"github.com/amp-labs/connectors/common"
"github.com/amp-labs/connectors/internal/datautils"
)

const (
// DefaultPageSize is the default page size for paginated requests.
Expand Down Expand Up @@ -28,7 +31,33 @@ var (
// MarketingObjects contains object names that belong to the HubSpot Marketing API.
//
// The Marketing API is separate from the CRM API and is not related to the Objects API.
MarketingObjects = datautils.NewSet(
"campaigns",
)
MarketingObjects = datautils.Map[string, ObjectDescription]{
"campaigns": {
Path: "campaigns",
RecordTransformer: common.FlattenNestedFields("properties"),
},
// "marketing/emails" refers to HubSpot marketing emails, which are distinct
// from the CRM email activity resource.
//
// The object name preserves the marketing-prefixed endpoint form to avoid a
// naming collision with CRM emails.
//
Comment thread
Cobalt0s marked this conversation as resolved.
// Path is relative to the Marketing API base path.
//
// Marketing emails:
// https://developers.hubspot.com/docs/api-reference/latest/marketing/marketing-emails/get-emails
// CRM emails:
// https://developers.hubspot.com/docs/api-reference/latest/crm/activities/emails/guide
"marketing/emails": {
Path: "emails",
RecordTransformer: nil, // None. Fields and Raw are the same.
},
}
)

type ObjectDescription struct {
// Path is URL path segment.
Path string
// RecordTransformer describes how to convert raw response and then extract selected fields by read operation.
RecordTransformer common.RecordTransformer
}
Loading
Loading