Repository: amp-labs/connectors
Pull request #126 (2024-03-26 12:19:32)

[ENG-894] feat: Add ConstantContact connector
## Checklist
- [x] Ran Linter
- [x] Catalog tests passing
- [x] Created PR from non-main branch 

## Catalog variables
None

## Notes
Scopes are explicitly required in the Authorization call.

## Testing 
### GET 
<img width="1144" alt="Screenshot 2024-03-26 at 15 07 12" src="https://github.com/amp-labs/connectors/assets/52887226/ff43dca3-f834-4222-89bc-4dbdc200cc82">


### POST
<img width="1147" alt="Screenshot 2024-03-25 at 23 16 47" src="https://github.com/amp-labs/connectors/assets/52887226/cf3b9cd5-8110-457a-a272-b926ab2b8c3a">


### PUT
<img width="1145" alt="Screenshot 2024-03-25 at 23 24 27" src="https://github.com/amp-labs/connectors/assets/52887226/391bca6d-87ad-4edf-a3e2-b31f64d8fbc0">

### DELETE
<img width="1147" alt="Screenshot 2024-03-26 at 15 17 10" src="https://github.com/amp-labs/connectors/assets/52887226/015bb9b5-b8db-4200-965e-c04912bcdb05">


## Pagination
Requesting a list of contacts. Paginated.
<img width="1149" alt="Screenshot 2024-03-25 at 23 58 29" src="https://github.com/amp-labs/connectors/assets/52887226/4e0e6e74-7cff-4d4d-8bd4-d50aa93b7c7a">

Requesting the next page
<img width="1146" alt="Screenshot 2024-03-25 at 23 59 42" src="https://github.com/amp-labs/connectors/assets/52887226/f63039e9-73bc-4ec7-b31d-8aea92fc3874">


Jkarage: @RajatPawar 

Patch:
diff --git a/providers/catalog.go b/providers/catalog.go
index 7d150ab7..840790cc 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -28,6 +28,7 @@ const (
 	Calendly          Provider = "calendly"
 	AWeber            Provider = "aWeber"
 	GetResponse       Provider = "getResponse"
+	ConstantContact   Provider = "constantContact"
 )
 
 // ================================================================================
@@ -449,8 +450,8 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			Write:     false,
 		},
 	},
-  
-  // GetResponse configuration
+
+	// GetResponse configuration
 	GetResponse: {
 		AuthType: Oauth2,
 		BaseURL:  "https://api.getresponse.com",
@@ -468,8 +469,8 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			Write:     false,
 		},
 	},
-  
-  // AWeber configuration
+
+	// AWeber configuration
 	AWeber: {
 		AuthType: Oauth2,
 		BaseURL:  "https://api.aweber.com",
@@ -487,4 +488,23 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			Write:     false,
 		},
 	},
+
+	// ConstantContact configuration
+	ConstantContact: {
+		AuthType: Oauth2,
+		BaseURL:  "https://api.cc.email",
+		OauthOpts: OauthOpts{
+			AuthURL:                   "https://authz.constantcontact.com/oauth2/default/v1/authorize",
+			TokenURL:                  "https://authz.constantcontact.com/oauth2/default/v1/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 7ab8e5a0..137fd3d0 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -548,7 +548,7 @@ var testCases = []struct { // nolint
 		},
 		expectedErr: nil,
 	},
-  {
+	{
 		provider:    AWeber,
 		description: "Valid AWeber provider config with no substitutions",
 		expected: &ProviderInfo{
@@ -570,6 +570,28 @@ var testCases = []struct { // nolint
 		},
 		expectedErr: nil,
 	},
+	{
+		provider:    ConstantContact,
+		description: "Valid ConstantContact 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://authz.constantcontact.com/oauth2/default/v1/authorize",
+				TokenURL:                  "https://authz.constantcontact.com/oauth2/default/v1/token",
+				ExplicitWorkspaceRequired: false,
+				ExplicitScopesRequired:    true,
+			},
+			BaseURL: "https://api.cc.email",
+		},
+		expectedErr: nil,
+	},
 }
 
 func TestReadInfo(t *testing.T) { // nolint