squarecommonblhelper 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -15,6 +15,14 @@ helper for common bl for my projects.
15
15
 
16
16
  ## changelog
17
17
 
18
+ ### v1.0.2
19
+
20
+ - replace user_id with accessToken from greeting -> createGreetingV0.
21
+
22
+ ### v1.0.1
23
+
24
+ - remove app_id from greeting -> createGreetingV0.
25
+
18
26
  ### v1.0.0
19
27
 
20
28
  - initial implementation.
@@ -1,6 +1,6 @@
1
1
  declare class GreetingCommonBL {
2
2
  private commonBLBaseURL;
3
3
  constructor(commonBLBaseURL?: string);
4
- createGreetingV0(greetingIsAnonymous: boolean, appId?: number, greetingAnonymousSenderName?: string, userId?: string, greetingText?: string): Promise<import("squarecommons").APIOutput>;
4
+ createGreetingV0(greetingIsAnonymous: boolean, greetingAnonymousSenderName?: string, accessToken?: string, greetingText?: string): Promise<import("squarecommons").APIOutput>;
5
5
  }
6
6
  export { GreetingCommonBL };
package/dist/greeting.js CHANGED
@@ -4,13 +4,20 @@ class GreetingCommonBL {
4
4
  constructor(commonBLBaseURL = "http://localhost:10110") {
5
5
  this.commonBLBaseURL = commonBLBaseURL;
6
6
  }
7
- async createGreetingV0(greetingIsAnonymous, appId, greetingAnonymousSenderName, userId, greetingText) {
7
+ async createGreetingV0(greetingIsAnonymous, greetingAnonymousSenderName, accessToken, greetingText) {
8
8
  try {
9
- const data = await fetchJSONData(this.commonBLBaseURL, "create_greeting/v0", "POST", undefined, {
10
- app_id: appId,
9
+ let headers;
10
+ if (accessToken) {
11
+ headers = {
12
+ access_token: accessToken,
13
+ };
14
+ }
15
+ else {
16
+ headers = undefined;
17
+ }
18
+ const data = await fetchJSONData(this.commonBLBaseURL, "create_greeting/v0", "POST", headers, {
11
19
  greeting_is_anonymous: greetingIsAnonymous,
12
20
  greeting_anonymous_sender_name: greetingAnonymousSenderName,
13
- user_id: userId,
14
21
  greeting_text: greetingText,
15
22
  });
16
23
  return data;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "squarecommonblhelper",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "helper for common bl for my projects.",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
9
  "test": "",
10
- "build": "tsc",
10
+ "build": "rm -rf ./dist && tsc",
11
11
  "dev": "tsc && node dist/index.js"
12
12
  },
13
13
  "files": [
@@ -31,6 +31,6 @@
31
31
  "node": ">=18.0.0"
32
32
  },
33
33
  "dependencies": {
34
- "squarecommons": "^1.0.5"
34
+ "squarecommons": "^1.0.10"
35
35
  }
36
36
  }