Skip to content

Commit

Permalink
guides: push records.json location [skip-bc] (#4196) (generated) [ski…
Browse files Browse the repository at this point in the history
…p ci]

Co-authored-by: Clément Vannicatte <vannicattec@gmail.com>
  • Loading branch information
algolia-bot and shortcuts committed Dec 4, 2024
1 parent 8904f51 commit f780851
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion docs/guides/csharp/src/pushSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PushSetup
{
public static async Task Main(string[] args)
{
string jsonContent = File.ReadAllText("/my-raw-records.json");
string jsonContent = File.ReadAllText("records.json");

var records = JsonSerializer.Deserialize<List<PushTaskRecords>>(jsonContent);

Expand Down
2 changes: 1 addition & 1 deletion docs/guides/go/src/pushSetup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func push() {
panic(err)
}

content, err := os.ReadFile("/my-raw-records.json")
content, err := os.ReadFile("records.json")
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/java/src/test/java/com/algolia/pushSetup.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class pushSetup {

public static void main(String[] args) throws Exception {
JsonNode content = new ObjectMapper().readTree(new File("/my-raw-records.json"));
JsonNode content = new ObjectMapper().readTree(new File("records.json"));
List<PushTaskRecords> records = new ObjectMapper().readerForListOf(Map.class).readValue(content);

// use the region matching your applicationID
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/javascript/src/pushSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initIn

try {
// read local JSON file containing array of records
const records = JSON.parse(fs.readFileSync('/my-raw-records.json', 'utf8')) as PushTaskRecords[];
const records = JSON.parse(fs.readFileSync('records.json', 'utf8')) as PushTaskRecords[];

// push records to the API
const run = await client.pushTask({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.serialization.json.Json
import java.io.File

suspend fun main() {
val json = File("/my-raw-records.json").readText()
val json = File("records.json").readText()
val records: List<PushTaskRecords> = Json.decodeFromString(ListSerializer(PushTaskRecords.serializer()), json)

// use the region matching your applicationID
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/php/src/pushSetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require __DIR__.'/vendor/autoload.php';
use Algolia\AlgoliaSearch\Api\IngestionClient;

$records = json_decode(file_get_contents('/my-raw-records.json'), true);
$records = json_decode(file_get_contents('records.json'), true);

// use the region matching your applicationID
$client = IngestionClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/python/pushSetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async def main():
"ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
)

with open("/my-raw-records.json") as f:
with open("records.json") as f:
records = json.load(f)

run = _client.push_task(
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/ruby/pushSetup.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "json"
require "algolia"

records = JSON.parse(File.read("/my-raw-records.json"))
records = JSON.parse(File.read("records.json"))

# use the region matching your applicationID
client = Algolia::IngestionClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/scala/src/main/scala/pushSetup.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ object PushSetup {
implicit val ec: ExecutionContextExecutor = scala.concurrent.ExecutionContext.global
implicit val formats: org.json4s.Formats = org.json4s.DefaultFormats

val result = Source.fromFile("/my-raw-records.json").getLines().mkString
val result = Source.fromFile("records.json").getLines().mkString
val records = JsonMethods.parse(result).extract[Seq[algoliasearch.ingestion.PushTaskRecords]]

// use the region matching your applicationID
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/swift/Sources/pushSetup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Ingestion
func pushSetup() async throws {
do {
let path = URL(string: #file)!.deletingLastPathComponent()
.appendingPathComponent("/my-raw-records.json")
.appendingPathComponent("records.json")
let data = try Data(contentsOf: URL(fileURLWithPath: path.absoluteString))
let records = try JSONDecoder().decode([PushTaskRecords].self, from: data)

Expand Down

0 comments on commit f780851

Please sign in to comment.