@@ -21,26 +21,27 @@ export function create{{#lambda.titlecase}}{{apiName}}{{/lambda.titlecase}}({
2121 ...options
2222 }: CreateClientOptions{ {#hasRegionalHost} } & { region{{#fallbackToAliasHost} }?{ {/fallbackToAliasHost} }: Region }{ {/hasRegionalHost} }) {
2323 const auth = createAuth(appIdOption, apiKeyOption, authMode);
24+ const transporter = createTransporter({
25+ hosts: getDefaultHosts({{#hostWithAppID} }appIdOption{ {/hostWithAppID} }{ {#hasRegionalHost} }regionOption{ {/hasRegionalHost} }),
26+ ...options,
27+ algoliaAgent: getAlgoliaAgent({
28+ algoliaAgents,
29+ client: ' {{{algoliaAgent}}}' ,
30+ version: apiClientVersion,
31+ } ),
32+ baseHeaders: {
33+ ' content-type' : ' text/plain' ,
34+ ...auth.headers(),
35+ ...options.baseHeaders,
36+ } ,
37+ baseQueryParameters: {
38+ ...auth.queryParameters(),
39+ ...options.baseQueryParameters,
40+ } ,
41+ });
2442
2543 return {
26- transporter: createTransporter({
27- hosts: getDefaultHosts({{#hostWithAppID} }appIdOption{ {/hostWithAppID} }{ {#hasRegionalHost} }regionOption{ {/hasRegionalHost} }),
28- ...options,
29- algoliaAgent: getAlgoliaAgent({
30- algoliaAgents,
31- client: ' {{{algoliaAgent}}}' ,
32- version: apiClientVersion,
33- } ),
34- baseHeaders: {
35- ' content-type' : ' text/plain' ,
36- ...auth.headers(),
37- ...options.baseHeaders,
38- } ,
39- baseQueryParameters: {
40- ...auth.queryParameters(),
41- ...options.baseQueryParameters,
42- } ,
43- }),
44+ transporter,
4445
4546 /**
4647 * The `appId` currently in use.
@@ -52,16 +53,16 @@ export function create{{#lambda.titlecase}}{{apiName}}{{/lambda.titlecase}}({
5253 */
5354 clearCache(): Promise< void> {
5455 return Promise.all([
55- this. transporter.requestsCache.clear(),
56- this. transporter.responsesCache.clear(),
56+ transporter.requestsCache.clear(),
57+ transporter.responsesCache.clear(),
5758 ]).then(() => undefined);
5859 } ,
5960
6061 /**
6162 * Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
6263 */
6364 get _ua(): string {
64- return this. transporter.algoliaAgent.value;
65+ return transporter.algoliaAgent.value;
6566 } ,
6667
6768 /**
@@ -71,7 +72,7 @@ export function create{{#lambda.titlecase}}{{apiName}}{{/lambda.titlecase}}({
7172 * @param version - The version of the agent.
7273 */
7374 addAlgoliaAgent(segment: string, version?: string): void {
74- this. transporter.algoliaAgent.add({ segment, version } );
75+ transporter.algoliaAgent.add({ segment, version } );
7576 },
7677
7778 /**
@@ -82,9 +83,9 @@ export function create{{#lambda.titlecase}}{{apiName}}{{/lambda.titlecase}}({
8283 */
8384 setClientApiKey({ apiKey } : { apiKey: string } ): void {
8485 if (! authMode || authMode === ' WithinHeaders' ) {
85- this. transporter.baseHeaders[' x-algolia-api-key' ] = apiKey;
86+ transporter.baseHeaders[' x-algolia-api-key' ] = apiKey;
8687 } else {
87- this. transporter.baseQueryParameters[' x-algolia-api-key' ] = apiKey;
88+ transporter.baseQueryParameters[' x-algolia-api-key' ] = apiKey;
8889 }
8990 },
9091
@@ -156,7 +157,7 @@ export function create{{#lambda.titlecase}}{{apiName}}{{/lambda.titlecase}}({
156157 { {/vendorExtensions} }
157158 };
158159
159- return this. transporter.request(request, requestOptions);
160+ return transporter.request(request, requestOptions);
160161 },
161162
162163 { {/operation} }
0 commit comments