merge-api / merge-python-client

The Python SDK for accessing various Merge Unified APIs
Other
6 stars 11 forks source link

Typed integration names #52

Closed Vivalldi closed 1 year ago

Vivalldi commented 1 year ago

When creating a link token we have the option to specify a specific integration. It would be nice if this value was typed so that we don't have to guess at the underlying values that the api accepts.

diff --git a/example.py b/example.py
index 31ef560..3fd57e9 100644
--- a/example.py
+++ b/example.py
@@ -1,9 +1,9 @@
-from merge.resources.crm.types import CategoriesEnum
+from merge.resources.crm.types import CategoriesEnum, IntegrationsEnum

 merge_client.crm.link_token.create(
     end_user_email_address="an@email.com",
     end_user_organization_name="An org",
     end_user_origin_id="some-euoid",
     categories=[CategoriesEnum.CRM],
-    integration="salesforce",
+    integration=IntegrationsEnum.Salesforce,
 )
dsinghvi commented 1 year ago

@rmkonnur should we type this appropriately in the OpenAPI spec?

rmkonnur commented 1 year ago

Hi @Vivalldi, This is intentional behavior on our part to not type the field as an enum. The list of our integrations changes (increases) frequently meaning an enum would need to be manually updated across all our services every time a new integration is released. Rather we provide a list of Integration slugs that are valid and auto-updated in our docs which would be the string you would pass in the integration field.

https://docs.merge.dev/guides/merge-link/single-integration/

This raises a good point of a bug in our docs on the create-link-token endpoint. The hyperlink in the integration body parameter should point to the above link! We will fix that soon.

I will close this issue for now, please reopen or reach out via support@merge.dev if there are further concerns.