From 62257d3dc7fd410610297fa4e363076248db5474 Mon Sep 17 00:00:00 2001 From: Lorris Saint-Genez Date: Thu, 23 Jan 2025 00:31:40 -0800 Subject: [PATCH] feat(scripts): update sample_datasets fetch url (#4364) Co-authored-by: shortcuts --- templates/csharp/guides/search/saveObjectsMovies.mustache | 2 +- templates/dart/guides/search/saveObjectsMovies.mustache | 2 +- templates/go/guides/search/saveObjectsMovies.mustache | 2 +- templates/java/guides/search/saveObjectsMovies.mustache | 2 +- templates/javascript/guides/search/saveObjectsMovies.mustache | 2 +- templates/kotlin/guides/search/saveObjectsMovies.mustache | 2 +- templates/php/guides/search/saveObjectsMovies.mustache | 2 +- templates/python/guides/search/saveObjectsMovies.mustache | 2 +- templates/ruby/guides/search/saveObjectsMovies.mustache | 2 +- templates/scala/guides/search/saveObjectsMovies.mustache | 2 +- templates/swift/guides/search/saveObjectsMovies.mustache | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/templates/csharp/guides/search/saveObjectsMovies.mustache b/templates/csharp/guides/search/saveObjectsMovies.mustache index 52eef93941..02506e981f 100644 --- a/templates/csharp/guides/search/saveObjectsMovies.mustache +++ b/templates/csharp/guides/search/saveObjectsMovies.mustache @@ -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(); diff --git a/templates/dart/guides/search/saveObjectsMovies.mustache b/templates/dart/guides/search/saveObjectsMovies.mustache index 4f647c4303..3b49b25fd2 100644 --- a/templates/dart/guides/search/saveObjectsMovies.mustache +++ b/templates/dart/guides/search/saveObjectsMovies.mustache @@ -8,7 +8,7 @@ void main() async { // read json file from url final datasetRequest = await http.get( - Uri.parse('https://dashboard.algolia.com/sample_datasets/movie.json')); + Uri.parse('https://dashboard.algolia.com/api/1/sample_datasets?type=movie')); if (datasetRequest.statusCode == 200) { final moviesData = jsonDecode(datasetRequest.body); diff --git a/templates/go/guides/search/saveObjectsMovies.mustache b/templates/go/guides/search/saveObjectsMovies.mustache index ae66822938..f2fb3f0a84 100644 --- a/templates/go/guides/search/saveObjectsMovies.mustache +++ b/templates/go/guides/search/saveObjectsMovies.mustache @@ -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 { diff --git a/templates/java/guides/search/saveObjectsMovies.mustache b/templates/java/guides/search/saveObjectsMovies.mustache index 8f43008575..581d922f46 100644 --- a/templates/java/guides/search/saveObjectsMovies.mustache +++ b/templates/java/guides/search/saveObjectsMovies.mustache @@ -12,7 +12,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; 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 movies = mapper.readValue(stream, new TypeReference>() {}); diff --git a/templates/javascript/guides/search/saveObjectsMovies.mustache b/templates/javascript/guides/search/saveObjectsMovies.mustache index ec319305ab..feba1927ab 100644 --- a/templates/javascript/guides/search/saveObjectsMovies.mustache +++ b/templates/javascript/guides/search/saveObjectsMovies.mustache @@ -4,7 +4,7 @@ // 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 {{#dynamicSnippet}}saveObjectsMovies{{/dynamicSnippet}} }; diff --git a/templates/kotlin/guides/search/saveObjectsMovies.mustache b/templates/kotlin/guides/search/saveObjectsMovies.mustache index f6517eda00..eadf0ad97e 100644 --- a/templates/kotlin/guides/search/saveObjectsMovies.mustache +++ b/templates/kotlin/guides/search/saveObjectsMovies.mustache @@ -9,7 +9,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 = Json.decodeFromString(ListSerializer(JsonObject.serializer()), json) diff --git a/templates/php/guides/search/saveObjectsMovies.mustache b/templates/php/guides/search/saveObjectsMovies.mustache index 407b1d8357..29ef73332f 100644 --- a/templates/php/guides/search/saveObjectsMovies.mustache +++ b/templates/php/guides/search/saveObjectsMovies.mustache @@ -3,7 +3,7 @@ require(__DIR__."/vendor/autoload.php"); {{> snippets/import}} // 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); diff --git a/templates/python/guides/search/saveObjectsMovies.mustache b/templates/python/guides/search/saveObjectsMovies.mustache index 13595b0e80..0b1dd1e84f 100644 --- a/templates/python/guides/search/saveObjectsMovies.mustache +++ b/templates/python/guides/search/saveObjectsMovies.mustache @@ -5,7 +5,7 @@ import requests 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 diff --git a/templates/ruby/guides/search/saveObjectsMovies.mustache b/templates/ruby/guides/search/saveObjectsMovies.mustache index 9df784febe..d6c441d125 100644 --- a/templates/ruby/guides/search/saveObjectsMovies.mustache +++ b/templates/ruby/guides/search/saveObjectsMovies.mustache @@ -2,7 +2,7 @@ require 'uri' {{> snippets/import}} # 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) diff --git a/templates/scala/guides/search/saveObjectsMovies.mustache b/templates/scala/guides/search/saveObjectsMovies.mustache index 253ac7f362..a0e3345814 100644 --- a/templates/scala/guides/search/saveObjectsMovies.mustache +++ b/templates/scala/guides/search/saveObjectsMovies.mustache @@ -14,7 +14,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]]] diff --git a/templates/swift/guides/search/saveObjectsMovies.mustache b/templates/swift/guides/search/saveObjectsMovies.mustache index 5d1aec37c8..66d7ec6a7e 100644 --- a/templates/swift/guides/search/saveObjectsMovies.mustache +++ b/templates/swift/guides/search/saveObjectsMovies.mustache @@ -7,7 +7,7 @@ import Core {{> snippets/import}} 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? = nil #if os(Linux) // For linux interop (data, _) = try await URLSession.shared.asyncData(for: URLRequest(url: url))