@taruvi/sdk 1.0.7 → 1.0.8

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taruvi/sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Taruvi SDK",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",
@@ -0,0 +1,24 @@
1
+ import type { Client } from "../../client.js"
2
+
3
+ export class App {
4
+
5
+ private client: Client
6
+ private urlParams: {}
7
+
8
+ constructor(client: Client, urlParams: {}, filters?: {}) {
9
+ this.client = client
10
+ this.urlParams = urlParams
11
+ }
12
+
13
+ roles() {
14
+ return new App(this.client, {...this.urlParams})
15
+ }
16
+
17
+ filter(filters: {}) {
18
+ return new App(this.client, { ...this.urlParams }, filters)
19
+ }
20
+
21
+ execute() {
22
+
23
+ }
24
+ }
File without changes
@@ -40,7 +40,7 @@ export class Database {
40
40
  }
41
41
 
42
42
  update(body: any): Database {
43
- return new Database(this.client, this.urlParams = { ...this.urlParams }, HttpMethod.PUT, body)
43
+ return new Database(this.client, this.urlParams = { ...this.urlParams }, HttpMethod.PATCH, body)
44
44
  }
45
45
 
46
46
  delete(recordId?: any): Database {
@@ -67,7 +67,6 @@ export class Database {
67
67
  async execute() {
68
68
  // Build the API URL
69
69
  const url = this.buildRoute()
70
- // const fullUrl = `sites/eox_site/${url}` //remove for productions because baseurl is in the appscope, no need for site
71
70
 
72
71
  const operation = this.operation || HttpMethod.GET
73
72
 
@@ -75,11 +74,11 @@ export class Database {
75
74
  case HttpMethod.POST:
76
75
  return await this.client.httpClient.post(url, this.body)
77
76
 
78
- case HttpMethod.PUT:
77
+ case HttpMethod.PATCH:
79
78
  if (!this.urlParams.recordId) {
80
- throw new Error('PUT operation requires a record ID. Use .get(recordId) before .update()')
79
+ throw new Error('PATCH operation requires a record ID.')
81
80
  }
82
- return await this.client.httpClient.put(url, this.body)
81
+ return await this.client.httpClient.patch(url, this.body)
83
82
 
84
83
  case HttpMethod.DELETE:
85
84
  return await this.client.httpClient.delete(url)