Skip to content

Commit

Permalink
feat(scripts): update sample_datasets fetch url (#4364) (generated) […
Browse files Browse the repository at this point in the history
…skip ci]

Co-authored-by: Lorris Saint-Genez <[email protected]>
Co-authored-by: shortcuts <[email protected]>
  • Loading branch information
3 people committed Jan 23, 2025
1 parent 62257d3 commit 17592e5
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/guides/csharp/src/saveObjectsMovies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SaveObjectsMovies
public static async Task Main(string[] args)
{
// read json file from url
var url = "https://dashboard.algolia.com/sample_datasets/movie.json";
var url = "https://dashboard.algolia.com/api/1/sample_datasets?type=movie";
var httpClient = new HttpClient();
var response = await httpClient.GetAsync(url);
var content = await response.Content.ReadAsStringAsync();
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/dart/lib/saveObjectsMovies.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ void main() async {
SearchClient(appId: 'ALGOLIA_APPLICATION_ID', apiKey: 'ALGOLIA_API_KEY');

// read json file from url
final datasetRequest = await http.get(
Uri.parse('https://dashboard.algolia.com/sample_datasets/movie.json'));
final datasetRequest = await http.get(Uri.parse(
'https://dashboard.algolia.com/api/1/sample_datasets?type=movie'));

if (datasetRequest.statusCode == 200) {
final moviesData = jsonDecode(datasetRequest.body);
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/go/src/saveObjectsMovies.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func saveObjectsMovies() {
// read json file
url := "https://dashboard.algolia.com/sample_datasets/movie.json"
url := "https://dashboard.algolia.com/api/1/sample_datasets?type=movie"
response, err := http.Get(url)

if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class saveObjectsMovies {

public static void main(String[] args) throws Exception {
// Fetch sample dataset
URL url = new URI("https://dashboard.algolia.com/sample_datasets/movie.json").toURL();
URL url = new URI("https://dashboard.algolia.com/api/1/sample_datasets?type=movie").toURL();
InputStream stream = url.openStream();
ObjectMapper mapper = new ObjectMapper();
List<JsonNode> movies = mapper.readValue(stream, new TypeReference<List<JsonNode>>() {});
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/javascript/src/saveObjectsMovies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY');

// Fetch and index objects in Algolia
const processRecords = async () => {
const datasetRequest = await fetch('https://dashboard.algolia.com/sample_datasets/movie.json');
const datasetRequest = await fetch('https://dashboard.algolia.com/api/1/sample_datasets?type=movie');
const movies = await datasetRequest.json();
return await client.saveObjects({ indexName: 'movies_index', objects: movies });
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.serialization.json.JsonObject
import java.net.URI

suspend fun main() {
val url = URI.create("https://dashboard.algolia.com/sample_datasets/movie.json")
val url = URI.create("https://dashboard.algolia.com/api/1/sample_datasets?type=movie")
val json = url.toURL().readText()
val movies: List<JsonObject> = Json.decodeFromString(ListSerializer(JsonObject.serializer()), json)

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/php/src/saveObjectsMovies.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Algolia\AlgoliaSearch\Api\SearchClient;

// Fetch sample dataset
$url = "https://dashboard.algolia.com/sample_datasets/movie.json";
$url = "https://dashboard.algolia.com/api/1/sample_datasets?type=movie";
$response = file_get_contents($url);
$movies = json_decode($response, true);

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/saveObjectsMovies.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

async def main():
# Fetch sample dataset
url = "https://dashboard.algolia.com/sample_datasets/movie.json"
url = "https://dashboard.algolia.com/api/1/sample_datasets?type=movie"
movies = requests.get(url).json()

# Connect and authenticate with your Algolia app
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/ruby/saveObjectsMovies.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "algolia"

# Fetch sample dataset
uri = URI("https://dashboard.algolia.com/sample_datasets/movie.json")
uri = URI("https://dashboard.algolia.com/api/1/sample_datasets?type=movie")
response = Net::HTTP.get_response(uri)
movies = JSON.parse(response.body)

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/scala/src/main/scala/saveObjectsMovies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ object Main {
implicit val formats: org.json4s.Formats = org.json4s.DefaultFormats

// Fetch sample dataset
val url = "https://dashboard.algolia.com/sample_datasets/movie.json"
val url = "https://dashboard.algolia.com/api/1/sample_datasets?type=movie"
val result = Source.fromURL(url).mkString
val movies = JsonMethods.parse(result).extract[Seq[Map[String, Any]]]

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/swift/Sources/saveObjectsMovies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Core
import Search

func saveObjectsMovies() async throws {
let url = URL(string: "https://dashboard.algolia.com/sample_datasets/movie.json")!
let url = URL(string: "https://dashboard.algolia.com/api/1/sample_datasets?type=movie")!
var data: Data?
#if os(Linux) // For linux interop
(data, _) = try await URLSession.shared.asyncData(for: URLRequest(url: url))
Expand Down

0 comments on commit 17592e5

Please sign in to comment.