Repository: amp-labs/connectors
Pull request #145 (2024-04-01 14:14:45)

feat: Add Box connector
Closes [#143](https://github.com/amp-labs/connectors/issues/143)

## Checklist

- [x] Ran Linter
- [x]  Catalog tests passing
- [x] Created PR from non-main branch

## Catalog variables
Box Provider = "box"

## Notes
Supports batching requests and pagination as well

## Testing
### GET
URL: http://localhost:4444/2.0/users/32911837763
![GET](https://github.com/amp-labs/connectors/assets/163011126/af29df47-2fed-4529-9e72-9b5081f091da)

### POST
URL: http://localhost:4444/2.0/users
![POST](https://github.com/amp-labs/connectors/assets/163011126/5b15e0c4-52f2-41b9-ab3d-961d40dff0f6)
 
### PUT
URL: http://localhost:4444/2.0/users/32911837763
![PUT](https://github.com/amp-labs/connectors/assets/163011126/63a85ac8-1d55-4b33-8398-71188bb89fc9)

### DELETE
URL: http://localhost:4444/2.0/users/32911837763
![DELETE](https://github.com/amp-labs/connectors/assets/163011126/afa3c1cb-6cb3-4fdd-ae73-930b6317bfb9)



Patch:
diff --git a/providers/catalog.go b/providers/catalog.go
index 95caf584..df901664 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -33,6 +33,7 @@ const (
 	MicrosoftDynamics365Sales           Provider = "microsoftDynamics365Sales"
 	MicrosoftDynamics365BusinessCentral Provider = "microsoftDynamics365BusinessCentral"
 	Gainsight                           Provider = "gainsight"
+	Box                                 Provider = "box"
 	GoogleCalendar                      Provider = "googleCalendar"
 	ZendeskSupport                      Provider = "zendeskSupport"
 	ZendeskChat                         Provider = "zendeskChat"
@@ -594,6 +595,25 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		},
 	},
 
+	// Box configuration
+	Box: {
+		AuthType: Oauth2,
+		BaseURL:  "https://api.box.com",
+		OauthOpts: OauthOpts{
+			AuthURL:                   "https://account.box.com/api/oauth2/authorize",
+			TokenURL:                  "https://api.box.com/oauth2/token",
+			ExplicitScopesRequired:    false,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: false,
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
+
 	GoogleCalendar: {
 		AuthType: Oauth2,
 		BaseURL:  "https://www.googleapis.com/calendar",
@@ -633,6 +653,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			Write:     false,
 		},
 	},
+
 	ZendeskChat: {
 		AuthType: Oauth2,
 		BaseURL:  "https://www.zopim.com",


Test patch:
diff --git a/providers/catalog_test.go b/providers/catalog_test.go
index a8b2d4b1..dbacb401 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -692,6 +692,28 @@ var testCases = []struct { // nolint
 		},
 		expectedErr: nil,
 	},
+	{
+		provider:    Box,
+		description: "Box config with no substitutions",
+		expected: &ProviderInfo{
+			Support: Support{
+				Read:      false,
+				Write:     false,
+				BulkWrite: false,
+				Subscribe: false,
+				Proxy:     false,
+			},
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				AuthURL:                   "https://account.box.com/api/oauth2/authorize",
+				TokenURL:                  "https://api.box.com/oauth2/token",
+				ExplicitScopesRequired:    false,
+				ExplicitWorkspaceRequired: false,
+			},
+			BaseURL: "https://api.box.com",
+		},
+		expectedErr: nil,
+	},
 	{
 		provider:    GoogleCalendar,
 		description: "Google Calendar provider config with no substitutions",