Repository: amp-labs/connectors
Pull request #318 (2024-05-13 12:01:43)

Update provider catalog with fixes
* This PR fixes some provider options that were set incorrectly.
* It also sorts the providers alphabetically.
* Renames `GoogleMail` to `Gmail`

RajatPawar: * **#318** <a href="https://app.graphite.dev/github/pr/amp-labs/connectors/318?utm_source=stack-comment-icon" target="_blank"><img src="https://static.graphite.dev/graphite-32x32-black.png" alt="Graphite" width="10px" height="10px"/></a> 👈
* `main`

This stack of pull requests is managed by Graphite. <a href="https://stacking.dev/?utm_source=stack-comment">Learn more about stacking.</a>
<h2></h2>

 Join @RajatPawar and the rest of your teammates on <a href="https://graphite.dev?utm-source=stack-comment"><img src="https://static.graphite.dev/graphite-32x32-black.png" alt="Graphite" width="11px" height="11px"/> <b>Graphite</b></a>
  <!-- Current dependencies on/for this PR: -->

Patch:
diff --git a/providers/catalog.go b/providers/catalog.go
index 6134d175..4917f334 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -5,65 +5,65 @@ package providers
 // ================================================================================
 
 const (
-	Mock                                Provider = "mock"
-	Salesforce                          Provider = "salesforce"
-	Hubspot                             Provider = "hubspot"
-	LinkedIn                            Provider = "linkedIn"
-	Salesloft                           Provider = "salesloft"
-	Outreach                            Provider = "outreach"
-	RingCentral                         Provider = "ringCentral"
-	Pipedrive                           Provider = "pipedrive"
-	Copper                              Provider = "copper"
-	ZohoCRM                             Provider = "zohoCRM"
-	Mural                               Provider = "mural"
-	Klaviyo                             Provider = "klaviyo"
-	Sellsy                              Provider = "sellsy"
-	Attio                               Provider = "attio"
-	Close                               Provider = "close"
-	Keap                                Provider = "keap"
+	Airtable                            Provider = "airtable"
+	AWeber                              Provider = "aWeber"
 	Asana                               Provider = "asana"
-	Dropbox                             Provider = "dropbox"
-	Notion                              Provider = "notion"
-	Gong                                Provider = "gong"
-	Zoom                                Provider = "zoom"
-	Intercom                            Provider = "intercom"
+	Atlassian                           Provider = "atlassian"
+	Attio                               Provider = "attio"
+	Box                                 Provider = "box"
+	Calendly                            Provider = "calendly"
 	Capsule                             Provider = "capsule"
-	Wrike                               Provider = "wrike"
+	ClickUp                             Provider = "clickup"
+	Close                               Provider = "close"
+	ConstantContact                     Provider = "constantContact"
+	Copper                              Provider = "copper"
+	Discord                             Provider = "discord"
 	Docusign                            Provider = "docusign"
 	DocusignDeveloper                   Provider = "docusignDeveloper"
-	Calendly                            Provider = "calendly"
-	AWeber                              Provider = "aWeber"
-	GetResponse                         Provider = "getResponse"
-	ConstantContact                     Provider = "constantContact"
-	MicrosoftDynamics365CRM             Provider = "microsoftDynamics365CRM"
-	MicrosoftDynamics365BusinessCentral Provider = "microsoftDynamics365BusinessCentral"
+	Dropbox                             Provider = "dropbox"
+	DropboxSign                         Provider = "dropboxSign"
+	Figma                               Provider = "figma"
 	Gainsight                           Provider = "gainsight"
-	Box                                 Provider = "box"
-	ZendeskSupport                      Provider = "zendeskSupport"
-	ZendeskChat                         Provider = "zendeskChat"
-	WordPress                           Provider = "wordPress"
+	GetResponse                         Provider = "getResponse"
+	Gmail                               Provider = "gmail"
+	Gong                                Provider = "gong"
 	IroncladDemo                        Provider = "ironcladDemo"
 	IroncladEU                          Provider = "ironcladEU"
-	Airtable                            Provider = "airtable"
 	Ironclad                            Provider = "ironclad"
-	Slack                               Provider = "slack"
-	HelpScoutMailbox                    Provider = "helpScoutMailbox"
-	Timely                              Provider = "timely"
-	Atlassian                           Provider = "atlassian"
-	Webflow                             Provider = "webflow"
-	Smartsheet                          Provider = "smartsheet"
-	StackExchange                       Provider = "stackExchange"
 	Google                              Provider = "google"
 	GoogleContacts                      Provider = "googleContacts"
-	GoogleMail                          Provider = "googleMail"
-	Monday                              Provider = "monday"
-	Figma                               Provider = "figma"
+	HelpScoutMailbox                    Provider = "helpScoutMailbox"
+	Hubspot                             Provider = "hubspot"
+	Intercom                            Provider = "intercom"
+	Keap                                Provider = "keap"
+	Klaviyo                             Provider = "klaviyo"
+	LinkedIn                            Provider = "linkedIn"
+	MicrosoftDynamics365BusinessCentral Provider = "microsoftDynamics365BusinessCentral"
+	MicrosoftDynamics365CRM             Provider = "microsoftDynamics365CRM"
 	Miro                                Provider = "miro"
+	Mock                                Provider = "mock"
+	Monday                              Provider = "monday"
+	Mural                               Provider = "mural"
+	Notion                              Provider = "notion"
+	Outreach                            Provider = "outreach"
+	Pipedrive                           Provider = "pipedrive"
+	RingCentral                         Provider = "ringCentral"
+	Salesforce                          Provider = "salesforce"
+	Salesloft                           Provider = "salesloft"
+	Sellsy                              Provider = "sellsy"
+	Slack                               Provider = "slack"
+	Smartsheet                          Provider = "smartsheet"
+	StackExchange                       Provider = "stackExchange"
+	Timely                              Provider = "timely"
 	Typeform                            Provider = "typeform"
+	Webflow                             Provider = "webflow"
+	WordPress                           Provider = "wordPress"
+	Wrike                               Provider = "wrike"
+	ZendeskChat                         Provider = "zendeskChat"
+	ZendeskSupport                      Provider = "zendeskSupport"
+	ZohoCRM                             Provider = "zohoCRM"
+	Zoom                                Provider = "zoom"
 	Zuora                               Provider = "zuora"
-	DropboxSign                         Provider = "dropboxSign"
-	ClickUp                             Provider = "clickup"
-	Discord                             Provider = "discord"
 )
 
 // ================================================================================
@@ -614,8 +614,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			ExplicitScopesRequired:    true,
 			ExplicitWorkspaceRequired: false,
 			TokenMetadataFields: TokenMetadataFields{
-				ScopesField:      "scope",
-				ConsumerRefField: "client_id",
+				ScopesField: "scope",
 			},
 		},
 		Support: Support{
@@ -681,30 +680,28 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 	},
 
 	// Docusign configuration
-	// TODO: we don't have a good way to get the server string yet. Need to make API call to /oauth/userinfo.
-	// Leaving this connector commented out until that is unblocked.
-	// Docusign: {
-	//	AuthType: Oauth2,
-	//	BaseURL:  "https://{{.server}}.docusign.net",
-	//	OauthOpts: OauthOpts{
-	//		AuthURL:                   "https://account.docusign.com/oauth/auth",
-	//		TokenURL:                  "https://account.docusign.com/oauth/token",
-	//		ExplicitScopesRequired:    true,
-	//		ExplicitWorkspaceRequired: false,
-	//	},
-	//	Support: Support{
-	//		BulkWrite: BulkWriteSupport{
-	//			Insert: false,
-	//			Update: false,
-	//			Upsert: false,
-	//			Delete: false,
-	//		},
-	//		Proxy:     false,
-	//		Read:      false,
-	//		Subscribe: false,
-	//		Write:     false,
-	//	},
-	// },
+	Docusign: {
+		AuthType: Oauth2,
+		BaseURL:  "https://{{.server}}.docusign.net",
+		OauthOpts: OauthOpts{
+			AuthURL:                   "https://account.docusign.com/oauth/auth",
+			TokenURL:                  "https://account.docusign.com/oauth/token",
+			ExplicitScopesRequired:    true,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: BulkWriteSupport{
+				Insert: false,
+				Update: false,
+				Upsert: false,
+				Delete: false,
+			},
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
 
 	// Docusign Developer configuration
 	DocusignDeveloper: {
@@ -815,7 +812,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			AuthURL:                   "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
 			TokenURL:                  "https://login.microsoftonline.com/common/oauth2/v2.0/token",
 			ExplicitScopesRequired:    true,
-			ExplicitWorkspaceRequired: true,
+			ExplicitWorkspaceRequired: false,
 		},
 		Support: Support{
 			BulkWrite: BulkWriteSupport{
@@ -1069,7 +1066,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			AuthURL:                   "https://slack.com/oauth/v2/authorize",
 			TokenURL:                  "https://slack.com/api/oauth.v2.access",
 			ExplicitScopesRequired:    true,
-			ExplicitWorkspaceRequired: true,
+			ExplicitWorkspaceRequired: false,
 			TokenMetadataFields: TokenMetadataFields{
 				ScopesField:       "scope",
 				WorkspaceRefField: "workspace_name",
@@ -1307,7 +1304,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 	},
 
 	// GoogleMail Support Configuration
-	GoogleMail: {
+	Gmail: {
 		AuthType: Oauth2,
 		BaseURL:  "https://gmail.googleapis.com",
 		OauthOpts: OauthOpts{
@@ -1443,13 +1440,13 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 	// Zuora Configuration
 	Zuora: {
 		AuthType: Oauth2,
-		BaseURL:  "https://{{.subdomain}}.zuora.com",
+		BaseURL:  "https://{{.workspace}}.zuora.com",
 		OauthOpts: OauthOpts{
 			GrantType:                 ClientCredentials,
-			AuthURL:                   "https://{{.subdomain}}.zuora.com/oauth/auth_mock",
-			TokenURL:                  "https://{{.subdomain}}.zuora.com/oauth/token",
+			AuthURL:                   "https://{{.workspace}}.zuora.com/oauth/auth_mock",
+			TokenURL:                  "https://{{.workspace}}.zuora.com/oauth/token",
 			ExplicitScopesRequired:    false,
-			ExplicitWorkspaceRequired: false,
+			ExplicitWorkspaceRequired: true,
 		},
 		Support: Support{
 			BulkWrite: BulkWriteSupport{


Test patch:
diff --git a/providers/catalog_test.go b/providers/catalog_test.go
index 8bed8eaf..1e8d22a6 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -671,8 +671,7 @@ var testCases = []struct { // nolint
 				ExplicitWorkspaceRequired: false,
 				ExplicitScopesRequired:    true,
 				TokenMetadataFields: TokenMetadataFields{
-					ScopesField:      "scope",
-					ConsumerRefField: "client_id",
+					ScopesField: "scope",
 				},
 			},
 			BaseURL: "https://api.gong.io",
@@ -733,36 +732,35 @@ var testCases = []struct { // nolint
 		},
 		expectedErr: nil,
 	},
-	// TODO: uncomment this when the docusign connector is uncommented
-	//{
-	//	provider: Docusign,
-	//	substitutions: map[string]string{
-	//		"server": "example",
-	//	},
-	//	expected: &ProviderInfo{
-	//		Support: Support{
-	//			Read:  false,
-	//			Write: false,
-	//			BulkWrite: BulkWriteSupport{
-	//				Insert: false,
-	//				Update: false,
-	//				Upsert: false,
-	//				Delete: false,
-	//			},
-	//			Subscribe: false,
-	//			Proxy:     false,
-	//		},
-	//		AuthType: Oauth2,
-	//		OauthOpts: OauthOpts{
-	//			AuthURL:                   "https://account.docusign.com/oauth/auth",
-	//			TokenURL:                  "https://account.docusign.com/oauth/token",
-	//			ExplicitScopesRequired:    true,
-	//			ExplicitWorkspaceRequired: false,
-	//		},
-	//		BaseURL: "https://example.docusign.net",
-	//	},
-	//	expectedErr: nil,
-	// },
+	{
+		provider: Docusign,
+		substitutions: map[string]string{
+			"server": "example",
+		},
+		expected: &ProviderInfo{
+			Support: Support{
+				Read:  false,
+				Write: false,
+				BulkWrite: BulkWriteSupport{
+					Insert: false,
+					Update: false,
+					Upsert: false,
+					Delete: false,
+				},
+				Subscribe: false,
+				Proxy:     false,
+			},
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				AuthURL:                   "https://account.docusign.com/oauth/auth",
+				TokenURL:                  "https://account.docusign.com/oauth/token",
+				ExplicitScopesRequired:    true,
+				ExplicitWorkspaceRequired: false,
+			},
+			BaseURL: "https://example.docusign.net",
+		},
+		expectedErr: nil,
+	},
 	{
 		provider: DocusignDeveloper,
 		expected: &ProviderInfo{
@@ -900,7 +898,7 @@ var testCases = []struct { // nolint
 				AuthURL:                   "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
 				TokenURL:                  "https://login.microsoftonline.com/common/oauth2/v2.0/token",
 				ExplicitScopesRequired:    true,
-				ExplicitWorkspaceRequired: true,
+				ExplicitWorkspaceRequired: false,
 			},
 			BaseURL: "https://testing.api.crm.dynamics.com",
 		},
@@ -1259,7 +1257,7 @@ var testCases = []struct { // nolint
 				AuthURL:                   "https://slack.com/oauth/v2/authorize",
 				TokenURL:                  "https://slack.com/api/oauth.v2.access",
 				ExplicitScopesRequired:    true,
-				ExplicitWorkspaceRequired: true,
+				ExplicitWorkspaceRequired: false,
 				TokenMetadataFields: TokenMetadataFields{
 					ScopesField:       "scope",
 					WorkspaceRefField: "workspace_name",
@@ -1512,7 +1510,7 @@ var testCases = []struct { // nolint
 		expectedErr: nil,
 	},
 	{
-		provider:    GoogleMail,
+		provider:    Gmail,
 		description: "Valid GoogleMail provider config with no substitutions",
 		expected: &ProviderInfo{
 			AuthType: Oauth2,
@@ -1670,7 +1668,7 @@ var testCases = []struct { // nolint
 		provider:    Zuora,
 		description: "Valid Zuora provider config with substitutions",
 		substitutions: map[string]string{
-			"subdomain": "rest.test",
+			"workspace": "rest.test",
 		},
 		expected: &ProviderInfo{
 			AuthType: Oauth2,
@@ -1679,7 +1677,7 @@ var testCases = []struct { // nolint
 				AuthURL:                   "https://rest.test.zuora.com/oauth/auth_mock",
 				TokenURL:                  "https://rest.test.zuora.com/oauth/token",
 				ExplicitScopesRequired:    false,
-				ExplicitWorkspaceRequired: false,
+				ExplicitWorkspaceRequired: true,
 			},
 			Support: Support{
 				BulkWrite: BulkWriteSupport{