Skip to content

Commit cde8d7e

Browse files
authored
Merge branch 'main' into feat/specs-cURL-snippet
2 parents a7aad85 + 6a2f9f8 commit cde8d7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2072
-370
lines changed

generators/src/main/java/com/algolia/codegen/cts/guides/GuidesGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ public void addSupportingFiles(List<SupportingFile> supportingFiles, String outp
5050

5151
@Override
5252
public void run(Map<String, CodegenModel> models, Map<String, CodegenOperation> operations, Map<String, Object> bundle) throws Exception {
53+
if (this.client.equals("search")) {
54+
bundle.put("isSearchClient", true);
55+
}
56+
bundle.put("isSyncClient", true);
5357
// nothing to do here, the mustache uses dynamicSnippets lambda
5458
}
5559
}

generators/src/main/java/com/algolia/codegen/cts/manager/SwiftCTSManager.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,13 @@ public void addDataToBundle(Map<String, Object> bundle) throws GeneratorExceptio
4242

4343
@Override
4444
public void addSnippetsSupportingFiles(List<SupportingFile> supportingFiles, String output) {
45-
supportingFiles.add(new SupportingFile("snippets/Package.mustache", output + "/swift", "Package.swift"));
4645
supportingFiles.add(new SupportingFile("snippets/.swiftformat.mustache", output + "/swift", ".swiftformat"));
4746
supportingFiles.add(new SupportingFile("snippets/.gitignore.mustache", output + "/swift", ".gitignore"));
47+
48+
if (output.equals("snippets")) {
49+
supportingFiles.add(new SupportingFile("snippets/Package.mustache", output + "/swift", "Package.swift"));
50+
} else if (output.equals("guides")) {
51+
supportingFiles.add(new SupportingFile("guides/Package.mustache", output + "/swift", "Package.swift"));
52+
}
4853
}
4954
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"version": 1,
3+
"isRoot": true,
4+
"tools": {
5+
"csharpier": {
6+
"version": "0.29.2",
7+
"commands": [
8+
"dotnet-csharpier"
9+
]
10+
}
11+
}
12+
}

guides/csharp/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin
2+
obj

guides/csharp/Algolia.sln

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "src", "src\src.csproj", "{C3F414F4-84DD-4E56-A1E7-34086763F07D}"
4+
EndProject
5+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Algolia.Search", "..\..\clients\algoliasearch-client-csharp\algoliasearch\Algolia.Search.csproj", "{2485A285-E565-4407-95E1-0F216142AAA8}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Release|Any CPU = Release|Any CPU
11+
EndGlobalSection
12+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
13+
{C3F414F4-84DD-4E56-A1E7-34086763F07D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
14+
{C3F414F4-84DD-4E56-A1E7-34086763F07D}.Debug|Any CPU.Build.0 = Debug|Any CPU
15+
{C3F414F4-84DD-4E56-A1E7-34086763F07D}.Release|Any CPU.ActiveCfg = Release|Any CPU
16+
{C3F414F4-84DD-4E56-A1E7-34086763F07D}.Release|Any CPU.Build.0 = Release|Any CPU
17+
{2485A285-E565-4407-95E1-0F216142AAA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{2485A285-E565-4407-95E1-0F216142AAA8}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{2485A285-E565-4407-95E1-0F216142AAA8}.Release|Any CPU.ActiveCfg = Release|Any CPU
20+
{2485A285-E565-4407-95E1-0F216142AAA8}.Release|Any CPU.Build.0 = Release|Any CPU
21+
{33F416B9-F209-47BF-9504-D596428FA5E1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22+
{33F416B9-F209-47BF-9504-D596428FA5E1}.Debug|Any CPU.Build.0 = Debug|Any CPU
23+
{33F416B9-F209-47BF-9504-D596428FA5E1}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{33F416B9-F209-47BF-9504-D596428FA5E1}.Release|Any CPU.Build.0 = Release|Any CPU
25+
EndGlobalSection
26+
EndGlobal
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System;
2+
using System.Text.Json;
3+
using System.Net.Http;
4+
using System.Collections.Generic;
5+
6+
using Algolia.Search.Clients;
7+
using Algolia.Search.Models.Search;
8+
9+
class Program
10+
{
11+
public static async Task Main(string[] args)
12+
{
13+
// read json file from url
14+
var url = "https://dashboard.algolia.com/sample_datasets/movie.json";
15+
var httpClient = new HttpClient();
16+
var response = await httpClient.GetAsync(url);
17+
var content = await response.Content.ReadAsStringAsync();
18+
19+
// parse json
20+
var movies = JsonSerializer.Deserialize<List<dynamic>>(content);
21+
22+
// initiate client and index
23+
var client = new SearchClient(new SearchConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY"));
24+
25+
// push data to algolia
26+
try
27+
{
28+
var result = await client.SaveObjectsAsync("<YOUR_INDEX_NAME>"
29+
, movies
30+
);
31+
}
32+
catch (Exception e)
33+
{
34+
Console.WriteLine(e.Message);
35+
}
36+
}
37+
}

guides/csharp/src/src.csproj

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<Nullable>enable</Nullable>
8+
<RootNamespace>Algolia</RootNamespace>
9+
<LangVersion>12</LangVersion>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\..\..\clients\algoliasearch-client-csharp\algoliasearch\Algolia.Search.csproj" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
18+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<None Update="appsettings.json">
23+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
24+
</None>
25+
</ItemGroup>
26+
27+
</Project>

guides/go/.golangci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
linters:
2+
disable:
3+
- ineffassign
4+
- staticcheck
5+
6+
issues:
7+
exclude-generated: disable
8+
9+
run:
10+
concurrency: 2
11+
timeout: 10m

guides/go/go.mod

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module snippets
2+
3+
go 1.21
4+
5+
replace github.com/algolia/algoliasearch-client-go/v4 v4.0.0 => ../../clients/algoliasearch-client-go
6+
7+
require github.com/algolia/algoliasearch-client-go/v4 v4.0.0
8+
9+
require (
10+
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
11+
github.com/go-playground/locales v0.14.1 // indirect
12+
github.com/go-playground/universal-translator v0.18.1 // indirect
13+
github.com/go-playground/validator/v10 v10.22.1 // indirect
14+
github.com/leodido/go-urn v1.4.0 // indirect
15+
golang.org/x/crypto v0.22.0 // indirect
16+
golang.org/x/net v0.24.0 // indirect
17+
golang.org/x/sys v0.19.0 // indirect
18+
golang.org/x/text v0.14.0 // indirect
19+
)

guides/go/go.sum

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
4+
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
5+
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
6+
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
7+
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
8+
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
9+
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
10+
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
11+
github.com/go-playground/validator/v10 v10.22.1 h1:40JcKH+bBNGFczGuoBYgX4I6m/i27HYW8P9FDk5PbgA=
12+
github.com/go-playground/validator/v10 v10.22.1/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
13+
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
14+
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
15+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
16+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
17+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
18+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
19+
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
20+
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
21+
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
22+
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
23+
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
24+
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
25+
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
26+
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
27+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
28+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

0 commit comments

Comments
 (0)