Skip to content

Commit 89f6a53

Browse files
authored
Merge pull request #533 from swagger-api/MBcom-master
fixed conflict for #266 PR
2 parents 5a1cfa7 + 9200ff7 commit 89f6a53

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

src/main/resources/handlebars/typescript-angular/README.mustache

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ _without publishing (not recommended):_
3131

3232
```
3333
{{#useNgPackagr}}
34-
npm install PATH_TO_GENERATED_PACKAGE/dist --save
34+
npm install PATH_TO_GENERATED_PACKAGE/dist.tgz --save
3535
{{/useNgPackagr}}
3636
{{^useNgPackagr}}
37-
npm install PATH_TO_GENERATED_PACKAGE --save
37+
npm install PATH_TO_GENERATED_PACKAGE/{{npmName}}-{{npmVersion}}.tgz --save
3838
{{/useNgPackagr}}
39-
```
39+
It's important to take the tgz file, otherwise you'll get trouble with links on windows.
4040

4141
_using `npm link`:_
4242

@@ -190,4 +190,4 @@ import { environment } from '../environments/environment';
190190
bootstrap: [ AppComponent ]
191191
})
192192
export class AppModule { }
193-
```
193+
```

src/main/resources/handlebars/typescript-angular/api.service.mustache

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ export class {{classname}} {
218218
}
219219

220220
{{/isBasic}}
221+
{{#isBearer}}
222+
if (this.configuration.accessToken) {
223+
const accessToken = typeof this.configuration.accessToken === 'function'
224+
? this.configuration.accessToken()
225+
: this.configuration.accessToken;
226+
{{#useHttpClient}}headers = {{/useHttpClient}}headers.set('Authorization', 'Bearer ' + accessToken);
227+
}
228+
{{/isBearer}}
221229
{{#isOAuth}}
222230
if (this.configuration.accessToken) {
223231
const accessToken = typeof this.configuration.accessToken === 'function'
@@ -312,8 +320,8 @@ export class {{classname}} {
312320

313321
{{/hasFormParams}}
314322
{{#useHttpClient}}
315-
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}}
316-
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}}
323+
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#hasBodyParam}}
324+
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/hasBodyParam}}
317325
{
318326
{{#hasQueryParams}}
319327
params: queryParameters,

src/main/resources/mustache/typescript-angular/api.service.mustache

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ export class {{classname}} {
218218
}
219219

220220
{{/isBasic}}
221+
{{#isBearer}}
222+
if (this.configuration.accessToken) {
223+
const accessToken = typeof this.configuration.accessToken === 'function'
224+
? this.configuration.accessToken()
225+
: this.configuration.accessToken;
226+
{{#useHttpClient}}headers = {{/useHttpClient}}headers.set('Authorization', 'Bearer ' + accessToken);
227+
}
228+
{{/isBearer}}
221229
{{#isOAuth}}
222230
if (this.configuration.accessToken) {
223231
const accessToken = typeof this.configuration.accessToken === 'function'
@@ -312,8 +320,8 @@ export class {{classname}} {
312320

313321
{{/hasFormParams}}
314322
{{#useHttpClient}}
315-
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#isBodyAllowed}}
316-
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/isBodyAllowed}}
323+
return this.httpClient.{{httpMethod}}{{^isResponseFile}}<{{#returnType}}{{{returnType}}}{{#isResponseTypeFile}}|undefined{{/isResponseTypeFile}}{{/returnType}}{{^returnType}}any{{/returnType}}>{{/isResponseFile}}(`${this.basePath}{{{path}}}`,{{#hasBodyParam}}
324+
{{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}{{#hasFormParams}}convertFormParamsToString ? formParams.toString() : formParams{{/hasFormParams}}{{^hasFormParams}}null{{/hasFormParams}}{{/bodyParam}},{{/hasBodyParam}}
317325
{
318326
{{#hasQueryParams}}
319327
params: queryParameters,

0 commit comments

Comments
 (0)