0.0.6 • Published 5 years ago

mvplus-network v0.0.6

Weekly downloads
1,155
License
-
Repository
-
Last release
5 years ago

MvplusNetwork

This project was generated with Angular CLI version 6.2.5.

Support

  • Angular version >=5.0.0
  • Rxjs@ version >=5.0.0

Upgrade version of npm plugin

Change manually the version in projects/mvplus-network/package.json

Build package

npm run package

Publish on npm

npm login

npm publish dist/mvplus-network/mvplus-network-${your-version}.tgz

Usage

Import module

Import MvplusNetworkModule in your app (or core if you have) module, calling forRoot method, passing the backend endpoint where the API must be called :

Example core.module.ts

@NgModule({
    imports: [
        BrowserModule,
        MvplusNetworkModule.forRoot({backendEndpoint: 'http://demo.virt.moviplus.ch:8083/tpc_app_clients/1.32.4'})
    ],
    providers: [],
    exports: [MvplusNetworkModule]
})

Usage of API

Example

@Injectable()
export class MyService {
    constructor(
        private mvplusNetworkService: MvplusNetworkService) {
    }

    public foo() {
        this.mvplusNetworkService.$getNetworkTypeById('3454354325432').subscribe((network)=>{
          console.log(network);
        })
    }
}

Network interface

export interface Network {
  name: NetworkType;
  id: string;
}

Network type available

export enum NetworkType {
  TPC = 'Transports Publics du Chablais',
  RegionAlps = 'RegionAlps',
  CFF = 'SBB CFF',
  CarPostal = 'CarPostal'
}

NOTE : The value of each enum must be corresponding to the name of network returned by the server

Changelog

0.0.6

  • Bugfix when no network found

0.0.5

  • Bugfix on exporting interface of lib

0.0.4

  • Export enum NetworkType enum
  • Export enum Network interface

0.0.3

  • Add TPG network type

0.0.2

  • Bugfix when no networks found or if backend endpoint is unreachable/invalid
0.0.6

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