-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
linters: | ||
disable: | ||
- ineffassign | ||
- staticcheck | ||
service: | ||
golangci-lint-version: 1.55.2 | ||
|
||
run: | ||
concurrency: 2 | ||
timeout: 10m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module snippets | ||
|
||
go 1.21 | ||
|
||
replace github.com/algolia/algoliasearch-client-go/v4 v4.0.0 => ../../clients/algoliasearch-client-go | ||
|
||
require github.com/algolia/algoliasearch-client-go/v4 v4.0.0 | ||
|
||
require ( | ||
github.com/gabriel-vasile/mimetype v1.4.2 // indirect | ||
github.com/go-playground/locales v0.14.1 // indirect | ||
github.com/go-playground/universal-translator v0.18.1 // indirect | ||
github.com/go-playground/validator/v10 v10.17.0 // indirect | ||
github.com/leodido/go-urn v1.2.4 // indirect | ||
github.com/stretchr/testify v1.8.4 // indirect | ||
golang.org/x/crypto v0.17.0 // indirect | ||
golang.org/x/net v0.17.0 // indirect | ||
golang.org/x/sys v0.15.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package snippets | ||
|
||
import ( | ||
"github.com/algolia/algoliasearch-client-go/v4/algolia/{{clientImport}}" | ||
) | ||
|
||
{{#blocksRequests}} | ||
{{#snippet}} | ||
func SnippetFor{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}Of{{#lambda.pascalcase}}{{clientPrefix}}{{/lambda.pascalcase}}() { | ||
/* | ||
Snippet for the {{method}} method. | ||
|
||
{{{description}}} | ||
*/ | ||
|
||
// Initialize the client{{#hasRegionalHost}} with your application region, eg. {{clientPrefix}}.YOUR_APP_ID_REGION{{/hasRegionalHost}} | ||
client, err := {{clientPrefix}}.NewClient("YOUR_APP_ID", "YOUR_API_KEY"{{#hasRegionalHost}}, {{clientPrefix}}.{{#lambda.uppercase}}{{defaultRegion}}{{/lambda.uppercase}}{{/hasRegionalHost}}) | ||
if err != nil { | ||
// The client can fail to initialize if you pass an invalid parameter. | ||
panic(err) | ||
} | ||
|
||
// Call the API | ||
{{#hasResponsePayload}}resp, err :={{/hasResponsePayload}}{{^hasResponsePayload}}err ={{/hasResponsePayload}} client.{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}({{#hasOperationParams}}client.NewApi{{#lambda.titlecase}}{{method}}{{/lambda.titlecase}}Request( | ||
{{#parametersWithDataType}}{{#required}}{{> tests/generateParams}},{{/required}}{{/parametersWithDataType}} | ||
){{#parametersWithDataType}}{{^required}}.With{{#lambda.pascalcase}}{{{key}}}{{/lambda.pascalcase}}({{> tests/generateParams}}){{/required}}{{/parametersWithDataType}}{{/hasOperationParams}}{{#requestOptions}}{{#hasOperationParams}},{{/hasOperationParams}} | ||
{{#queryParameters.parametersWithDataType}}{{clientPrefix}}.QueryParamOption("{{{key}}}", {{> tests/generateInnerParams}}),{{/queryParameters.parametersWithDataType}}{{#headers.parametersWithDataType}}{{clientPrefix}}.HeaderParamOption("{{{key}}}", {{> tests/generateInnerParams}}),{{/headers.parametersWithDataType}} | ||
{{/requestOptions}}) | ||
if err != nil { | ||
// handle the eventual error | ||
panic(err) | ||
} | ||
|
||
{{#hasResponsePayload}} | ||
// use the model directly | ||
print(resp) | ||
{{/hasResponsePayload}} | ||
} | ||
{{/snippet}} | ||
{{/blocksRequests}} |