-
Notifications
You must be signed in to change notification settings - Fork 18
fix(client): pass correct client reference to root resources #50
Changes from all commits
9dc76c6
992e70a
c7d1c63
5d3212e
e147c5b
d20ffc2
9213c91
abc47fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| dist: trusty | ||
|
|
||
| language: node_js | ||
|
|
||
| sudo: required | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,8 +25,7 @@ export function getRequestSnippet(method: any, resource: any) { | |
| } | ||
|
|
||
| const parts = resource.relativeUri.split(/(?=[\/\.])/g); | ||
|
|
||
| return parts.map((part: string) => { | ||
| const requestMethod = parts.map((part: string) => { | ||
| const methodName = toMethodName(part); | ||
| const uriParams = Object.keys(getUsedUriParameters(part, resource.uriParameters)); | ||
|
|
||
|
|
@@ -35,7 +34,9 @@ export function getRequestSnippet(method: any, resource: any) { | |
| } | ||
|
|
||
| return `${methodName}`; | ||
| }).join('.') + `.${camelCase(method.method)}([${type}, [options]])`; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to make this change because TSLint failed due to this string concatenation, it expects template literals. |
||
| }).join('.'); | ||
|
|
||
| return `${requestMethod}.${camelCase(method.method)}([${type}, [options]])`; | ||
| } | ||
|
|
||
| /** | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,7 +186,7 @@ const request = (client, method, path, opts) => { | |
| } | ||
|
|
||
| // Create prototype resources. | ||
| private createProtoResources(withParams: KeyedNestedResources, noParams: KeyedNestedResources) { | ||
| private createProtoResources(withParams: KeyedNestedResources, client: string, noParams: KeyedNestedResources) { | ||
| for (const key of Object.keys(withParams)) { | ||
| const child = withParams[key]; | ||
|
|
||
|
|
@@ -196,7 +196,7 @@ const request = (client, method, path, opts) => { | |
| } | ||
|
|
||
| this.buffer.append(`\n`); | ||
| this.buffer.append(` ${child.methodName}${this.toParamsMethod(child, 'this.client', true)}`); | ||
| this.buffer.append(` ${child.methodName}${this.toParamsMethod(child, client, true)}`); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -223,7 +223,7 @@ const request = (client, method, path, opts) => { | |
|
|
||
| this.createThisResources(withParams, noParams, 'this.client'); | ||
| this.buffer.line(` }`); | ||
| this.createProtoResources(withParams, noParams); | ||
| this.createProtoResources(withParams, 'this.client', noParams); | ||
| this.createProtoMethods(resource.methods, 'this.client', 'this.path'); | ||
| if (className.indexOf('.') > 0) { | ||
| this.buffer.line(`};`); | ||
|
|
@@ -368,7 +368,7 @@ class Client { | |
| } | ||
| } | ||
| this.createProtoMethods(this.nestedTree.methods, 'this', `''`); | ||
| this.createProtoResources(this.withParams, this.noParams); | ||
| this.createProtoResources(this.withParams, 'this', this.noParams); | ||
| this.buffer.line(`}`); | ||
| } | ||
|
|
||
|
|
@@ -382,7 +382,7 @@ class Client { | |
|
|
||
| if (scheme.type === 'OAuth 2.0') { | ||
| this.buffer.return(); | ||
| this.buffer.line('// eslint-disable-next-line'); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to make this change because TSLint failed due to it expects two indentation spaces |
||
| this.buffer.line(' // eslint-disable-next-line'); | ||
| this.buffer.line(` ${name}: function ${name}(options) {`); | ||
| this.buffer.multiline(` const schemeSettings = ${this.formatJSON(scheme.settings, 2, 4)};`); | ||
| this.buffer.line(` return new ClientOAuth2(Object.assign(schemeSettings, options));`); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,5 +35,5 @@ export const packageTemplate = (api: Api) => { | |
| } | ||
| }; | ||
|
|
||
| return JSON.stringify(json, null, 2) + '\n'; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had to make this change because TSLint failed due to this string concatenation, it expects template literals. |
||
| return `${JSON.stringify(json, null, 2)}\n`; | ||
| }; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Travis CI was failing, after researching a bit I found that
dist: trustyis needed ifxvfbis used directly.Doc: https://docs.travis-ci.com/user/gui-and-headless-browsers/#using-xvfb-directly