@colior115/all-connected-be-sdk 1.0.25 → 1.0.26
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
|
@@ -7,27 +7,29 @@ import {
|
|
|
7
7
|
} from "../types";
|
|
8
8
|
|
|
9
9
|
export const createBusinessRelationClient = (config: SdkConfig) => ({
|
|
10
|
+
// Pre-connect — no business token needed
|
|
11
|
+
connect: (businessId: string) =>
|
|
12
|
+
request<{ token: string }>(config, "/api/businessRelation/connect", {
|
|
13
|
+
method: "POST",
|
|
14
|
+
body: { businessId },
|
|
15
|
+
}),
|
|
16
|
+
|
|
17
|
+
getUserBusinesses: () =>
|
|
18
|
+
request<BusinessRelationEnrichedDTO[]>(config, "/api/businessRelation/user/businesses"),
|
|
19
|
+
|
|
20
|
+
// Business-scoped — requires business token
|
|
10
21
|
getAll: (businessId: string) =>
|
|
11
|
-
request<BusinessRelationDTO[]>(config, `/api/businessRelation/${businessId}/all
|
|
22
|
+
request<BusinessRelationDTO[]>(config, `/api/businessRelation/${businessId}/all`, { withBusinessToken: true }),
|
|
12
23
|
|
|
13
24
|
get: (id: string) =>
|
|
14
|
-
request<BusinessRelationDTO>(config, `/api/businessRelation/${id}
|
|
25
|
+
request<BusinessRelationDTO>(config, `/api/businessRelation/${id}`, { withBusinessToken: true }),
|
|
15
26
|
|
|
16
27
|
create: (input: CreateBusinessRelationInputDTO) =>
|
|
17
|
-
request<BusinessRelationDTO>(config, "/api/businessRelation", { method: "POST", body: input }),
|
|
28
|
+
request<BusinessRelationDTO>(config, "/api/businessRelation", { method: "POST", body: input, withBusinessToken: true }),
|
|
18
29
|
|
|
19
30
|
update: (id: string, input: UpdateBusinessRelationInputDTO) =>
|
|
20
|
-
request<BusinessRelationDTO>(config, `/api/businessRelation/${id}`, { method: "PUT", body: input }),
|
|
31
|
+
request<BusinessRelationDTO>(config, `/api/businessRelation/${id}`, { method: "PUT", body: input, withBusinessToken: true }),
|
|
21
32
|
|
|
22
33
|
delete: (id: string) =>
|
|
23
|
-
request<BusinessRelationDTO>(config, `/api/businessRelation/${id}`, { method: "DELETE" }),
|
|
24
|
-
|
|
25
|
-
connect: (businessId: string) =>
|
|
26
|
-
request<{ token: string }>(config, "/api/businessRelation/connect", {
|
|
27
|
-
method: "POST",
|
|
28
|
-
body: { businessId },
|
|
29
|
-
}),
|
|
30
|
-
|
|
31
|
-
getUserBusinesses: () =>
|
|
32
|
-
request<BusinessRelationEnrichedDTO[]>(config, "/api/businessRelation/user/businesses"),
|
|
34
|
+
request<BusinessRelationDTO>(config, `/api/businessRelation/${id}`, { method: "DELETE", withBusinessToken: true }),
|
|
33
35
|
});
|
|
@@ -14,21 +14,21 @@ export const createCustomerClient = (config: SdkConfig) => ({
|
|
|
14
14
|
if (params.limit !== undefined) query.set("limit", String(params.limit));
|
|
15
15
|
if (params.search) query.set("search", params.search);
|
|
16
16
|
const qs = query.toString();
|
|
17
|
-
return request<CustomerListResponseDTO>(config, `/api/customer/${businessId}/all${qs ? `?${qs}` : ""}
|
|
17
|
+
return request<CustomerListResponseDTO>(config, `/api/customer/${businessId}/all${qs ? `?${qs}` : ""}`, { withBusinessToken: true });
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
get: (id: string) =>
|
|
21
|
-
request<CustomerDTO>(config, `/api/customer/${id}
|
|
21
|
+
request<CustomerDTO>(config, `/api/customer/${id}`, { withBusinessToken: true }),
|
|
22
22
|
|
|
23
23
|
getByBusinessIdAndEmail: (businessId: string, email: string) =>
|
|
24
|
-
request<CustomerDTO>(config, `/api/customer/${businessId}/email/${encodeURIComponent(email)}
|
|
24
|
+
request<CustomerDTO>(config, `/api/customer/${businessId}/email/${encodeURIComponent(email)}`, { withBusinessToken: true }),
|
|
25
25
|
|
|
26
26
|
create: (input: CreateCustomerInputDTO) =>
|
|
27
|
-
request<CustomerDTO>(config, "/api/customer", { method: "POST", body: input }),
|
|
27
|
+
request<CustomerDTO>(config, "/api/customer", { method: "POST", body: input, withBusinessToken: true }),
|
|
28
28
|
|
|
29
29
|
update: (id: string, input: UpdateCustomerInputDTO) =>
|
|
30
|
-
request<CustomerDTO>(config, `/api/customer/${id}`, { method: "PUT", body: input }),
|
|
30
|
+
request<CustomerDTO>(config, `/api/customer/${id}`, { method: "PUT", body: input, withBusinessToken: true }),
|
|
31
31
|
|
|
32
32
|
delete: (id: string) =>
|
|
33
|
-
request<CustomerDTO>(config, `/api/customer/${id}`, { method: "DELETE" }),
|
|
33
|
+
request<CustomerDTO>(config, `/api/customer/${id}`, { method: "DELETE", withBusinessToken: true }),
|
|
34
34
|
});
|
|
@@ -14,21 +14,21 @@ export const createEmployeeClient = (config: SdkConfig) => ({
|
|
|
14
14
|
if (params.limit !== undefined) query.set("limit", String(params.limit));
|
|
15
15
|
if (params.search) query.set("search", params.search);
|
|
16
16
|
const qs = query.toString();
|
|
17
|
-
return request<EmployeeListResponseDTO>(config, `/api/employee/${businessId}/all${qs ? `?${qs}` : ""}
|
|
17
|
+
return request<EmployeeListResponseDTO>(config, `/api/employee/${businessId}/all${qs ? `?${qs}` : ""}`, { withBusinessToken: true });
|
|
18
18
|
},
|
|
19
19
|
|
|
20
20
|
get: (employeeId: string) =>
|
|
21
|
-
request<EmployeeDTO>(config, `/api/employee/${employeeId}
|
|
21
|
+
request<EmployeeDTO>(config, `/api/employee/${employeeId}`, { withBusinessToken: true }),
|
|
22
22
|
|
|
23
23
|
getByBusinessIdAndEmail: (businessId: string, email: string) =>
|
|
24
|
-
request<EmployeeDTO>(config, `/api/employee/${businessId}/email/${encodeURIComponent(email)}
|
|
24
|
+
request<EmployeeDTO>(config, `/api/employee/${businessId}/email/${encodeURIComponent(email)}`, { withBusinessToken: true }),
|
|
25
25
|
|
|
26
26
|
create: (input: CreateEmployeeInputDTO) =>
|
|
27
|
-
request<EmployeeDTO>(config, "/api/employee", { method: "POST", body: input }),
|
|
27
|
+
request<EmployeeDTO>(config, "/api/employee", { method: "POST", body: input, withBusinessToken: true }),
|
|
28
28
|
|
|
29
29
|
update: (employeeId: string, input: UpdateEmployeeInputDTO) =>
|
|
30
|
-
request<EmployeeDTO>(config, `/api/employee/${employeeId}`, { method: "PUT", body: input }),
|
|
30
|
+
request<EmployeeDTO>(config, `/api/employee/${employeeId}`, { method: "PUT", body: input, withBusinessToken: true }),
|
|
31
31
|
|
|
32
32
|
delete: (employeeId: string) =>
|
|
33
|
-
request<EmployeeDTO>(config, `/api/employee/${employeeId}`, { method: "DELETE" }),
|
|
33
|
+
request<EmployeeDTO>(config, `/api/employee/${employeeId}`, { method: "DELETE", withBusinessToken: true }),
|
|
34
34
|
});
|
|
@@ -3,17 +3,17 @@ import { UserRoleDTO, CreateUserRoleInputDTO, UpdateUserRoleInputDTO } from "../
|
|
|
3
3
|
|
|
4
4
|
export const createUserRoleClient = (config: SdkConfig) => ({
|
|
5
5
|
getAll: (businessId: string) =>
|
|
6
|
-
request<UserRoleDTO[]>(config, `/api/userRole/${businessId}/all
|
|
6
|
+
request<UserRoleDTO[]>(config, `/api/userRole/${businessId}/all`, { withBusinessToken: true }),
|
|
7
7
|
|
|
8
8
|
get: (id: string) =>
|
|
9
|
-
request<UserRoleDTO>(config, `/api/userRole/${id}
|
|
9
|
+
request<UserRoleDTO>(config, `/api/userRole/${id}`, { withBusinessToken: true }),
|
|
10
10
|
|
|
11
11
|
create: (input: CreateUserRoleInputDTO) =>
|
|
12
|
-
request<UserRoleDTO>(config, "/api/userRole", { method: "POST", body: input }),
|
|
12
|
+
request<UserRoleDTO>(config, "/api/userRole", { method: "POST", body: input, withBusinessToken: true }),
|
|
13
13
|
|
|
14
14
|
update: (id: string, input: UpdateUserRoleInputDTO) =>
|
|
15
|
-
request<UserRoleDTO>(config, `/api/userRole/${id}`, { method: "PUT", body: input }),
|
|
15
|
+
request<UserRoleDTO>(config, `/api/userRole/${id}`, { method: "PUT", body: input, withBusinessToken: true }),
|
|
16
16
|
|
|
17
17
|
delete: (id: string) =>
|
|
18
|
-
request<UserRoleDTO>(config, `/api/userRole/${id}`, { method: "DELETE" }),
|
|
18
|
+
request<UserRoleDTO>(config, `/api/userRole/${id}`, { method: "DELETE", withBusinessToken: true }),
|
|
19
19
|
});
|