@gravity-ai/api 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -23,6 +23,7 @@ interface AdParams {
23
23
  device?: DeviceObject;
24
24
  user?: UserObject;
25
25
  excludedTopics?: string[];
26
+ relevancy?: number | null;
26
27
  [key: string]: any;
27
28
  }
28
29
  interface AdResponse {
@@ -43,6 +44,7 @@ interface ApiErrorResponse {
43
44
  interface ClientParams {
44
45
  endpoint?: string;
45
46
  excludedTopics?: string[];
47
+ relevancy?: number | null;
46
48
  }
47
49
  /**
48
50
  * Client for the Gravity API
@@ -51,6 +53,7 @@ declare class Client {
51
53
  private apiKey;
52
54
  private endpoint?;
53
55
  private excludedTopics?;
56
+ private relevancy?;
54
57
  private axios;
55
58
  constructor(apiKey: string, params?: ClientParams);
56
59
  /**
package/dist/index.d.ts CHANGED
@@ -23,6 +23,7 @@ interface AdParams {
23
23
  device?: DeviceObject;
24
24
  user?: UserObject;
25
25
  excludedTopics?: string[];
26
+ relevancy?: number | null;
26
27
  [key: string]: any;
27
28
  }
28
29
  interface AdResponse {
@@ -43,6 +44,7 @@ interface ApiErrorResponse {
43
44
  interface ClientParams {
44
45
  endpoint?: string;
45
46
  excludedTopics?: string[];
47
+ relevancy?: number | null;
46
48
  }
47
49
  /**
48
50
  * Client for the Gravity API
@@ -51,6 +53,7 @@ declare class Client {
51
53
  private apiKey;
52
54
  private endpoint?;
53
55
  private excludedTopics?;
56
+ private relevancy?;
54
57
  private axios;
55
58
  constructor(apiKey: string, params?: ClientParams);
56
59
  /**
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ var Client = class {
41
41
  this.apiKey = apiKey;
42
42
  this.endpoint = params.endpoint || "https://server.trygravity.ai";
43
43
  this.excludedTopics = params.excludedTopics || [];
44
+ this.relevancy = params.relevancy || null;
44
45
  this.axios = import_axios.default.create({
45
46
  baseURL: this.endpoint,
46
47
  timeout: 1e4,
@@ -62,7 +63,9 @@ var Client = class {
62
63
  // prefer explicit apiKey in params, else default to client's apiKey
63
64
  apiKey: params.apiKey ?? this.apiKey,
64
65
  // supply top-level excludedTopics if not provided
65
- excludedTopics: params.excludedTopics ?? this.excludedTopics
66
+ excludedTopics: params.excludedTopics ?? this.excludedTopics,
67
+ // supply top-level relevancy if not provided
68
+ relevancy: params.relevancy ?? this.relevancy
66
69
  };
67
70
  const response = await this.axios.post("/ad", body);
68
71
  if (response.status === 204) return null;
package/dist/index.mjs CHANGED
@@ -5,6 +5,7 @@ var Client = class {
5
5
  this.apiKey = apiKey;
6
6
  this.endpoint = params.endpoint || "https://server.trygravity.ai";
7
7
  this.excludedTopics = params.excludedTopics || [];
8
+ this.relevancy = params.relevancy || null;
8
9
  this.axios = axios.create({
9
10
  baseURL: this.endpoint,
10
11
  timeout: 1e4,
@@ -26,7 +27,9 @@ var Client = class {
26
27
  // prefer explicit apiKey in params, else default to client's apiKey
27
28
  apiKey: params.apiKey ?? this.apiKey,
28
29
  // supply top-level excludedTopics if not provided
29
- excludedTopics: params.excludedTopics ?? this.excludedTopics
30
+ excludedTopics: params.excludedTopics ?? this.excludedTopics,
31
+ // supply top-level relevancy if not provided
32
+ relevancy: params.relevancy ?? this.relevancy
30
33
  };
31
34
  const response = await this.axios.post("/ad", body);
32
35
  if (response.status === 204) return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ai/api",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Gravity JS SDK for retrieving targeted advertisements",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",