Repository: amp-labs/connectors
Pull request #104 (2024-03-18 15:04:29)

[ENG-849] feat: Add Zoom connector
## Catalog variables
Zoom       Provider = "zoom"

## Notes
Supports pagination and no batching support

## Testing 
### GET 
URL: http://localhost:4444/v2/meetings/87526499441
![GET](https://github.com/amp-labs/connectors/assets/163011126/d172e8c3-b1cf-4abf-a3aa-de4ad9945e0a)



### POST
URL: http://localhost:4444/v2/users/me/meetings
![POST](https://github.com/amp-labs/connectors/assets/163011126/3289b6e5-f5ab-496a-b50a-3fd4122a702e)



### PATCH
URL: http://localhost:4444/v2/meetings/87526499441
![PATCH](https://github.com/amp-labs/connectors/assets/163011126/23eeb5b0-b154-4fb3-a0de-6d2f479abade)



### DELETE
URL: http://localhost:4444/v2/meetings/87526499441
![DELETE](https://github.com/amp-labs/connectors/assets/163011126/4abdd317-0021-4d90-92e9-434ea3e2d670)




Patch:
diff --git a/basic/string.go b/basic/string.go
index 6d102344..e38aad4e 100644
--- a/basic/string.go
+++ b/basic/string.go
@@ -1,9 +1,5 @@
 package basic
 
-import (
-	"fmt"
-)
-
 func (c *Connector) String() string {
-	return fmt.Sprintf("%s.Connector", c.Provider())
+	return c.Provider() + ".Connector"
 }
diff --git a/common/oauth.go b/common/oauth.go
index 18217df3..52561205 100644
--- a/common/oauth.go
+++ b/common/oauth.go
@@ -26,8 +26,8 @@ func NewOAuthHTTPClient(ctx context.Context, opts ...OAuthOption) (Authenticated
 	}
 
 	var err error
-	params, err = params.prepare()
 
+	params, err = params.prepare()
 	if err != nil {
 		return nil, err
 	}
diff --git a/go.mod b/go.mod
index 51344f73..98da7900 100644
--- a/go.mod
+++ b/go.mod
@@ -6,7 +6,7 @@ require (
 	github.com/brianvoe/gofakeit/v6 v6.28.0
 	github.com/go-playground/validator v9.31.0+incompatible
 	github.com/joho/godotenv v1.5.1
-	github.com/spyzhov/ajson v0.9.0
+	github.com/spyzhov/ajson v0.9.1
 	github.com/stretchr/testify v1.9.0
 	github.com/subchen/go-xmldom v1.1.2
 	golang.org/x/oauth2 v0.18.0
diff --git a/go.sum b/go.sum
index fa6a8675..7f0999b8 100644
--- a/go.sum
+++ b/go.sum
@@ -23,8 +23,8 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
 github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/spyzhov/ajson v0.9.0 h1:tF46gJGOenYVj+k9K1U1XpCxVWhmiyY5PsVCAs1+OJ0=
-github.com/spyzhov/ajson v0.9.0/go.mod h1:a6oSw0MMb7Z5aD2tPoPO+jq11ETKgXUr2XktHdT8Wt8=
+github.com/spyzhov/ajson v0.9.1 h1:izsDkOC9yznlpA2BxJcrkr8Q5Gyjf43yeSc2Wz0g/aU=
+github.com/spyzhov/ajson v0.9.1/go.mod h1:a6oSw0MMb7Z5aD2tPoPO+jq11ETKgXUr2XktHdT8Wt8=
 github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
 github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
 github.com/subchen/go-xmldom v1.1.2 h1:7evI2YqfYYOnuj+PBwyaOZZYjl3iWq35P6KfBUw9jeU=
diff --git a/providers/catalog.go b/providers/catalog.go
index 866ed756..a3b16689 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -10,6 +10,7 @@ const (
 	LinkedIn   Provider = "linkedIn"
 	Salesloft  Provider = "salesloft"
 	Outreach   Provider = "outreach"
+	Pipedrive  Provider = "pipedrive"
 	Sellsy     Provider = "sellsy"
 	Attio      Provider = "attio"
 	Close      Provider = "close"
@@ -18,6 +19,7 @@ const (
 	Dropbox    Provider = "dropbox"
 	Notion     Provider = "notion"
 	Gong       Provider = "gong"
+	Zoom       Provider = "zoom"
 )
 
 // ================================================================================
@@ -132,6 +134,25 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		},
 	},
 
+	// Pipedrive configuration
+	Pipedrive: {
+		AuthType: Oauth2,
+		BaseURL:  "https://api.pipedrive.com",
+		OauthOpts: OauthOpts{
+			AuthURL:                   "https://oauth.pipedrive.com/oauth/authorize",
+			TokenURL:                  "https://oauth.pipedrive.com/oauth/token",
+			ExplicitScopesRequired:    true,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: false,
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
+
 	// Sellsy configuration
 	Sellsy: {
 		AuthType: Oauth2,
@@ -287,4 +308,23 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			Write:     false,
 		},
 	},
+
+	// Zoom configuration
+	Zoom: {
+		AuthType: Oauth2,
+		BaseURL:  "https://api.zoom.us",
+		OauthOpts: OauthOpts{
+			AuthURL:                   "https://zoom.us/oauth/authorize",
+			TokenURL:                  "https://zoom.us/oauth/token",
+			ExplicitScopesRequired:    false,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: false,
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
 }
diff --git a/salesforce/bulkwrite.go b/salesforce/bulkwrite.go
index 5ad2bdef..96d88e77 100644
--- a/salesforce/bulkwrite.go
+++ b/salesforce/bulkwrite.go
@@ -248,7 +248,7 @@ func (c *Connector) completeUpload(ctx context.Context, jobId string) (*common.J
 		"state": JobStateUploadComplete,
 	}
 
-	location, err := joinURLPath(c.BaseURL, fmt.Sprintf("jobs/ingest/%s", jobId))
+	location, err := joinURLPath(c.BaseURL, "jobs/ingest/"+jobId)
 	if err != nil {
 		return nil, err
 	}
diff --git a/salesforce/read.go b/salesforce/read.go
index 89225638..d2979bb0 100644
--- a/salesforce/read.go
+++ b/salesforce/read.go
@@ -20,7 +20,7 @@ func (c *Connector) Read(ctx context.Context, config common.ReadParams) (*common
 	if len(config.NextPage) > 0 {
 		// If NextPage is set, then we're reading the next page of results.
 		// All that matters is the NextPage URL, the fields are ignored.
-		location, joinErr := url.JoinPath(fmt.Sprintf("https://%s", c.Domain), config.NextPage)
+		location, joinErr := url.JoinPath("https://"+c.Domain, config.NextPage)
 		if joinErr != nil {
 			return nil, joinErr
 		}
@@ -75,7 +75,7 @@ func makeSOQL(config common.ReadParams) (string, error) {
 
 	// If Since is not set, then we're doing a backfill. We read all rows (in pages)
 	if !config.Since.IsZero() {
-		soql += fmt.Sprintf(" WHERE SystemModstamp > %s", config.Since.Format("2006-01-02T15:04:05Z"))
+		soql += " WHERE SystemModstamp > " + config.Since.Format("2006-01-02T15:04:05Z")
 		hasWhere = true
 	}
 
diff --git a/salesforce/write.go b/salesforce/write.go
index 6a0ec6c6..3e70c556 100644
--- a/salesforce/write.go
+++ b/salesforce/write.go
@@ -2,7 +2,6 @@ package salesforce
 
 import (
 	"context"
-	"fmt"
 	"net/url"
 
 	"github.com/amp-labs/connectors/common"
@@ -16,7 +15,7 @@ func (c *Connector) Write(ctx context.Context, config common.WriteParams) (*comm
 		err error
 	)
 
-	location, joinErr := url.JoinPath(fmt.Sprintf("%s/sobjects", c.BaseURL), config.ObjectName)
+	location, joinErr := url.JoinPath(c.BaseURL+"/sobjects", config.ObjectName)
 	if joinErr != nil {
 		return nil, joinErr
 	}


Test patch:
diff --git a/providers/catalog_test.go b/providers/catalog_test.go
index a7b0f294..369691c7 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -158,6 +158,28 @@ var testCases = []struct { // nolint
 		expectedErr: nil,
 	},
 
+	{
+		provider: Pipedrive,
+		expected: &ProviderInfo{
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				AuthURL:                   "https://oauth.pipedrive.com/oauth/authorize",
+				TokenURL:                  "https://oauth.pipedrive.com/oauth/token",
+				ExplicitScopesRequired:    true,
+				ExplicitWorkspaceRequired: false,
+			},
+			Support: Support{
+				BulkWrite: false,
+				Proxy:     false,
+				Read:      false,
+				Subscribe: false,
+				Write:     false,
+			},
+			BaseURL: "https://api.pipedrive.com",
+		},
+		expectedErr: nil,
+	},
+
 	{
 		provider: Sellsy,
 		expected: &ProviderInfo{
@@ -347,6 +369,28 @@ var testCases = []struct { // nolint
 		},
 		expectedErr: nil,
 	},
+	{
+		provider: Zoom,
+		description: "Zoom provider config with no substitutions",
+		expected: &ProviderInfo{
+			Support: Support{
+				Read:      false,
+				Write:     false,
+				BulkWrite: false,
+				Subscribe: false,
+				Proxy:     false,
+			},
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				AuthURL:                   "https://zoom.us/oauth/authorize",
+				TokenURL:                  "https://zoom.us/oauth/token",
+				ExplicitScopesRequired:    false,
+				ExplicitWorkspaceRequired: false,
+			},
+			BaseURL: "https://api.zoom.us",
+		},
+		expectedErr: nil,
+	},
 }
 
 func TestReadInfo(t *testing.T) { // nolint
diff --git a/test/metadata/main.go b/test/metadata/main.go
index ac930524..f002d487 100644
--- a/test/metadata/main.go
+++ b/test/metadata/main.go
@@ -66,7 +66,6 @@ func main() {
 	}()
 
 	example, err := xmldom.ParseXML(`<createMetadata><metadata xsi:type="CustomObject"><fullName>TestObject15__c</fullName><label>Test Object 15</label><pluralLabel>Test Objects 15</pluralLabel><nameField><type>Text</type><label>Test Object Name</label></nameField><deploymentStatus>Deployed</deploymentStatus><sharingModel>ReadWrite</sharingModel></metadata><metadata xsi:type="CustomField"><fullName>TestObject13__c.Comments__c</fullName><label>Comments</label><type>LongTextArea</type><length>500</length><inlineHelpText>This field contains help text for this object</inlineHelpText><description>Add your comments about this object here</description><visibleLines>30</visibleLines><required>false</required><trackFeedHistory>false</trackFeedHistory><trackHistory>false</trackHistory></metadata></createMetadata>`)
-
 	if err != nil {
 		slog.Error("err parsing", "error", err)
 		os.Exit(1)