Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TypeScript-Angular] Add AuthService example to README.md #6087

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '{{npmName}}';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '{{npmName}}';

Expand Down
25 changes: 25 additions & 0 deletions samples/client/petstore/typescript-angular-v2/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '';

Expand Down
25 changes: 25 additions & 0 deletions samples/client/petstore/typescript-angular-v2/npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '@openapitools/angular2-typescript-petstore';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '@openapitools/angular2-typescript-petstore';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '';

Expand Down
25 changes: 25 additions & 0 deletions samples/client/petstore/typescript-angular-v4.3/npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '@openapitools/angular2-typescript-petstore';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '@openapitools/angular2-typescript-petstore';

Expand Down
25 changes: 25 additions & 0 deletions samples/client/petstore/typescript-angular-v4/npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '@openapitools/angular2-typescript-petstore';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '@openapitools/angular2-typescript-petstore';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '@openapitools/typescript-angular-petstore';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '@openapitools/typescript-angular-petstore';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,31 @@ export function apiConfigFactory (): Configuration => {
export class AppModule {}
```

```
// configuring providers with an authentication service that manages your access tokens
import { ApiModule, Configuration } from '@openapitools/typescript-angular-petstore';

@NgModule({
imports: [ ApiModule ],
declarations: [ AppComponent ],
providers: [
{
provide: Configuration,
useFactory: (authService: AuthService) => new Configuration(
{
basePath: environment.apiUrl,
accessToken: authService.getAccessToken.bind(authService)
}
),
deps: [AuthService],
multi: false
}
],
bootstrap: [ AppComponent ]
})
export class AppModule {}
```

```
import { DefaultApi } from '@openapitools/typescript-angular-petstore';

Expand Down
Loading