2.1.82 • Published 2 years ago

@funcate/sigweb-cti-api v2.1.82

Weekly downloads
143
License
Unlicense
Repository
-
Last release
2 years ago

sigweb-cti-api

Building

To install the required dependencies and to build the typescript sources run:

npm install
npm run build

If need edit the api.module.ts because an error breaks the build:

from:

ModuleWithProviders {

to:

ModuleWithProviders<ApiModule> {

publishing

First build the package than run npm publish dist (don't forget to specify the dist folder!)

Check if name of package in package.json include the organization name.

{"name": "@funcate/sigweb-cti-api",...}

npm login
npm publish --access public dist/

consuming

Navigate to the folder of your consuming project and run one of next commands.

published:

npm install sigweb-cti-api@1.0.0 --save

without publishing (not recommended):

npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save

It's important to take the tgz file, otherwise you'll get trouble with links on windows.

using npm link:

In PATH_TO_GENERATED_PACKAGE/dist:

npm link

In your project:

npm link sigweb-cti-api

Note for Windows users: The Angular CLI has troubles to use linked npm packages. Please refer to this issue https://github.com/angular/angular-cli/issues/8284 for a solution / workaround. Published packages are not effected by this issue.

General usage

In your Angular project:

// without configuring providers
import { ApiModule } from 'sigweb-cti-api';
import { HttpClientModule } from '@angular/common/http';


@NgModule({
    imports: [
        ApiModule,
        // make sure to import the HttpClientModule in the AppModule only,
        // see https://github.com/angular/angular/issues/20575
        HttpClientModule
    ],
    declarations: [ AppComponent ],
    providers: [],
    bootstrap: [ AppComponent ]
})
export class AppModule {}
// configuring providers
import { ApiModule, Configuration, ConfigurationParameters } from 'sigweb-cti-api';

export function apiConfigFactory (): Configuration => {
  const params: ConfigurationParameters = {
    // set configuration parameters here.
  }
  return new Configuration(params);
}

@NgModule({
    imports: [ ApiModule.forRoot(apiConfigFactory) ],
    declarations: [ AppComponent ],
    providers: [],
    bootstrap: [ AppComponent ]
})
export class AppModule {}
import { DefaultApi } from 'sigweb-cti-api';

export class AppComponent {
	 constructor(private apiGateway: DefaultApi) { }
}

Note: The ApiModule is restricted to being instantiated once app wide. This is to ensure that all services are treated as singletons.

Using multiple swagger files / APIs / ApiModules

In order to use multiple ApiModules generated from different swagger files, you can create an alias name when importing the modules in order to avoid naming conflicts:

import { ApiModule } from 'my-api-path';
import { ApiModule as OtherApiModule } from 'my-other-api-path';
import { HttpClientModule } from '@angular/common/http';


@NgModule({
  imports: [
    ApiModule,
    OtherApiModule,
    // make sure to import the HttpClientModule in the AppModule only,
    // see https://github.com/angular/angular/issues/20575
    HttpClientModule
  ]
})
export class AppModule {

}

Set service base path

If different than the generated base path, during app bootstrap, you can provide the base path to your service.

import { BASE_PATH } from 'sigweb-cti-api';

bootstrap(AppComponent, [
    { provide: BASE_PATH, useValue: 'https://your-web-service.com' },
]);

or

import { BASE_PATH } from 'sigweb-cti-api';

@NgModule({
    imports: [],
    declarations: [ AppComponent ],
    providers: [ provide: BASE_PATH, useValue: 'https://your-web-service.com' ],
    bootstrap: [ AppComponent ]
})
export class AppModule {}

Using @angular/cli

First extend your src/environments/*.ts files by adding the corresponding base path:

export const environment = {
  production: false,
  API_BASE_PATH: 'http://127.0.0.1:8080'
};

In the src/app/app.module.ts:

import { BASE_PATH } from 'sigweb-cti-api';
import { environment } from '../environments/environment';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [ ],
  providers: [{ provide: BASE_PATH, useValue: environment.API_BASE_PATH }],
  bootstrap: [ AppComponent ]
})
export class AppModule { }
2.1.82

2 years ago

2.1.81

2 years ago

2.1.80

2 years ago

2.1.49

2 years ago

2.1.47

2 years ago

2.1.48

2 years ago

2.1.45

2 years ago

2.1.46

2 years ago

2.1.58

2 years ago

2.1.59

2 years ago

2.1.56

2 years ago

2.1.57

2 years ago

2.1.54

2 years ago

2.1.55

2 years ago

2.1.52

2 years ago

2.1.53

2 years ago

2.1.50

2 years ago

2.1.51

2 years ago

2.1.69

2 years ago

2.1.67

2 years ago

2.1.68

2 years ago

2.1.65

2 years ago

2.1.66

2 years ago

2.1.63

2 years ago

2.1.64

2 years ago

2.1.61

2 years ago

2.1.62

2 years ago

2.1.60

2 years ago

2.1.78

2 years ago

2.1.79

2 years ago

2.1.76

2 years ago

2.1.77

2 years ago

2.1.74

2 years ago

2.1.75

2 years ago

2.1.72

2 years ago

2.1.73

2 years ago

2.1.70

2 years ago

2.1.71

2 years ago

2.1.43

2 years ago

2.1.41

2 years ago

2.1.42

2 years ago

2.1.40

2 years ago

2.1.38

2 years ago

2.1.39

2 years ago

2.1.37

2 years ago

2.1.29

2 years ago

2.1.36

2 years ago

2.1.35

2 years ago

2.1.30

2 years ago

2.1.31

2 years ago

2.1.27

3 years ago

2.1.28

2 years ago

2.1.25

3 years ago

2.1.26

3 years ago

2.1.24

3 years ago

2.1.19

3 years ago

2.1.23

3 years ago

2.1.21

3 years ago

2.1.22

3 years ago

2.1.20

3 years ago

2.1.11

3 years ago

2.1.9

3 years ago

2.1.10

3 years ago

2.1.4

3 years ago

2.1.3

3 years ago

2.1.6

3 years ago

2.1.5

3 years ago

2.1.8

3 years ago

2.1.7

3 years ago

2.1.2

4 years ago

2.1.1

4 years ago

2.0.5

4 years ago

2.1.0

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.2-2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.3.24

4 years ago

1.3.25

4 years ago

1.3.22

4 years ago

1.3.23

4 years ago

1.3.21

4 years ago

1.3.20

4 years ago

1.3.17

4 years ago

1.3.18

4 years ago

1.3.16

4 years ago

1.3.19

4 years ago

1.3.17-2

4 years ago

1.3.5

4 years ago

1.3.14

4 years ago

1.3.15

4 years ago

1.3.4

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.10

4 years ago

1.2.9

4 years ago

1.2.8

4 years ago

1.2.7

4 years ago

1.2.6

4 years ago

1.2.5

4 years ago

1.2.2

4 years ago

1.1.8

4 years ago

1.2.1

4 years ago

1.1.7

4 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.0.2

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago