POC Quota API SDK/CLI#1217
Open
asonnenschein wants to merge 3 commits into
Open
Conversation
Contributor
Author
|
@asonnenschein to do - add tests. |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds first-pass SDK + CLI support for Planet’s Quota Reservations API, including an async client, sync wrapper on Planet, and a new planet quota CLI command group, plus integration tests for both API and CLI behavior.
Changes:
- Introduces
QuotaClient(async) with pagination support for the Quota API response shape. - Adds
QuotaAPI(sync) and exposes it asPlanet().quota. - Adds
planet quotaCLI group (products/reservations/jobs) and integration tests covering expected request/response behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/integration/test_quota_cli.py | New integration coverage for planet quota CLI subcommands and request parameter handling. |
| tests/integration/test_quota_api.py | New integration coverage for async + sync Quota API clients, pagination, and product filtering. |
| planet/sync/quota.py | New synchronous wrapper (QuotaAPI) around the async QuotaClient. |
| planet/sync/client.py | Exposes QuotaAPI as Planet().quota. |
| planet/clients/quota.py | New async QuotaClient + _QuotaPaged pagination adapter for {meta, results} responses. |
| planet/clients/init.py | Registers and exports QuotaClient for sess.client('quota') resolution. |
| planet/cli/types.py | Adds mypy override ignores for CommaSeparatedString/Float.convert signatures. |
| planet/cli/quota.py | New planet quota CLI group implementation using the async client. |
| planet/cli/cli.py | Registers the new quota CLI command group. |
| planet/init.py | Exports QuotaClient from the top-level planet package. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+17
to
+29
| from typing import Any, AsyncIterator, Dict, List, Optional, TypeVar | ||
|
|
||
| from planet.clients.base import _BaseClient | ||
| from planet.exceptions import APIError, ClientError | ||
| from planet.http import Session | ||
| from planet.models import Paged, Response | ||
| from ..constants import PLANET_BASE_URL | ||
|
|
||
| BASE_URL = f'{PLANET_BASE_URL}/account/v1' | ||
|
|
||
| LOGGER = logging.getLogger() | ||
|
|
||
| T = TypeVar("T") |
Comment on lines
+175
to
+184
| def _aoi_refs_from_options(aoi_ref: Tuple[str, ...], | ||
| aoi_refs_json: Optional[List[str]]) -> List[str]: | ||
| refs: List[str] = list(aoi_ref) | ||
| if aoi_refs_json: | ||
| refs.extend(aoi_refs_json) | ||
| if not refs: | ||
| raise click.BadParameter( | ||
| 'At least one AOI ref must be supplied via --aoi-ref or ' | ||
| '--aoi-refs.') | ||
| return refs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds support for the Planet Quota Reservations API to the SDK. Includes an async client, sync client, and CLI built on the
async client, following the same patterns used by the existing Planet APIs that are supported in the SDK.
Changes
QuotaClient(planet/clients/quota.py) covering all Quota Reservations API endpoints:list_reservations,get_reservation,create_reservation,bulk_create_reservations,estimate_reservation,list_jobs,get_job, pluslist_products(with optionalsupports_reservationfilter) for looking up theproduct_idrequired by reservation requests._QuotaPagedsubclass ofmodels.Pagedto handle the API's{meta: {next: ...}, results: [...]}pagination shape.QuotaAPI(planet/sync/quota.py) synchronous wrapper, exposed onPlanetaspl.quota.planet quotaCLI group (planet/cli/quota.py) withproducts,reservations, andjobssubcommands. List commands support--limit,--page-size,--sort,--fields, and repeated--filter KEY=VALUE. Mutation commands accept repeated--aoi-refor--aoi-refs <json>(string, file, or stdin) for large AOI lists.QuotaClientinplanet.clients._client_directorysosess.client('quota')resolves it, and exportQuotaClientfrom the top-levelplanetpackage.