@vcd/angular-client
TypeScript icon, indicating that this package has built-in type declarations

0.0.2-alpha.0 • Public • Published

Usage examples

Authenticating

If you don't have an existing session, you can create one:

ngOnInit(): void {
this.client.login('username', 'org', 'pa$$w0rd').subscribe(() => {
console.log(`logged into ${this.client.organization} as ${this.client.username}`);
});

If you already have an existing session (because you're acting as a UI extension and have access to the authentication token for example) you can simply set the authentication of the client instance to use the Bearer token:

ngOnInit(): void {
this.client.setAuthentication(bearerToken).subscribe(() => {
console.log(`logged into ${this.client.organization} as ${this.client.username}`);
});

Querying the API

The query builder can be used to quickly create API calls that are compatible with the query service:

this.client.query(Query.Builder.ofType('virtualCenter'))).pipe(

tap(queryResult  =>  console.log(`Virtual centers: ${queryResult.total}`))

).subscribe();

Readme

Keywords

none

Package Sidebar

Install

npm i @vcd/angular-client

Weekly Downloads

68

Version

0.0.2-alpha.0

License

BSD-2

Unpacked Size

1.03 MB

Total Files

68

Last publish

Collaborators

  • cd-extensions
  • nvladimirovi
  • jmoroski
  • juanito.bsb