Repository: amp-labs/connectors
Pull request #97 (2024-03-15 11:36:05)

[ENG-790] feat: Add Attio connector
## Catalog variables
No required catalog variables

## Notes

## Testing 
### GET 
URL: <localhost:4444/v2/lists/new_test_list_2/entries/b10dcb40-95bc-4c34-82e5-c573f75c5673l> 
![Get proxy ok](https://github.com/amp-labs/connectors/assets/95291462/306bc0a4-2c9b-4630-817a-336ce38060f4)

### POST
URL: <localhost:4444/v2/lists/new_test_list_2/entries/query> 
![Post proxy ok](https://github.com/amp-labs/connectors/assets/95291462/7d781db7-870e-44ed-88f3-cade6910b37c)


### PUT
URL: <localhost:4444/v2/lists/new_test_list_2/entries/b10dcb40-95bc-4c34-82e5-c573f75c5673> 
![Put Proxy ok](https://github.com/amp-labs/connectors/assets/95291462/71450f95-ad0e-4686-8e26-9b3294f3a90b)

### PATCH
URL: <localhost:4444/v2/lists/new_test_list_2/entries/b10dcb40-95bc-4c34-82e5-c573f75c5673> 
![patch proxy ok](https://github.com/amp-labs/connectors/assets/95291462/5cf82427-678b-4419-9773-00fd4c3f9da7)


### DELETE
URL: <localhost:4444/v2/lists/new_test_list_2/entries/b10dcb40-95bc-4c34-82e5-c573f75c5673> 
![del proxy ok](https://github.com/amp-labs/connectors/assets/95291462/565bdb36-592a-4a57-ba5e-7f48290406f1)


## Pagination
Direct pagination works fine
![pagination direct works](https://github.com/amp-labs/connectors/assets/95291462/87f56108-9fc6-4993-9d5b-c3fd3cbacdd3)

Going through the connector both http and httpS generates the following error
GET https://localhost:4444/v2/lists?limit=3&offset=0
Error: connect ECONNREFUSED 127.0.0.1:4444
![pagination proxy fails https   http](https://github.com/amp-labs/connectors/assets/95291462/12d6f070-6c15-479d-be09-1feae6ccd15d)

Could be related to the issues with my local env, would propose to reproduce it on the server. 



Listener430: @RajatPawar as agreed, here is the attio PR. Would appreciate if you could please take a look. 

Patch:
diff --git a/providers/catalog.go b/providers/catalog.go
index b839a72d..c3d14e3f 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -10,6 +10,7 @@ const (
 	LinkedIn   Provider = "linkedIn"
 	Salesloft  Provider = "salesloft"
 	Outreach   Provider = "outreach"
+	Attio      Provider = "attio"
 	Close      Provider = "close"
 	Keap       Provider = "keap"
 	Asana      Provider = "asana"
@@ -121,6 +122,25 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		},
 	},
 
+	// Attio configuration
+	Attio: {
+		AuthType: Oauth2,
+		BaseURL:  "https://api.attio.com/api",
+		OauthOpts: OauthOpts{
+			AuthURL:                   "https://app.attio.com/authorize",
+			TokenURL:                  "https://app.attio.com/oauth/token",
+			ExplicitScopesRequired:    true,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: false,
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
+
 	// Close configuration
 	Close: {
 		AuthType: Oauth2,


Test patch:
diff --git a/providers/catalog_test.go b/providers/catalog_test.go
index 3856ebc1..383adf12 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -150,6 +150,32 @@ var testCases = []struct { // nolint
 		expectedErr: nil,
 	},
 
+	{
+		provider:    Attio,
+		description: "Valid Attio provider config with non-existent substitutions",
+		substitutions: map[string]string{
+			"nonexistentvar": "abc",
+		},
+		expected: &ProviderInfo{
+			Support: Support{
+				Read:      false,
+				Write:     false,
+				BulkWrite: false,
+				Subscribe: false,
+				Proxy:     false,
+			},
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				AuthURL:                   "https://app.attio.com/authorize",
+				TokenURL:                  "https://app.attio.com/oauth/token",
+				ExplicitScopesRequired:    true,
+				ExplicitWorkspaceRequired: false,
+			},
+			BaseURL: "https://api.attio.com/api",
+		},
+		expectedErr: nil,
+	},
+
 	{
 		provider:    Close,
 		description: "Valid Close provider config with no substitutions",