Skip to content

Commit

Permalink
Merge pull request #22 from fingerprintjs/feat/swagger-update-seen-at
Browse files Browse the repository at this point in the history
Sync with latest OpenAPI (schema, seenAt, error examples)
  • Loading branch information
ilfa authored Jan 18, 2023
2 parents c0076f8 + 1d94e69 commit 491021a
Show file tree
Hide file tree
Showing 70 changed files with 4,789 additions and 118 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
go-version: ${{ matrix.go-version }}
- run: go version
- name: Run functional tests
run: cd example && go run GetVisits_APIKey.go
run: cd example && go run visits/GetVisits_APIKey.go && go run events/GetEvent_APIKey.go
env:
FINGERPRINT_API_KEY: ${{ secrets.FINGERPRINT_API_KEY }}
VISITOR_ID: ${{ secrets.VISITOR_ID }}
Expand Down
57 changes: 57 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,60 @@
## [1.2.0](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/compare/v1.1.0...v1.2.0) (2022-10-24)


### Features

* update schema to support url field for botd result ([5e0ec6c](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/5e0ec6c9c65ec79e20dfbb062c6a7471215852cd))


### Documentation

* **README:** add different region to code example ([3986d6d](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/3986d6df1306666bb03812be05c408ed91ecf0d9))
* **README:** add region section ([a2342cd](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/a2342cdc0451982ee5c33bd46704d193a263ddd1))

## [1.1.0](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/compare/v1.0.2...v1.1.0) (2022-09-19)


### Features

* introduce /event/{request_id} endpoint ([74a39b6](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/74a39b609b64ef2f9b7eae76972d7e4532b1867b))

## [1.0.2](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/compare/v1.0.1...v1.0.2) (2022-09-01)


### Documentation

* **README:** update template ([0bb3917](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/0bb391711ec3625af7c8ffb2de6bdc525758fbf1))

## [1.0.1](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/compare/v1.0.0...v1.0.1) (2022-09-01)


### Documentation

* **README:** remove WIP label ([5d910ae](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/5d910ae9a0d43e19647d5982eefec536502f616f))

## 1.0.0 (2022-09-01)


### Features

* add "integrationsInfo" query param ([b326815](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/b326815f69b92c3c1d2d691a99c8483753ec6e49))
* create Go SDK ([a5e03b5](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/a5e03b5b1ad5e58441d88faf992f5f6e08033d55))
* support passing region ([1ba2e94](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/1ba2e941ae8fe65abd706f7e5506953b03cde9ab))


### Bug Fixes

* send API key only in headers ([92a4f88](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/92a4f886b6876d878d9c7ca61f6b4e3af34445d6))
* support nil values for time.Time ([459ba4c](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/459ba4c8dde6c6e1428fdeb9b0c2975de1a2f1d6))
* use config.json as single source of truth ([519f0d7](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/519f0d7b0c7c84fc164c4cf71440a83c87ab6239))


### Documentation

* **README:** fix installation cmd typo ([2017b4c](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/2017b4c890cf7d0cb6b9dd1df5a374a8af2e96a4))
* **README:** remove unnecessary import from example ([e6759e7](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/e6759e71e712cff1508fbfc88a941e68244bbd66))
* **README:** update readme ([ae4e0ea](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/commit/ae4e0ea67c95598f3771cd1e7c89189bab17793e))

## [1.0.0-test.5](https://github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/compare/v1.0.0-test.4...v1.0.0-test.5) (2022-08-29)


Expand Down
66 changes: 42 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,13 @@
</a>
</p>

> :warning: **Work in progress**: This is a beta version of the library
# Fingerprint Pro Server Go SDK
Fingerprint Pro Server API provides a way for validating visitorsdata issued by Fingerprint Pro.
Fingerprint Pro Server API allows you to get information about visitors and about individual events in a server environment. This API can be used for data exports, decision-making, and data analysis scenarios.

This Go package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: 3
- Package version: 1.0.0-test.5
- Package version: 1.2.0
- Build package: io.swagger.codegen.v3.generators.go.GoClientCodegen

## Requirements.
Expand All @@ -42,19 +40,13 @@ Go Lang 1.17 or higher

## Installation & Usage

You can get the package directly from GitHub:
1. Get the package from GitHub:
```shell
go get github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk
```

Then import it:
```go
import "github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/sdk"
```
2. Import and use the library:

## Getting started

Please follow the [installation procedure](#installation--usage) and then run the following:
```go
package main

Expand All @@ -70,35 +62,47 @@ func main() {
cfg := sdk.NewConfiguration()
client := sdk.NewAPIClient(cfg)

// You can also use sdk.RegionUS or sdk.RegionAsia. Default one is sdk.RegionUS
//cfg.ChangeRegion(sdk.RegionEU)

// Configure authorization, in our case with API Key
auth := context.WithValue(context.Background(), sdk.ContextAPIKey, sdk.APIKey{
Key: "SECRET_API_KEY",
})

// Usually this data will come from your frontend app
visitorId := "VISITOR_ID"
opts := sdk.FingerprintApiGetVisitsOpts{
RequestId: optional.NewString("REQUEST_ID"),
}

response, httpRes, err := client.FingerprintApi.GetVisits(auth, visitorId, &opts)

fmt.Printf("%+v\n", httpRes)

if err != nil {
log.Fatal(err)
}

fmt.Printf("Got response with visitorId: %s", response.VisitorId)
}

```

You can also check examples located in [example](./example) directory.
> **Note**
> You can also check examples located in [example](./example) directory.
> To run the examples:
> ```shell
> cd example && FINGERPRINT_API_KEY=SECRET_API_KEY VISITOR_ID=VISITOR_ID_EXAMPLE go run visits/GetVisits_APIKey.go
> ```
To run the example:
```shell
cd example && FINGERPRINT_API_KEY=SECRET_API_KEY VISITOR_ID=VISITOR_ID_EXAMPLE go run GetVisits_APIKey.go
### Region
If your subscription is in region other than US, you need to change the region in the configuration:
```go
import (
"github.com/fingerprintjs/fingerprint-pro-server-api-go-sdk/sdk"
)
func main() {
cfg := sdk.NewConfiguration()
cfg.ChangeRegion(sdk.RegionEU) // or sdk.RegionAsia
}
```
## Documentation for API Endpoints
Expand All @@ -107,18 +111,32 @@ All URIs are relative to *https://api.fpjs.io*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*FingerprintApi* | [**GetVisits**](docs/FingerprintApi.md#getvisits) | **Get** /visitors/{visitor_id} |
*FingerprintApi* | [**GetEvent**](docs/FingerprintApi.md#getevent) | **Get** /events/{request_id} | Get event by requestId
*FingerprintApi* | [**GetVisits**](docs/FingerprintApi.md#getvisits) | **Get** /visitors/{visitor_id} | Get visits by visitorId

## Documentation For Models

- [BotdDetectionResult](docs/BotdDetectionResult.md)
- [BotdError](docs/BotdError.md)
- [BotdResult](docs/BotdResult.md)
- [BrowserDetails](docs/BrowserDetails.md)
- [Confidence](docs/Confidence.md)
- [ErrorEvent403Response](docs/ErrorEvent403Response.md)
- [ErrorEvent403ResponseError](docs/ErrorEvent403ResponseError.md)
- [ErrorEvent404Response](docs/ErrorEvent404Response.md)
- [ErrorEvent404ResponseError](docs/ErrorEvent404ResponseError.md)
- [EventResponse](docs/EventResponse.md)
- [IpLocation](docs/IpLocation.md)
- [IpLocationCity](docs/IpLocationCity.md)
- [Location](docs/Location.md)
- [ManyRequestsResponse](docs/ManyRequestsResponse.md)
- [ProductsResponse](docs/ProductsResponse.md)
- [ProductsResponseBotd](docs/ProductsResponseBotd.md)
- [ProductsResponseIdentification](docs/ProductsResponseIdentification.md)
- [ProductsResponseIdentificationData](docs/ProductsResponseIdentificationData.md)
- [Response](docs/Response.md)
- [StSeenAt](docs/StSeenAt.md)
- [ResponseVisits](docs/ResponseVisits.md)
- [SeenAt](docs/SeenAt.md)
- [Subdivision](docs/Subdivision.md)
- [Visit](docs/Visit.md)
- [WebhookVisit](docs/WebhookVisit.md)
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"packageVersion": "1.0.0-test.5",
"packageVersion": "1.2.0",
"gitRepoId": "fingerprint-pro-server-api-go-sdk",
"gitUserId": "fingerprintjs",
"packageName": "sdk",
Expand Down
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Contributing to Fingerprint Pro Server API SDK
# Contributing to Fingerprint Pro Server API Go SDK

## Structure

Expand Down
9 changes: 9 additions & 0 deletions docs/BotdDetectionResult.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# BotdDetectionResult

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Result** | **string** | Bot detection result: * &#x60;notDetected&#x60; - the visitor is not a bot * &#x60;good&#x60; - good bot detected, such as Google bot, Baidu Spider, AlexaBot and so on * &#x60;bad&#x60; - bad bot detected, such as Selenium, Puppeteer, Playwright, headless browsers, and so on | [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions docs/BotdError.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# BotdError

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Error code: * &#x60;TooManyRequests&#x60; - the limit on secret API key requests per second has been exceeded * &#x60;Failed&#x60; - internal server error | [default to null]
**Message** | **string** | | [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

12 changes: 12 additions & 0 deletions docs/BotdResult.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# BotdResult

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Ip** | **string** | IP address of the requesting browser or bot. | [default to null]
**Time** | [**time.Time**](time.Time.md) | Time in UTC when the request from the JS agent was made. We recommend to treat requests that are older than 2 minutes as malicious. Otherwise, request replay attacks are possible | [default to null]
**Url** | **string** | Page URL from which identification request was sent. | [default to null]
**Bot** | [***BotdDetectionResult**](BotdDetectionResult.md) | | [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

9 changes: 9 additions & 0 deletions docs/ErrorEvent403Response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ErrorEvent403Response

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Error_** | [***ErrorEvent403ResponseError**](ErrorEvent403ResponseError.md) | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions docs/ErrorEvent403ResponseError.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ErrorEvent403ResponseError

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Error code: * &#x60;TokenRequired&#x60; - &#x60;Auth-API-Key&#x60; header is missing or empty * &#x60;TokenNotFound&#x60; - subscription not found for specified secret key * &#x60;SubscriptionNotActive&#x60; - subscription is not active * &#x60;WrongRegion&#x60; - server and subscription region differ | [default to null]
**Message** | **string** | | [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

9 changes: 9 additions & 0 deletions docs/ErrorEvent404Response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ErrorEvent404Response

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Error_** | [***ErrorEvent404ResponseError**](ErrorEvent404ResponseError.md) | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions docs/ErrorEvent404ResponseError.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ErrorEvent404ResponseError

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **string** | Error code: * &#x60;RequestNotFound&#x60; - request not found for specified id | [default to null]
**Message** | **string** | | [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

9 changes: 9 additions & 0 deletions docs/EventResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# EventResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Products** | [***ProductsResponse**](ProductsResponse.md) | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

39 changes: 34 additions & 5 deletions docs/FingerprintApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,40 @@ All URIs are relative to *https://api.fpjs.io*

Method | HTTP request | Description
------------- | ------------- | -------------
[**GetVisits**](FingerprintApi.md#GetVisits) | **Get** /visitors/{visitor_id} |
[**GetEvent**](FingerprintApi.md#GetEvent) | **Get** /events/{request_id} | Get event by requestId
[**GetVisits**](FingerprintApi.md#GetVisits) | **Get** /visitors/{visitor_id} | Get visits by visitorId

# **GetEvent**
> EventResponse GetEvent(ctx, requestId)
Get event by requestId

This endpoint allows you to get events with all the information from each activated product (Fingerprint Pro or Bot Detection). Use the requestId as a URL path :request_id parameter. This API method is scoped to a request, i.e. all returned information is by requestId.

### Required Parameters

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for authentication, logging, cancellation, deadlines, tracing, etc.
**requestId** | **string**| requestId is the unique identifier of each request |

### Return type

[**EventResponse**](EventResponse.md)

### Authorization

[ApiKeyHeader](../README.md#ApiKeyHeader), [ApiKeyQuery](../README.md#ApiKeyQuery)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

# **GetVisits**
> Response GetVisits(ctx, visitorId, optional)
Get visits by visitorId

This endpoint allows you to get a history of visits with all available information. Use the visitorId as a URL path parameter. This API method is scoped to a visitor, i.e. all returned information is by visitorId.

Expand All @@ -25,8 +54,8 @@ Optional parameters are passed through a pointer to a FingerprintApiGetVisitsOpt

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**requestId** | **optional.String**| Filter events by requestId |
**linkedId** | **optional.String**| Filter events by custom identifier |
**requestId** | **optional.String**| Filter visits by requestId |
**linkedId** | **optional.String**| Filter visits by custom identifier |
**limit** | **optional.Int32**| Limit scanned results |
**before** | **optional.Int32**| Used to paginate results |

Expand All @@ -41,7 +70,7 @@ Name | Type | Description | Notes
### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json
- **Accept**: application/json, text/html

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

2 changes: 1 addition & 1 deletion docs/IpLocation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Name | Type | Description | Notes
**Longitude** | **float64** | | [default to null]
**PostalCode** | **string** | | [optional] [default to null]
**Timezone** | **string** | | [default to null]
**City** | [***IpLocationCity**](IPLocation_city.md) | | [optional] [default to null]
**City** | [***IpLocationCity**](IPLocationCity.md) | | [optional] [default to null]
**Country** | [***Location**](Location.md) | | [default to null]
**Continent** | [***Location**](Location.md) | | [default to null]
**Subdivisions** | [**[]Subdivision**](Subdivision.md) | | [optional] [default to null]
Expand Down
10 changes: 10 additions & 0 deletions docs/ProductsResponse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ProductsResponse

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Identification** | [***ProductsResponseIdentification**](ProductsResponseIdentification.md) | | [optional] [default to null]
**Botd** | [***ProductsResponseBotd**](ProductsResponseBotd.md) | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

10 changes: 10 additions & 0 deletions docs/ProductsResponseBotd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ProductsResponseBotd

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Data** | [***BotdResult**](BotdResult.md) | | [optional] [default to null]
**Error_** | [***BotdError**](BotdError.md) | | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

Loading

0 comments on commit 491021a

Please sign in to comment.