Package: silvr-client
silvr-clientA Python client for brokers to send new applications.Seedemo.pyto see how to use the API.InstallFrom PyPIpip install silvr-clientFrom sourcepip install -e .Demoexport BROKER_API_KEY="<api-key>"

CLIENT_EMAIL="john.doe@acme.com" \
COMPANY_REGISTRATION_NUMBER="123456789" \
python demo.pyAPIList existing applicationsimportosimporthttpximportjsonfromsilvr_clientimportSilvrClient,TokenAuthfromsilvr_client.modelsimportApplication,DocumentAPI_URL="https://demo.silvr.dev/api/"BROKER_API_KEY=os.getenv("BROKER_API_KEY")withSilvrClient(base_url=API_URL,auth=TokenAuth(BROKER_API_KEY))asclient:applications_response=client.applications()try:applications_response.raise_for_status()excepthttpx.HTTPStatusError:print(json.dumps(applications_response.json(),indent=2))applications=[Application.from_request(a)forainapplications_response.json()]Create new applicationimporthttpximportjsonfromsilvr_clientimportSilvrClient,TokenAuth,choicesfromsilvr_client.modelsimportApplication,DocumentCOMPANY_REGISTRATION_NUMBER="123456789"CLIENT_EMAIL="john.doe@acme.com"withSilvrClient(base_url=API_URL,auth=TokenAuth(BROKER_API_KEY))asclient:application=Application(first_name="John",last_name="Doe",email=CLIENT_EMAIL,phone_number="+33123456789",company_name="ACME SAS",company_registration_number=COMPANY_REGISTRATION_NUMBER,country=choices.Country.FR,expected_funding_amount_range=choices.ExpectedFundingAmountRange.BETWEEN_10K_AND_100K,declared_monthly_revenue_range=choices.DeclaredRevenueRange.BETWEEN_10K_AND_25K,declared_revenue_duration_range=choices.DeclaredRevenueDuration.ABOVE_12_MONTHS,additional_message="API demo",)application_response=application.save(client)try:application_response.raise_for_status()excepthttpx.HTTPStatusError:print(json.dumps(application_response.json(),indent=2))else:application=Application.from_request(application_response.json())Upload a new attachmentimporthttpximportjsonfromsilvr_clientimportSilvrClient,TokenAuth,choicesfromsilvr_client.modelsimportApplication,DocumentwithSilvrClient(base_url=API_URL,auth=TokenAuth(BROKER_API_KEY))asclient:application=Application.from_request(applications_response.json())# From the application objectdocument_response=application.upload_document(client,choices.UploadedFile("bank_statement.pdf",open("demo.pdf","rb"),choices.ContentType.PDF),choices.DocumentCategory.BANK_STATEMENT)document_response.raise_for_status()Document.from_request(document_response.json())# Or from the clientdocument_response=client.new_document(application_id=application.uuid,file=choices.UploadedFile("financial_statement.pdf",open("demo.pdf","rb"),choices.ContentType.PDF),category=choices.DocumentCategory.FINANCIAL_STATEMENT,)document_response.raise_for_status()Document.from_request(document_response.json())List all documentsimporthttpximportjsonfromsilvr_clientimportSilvrClient,TokenAuth,choicesfromsilvr_client.modelsimportApplication,DocumentwithSilvrClient(base_url=API_URL,auth=TokenAuth(BROKER_API_KEY))asclient:documents_response=client.documents(application_id=application.uuid,)documents_response.raise_for_status()documents=[Document.from_request(d)fordindocuments_response.json()]CHANGELOGThis document describes changes between each  past release.0.1.1 (2023-11-13)Add Silvr models dataclasses to help with the integration.Add API documentation in README0.1.0 (2023-11-13)Allow broker loginAllow sending applications