Skip to content

Commit

Permalink
Merge pull request #10 from algolia/fix/api-single-return-type
Browse files Browse the repository at this point in the history
fix(api-single-template): correct return type
  • Loading branch information
shortcuts authored Nov 18, 2021
2 parents 8a22000 + 713a681 commit d4e2278
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion algolia-typescript-template/api-single.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class {{classname}} {
* @param {{paramName}} {{description}}
{{/allParams}}
*/
public async {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; {{#returnType}}body: {{{returnType}}}; {{/returnType}}{{^returnType}}body?: any; {{/returnType}} }> {
public async {{nickname}} ({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{{{returnType}}}> {
const path = '{{{path}}}'{{#pathParams}}
.replace('{' + '{{baseName}}' + '}', encodeURIComponent(String({{paramName}}))){{/pathParams}};
let headers: Headers = {};
Expand Down
6 changes: 3 additions & 3 deletions output/client-search/searchApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class SearchApi {
indexName: string,
batchObject: BatchObject,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{ response: http.IncomingMessage; body: BatchResponse }> {
): Promise<BatchResponse> {
const path = '/1/indexes/{indexName}/batch'.replace(
'{' + 'indexName' + '}',
encodeURIComponent(String(indexName))
Expand Down Expand Up @@ -151,7 +151,7 @@ export class SearchApi {
public async multipleQueries(
multipleQueriesObject: MultipleQueriesObject,
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{ response: http.IncomingMessage; body: MultipleQueriesResponse }> {
): Promise<MultipleQueriesResponse> {
const path = '/1/indexes/*/queries';
let headers: Headers = {};
let queryParameters: Record<string, string> = {};
Expand Down Expand Up @@ -218,7 +218,7 @@ export class SearchApi {
indexName: string,
requestBody: { [key: string]: object },
options: { headers: { [name: string]: string } } = { headers: {} }
): Promise<{ response: http.IncomingMessage; body: SaveObjectResponse }> {
): Promise<SaveObjectResponse> {
const path = '/1/indexes/{indexName}'.replace(
'{' + 'indexName' + '}',
encodeURIComponent(String(indexName))
Expand Down
1 change: 0 additions & 1 deletion output/complement

This file was deleted.

4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ __metadata:

"algoliasearch-client-javascript@file:output/::locator=%40algolia%2Fautomation-javascript-client%40workspace%3A.":
version: 5.0.0
resolution: "algoliasearch-client-javascript@file:output/#output/::hash=892be8&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
checksum: efc65e36fc802d92d12c6d199daad038886325e334f9067d65242da736a3fd098b18ebaaf37914f58a04f95b3f474d4cfbc04264db8bd429c22f9785c6d2b804
resolution: "algoliasearch-client-javascript@file:output/#output/::hash=4ddc2e&locator=%40algolia%2Fautomation-javascript-client%40workspace%3A."
checksum: 2d82602e6f0874106d06f1118faa6dc32bdfbb367ff0a454890b82b4b7f5853270f509db510aeecd178646063840b03f920a5f5ea402f492d1f9a6101abaa592
languageName: node
linkType: hard

Expand Down

0 comments on commit d4e2278

Please sign in to comment.