generated from coulomb/repo-seed
feat: add v2 api consumer bootstrap endpoints
This commit is contained in:
@@ -110,6 +110,14 @@ tsSdkClientClass = T.unlines
|
||||
, " return this.fetch('/hub-capability-manifests/' + id + '/activate', 'POST').then(r => r.json());"
|
||||
, " }"
|
||||
, ""
|
||||
, " async createApiConsumer(body: { name: string; description?: string; hubCapabilityManifestId?: string; rateLimitPerMinute?: number; quotaPerDay?: number }) {"
|
||||
, " return this.fetch('/api-consumers', 'POST', body).then(r => r.json());"
|
||||
, " }"
|
||||
, ""
|
||||
, " async createApiKey(apiConsumerId: string, body?: { scopes?: string }) {"
|
||||
, " return this.fetch('/api-consumers/' + apiConsumerId + '/api-keys', 'POST', body ?? {}).then(r => r.json());"
|
||||
, " }"
|
||||
, ""
|
||||
, " async getWidgets(params?: { page?: number; perPage?: number }) {"
|
||||
, " const q = params ? `?page=${params.page ?? 1}&per_page=${params.perPage ?? 50}` : '';"
|
||||
, " return this.fetch('/widgets' + q).then(r => r.json());"
|
||||
@@ -181,6 +189,19 @@ pyClientClass = T.unlines
|
||||
, " def activate_hub_capability_manifest(self, manifest_id: str) -> dict:"
|
||||
, " return self._request('/hub-capability-manifests/' + manifest_id + '/activate', 'POST')"
|
||||
, ""
|
||||
, " def create_api_consumer(self, name: str, description: Optional[str] = None, hub_capability_manifest_id: Optional[str] = None, rate_limit_per_minute: Optional[int] = None, quota_per_day: Optional[int] = None) -> dict:"
|
||||
, " body: dict = {'name': name}"
|
||||
, " if description: body['description'] = description"
|
||||
, " if hub_capability_manifest_id: body['hubCapabilityManifestId'] = hub_capability_manifest_id"
|
||||
, " if rate_limit_per_minute: body['rateLimitPerMinute'] = rate_limit_per_minute"
|
||||
, " if quota_per_day: body['quotaPerDay'] = quota_per_day"
|
||||
, " return self._request('/api-consumers', 'POST', body)"
|
||||
, ""
|
||||
, " def create_api_key(self, api_consumer_id: str, scopes: Optional[str] = None) -> dict:"
|
||||
, " body: dict = {}"
|
||||
, " if scopes: body['scopes'] = scopes"
|
||||
, " return self._request('/api-consumers/' + api_consumer_id + '/api-keys', 'POST', body)"
|
||||
, ""
|
||||
, " def get_widgets(self, page: int = 1, per_page: int = 50) -> dict:"
|
||||
, " return self._request(f'/widgets?page={page}&per_page={per_page}')"
|
||||
, ""
|
||||
|
||||
Reference in New Issue
Block a user