0.3.79 • Published 5 months ago

@nyris/nyris-api v0.3.79

Weekly downloads
10
License
-
Repository
-
Last release
5 months ago

nyris-api

Install

npm install @nyris/nyris-api

Example usage

import NyrisAPI, { urlOrBlobToCanvas } from "@nyris/nyris-api";

const settings = {
    xOptions: 'default', // optional, see "General request options" https://docs.nyris.io/#general-request-options for available options
    apiKey: '<YOUR_API_KEY>',
    jpegQuality: 0.9, // 
    maxWidth: 500, // Maximal image size sent to server
    maxHeight: 500,
    responseFormat: 'application/offers.complete+json' // optional, see "Response type" https://docs.nyris.io/#response-type

};
const api = new NyrisAPI(settings);

const image = await urlOrBlobToCanvas("http://...");
const results = await api.findByImage(image, {});
console.log(results);

api methods

Search for an image

find(options: ImageSearchOptions, canvas: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, filters?: Filter[], xOptions?: any) : Promise<SearchResult>

The image has to be an image-like HTML object. Example options:

const options = {
    geoLocation: { lat: 52.5, lon: 13.4, dist: 50 },
    cropRect: {x1: 0.3, x2: 0.7, y1: 0.3, y2: 0.7}
}

Search for an SKU (itemID)

findBySku(sku: string, mid: string): Promise<SearchResult>

Search for significant sections in the image.

findRegions(canvas: HTMLCanvasElement | HTMLVideoElement | HTMLImageElement): Promise<Region[]>

Send feedback event.

sendFeedback(sessionId: string, requestId: string, payload: FeedbackEventPayload)

See Click and conversion analytics.

Example feedback events:

// Signal a successful or failed search
const success = {
    request_id: "<REQUEST_ID>",
    timestamp: new Date(),
    session_id: "<SESSION_ID>",
    event: 'feedback',
    data: { success: true }
};

// Signal a selected region
const region = {
    request_id: "<REQUEST_ID>",
    timestamp: new Date(),
    session_id: "<SESSION_ID>",
    event: 'region',
    data: { rect: { x: 0.1, y: 0.1, w: 0.2, h: 0.2 } }
};

// Signal a clicked result
const click = {
    request_id: "<REQUEST_ID>",
    timestamp: new Date(),
    session_id: "<SESSION_ID>",
    event: 'click',
    data: { positions: [4]} // position of the result in the results list
};
0.3.75

8 months ago

0.3.74

8 months ago

0.3.73

9 months ago

0.3.72

9 months ago

0.3.71

9 months ago

0.3.70

10 months ago

0.3.79

5 months ago

0.3.78

6 months ago

0.3.77

6 months ago

0.3.76

7 months ago

0.3.64

12 months ago

0.3.63

12 months ago

0.3.69

10 months ago

0.3.68

10 months ago

0.3.67

11 months ago

0.3.66

11 months ago

0.3.65

11 months ago

0.3.62

12 months ago

0.3.61

1 year ago

0.3.60

1 year ago

0.3.59

1 year ago

0.3.58

1 year ago

0.3.57

1 year ago

0.3.56

1 year ago

0.3.55

1 year ago

0.3.54

2 years ago

0.3.53

2 years ago

0.3.52

2 years ago

0.3.51

2 years ago

0.3.50

2 years ago

0.3.49

2 years ago

0.3.48

2 years ago

0.3.47

2 years ago

0.3.46

2 years ago

0.3.45

2 years ago

0.3.44

2 years ago

0.3.43

2 years ago

0.3.39

2 years ago

0.3.38

2 years ago

0.3.37

2 years ago

0.3.36

2 years ago

0.3.35

2 years ago

0.3.34

2 years ago

0.3.33

2 years ago

0.3.42

2 years ago

0.3.41

2 years ago

0.3.40

2 years ago

0.3.32

2 years ago

0.3.31

2 years ago

0.3.30

2 years ago

0.3.29

2 years ago

0.3.27

3 years ago

0.3.26

3 years ago

0.3.25

3 years ago

0.3.24

3 years ago

0.3.23

3 years ago

0.3.22

3 years ago

0.3.21

3 years ago

0.3.20

3 years ago

0.3.19

3 years ago

0.3.17

3 years ago

0.3.16

3 years ago

0.3.15

3 years ago

0.3.14

3 years ago

0.3.18

3 years ago

0.3.9

3 years ago

0.3.13

3 years ago

0.3.12

3 years ago

0.3.6

3 years ago

0.3.5

3 years ago

0.3.2

3 years ago

0.3.1

3 years ago

0.3.4

3 years ago

0.3.3

3 years ago

0.2.6

4 years ago

0.2.5

4 years ago

0.2.4

4 years ago

0.2.3

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.2.2

4 years ago

0.1.8

5 years ago

0.1.9

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago