GeezerVison is showing adk.dev — APIHubClient | ADK for TypeScript: API Reference - v2.5.0
Client for the API Hub REST API.
Each request sends a bearer token. The token is accessToken when it is
set; otherwise the client mints one from serviceAccountJson, or from
application default credentials when that is not set either. Minted tokens
are cached and refreshed by google-auth-library.
Constructors
Methods
getApi
-
getApi(apiResourceName: string): Promise<APIHubApi>
Gets an API by resource name.
Parameters
- apiResourceName: string
projects/{p}/locations/{l}/apis/{a}.
getApiVersion
-
Gets an API version by resource name.
Parameters
- apiVersionName: string
projects/{p}/locations/{l}/apis/{a}/versions/{v}.
getSpecContent
-
getSpecContent(path: string): Promise<string>
Returns the content of the first spec that path resolves to.
- A path naming an API resolves to the first spec of its first version.
- A path naming an API version resolves to the first spec of that version.
- A path naming an API spec resolves to that spec.
path may be a resource name such as
projects/my-project/locations/us-central1/apis/my-api, or a console URL
such as
https://console.cloud.google.com/apigee/api-hub/locations/us-central1/apis/my-api?project=my-project.
Parameters
- path: string
The API, API version or API spec to read.
Returns Promise<string>
The decoded spec content, or '' when the spec is empty.
Throws
When the path cannot be parsed, when the API has no versions, when
the version has no specs, or when a request fails.
listApis
-
listApis(project: string, location: string): Promise<APIHubApi[]>
Lists the APIs registered in a project and location.
Parameters
- project: string
The Google Cloud project ID.
- location: string
The API Hub location, for example us-central1.
Returns Promise<APIHubApi[]>
The APIs, or an empty array when there are none.