Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: fix SDK usage examples #178

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions x-readme/events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@

// Get a specific fingerprinting event
try {
$response = $client->getEvent("REQUEST_ID");
echo "<pre>" . $response->__toString() . "</pre>";
list($model, $response) = $client->getEvent("REQUEST_ID");
echo "Status: " . $response_upd->getStatusCode();
echo "<pre>" . $model . "</pre>";
} catch (Exception $e) {
echo $e->getMessage(), PHP_EOL;
}
Expand All @@ -52,8 +53,6 @@
install: pip install fingerprint_pro_server_api_sdk
code: |
import fingerprint_pro_server_api_sdk
from fingerprint_pro_server_api_sdk import EventResponse
from fingerprint_pro_server_api_sdk import Response
from fingerprint_pro_server_api_sdk.rest import ApiException

configuration = fingerprint_pro_server_api_sdk.Configuration(
Expand All @@ -64,21 +63,21 @@

# Get a specific fingerprinting event
try:
event: EventResponse = api_instance.get_event("REQUEST_ID")
event = api_instance.get_event("REQUEST_ID")
print(event)
except ApiException as e:
print("Exception when getting an event: %s\n" % e)
- language: golang
name: Go SDK
install: go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk
install: go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7
code: |
package main

import (
"context"
"fmt"
"github.com/antihax/optional"
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v3/sdk"
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk"
"log"
)

Expand All @@ -105,8 +104,7 @@
name: Java SDK
code: |
import com.fingerprint.api.FingerprintApi;
import com.fingerprint.models.EventResponse;
import com.fingerprint.models.Response;
import com.fingerprint.models.EventsGetResponse;
import com.fingerprint.sdk.ApiClient;
import com.fingerprint.sdk.ApiException;
import com.fingerprint.sdk.Configuration;
Expand All @@ -122,7 +120,7 @@

// Get a specific fingerprinting event
try {
EventResponse response = api.getEvent("REQUEST_ID");
EventsGetResponse response = api.getEvent("REQUEST_ID");
System.out.println(response.getProducts().toString());
} catch (ApiException e) {
System.err.println(e.getMessage());
Expand Down
18 changes: 8 additions & 10 deletions x-readme/visitors.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@

// Get visit history of a specific visitor
try {
$response = $client->getVisits("VISITOR_ID");
echo "<pre>" . $response->__toString() . "</pre>";
list($model, $response) = $client->getVisits("VISITOR_ID");
echo "Status: " . $response_upd->getStatusCode();
echo "<pre>" . $model . "</pre>";
} catch (Exception $e) {
echo $e->getMessage(), PHP_EOL;
}
Expand All @@ -52,8 +53,6 @@
install: pip install fingerprint_pro_server_api_sdk
code: |
import fingerprint_pro_server_api_sdk
from fingerprint_pro_server_api_sdk import EventResponse
from fingerprint_pro_server_api_sdk import Response
from fingerprint_pro_server_api_sdk.rest import ApiException

configuration = fingerprint_pro_server_api_sdk.Configuration(
Expand All @@ -64,21 +63,21 @@

# Get visit history of a specific visitor
try:
visits: Response = api_instance.get_visits("VISITOR_ID", limit=10)
visits = api_instance.get_visits("VISITOR_ID", limit=10)
print(visits)
except ApiException as e:
print("Exception when getting visits: %s\n" % e)
- language: golang
name: Go SDK
install: go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk
install: go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7
code: |
package main

import (
"context"
"fmt"
"github.com/antihax/optional"
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v3/sdk"
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/v7/sdk"
"log"
)

Expand Down Expand Up @@ -108,8 +107,7 @@
name: Java SDK
code: |
import com.fingerprint.api.FingerprintApi;
import com.fingerprint.models.EventResponse;
import com.fingerprint.models.Response;
import com.fingerprint.models.VisitorsGetResponse;
import com.fingerprint.sdk.ApiClient;
import com.fingerprint.sdk.ApiException;
import com.fingerprint.sdk.Configuration;
Expand All @@ -125,7 +123,7 @@

// Get visit history of a specific visitor
try {
Response response = api.getVisits("VISITOR_ID");
VisitorsGetResponse response = api.getVisits("VISITOR_ID");
System.out.println(response.getVisits().toString());
} catch (ApiException e) {
System.err.println(e.getMessage());
Expand Down