Repository: amp-labs/connectors
Pull request #220 (2024-04-16 08:02:34)

Added TokenMetadataFields and updated Proxy as true in dropbox

sanjay-mitrahsoft: Closes #287 

## Checklist

- [ ] Ran Linter
- [ ] Catalog tests passing

## Notes
No fishy behaviour was observed. All the requests/responses were parsed correctly.

## Testing
### GET
URL: https://proxy.withampersand.com/2/file_requests/get
![GET](https://github.com/amp-labs/connectors/assets/163011126/555640c9-a39c-4521-943c-71e2dd9dfc16)

### POST
URL: https://proxy.withampersand.com/2/file_requests/create
![POST](https://github.com/amp-labs/connectors/assets/163011126/2d44e3db-13a5-468f-9cc7-4354f77f10ea)

### PUT
URL: https://proxy.withampersand.com/2/file_requests/update
![PUT](https://github.com/amp-labs/connectors/assets/163011126/d29662d1-9db3-410b-96c1-804c9d315840)

### DELETE
URL: https://proxy.withampersand.com/2/file_requests/delete
![DELETE](https://github.com/amp-labs/connectors/assets/163011126/ead11fff-b05b-4de1-be82-2ee1ee74250d)


Patch:
diff --git a/.github/PULL_REQUEST_TEMPLATE/proxy_connector.md b/.github/PULL_REQUEST_TEMPLATE/proxy_connector.md
new file mode 100644
index 00000000..b3f52a15
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE/proxy_connector.md
@@ -0,0 +1,23 @@
+## Testing
+### GET
+URL: <localhost:4444/v2/some-api-call>
+Postman screenshot (must show the request URL, the response status code & body clearly)
+
+### POST
+URL: <localhost:4444/v2/some-api-call>
+Postman screenshot (must show the request URL, the response status code & body clearly)
+
+<Please add the same information for all other methods available - PUT, PATCH, DELETE, etc>
+
+### Invalid requests
+Wrong verb applied, invalid path.
+
+
+## Pagination
+Please add screenshots that show successful pagination using the connector. 
+
+## Successful console operation (operation & events)
+
+## Failed console operation (operation & events)
+
+## Raw token response
\ No newline at end of file
diff --git a/providers/catalog.go b/providers/catalog.go
index 248cbfa6..6b9ed1f3 100644
--- a/providers/catalog.go
+++ b/providers/catalog.go
@@ -59,6 +59,8 @@ const (
 	Typeform                            Provider = "typeform"
 	Zuora                               Provider = "zuora"
 	DropboxSign                         Provider = "dropboxSign"
+	ClickUp                             Provider = "clickup"
+	Discord                             Provider = "discord"
 )
 
 // ================================================================================
@@ -547,10 +549,15 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		AuthType: Oauth2,
 		BaseURL:  "https://api.dropboxapi.com",
 		OauthOpts: OauthOpts{
+			GrantType:                 AuthorizationCode,
 			AuthURL:                   "https://www.dropbox.com/oauth2/authorize",
 			TokenURL:                  "https://api.dropboxapi.com/oauth2/token",
 			ExplicitScopesRequired:    false,
 			ExplicitWorkspaceRequired: false,
+			TokenMetadataFields: TokenMetadataFields{
+				ScopesField:      "scope",
+				ConsumerRefField: "account_id",
+			},
 		},
 		Support: Support{
 			BulkWrite: BulkWriteSupport{
@@ -559,7 +566,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 				Upsert: false,
 				Delete: false,
 			},
-			Proxy:     false,
+			Proxy:     true,
 			Read:      false,
 			Subscribe: false,
 			Write:     false,
@@ -701,10 +708,14 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 		AuthType: Oauth2,
 		BaseURL:  "https://demo.docusign.net",
 		OauthOpts: OauthOpts{
+			GrantType:                 AuthorizationCode,
 			AuthURL:                   "https://account-d.docusign.com/oauth/auth",
 			TokenURL:                  "https://account-d.docusign.com/oauth/token",
 			ExplicitScopesRequired:    true,
 			ExplicitWorkspaceRequired: false,
+			TokenMetadataFields: TokenMetadataFields{
+				ScopesField: "scope",
+			},
 		},
 		Support: Support{
 			BulkWrite: BulkWriteSupport{
@@ -713,7 +724,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 				Upsert: false,
 				Delete: false,
 			},
-			Proxy:     false,
+			Proxy:     true,
 			Read:      false,
 			Subscribe: false,
 			Write:     false,
@@ -1040,7 +1051,7 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 				Upsert: false,
 				Delete: false,
 			},
-			Proxy:     false,
+			Proxy:     true,
 			Read:      false,
 			Subscribe: false,
 			Write:     false,
@@ -1447,4 +1458,56 @@ var catalog = CatalogType{ // nolint:gochecknoglobals
 			Write:     false,
 		},
 	},
+	// ClickUp Support Configuration
+	ClickUp: {
+		AuthType: Oauth2,
+		BaseURL:  "https://api.clickup.com",
+		OauthOpts: OauthOpts{
+			GrantType:                 AuthorizationCode,
+			AuthURL:                   "https://app.clickup.com/api",
+			TokenURL:                  "https://api.clickup.com/api/v2/oauth/token",
+			ExplicitScopesRequired:    false,
+			ExplicitWorkspaceRequired: false,
+		},
+		Support: Support{
+			BulkWrite: BulkWriteSupport{
+				Insert: false,
+				Update: false,
+				Upsert: false,
+				Delete: false,
+			},
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
+
+	// Discord Support Configuration
+	Discord: {
+		AuthType: Oauth2,
+		BaseURL:  "https://discord.com",
+		OauthOpts: OauthOpts{
+			GrantType:                 AuthorizationCode,
+			AuthURL:                   "https://discord.com/oauth2/authorize",
+			TokenURL:                  "https://discord.com/api/oauth2/token",
+			ExplicitScopesRequired:    true,
+			ExplicitWorkspaceRequired: false,
+			TokenMetadataFields: TokenMetadataFields{
+				ScopesField: "scope",
+			},
+		},
+		Support: Support{
+			BulkWrite: BulkWriteSupport{
+				Insert: false,
+				Update: false,
+				Upsert: false,
+				Delete: false,
+			},
+			Proxy:     false,
+			Read:      false,
+			Subscribe: false,
+			Write:     false,
+		},
+	},
 }


Test patch:
diff --git a/providers/catalog_test.go b/providers/catalog_test.go
index 6d08361b..c90b1ed2 100644
--- a/providers/catalog_test.go
+++ b/providers/catalog_test.go
@@ -591,10 +591,15 @@ var testCases = []struct { // nolint
 		expected: &ProviderInfo{
 			AuthType: Oauth2,
 			OauthOpts: OauthOpts{
+				GrantType:                 AuthorizationCode,
 				AuthURL:                   "https://www.dropbox.com/oauth2/authorize",
 				TokenURL:                  "https://api.dropboxapi.com/oauth2/token",
 				ExplicitScopesRequired:    false,
 				ExplicitWorkspaceRequired: false,
+				TokenMetadataFields: TokenMetadataFields{
+					ScopesField:      "scope",
+					ConsumerRefField: "account_id",
+				},
 			},
 			Support: Support{
 				BulkWrite: BulkWriteSupport{
@@ -603,7 +608,7 @@ var testCases = []struct { // nolint
 					Upsert: false,
 					Delete: false,
 				},
-				Proxy:     false,
+				Proxy:     true,
 				Read:      false,
 				Subscribe: false,
 				Write:     false,
@@ -771,14 +776,18 @@ var testCases = []struct { // nolint
 					Delete: false,
 				},
 				Subscribe: false,
-				Proxy:     false,
+				Proxy:     true,
 			},
 			AuthType: Oauth2,
 			OauthOpts: OauthOpts{
+				GrantType:                 AuthorizationCode,
 				AuthURL:                   "https://account-d.docusign.com/oauth/auth",
 				TokenURL:                  "https://account-d.docusign.com/oauth/token",
 				ExplicitScopesRequired:    true,
 				ExplicitWorkspaceRequired: false,
+				TokenMetadataFields: TokenMetadataFields{
+					ScopesField: "scope",
+				},
 			},
 			BaseURL: "https://demo.docusign.net",
 		},
@@ -1149,7 +1158,7 @@ var testCases = []struct { // nolint
 					Delete: false,
 				},
 				Subscribe: false,
-				Proxy:     false,
+				Proxy:     true,
 			},
 			AuthType: Oauth2,
 			OauthOpts: OauthOpts{
@@ -1624,6 +1633,65 @@ var testCases = []struct { // nolint
 		},
 		expectedErr: nil,
 	},
+	{
+		provider:    ClickUp,
+		description: "Valid ClickUp provider config with no substitutions",
+		expected: &ProviderInfo{
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				GrantType:                 AuthorizationCode,
+				AuthURL:                   "https://app.clickup.com/api",
+				TokenURL:                  "https://api.clickup.com/api/v2/oauth/token",
+				ExplicitScopesRequired:    false,
+				ExplicitWorkspaceRequired: false,
+			},
+			Support: Support{
+				BulkWrite: BulkWriteSupport{
+					Insert: false,
+					Update: false,
+					Upsert: false,
+					Delete: false,
+				},
+				Proxy:     false,
+				Read:      false,
+				Subscribe: false,
+				Write:     false,
+			},
+			BaseURL: "https://api.clickup.com",
+		},
+		expectedErr: nil,
+	},
+	{
+		provider:    Discord,
+		description: "Valid Discord provider config with no substitutions",
+		expected: &ProviderInfo{
+			AuthType: Oauth2,
+			OauthOpts: OauthOpts{
+				GrantType:                 AuthorizationCode,
+				AuthURL:                   "https://discord.com/oauth2/authorize",
+				TokenURL:                  "https://discord.com/api/oauth2/token",
+				ExplicitScopesRequired:    true,
+				ExplicitWorkspaceRequired: false,
+				TokenMetadataFields: TokenMetadataFields{
+					ScopesField: "scope",
+				},
+			},
+			Support: Support{
+				BulkWrite: BulkWriteSupport{
+					Insert: false,
+					Update: false,
+					Upsert: false,
+					Delete: false,
+				},
+				Proxy:     false,
+				Read:      false,
+				Subscribe: false,
+				Write:     false,
+			},
+			BaseURL: "https://discord.com",
+		},
+		expectedErr: nil,
+	},
 }
 
 func TestReadInfo(t *testing.T) { // nolint