Skip to content

Support geom_ref for SubscriptionsClient.list_subscriptions #1213

@tbarsballe

Description

@tbarsballe

Is your feature request related to a problem? Please describe.
The Planet Subscriptions API listSubscriptions reference lists the geom_ref property as a possible filter.

Describe the solution you'd like
The SubscriptionsClient.list_subscriptions method(s) do not support this filter. They should.

Describe alternatives you've considered
Hacking around the issue, but this is less than ideal. Example workaround:

async def _list_subscriptions_by_feature_ref(pl: Planet, feature_ref: str, status=None):
    try:
        params = {'geom_ref': feature_ref}
        if status:
            params['status'] = [val for val in status]

        class _SubscriptionsPager(Paged):
            ITEMS_KEY = "subscriptions"

        response = await pl.subscriptions._client._session.request(method="GET", url=pl.subscriptions._client._base_url, params=params)
        async for sub in _SubscriptionsPager(response, pl.subscriptions._client._session.request, limit=0):
            yield sub

    except APIError:
        raise
    except ClientError:
        raise

pl.subscriptions._client._aiter_to_iter(_list_subscriptions_by_feature_ref(pl, feature_ref, status) )

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions