예제 #1
0
class ManuallyTrackedBalancesResource(BaseResource):

    get_schema = AsyncQueryArgumentSchema()
    edit_schema = ManuallyTrackedBalancesSchema()
    delete_schema = ManuallyTrackedBalancesDeleteSchema()

    @use_kwargs(get_schema, location='json_and_query')
    def get(self, async_query: bool) -> Response:
        return self.rest_api.get_manually_tracked_balances(async_query)

    @use_kwargs(edit_schema, location='json')
    def put(self, async_query: bool,
            balances: List[ManuallyTrackedBalance]) -> Response:
        return self.rest_api.add_manually_tracked_balances(
            async_query=async_query, data=balances)

    @use_kwargs(edit_schema, location='json')
    def patch(self, async_query: bool,
              balances: List[ManuallyTrackedBalance]) -> Response:
        return self.rest_api.edit_manually_tracked_balances(
            async_query=async_query, data=balances)

    @use_kwargs(delete_schema, location='json')
    def delete(self, async_query: bool, labels: List[str]) -> Response:
        return self.rest_api.remove_manually_tracked_balances(
            async_query=async_query,
            labels=labels,
        )
예제 #2
0
class ManuallyTrackedBalancesResource(BaseResource):

    edit_schema = ManuallyTrackedBalancesSchema()
    delete_schema = ManuallyTrackedBalancesDeleteSchema()

    def get(self) -> Response:
        return self.rest_api.get_manually_tracked_balances()

    @use_kwargs(edit_schema, location='json')  # type: ignore
    def put(self, balances: List[ManuallyTrackedBalance]) -> Response:
        return self.rest_api.add_manually_tracked_balances(data=balances)

    @use_kwargs(edit_schema, location='json')  # type: ignore
    def patch(self, balances: List[ManuallyTrackedBalance]) -> Response:
        return self.rest_api.edit_manually_tracked_balances(data=balances)

    @use_kwargs(delete_schema, location='json')  # type: ignore
    def delete(self, labels: List[str]) -> Response:
        return self.rest_api.remove_manually_tracked_balances(labels=labels)