0.3.54 • Published 9 days ago

@nyris/nyris-api v0.3.54

Weekly downloads
10
License
-
Repository
-
Last release
9 days 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

findByImage(canvas: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement, options: ImageSearchOptions) : 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.54

9 days ago

0.3.53

10 days ago

0.3.52

15 days ago

0.3.51

16 days ago

0.3.50

25 days ago

0.3.49

29 days ago

0.3.48

2 months ago

0.3.47

3 months ago

0.3.46

3 months ago

0.3.45

4 months ago

0.3.44

4 months ago

0.3.43

4 months ago

0.3.39

7 months ago

0.3.38

7 months ago

0.3.37

8 months ago

0.3.36

8 months ago

0.3.35

9 months ago

0.3.34

10 months ago

0.3.33

10 months ago

0.3.42

5 months ago

0.3.41

6 months ago

0.3.40

6 months ago

0.3.32

10 months ago

0.3.31

11 months ago

0.3.30

12 months ago

0.3.29

1 year ago

0.3.27

1 year ago

0.3.26

1 year ago

0.3.25

1 year ago

0.3.24

1 year ago

0.3.23

1 year ago

0.3.22

1 year ago

0.3.21

1 year ago

0.3.20

1 year ago

0.3.19

1 year ago

0.3.17

2 years ago

0.3.16

2 years ago

0.3.15

2 years ago

0.3.14

2 years ago

0.3.18

2 years ago

0.3.9

2 years ago

0.3.13

2 years ago

0.3.12

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.2

3 years ago

0.1.8

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago