{"id":18753275,"url":"https://github.com/kpn/combadge","last_synced_at":"2025-04-13T00:31:35.522Z","repository":{"id":65943458,"uuid":"593711709","full_name":"kpn/combadge","owner":"kpn","description":"Generic API clients based on Pydantic and protocols","archived":false,"fork":false,"pushed_at":"2025-04-10T20:00:24.000Z","size":1037,"stargazers_count":12,"open_issues_count":10,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-10T21:19:04.627Z","etag":null,"topics":["annotations","api","api-client","httpx","pydantic","python","python3","soap","soap-client","typed","zeep"],"latest_commit_sha":null,"homepage":"https://kpn.github.io/combadge","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kpn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":"docs/support/backends/httpx.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-26T17:09:19.000Z","updated_at":"2025-01-30T16:42:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"8708ba1c-a979-49f6-b922-57320fe2d422","html_url":"https://github.com/kpn/combadge","commit_stats":{"total_commits":175,"total_committers":1,"mean_commits":175.0,"dds":0.0,"last_synced_commit":"04adffbcccc1974698dba1777fa6b777eea0ea32"},"previous_names":[],"tags_count":58,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpn%2Fcombadge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpn%2Fcombadge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpn%2Fcombadge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kpn%2Fcombadge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kpn","download_url":"https://codeload.github.com/kpn/combadge/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248650590,"owners_count":21139670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["annotations","api","api-client","httpx","pydantic","python","python3","soap","soap-client","typed","zeep"],"created_at":"2024-11-07T17:25:05.874Z","updated_at":"2025-04-13T00:31:34.598Z","avatar_url":"https://github.com/kpn.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Combadge\n\nCombadge generates a service client implementation from a user service interface\ndeclared by a [protocol](https://peps.python.org/pep-0544/) class or an abstract base class.\n\n[![Checks](https://img.shields.io/github/checks-status/kpn/combadge/main?logo=github)](https://github.com/kpn/combadge/actions/workflows/check.yaml)\n[![Coverage](https://codecov.io/gh/kpn/combadge/branch/main/graph/badge.svg?token=ZAqYAaTXwE)](https://codecov.io/gh/kpn/combadge)\n![Code style](https://img.shields.io/badge/code%20style-black-000000.svg)\n[![Python Version](https://img.shields.io/pypi/pyversions/combadge?logo=python\u0026logoColor=yellow)](https://pypi.org/project/combadge/)\n[![License](https://img.shields.io/github/license/kpn/combadge)](LICENSE)\n\n## Documentation\n\n\u003ca href=\"https://kpn.github.io/combadge/\"\u003e\n    \u003cimg alt=\"Documentation\" height=\"30em\" src=\"https://img.shields.io/github/actions/workflow/status/kpn/combadge/docs.yml?label=documentation\u0026logo=github\"\u003e\n\u003c/a\u003e\n\n## Sneak peek\n\n```python title=\"quickstart_httpx.py\"\nfrom httpx import Client\nfrom pydantic import BaseModel, Field\nfrom typing_extensions import Annotated, Protocol\n\nfrom combadge.support.http.markers import QueryParam, http_method, path\nfrom combadge.support.httpx.backends.sync import HttpxBackend\n\n\n# 1️⃣ Declare the response models:\nclass CurrentCondition(BaseModel):\n    humidity: int\n    temperature: Annotated[float, Field(alias=\"temp_C\")]\n\n\nclass Weather(BaseModel):\n    current: Annotated[list[CurrentCondition], Field(alias=\"current_condition\")]\n\n\n# 2️⃣ Declare the protocol:\nclass SupportsWttrIn(Protocol):\n    @http_method(\"GET\")\n    @path(\"/{in_}\")\n    def get_weather(\n        self,\n        *,\n        in_: str,\n        format_: Annotated[str, QueryParam(\"format\")] = \"j1\",\n    ) -\u003e Weather:\n        raise NotImplementedError\n\n\n# 3️⃣ Bind the service:\nwith HttpxBackend(Client(base_url=\"https://wttr.in\"))[SupportsWttrIn] as service:\n    # 🚀 Call the service:\n    response = service.get_weather(in_=\"amsterdam\")\n\nassert response.current[0].humidity == 71\nassert response.current[0].temperature == 8.0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpn%2Fcombadge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkpn%2Fcombadge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkpn%2Fcombadge/lists"}