Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 20, 2025

Adds HTTP API client for Sites endpoints following the existing Devices API pattern.

Implementation

  • Site model (sites/site.py): dataclass with id, name, created_at, updated_at
  • Sites client (sites/client.py): CRUD operations matching API spec
    • create(name) → POST /v3/sites
    • get(site_id) → GET /v3/sites/{site_id}
    • update(site_id, name) → PATCH /v3/sites/{site_id}
    • list() → GET /v3/sites (paginated async generator, limit=50)
    • delete(site_id) → DELETE /v3/sites/{site_id}
  • Integration: exposed via Client.sites property

Usage

async with enapter.http.api.Client(config) as client:
    site = await client.sites.create(name="Production")
    async for site in client.sites.list():
        print(site)
    await client.sites.update(site.id, name="Updated")
    await client.sites.delete(site.id)

Follows Devices API conventions: DTO serialization with from_dto()/to_dto(), error handling via api.check_error(), ISO datetime formatting.

Original prompt

This section details on the original issue you should resolve

<issue_title>Implement HTTP API Client: Sites API</issue_title>
<issue_description>- [ ] Create Site

<agent_instructions>Use the current HTTP API client implementation (src/enapter/http/api) as a reference.</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Implement HTTP API Client for Sites API Implement Sites API client Nov 20, 2025
Copilot AI requested a review from rnovatorov November 20, 2025 20:35
Copilot finished work on behalf of rnovatorov November 20, 2025 20:35
@rnovatorov rnovatorov force-pushed the copilot/implement-sites-api-client branch from 8f9d8ba to 8de5e2f Compare December 1, 2025 11:27
Copy link
Member

@rnovatorov rnovatorov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed your changes and added a few fixes. LGTM now.

@rnovatorov rnovatorov marked this pull request as ready for review December 1, 2025 11:31
@rnovatorov rnovatorov merged commit 2de3b50 into main Dec 1, 2025
5 checks passed
@rnovatorov rnovatorov deleted the copilot/implement-sites-api-client branch December 1, 2025 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement HTTP API Client: Sites API

2 participants