Skip to content

Commit 5896759

Browse files
committed
partial snippets
1 parent 8b3ca13 commit 5896759

30 files changed

+53
-34
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
using Algolia.Search.Clients;
2+
using Algolia.Search.Models.{{clientPrefix}};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var client = new {{client}}(new {{clientPrefix}}Config("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"{{#hasRegionalHost}},"ALGOLIA_APPLICATION_REGION"{{/hasRegionalHost}}));

templates/csharp/snippets/method.mustache

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// {{generationBanner}}
22
// >IMPORT
3-
using Algolia.Search.Clients;
4-
using Algolia.Search.Models.{{clientPrefix}};
3+
{{> snippets/import}}
54
// IMPORT<
65
{{#isSearchClient}}
76
using Action = Algolia.Search.Models.Search.Action;
@@ -24,7 +23,7 @@ public class Snippet{{client}}
2423
{
2524
// >SEPARATOR {{method}} {{testName}}
2625
// Initialize the client
27-
var client = new {{client}}(new {{clientPrefix}}Config("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"{{#hasRegionalHost}},"ALGOLIA_APPLICATION_REGION"{{/hasRegionalHost}}));
26+
{{> snippets/init}}
2827

2928
// Call the API
3029
{{#hasResponse}}var response = {{/hasResponse}}{{> tests/method}};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '{{{import}}}';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
final client = {{client}}(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'{{#hasRegionalHost}}, region: 'ALGOLIA_APPLICATION_REGION'{{/hasRegionalHost}});

templates/dart/snippets/method.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// {{generationBanner}}
22
// >IMPORT
3-
import '{{{import}}}';
3+
{{> snippets/import}}
44
// IMPORT<
55

66
{{#blocksRequests}}
@@ -11,7 +11,7 @@ import '{{{import}}}';
1111
void snippetFor{{method}}{{testIndex}}() async {
1212
// >SEPARATOR {{method}} {{testName}}
1313
// Initialize the client
14-
final client = {{client}}(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY'{{#hasRegionalHost}}, region: 'ALGOLIA_APPLICATION_REGION'{{/hasRegionalHost}});
14+
{{> snippets/init}}
1515

1616
// Call the API
1717
{{#hasResponse}}final response = {{/hasResponse}}{{#isAsyncMethod}}await {{/isAsyncMethod}}client.{{method}}(
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "github.com/algolia/algoliasearch-client-go/v4/algolia/{{clientImport}}"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
client, err := {{clientPrefix}}.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"{{#hasRegionalHost}}, {{clientPrefix}}.{{#lambda.uppercase}}{{defaultRegion}}{{/lambda.uppercase}}{{/hasRegionalHost}})
2+
if err != nil {
3+
// The client can fail to initialize if you pass an invalid parameter.
4+
panic(err)
5+
}

templates/go/snippets/method.mustache

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package snippets
33

44
// >IMPORT
5-
import "github.com/algolia/algoliasearch-client-go/v4/algolia/{{clientImport}}"
5+
{{> snippets/import}}
66
// IMPORT<
77

88

@@ -17,11 +17,7 @@ func SnippetFor{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}Of{{#lambda.p
1717

1818
// >SEPARATOR {{method}} {{testName}}
1919
// Initialize the client{{#hasRegionalHost}} with your application region, eg. {{clientPrefix}}.ALGOLIA_APPLICATION_REGION{{/hasRegionalHost}}
20-
client, err := {{clientPrefix}}.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"{{#hasRegionalHost}}, {{clientPrefix}}.{{#lambda.uppercase}}{{defaultRegion}}{{/lambda.uppercase}}{{/hasRegionalHost}})
21-
if err != nil {
22-
// The client can fail to initialize if you pass an invalid parameter.
23-
panic(err)
24-
}
20+
{{> snippets/init}}
2521

2622
// Call the API
2723
{{#hasResponse}}response, err :={{/hasResponse}}{{^hasResponse}}err ={{/hasResponse}} {{> tests/method}}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import com.algolia.api.{{client}};
2+
import com.algolia.model.{{import}}.*;

0 commit comments

Comments
 (0)