File tree Expand file tree Collapse file tree 4 files changed +52
-5
lines changed
generators/src/main/java/com/algolia/codegen
templates/javascript/clients Expand file tree Collapse file tree 4 files changed +52
-5
lines changed Original file line number Diff line number Diff line change @@ -119,7 +119,7 @@ private void setDefaultGeneratorOptions() {
119
119
additionalProperties .put ("algoliaAgent" , Utils .capitalize (CLIENT ));
120
120
additionalProperties .put ("gitRepoId" , "algoliasearch-client-javascript" );
121
121
additionalProperties .put ("isSearchClient" , CLIENT .equals ("search" ));
122
- additionalProperties .put ("useAlgoliaUA " , ! CLIENT .equals ("ingestion" ));
122
+ additionalProperties .put ("isIngestionClient " , CLIENT .equals ("ingestion" ));
123
123
additionalProperties .put ("isAlgoliasearchClient" , isAlgoliasearchClient );
124
124
125
125
if (isAlgoliasearchClient ) {
Original file line number Diff line number Diff line change @@ -20,20 +20,20 @@ export function create{{capitalizedApiName}}({
20
20
hosts: getDefaultHosts({{^hasRegionalHost} }appIdOption{ {/hasRegionalHost} }{ {#hasRegionalHost} }regionOption{ {/hasRegionalHost} }),
21
21
...options,
22
22
algoliaAgent:
23
- { {^useAlgoliaUA } }
23
+ { {#isIngestionClient } }
24
24
{ ...getAlgoliaAgent({
25
25
algoliaAgents,
26
26
client: ' {{{algoliaAgent}}}' ,
27
27
version: apiClientVersion,
28
28
} ), value: ''},
29
- { {/useAlgoliaUA } }
30
- { {#useAlgoliaUA } }
29
+ { {/isIngestionClient } }
30
+ { {^isIngestionClient } }
31
31
getAlgoliaAgent({
32
32
algoliaAgents,
33
33
client: ' {{{algoliaAgent}}}' ,
34
34
version: apiClientVersion,
35
35
} ),
36
- { {/useAlgoliaUA } }
36
+ { {/isIngestionClient } }
37
37
baseHeaders: {
38
38
' content-type' : ' text/plain' ,
39
39
...auth.headers(),
@@ -83,6 +83,9 @@ export function create{{capitalizedApiName}}({
83
83
{ {#isSearchClient} }
84
84
{ {> client/api/helpers} }
85
85
{ {/isSearchClient} }
86
+ { {#isIngestionClient} }
87
+ { {> client/api/guards} }
88
+ { {/isIngestionClient} }
86
89
{ {#operation} }
87
90
{ {> client/api/operation/jsdoc} }
88
91
{ {nickname} }{ {#vendorExtensions.x-is-generic} }<T >{ {/vendorExtensions.x-is-generic} }( { {> client/api/operation/parameters} } ) : Promise<{ {#returnType} }{ {{returnType} }}{ {/returnType} }{ {^returnType} }void{ {/returnType} }{ {#vendorExtensions.x-is-generic} }<T >{ {/vendorExtensions.x-is-generic} }> {
Original file line number Diff line number Diff line change
1
+ { {#isIngestionClient} }
2
+ /**
3
+ * Guard: Return strongly typed specific OnDemandTrigger for a given Trigger.
4
+ *
5
+ * @summary Guard method that returns a strongly typed specific OnDemandTrigger for a given Trigger.
6
+ * @param trigger - The given Task Trigger.
7
+ */
8
+ isOnDemandTrigger(
9
+ trigger: Trigger
10
+ ): trigger is OnDemandTrigger {
11
+ return trigger.type === ' on_demand' ;
12
+ } ,
13
+
14
+ /**
15
+ * Guard: Return strongly typed specific ScheduleTrigger for a given Trigger.
16
+ *
17
+ * @summary Guard method that returns a strongly typed specific ScheduleTrigger for a given Trigger.
18
+ * @param trigger - The given Task Trigger.
19
+ */
20
+ isScheduleTrigger(
21
+ trigger: Trigger
22
+ ): trigger is ScheduleTrigger {
23
+ return trigger.type === ' schedule' ;
24
+ } ,
25
+
26
+ /**
27
+ * Guard: Return strongly typed specific SubscriptionTrigger for a given Trigger.
28
+ *
29
+ * @summary Guard method that returns a strongly typed specific SubscriptionTrigger for a given Trigger.
30
+ * @param trigger - The given Task Trigger.
31
+ */
32
+ isSubscriptionTrigger(
33
+ trigger: Trigger
34
+ ): trigger is SubscriptionTrigger {
35
+ return trigger.type === ' subscription' ;
36
+ } ,
37
+ { {/isIngestionClient} }
Original file line number Diff line number Diff line change @@ -43,3 +43,10 @@ import type {
43
43
{ {/operation} }
44
44
} from '../model/clientMethodProps';
45
45
{ {/operations} }
46
+
47
+ { {#isIngestionClient} }
48
+ import type { Trigger } from '../model/trigger';
49
+ import type { OnDemandTrigger } from '../model/onDemandTrigger';
50
+ import type { ScheduleTrigger } from '../model/scheduleTrigger';
51
+ import type { SubscriptionTrigger } from '../model/subscriptionTrigger';
52
+ { {/isIngestionClient} }
You can’t perform that action at this time.
0 commit comments