0.12.16 • Published 8 months ago

@apaleo/angular-identity-api-proxy v0.12.16

Weekly downloads
63
License
Apache-2.0
Repository
github
Last release
8 months ago

@

Building

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

npm install
npm run build

publishing

First build the package than run npm publish

consuming

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

published:

npm install @ --save

without publishing (not recommended):

npm install PATH_TO_GENERATED_PACKAGE --save

using npm link:

In PATH_TO_GENERATED_PACKAGE:

npm link

In your project:

npm link 

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 '';
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 '';

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 '';

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 '';

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

or

import { BASE_PATH } from '';

@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 '';
import { environment } from '../environments/environment';

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

8 months ago

0.12.13

11 months ago

0.12.14

9 months ago

0.12.15

8 months ago

0.12.12

12 months ago

0.12.10

12 months ago

0.12.11

12 months ago

0.12.7

1 year ago

0.12.8

1 year ago

0.12.9

12 months ago

0.12.6

1 year ago

0.12.5

1 year ago

0.12.4

1 year ago

0.12.2

2 years ago

0.12.3

2 years ago

0.12.1

3 years ago

0.12.0

3 years ago

0.11.1

3 years ago

0.11.0

3 years ago

0.10.3

3 years ago

0.10.2

3 years ago

0.10.1

3 years ago

0.10.0

3 years ago

0.9.9

4 years ago

0.9.8

4 years ago

0.9.7

4 years ago

0.9.6

4 years ago

0.9.5

4 years ago

0.9.4

4 years ago

0.9.3

4 years ago

0.9.2

4 years ago

0.6.43

4 years ago

0.6.42

4 years ago

0.6.41

4 years ago

0.9.1

4 years ago

0.9.0

4 years ago

0.6.40

4 years ago

0.6.39

4 years ago

0.6.38

4 years ago

0.6.37

4 years ago

0.6.36

4 years ago

0.6.35

4 years ago

0.6.34

4 years ago

0.6.33

4 years ago

0.6.32

4 years ago

0.6.31

4 years ago

2.0.3

4 years ago

0.6.30

4 years ago

0.6.29

4 years ago

0.6.28

4 years ago

0.6.27

4 years ago

0.6.26

4 years ago

0.6.25

4 years ago

2.0.2

4 years ago

0.6.24

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

0.6.23

4 years ago

0.6.22

4 years ago

0.6.21

4 years ago

0.6.20

4 years ago

0.6.19

4 years ago

0.6.18

4 years ago

0.6.17

4 years ago

0.6.16

4 years ago

0.6.15

5 years ago

0.6.14

5 years ago

0.6.13

5 years ago

0.6.12

5 years ago

0.6.11

5 years ago

0.6.10

5 years ago

0.6.9

5 years ago

0.6.8

5 years ago

0.6.7

5 years ago

0.6.6

5 years ago

0.6.5

5 years ago

0.6.4

5 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.12

5 years ago

0.5.11

5 years ago

0.5.10

5 years ago

0.5.9

5 years ago

0.5.8

5 years ago

0.5.7

5 years ago

0.5.6

5 years ago

0.5.5

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

6 years ago

0.5.1

6 years ago

0.4.6

6 years ago

0.4.5

6 years ago

0.4.4

6 years ago

0.4.2

6 years ago

0.4.1

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago