8000 Merge pull request #95 from apisearch-io/feature/added-device-to-inte… · apisearch-io/javascript-client@0c6a332 · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 25, 2025. It is now read-only.

Commit 0c6a332

Browse files
authored
Merge pull request #95 from apisearch-io/feature/added-device-to-interactions-and-purchases
Added device in both action calls
2 parents 31ec01b + acd7e1f commit 0c6a332

File tree

9 files changed

+32
-12
lines changed

9 files changed

+32
-12
lines changed

dist/apisearch.js

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/apisearch.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Repository/HttpRepository.d.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,21 @@ export declare class HttpRepository extends Repository {
153153
* @param {string} interaction
154154
* @param {string} queryString
155155
* @param {string} site
156+
* @param {string} device
156157
*
157158
* @return {Promise<void>}
158159
*/
159-
pushInteraction(indexUUID: IndexUUID, itemUUID: ItemUUID, userId: string, queryString: string, interaction: string, site?: string): Promise<void>;
160+
pushInteraction(indexUUID: IndexUUID, itemUUID: ItemUUID, userId: string, queryString: string, interaction: string, site?: string, device?: string): Promise<void>;
160161
/**
161162
* @param {IndexUUID} indexUUID
162163
* @param {string} userId
163164
* @param {ItemUUID[]} itemUUIDs
164165
* @param {string} site
166+
* @param {string} device
165167
*
166168
* @return {Promise<void>}
167169
*/
168-
purchase(indexUUID: IndexUUID, userId: string, itemUUIDs: ItemUUID[], site?: string): Promise<void>;
170+
purchase(indexUUID: IndexUUID, userId: string, itemUUIDs: ItemUUID[], site?: string, device?: string): Promise<void>;
169171
/**
170172
*
171173
*/

lib/Repository/HttpRepository.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,13 @@ var HttpRepository = /** @class */ (function (_super) {
432432
* @param {string} interaction
433433
* @param {string} queryString
434434
* @param {string} site
435+
* @param {string} device
435436
*
436437
* @return {Promise<void>}
437438
*/
438-
HttpRepository.prototype.pushInteraction = function (indexUUID, itemUUID, userId, queryString, interaction, site) {
439+
HttpRepository.prototype.pushInteraction = function (indexUUID, itemUUID, userId, queryString, interaction, site, device) {
439440
if (site === void 0) { site = null; }
441+
if (device === void 0) { device = null; }
440442
return tslib_1.__awaiter(this, void 0, void 0, function () {
441443
var parameters, response_13;
442444
return tslib_1.__generator(this, function (_a) {
@@ -445,6 +447,7 @@ var HttpRepository = /** @class */ (function (_super) {
445447
parameters = {
446448
query_string: queryString,
447449
site: site,
450+
device: device,
448451
user_id: userId
449452
};
450453
_a.label = 1;
@@ -469,18 +472,21 @@ var HttpRepository = /** @class */ (function (_super) {
469472
* @param {string} userId
470473
* @param {ItemUUID[]} itemUUIDs
471474
* @param {string} site
475+
* @param {string} device
472476
*
473477
* @return {Promise<void>}
474478
*/
475-
HttpRepository.prototype.purchase = function (indexUUID, userId, itemUUIDs, site) {
479+
HttpRepository.prototype.purchase = function (indexUUID, userId, itemUUIDs, site, device) {
476480
if (site === void 0) { site = null; }
481+
if (device === void 0) { device = null; }
477482
return tslib_1.__awaiter(this, void 0, void 0, function () {
478483
var parameters, response_14;
479484
return tslib_1.__generator(this, function (_a) {
480485
switch (_a.label) {
481486
case 0:
482487
parameters = {
483488
site: site,
489+
device: device,
484490
user_id: userId
485491
};
486492
_a.label = 1;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "apisearch",
3-
"version": "0.3.12",
3+
"version": "0.3.13",
44
"description": "Javascript client for Apisearch.",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",

src/Repository/HttpRepository.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ export class HttpRepository extends Repository {
412412
* @param {string} interaction
413413
* @param {string} queryString
414414
* @param {string} site
415+
* @param {string} device
415416
*
416417
* @return {Promise<void>}
417418
*/
@@ -422,10 +4 F438 23,12 @@ export class HttpRepository extends Repository {
422423
queryString: string,
423424
interaction: string,
424425
site: string = null,
426+
device: string = null,
425427
): Promise<void> {
426428
const parameters = {
427429
query_string: queryString,
428430
site: site,
431+
device: device,
429432
user_id: userId,
430433
};
431434

@@ -449,6 +452,7 @@ export class HttpRepository extends Repository {
449452
* @param {string} userId
450453
* @param {ItemUUID[]} itemUUIDs
451454
* @param {string} site
455+
* @param {string} device
452456
*
453457
* @return {Promise<void>}
454458
*/
@@ -457,9 +461,11 @@ export class HttpRepository extends Repository {
457461
userId: string,
458462
itemUUIDs: ItemUUID[],
459463
site: string = null,
464+
device: string = null,
460465
): Promise<void> {
461466
const parameters = {
462467
site: site,
468+
device: device,
463469
user_id: userId,
464470
};
465471

test/Repository/HttpRepository.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ describe('Repository/', () => {
244244
await repository.getSimilarItems(Query.createMatchAll(), [ItemUUID.createByComposedUUID('1~type')], 1).then(_ => counter++);
245245
await repository.getRecommendedItems(Query.createMatchAll()).then(_ => counter++);
246246
await repository.pushInteraction(IndexUUID.createById('x'), ItemUUID.createByComposedUUID('1~type'), '123', 'queryX', 'cli').then(_ => counter++);
247-
await repository.pushInteraction(IndexUUID.createById('x'), ItemUUID.createByComposedUUID('1~type'), '123', 'queryX', 'cli', 'site2').then(_ => counter++);
247+
await repository.pushInteraction(IndexUUID.createById('x'), ItemUUID.createByComposedUUID('1~type'), '123', 'queryX', 'cli', 'site2', 'desktop').then(_ => counter++);
248248
await repository.purchase(IndexUUID.createById('x'), '123', []).then(_ => counter++);
249-
await repository.purchase(IndexUUID.createById('x'), '123', [], 'site2').then(_ => counter++);
249+
await repository.purchase(IndexUUID.createById('x'), '123', [], 'site2', 'desktop').then(_ => counter++);
250250
await repository.purchase(IndexUUID.createById('x'), '123', [
251251
ItemUUID.createByComposedUUID('2~type'),
252252
ItemUUID.createByComposedUUID('3~type')

0 commit comments

Comments
 (0)
0