Repository: amp-labs/connectors
Pull request #125 (2024-03-26 10:08:21)

[ENG-791] feat: Add Capsule connector
## Catalog variables
No required catalog variables

## Notes

## Testing 
### GET 
URL: <localhost:4444/v2/kases/4827250> 
Connection via proxy fails with this error 
![Gapsule - Get proxy fails console output](https://github.com/amp-labs/connectors/assets/95291462/9996f71f-3b04-48e8-b13c-0171478a5b6c)
And the postman query for proxy looked like this 
![Capsule - Get proxy fails](https://github.com/amp-labs/connectors/assets/95291462/c10c349f-0797-4275-b91f-87fd4d178834)
While direct hit at http://api.capsulecrm.com/api/v2/kases/4827250 works fine
![Capsule - GET direct works ok](https://github.com/amp-labs/connectors/assets/95291462/76c133fa-c528-4289-84a1-2f0cf77dc798)

### PUT
URL: <localhost:4444/v2/kases/4827250> 
Proxy request fails like this
If hit directly works fine


### DELETE
URL: <localhost:4444/v2/kases/4827250> 
Proxy request fails 
![Capsule - DEL proxy fails](https://github.com/amp-labs/connectors/assets/95291462/3dd5738b-63db-4156-992b-8afdf83ace62)


## Pagination
![Capsule - pagination example](https://github.com/amp-labs/connectors/assets/95291462/8501a825-83d5-4a6b-943b-348f8458caad)




Listener430: @RajatPawar please kindly take a look when you have a minute. Thanks! 


Patch:
diff --git a/providers/catalog.go b/providers/catalog.go
index 0a4ea8f4..24766fe5 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -23,6 +23,7 @@ const (
 	Gong                                Provider = "gong"
 	Zoom                                Provider = "zoom"
 	Intercom                            Provider = "intercom"
+  	Capsule                             Provider = "capsule"
 	DocuSign                            Provider = "docuSign"
 	DocuSignDeveloper                   Provider = "docuSignDeveloper"
 	Calendly                            Provider = "calendly"
@@ -164,6 +165,25 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		},
 	},
 
+	// Capsule configuration
+	Capsule: {
+		AuthType: Oauth2,
+		BaseURL:  "https://api.capsulecrm.com/api",
+		OauthOpts: OauthOpts{
+			AuthURL:                   "https://api.capsulecrm.com/oauth/authorise",
+			TokenURL:                  "https://api.capsulecrm.com/oauth/token",
+			ExplicitScopesRequired:    true,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: false,
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
+
 	// Copper configuration
 	Copper: {
 		AuthType: Oauth2,


Test patch:
diff --git a/providers/catalog_test.go b/providers/catalog_test.go
index d80c6136..feee17fe 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -180,6 +180,28 @@ var testCases = []struct { // nolint
 		expectedErr: nil,
 	},
 
+	{
+		provider: Capsule,
+		expected: &ProviderInfo{
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				AuthURL:                   "https://api.capsulecrm.com/oauth/authorise",
+				TokenURL:                  "https://api.capsulecrm.com/oauth/token",
+				ExplicitScopesRequired:    true,
+				ExplicitWorkspaceRequired: false,
+			},
+			Support: Support{
+				BulkWrite: false,
+				Proxy:     false,
+				Read:      false,
+				Subscribe: false,
+				Write:     false,
+			},
+			BaseURL: "https://api.capsulecrm.com/api",
+		},
+		expectedErr: nil,
+	},
+
 	{
 		provider:    Copper,
 		description: "Valid Copper provider config with no substitutions",