0.1.2 • Published 4 years ago

@netfx/angular2-typescript-netfx v0.1.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

NetFx.io's Angular SDK

The official client library for Angular (6.0.0+) NetFx.io platform

This SDK aims to greatly improve developer productivity and reduce errors by providing discoverable, strongly-typed wrappers for all public endpoints and request/response models.

All included methods are a 1:1 reflection of the API with the addition of the NetFxAuthService for authentication and the NetFxTokenService exposed as a convenience service for setting and getting authentication tokens

Acknowledgement

This Angular SDK is made possible by leveraging Swagger's open source tools with our Open API Specification: https://netfx.io/swagger

Requirements

Installation

From the npm registry:

npm install --save @netfx/angular2-typescript-netfx

Configuration

In your root app module:

import { NetFxModule, Configuration } from '@netfx/angular2-typescript-netfx';

export function apiConfigFactory() {
  return new Configuration({
    authPath: `https:\\api.netfx.io\oauth\token`,
    basePath: `https:\\api.netfx.io`,
    cookiePrefix: `netfx`,
  });
}

@NgModule({
  declarations: [...],
  imports: [
    NetFxModule.forRoot(apiConfigFactory),
     ...
  ],
  providers: [...]
  bootstrap: [AppComponent]
})
export class AppModule {}

Example API call for OAuth authentication

import { Component, OnInit, Input } from '@angular/core';

import { ToastrService } from 'ngx-toastr';
import { TokenRequest } from './token-request';
import { NetFxAuthService, NetFxTokenService } from '@netfx/angular2-typescript-netfx';

@Component({
  selector: 'netfx-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.scss']
})
export class LoginComponent implements OnInit {
  @Input() credentials: TokenRequest = new TokenRequest();

  constructor(
    private toastr: ToastrService,
    private authService: NetFxAuthService,
    private tokenService: NetFxTokenService
  ) {
    this.credentials.username = 'example_username';
    this.credentials.password = 'XXXX';
    this.credentials.client_id = 'XXXX';
    this.credentials.grant_type = 'password';
    this.credentials.scope = ['FullAccess'];
  }

  ngOnInit() {
  }

  login(): void {
    this.authService.Get(this.credentials).subscribe(response => {
        this.tokenService.Set(response.access_token);
        this.toastr.success('Success', 'Login Attempt');
    });
  }

}
0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.2-1q

5 years ago

0.0.2-1p

5 years ago

0.0.2-1o

5 years ago

0.0.2-1n

5 years ago

0.0.2-1m

5 years ago

0.0.2-1l

5 years ago

0.0.2-1k

5 years ago

0.0.2-1j

5 years ago

0.0.2-1i

5 years ago

0.0.2-1h

5 years ago

0.0.2-1g

5 years ago

0.0.2-1f

5 years ago

0.0.2-1e

5 years ago

0.0.2-1d

5 years ago

0.0.2-1c

5 years ago

0.0.2-1b

5 years ago

0.0.2-1a

5 years ago

0.0.2-1

5 years ago

0.0.1-8q

5 years ago

0.0.1-8p

5 years ago

0.0.1-8o

5 years ago

0.0.1-8n

5 years ago

0.0.1-8m

5 years ago

0.0.1-8l

5 years ago

0.0.1-8k

5 years ago

0.0.1-8j

5 years ago

0.0.1-8i

5 years ago

0.0.1-8h

5 years ago

0.0.1-8g

5 years ago

0.0.1-8f

5 years ago

0.0.1-8e

5 years ago

0.0.1-8d

5 years ago

0.0.1-8c

5 years ago

0.0.1-8b

5 years ago

0.0.1-8a

5 years ago

0.0.1-8

5 years ago

0.0.1-7d

5 years ago

0.0.1-7c

5 years ago

0.0.1-7b

5 years ago

0.0.1-7a

5 years ago

0.0.1-7

5 years ago

0.0.1-6l

5 years ago

0.0.1-6k

5 years ago

0.0.1-6j

5 years ago

0.0.1-6i

5 years ago

0.0.1-6h

5 years ago

0.0.1-6g

5 years ago

0.0.1-6f

5 years ago

0.0.1-6e

5 years ago

0.0.1-6d

5 years ago

0.0.1-6c

5 years ago

0.0.1-6b

5 years ago

0.0.1-6a

5 years ago

0.0.1-6

5 years ago

0.0.1-5k

5 years ago

0.0.1-5j

5 years ago

0.0.1-5i

5 years ago

0.0.1-5h

5 years ago

0.0.1-5g

5 years ago

0.0.1-5f

5 years ago

0.0.1-5e

5 years ago

0.0.1-5d

5 years ago

0.0.1-5c

5 years ago

0.0.1-5b

5 years ago

0.0.1-5a

5 years ago

0.0.1-5

5 years ago

0.0.1-4

5 years ago

0.0.1-3

5 years ago

0.0.1-2

5 years ago

0.0.1-1

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago