diff --git a/alice/onboarding/onboarding.py b/alice/onboarding/onboarding.py index ded81ba..ddc8544 100644 --- a/alice/onboarding/onboarding.py +++ b/alice/onboarding/onboarding.py @@ -371,11 +371,14 @@ def void_selfie( ) def supported_documents( - self, user_id: str, verbose: bool = False + self, user_id: str = None, verbose: bool = False ) -> Result[Dict[str, str], OnboardingError]: """ This method is used to obtain a hierarchical-ordered dict with the information of the documents supported by the API. + This method can be called accessed with both USER_TOKEN and BACKEND_TOKEN. + If you provide a user_id this method call it using the USER_TOKEN, otherwise it will be called with the BACKEND_TOKEN + Parameters ---------- user_id diff --git a/alice/onboarding/onboarding_client.py b/alice/onboarding/onboarding_client.py index 175f6b5..63a2cc5 100644 --- a/alice/onboarding/onboarding_client.py +++ b/alice/onboarding/onboarding_client.py @@ -410,10 +410,15 @@ def supported_documents(self, user_id: str, verbose: bool = False) -> Response: A Response object [requests library] """ print_intro("supported_documents", verbose=verbose) - user_token = self.auth.create_user_token(user_id).unwrap() - print_token("user_token", user_token, verbose=verbose) - headers = self._auth_headers(user_token) + if user_id: + token = self.auth.create_user_token(user_id).unwrap() + print_token("user_token", token, verbose=verbose) + else: + token = self.auth.create_backend_token().unwrap() + print_token("backend_token", token, verbose=verbose) + + headers = self._auth_headers(token) response = requests.get(self.url + "/documents/supported", headers=headers) print_response(response=response, verbose=verbose) diff --git a/examples/onboarding_with_webhooks.py b/examples/onboarding_with_webhooks.py index 24961d5..fe2d0d2 100644 --- a/examples/onboarding_with_webhooks.py +++ b/examples/onboarding_with_webhooks.py @@ -43,7 +43,7 @@ def configure_webhooks(api_key: str, verbose: bool = False): webhooks_client.update_webhook(webhook_to_update, verbose) # Send a ping using configured webhook - webhooks_client.ping_webhook(webhook_id, verbose) + result = webhooks_client.ping_webhook(webhook_id, verbose) # Retrieve an existent Webhook retrieved_webhook = webhooks_client.get_webhook(webhook_id, verbose).unwrap()