Repository: amp-labs/connectors
Pull request #98 (2024-03-15 12:41:39)

[ENG-786] feat: Add Gong connector
## Checklist
- [x] Ran Linter
- [x] Catalog tests passing
- [x] Created PR from non-main branch

## Catalog variables
workspace variable is required. It's given by Gong. Sample is us-49467 in https://us-49467.api.gong.io/

## Notes
It's currently private, The only OAuth user who can access the app is the Creator. Publishing it requires filling a form.
Also the token endpoint requires Basic Authorization header whose values is base64 encoded `client_id:client_secret`

## Testing
### GET
<img width="1150" alt="Screenshot 2024-03-15 at 12 14 22" src="https://github.com/amp-labs/connectors/assets/52887226/af390b63-e575-46ff-b886-09c952edc1b8">

### POST
<img width="1148" alt="Screenshot 2024-03-15 at 13 03 09" src="https://github.com/amp-labs/connectors/assets/52887226/fec1224c-4359-4a6c-ace5-a3cd1a0c80c2">

### PUT
<img width="1157" alt="Screenshot 2024-03-15 at 13 10 26" src="https://github.com/amp-labs/connectors/assets/52887226/ee60ed79-9427-49ac-bd9e-8bb59658dd37">

### DELETE
<img width="1155" alt="Screenshot 2024-03-15 at 13 26 22"  src="https://github.com/amp-labs/connectors/assets/52887226/ad530342-9931-4bb6-88ad-eb3b8e196cf7">

## Pagination
For pagination, we would have the cursor value in the records object below: We would in turn use that value as the query parameter in the next request. 
<img width="1151" alt="Screenshot 2024-03-15 at 12 12 41" src="https://github.com/amp-labs/connectors/assets/52887226/afae1a35-5127-46b7-9e0e-2c927cf3e1bc">


Jkarage: @RajatPawar 
I have also changed the test values for Notion, as the changes for proxy support were not made in the tests as well. 

Patch:
diff --git a/providers/catalog.go b/providers/catalog.go
index c3d14e3f..6060c456 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -16,6 +16,7 @@ const (
 	Asana      Provider = "asana"
 	Dropbox    Provider = "dropbox"
 	Notion     Provider = "notion"
+	Gong       Provider = "gong"
 )
 
 // ================================================================================
@@ -84,7 +85,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		},
 	},
 
-	// SalesLoft configuration
+	// Salesloft configuration
 	Salesloft: {
 		AuthType: Oauth2,
 		BaseURL:  "https://api.salesloft.com",
@@ -146,7 +147,6 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		AuthType: Oauth2,
 		BaseURL:  "https://api.close.com/api",
 		OauthOpts: OauthOpts{
-
 			AuthURL:                   "https://app.close.com/oauth2/authorize",
 			TokenURL:                  "https://api.close.com/oauth2/token",
 			ExplicitScopesRequired:    false,
@@ -166,7 +166,6 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		BaseURL:  "https://api.infusionsoft.com",
 
 		OauthOpts: OauthOpts{
-
 			AuthURL:                   "https://accounts.infusionsoft.com/app/oauth/authorize",
 			TokenURL:                  "https://api.infusionsoft.com/token",
 			ExplicitScopesRequired:    false,
@@ -237,4 +236,23 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			Write:     false,
 		},
 	},
+
+	// Gong configuration
+	Gong: {
+		AuthType: Oauth2,
+		BaseURL:  "https://{{.workspace}}.api.gong.io",
+		OauthOpts: OauthOpts{
+			AuthURL:                   "https://app.gong.io/oauth2/authorize",
+			TokenURL:                  "https://app.gong.io/oauth2/generate-customer-token",
+			ExplicitScopesRequired:    true,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: false,
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
 }


Test patch:
diff --git a/providers/catalog_test.go b/providers/catalog_test.go
index 383adf12..159396af 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -275,7 +275,7 @@ var testCases = []struct { // nolint
 				Write:     false,
 				BulkWrite: false,
 				Subscribe: false,
-				Proxy:     false,
+				Proxy:     true,
 			},
 			AuthType: Oauth2,
 			OauthOpts: OauthOpts{
@@ -288,6 +288,31 @@ var testCases = []struct { // nolint
 		},
 		expectedErr: nil,
 	},
+	{
+		provider:    Gong,
+		description: "Gong provider config with valid substitutions",
+		substitutions: map[string]string{
+			"workspace": "testing",
+		},
+		expected: &ProviderInfo{
+			Support: Support{
+				Read:      false,
+				Write:     false,
+				BulkWrite: false,
+				Subscribe: false,
+				Proxy:     false,
+			},
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				AuthURL:                   "https://app.gong.io/oauth2/authorize",
+				TokenURL:                  "https://app.gong.io/oauth2/generate-customer-token",
+				ExplicitWorkspaceRequired: false,
+				ExplicitScopesRequired:    true,
+			},
+			BaseURL: "https://testing.api.gong.io",
+		},
+		expectedErr: nil,
+	},
 }
 
 func TestReadInfo(t *testing.T) { // nolint