@skyiro/sky-client 0.1.10 → 0.1.12
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 +30 -0
- package/dist/accounts-client.d.ts +9 -1
- package/dist/accounts-client.js +100 -2
- package/dist/accounts-client.js.map +1 -1
- package/dist/enums.d.ts +2 -0
- package/dist/enums.js +2 -0
- package/dist/enums.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +69 -2
- package/dist/types.js +2 -2
- package/dist/types.js.map +1 -1
- package/package.json +4 -3
- package/proto/accounts.proto +108 -33
package/README.md
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Single dependency for Skyiro **internal gRPC** clients:
|
|
4
4
|
|
|
5
|
+
- **Accounts** — `AccountClient` (`account.v1.AccountsGrpcService`)
|
|
5
6
|
- **Notifier** — `NotifierClient` (`notifier.v1.NotifierService`)
|
|
6
7
|
- **Short** — `ShortenerClient` (`shortener.v1.ShortenerService`)
|
|
7
8
|
|
|
@@ -13,6 +14,35 @@ Typed **`ProductKey`**, **`EventKey`**, and **`NotificationChannel`** mirror not
|
|
|
13
14
|
pnpm add @skyiro/sky-client
|
|
14
15
|
```
|
|
15
16
|
|
|
17
|
+
## Accounts
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { AccountClient, OrgRole, ProductKey } from "@skyiro/sky-client";
|
|
21
|
+
|
|
22
|
+
const accounts = new AccountClient(
|
|
23
|
+
process.env.ACCOUNTS_GRPC_ADDRESS ?? "127.0.0.1:50510",
|
|
24
|
+
ProductKey.SkyPaper,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
const { id } = await accounts.createUser({
|
|
28
|
+
organizationId: "org-id",
|
|
29
|
+
firstName: "Ada",
|
|
30
|
+
lastName: "Lovelace",
|
|
31
|
+
password: "ChangeMe123!",
|
|
32
|
+
orgRole: OrgRole.User,
|
|
33
|
+
email: "ada@example.com",
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
await accounts.licenseCheck({
|
|
37
|
+
organizationId: "org-id",
|
|
38
|
+
key: ProductKey.SkyPaper,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
accounts.close();
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Run the bundled example: `pnpm example:create-user` (requires a running account-api).
|
|
45
|
+
|
|
16
46
|
## Notifier
|
|
17
47
|
|
|
18
48
|
```ts
|
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import { UpdateOrganizationRequest, UpdateOrganizationResponse, UserCreateRequest, UserCreateResponse, UserUpdateRequest, UserUpdateResponse } from "./types";
|
|
1
|
+
import { LicenseCheckRequest, LicenseCheckResponse, MfaSessionRequest, MfaSessionResponse, OAuthCodeExchangeRequest, OAuthCodeExchangeResponse, UpdateOrganizationRequest, UpdateOrganizationResponse, UserCreateRequest, UserCreateResponse, UserDeleteRequest, UserDeleteResponse, UserGetResponse, UserUpdateRequest, UserUpdateResponse, IssueSalaryRevealTokenRequest, IssueSalaryRevealTokenResponse } from "./types";
|
|
2
2
|
import { ProductKey } from "./enums";
|
|
3
3
|
export declare class AccountClient {
|
|
4
4
|
private readonly client;
|
|
5
5
|
private readonly defaultProductKey;
|
|
6
6
|
constructor(address: string, defaultProductKey: ProductKey);
|
|
7
|
+
getUser(id: string): Promise<UserGetResponse>;
|
|
7
8
|
createUser(data: UserCreateRequest): Promise<UserCreateResponse>;
|
|
8
9
|
updateUser(data: UserUpdateRequest): Promise<UserUpdateResponse>;
|
|
10
|
+
softDeleteUser(data: UserDeleteRequest): Promise<UserDeleteResponse>;
|
|
11
|
+
hardDeleteUser(data: UserDeleteRequest): Promise<UserDeleteResponse>;
|
|
12
|
+
deleteUser(data: UserDeleteRequest): Promise<UserDeleteResponse>;
|
|
9
13
|
updateOrganization(data: UpdateOrganizationRequest): Promise<UpdateOrganizationResponse>;
|
|
14
|
+
licenseCheck(data: LicenseCheckRequest): Promise<LicenseCheckResponse>;
|
|
15
|
+
createMfaSession(data: MfaSessionRequest): Promise<MfaSessionResponse>;
|
|
16
|
+
exchangeOAuthCode(data: OAuthCodeExchangeRequest): Promise<OAuthCodeExchangeResponse>;
|
|
17
|
+
issueSalaryRevealToken(data: IssueSalaryRevealTokenRequest): Promise<IssueSalaryRevealTokenResponse>;
|
|
10
18
|
}
|
package/dist/accounts-client.js
CHANGED
|
@@ -23,6 +23,18 @@ class AccountClient {
|
|
|
23
23
|
this.client = loadAccountGrpc(address);
|
|
24
24
|
this.defaultProductKey = defaultProductKey;
|
|
25
25
|
}
|
|
26
|
+
getUser(id) {
|
|
27
|
+
const grpcReq = { id };
|
|
28
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
29
|
+
this.client.getUser(grpcReq, (error, response) => {
|
|
30
|
+
if (error) {
|
|
31
|
+
rejectPromise(error);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
resolvePromise(response);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
26
38
|
createUser(data) {
|
|
27
39
|
const productKey = this.defaultProductKey;
|
|
28
40
|
const { firstName, organizationId, lastName, middleName, password, countryCode, email, phone, orgRole, } = data;
|
|
@@ -50,7 +62,7 @@ class AccountClient {
|
|
|
50
62
|
}
|
|
51
63
|
updateUser(data) {
|
|
52
64
|
const productKey = this.defaultProductKey;
|
|
53
|
-
const { id, organizationId, firstName, lastName, middleName, password, orgRole, } = data;
|
|
65
|
+
const { id, organizationId, firstName, lastName, middleName, password, orgRole, email, phone, } = data;
|
|
54
66
|
const grpcReq = {
|
|
55
67
|
id,
|
|
56
68
|
organizationId,
|
|
@@ -60,6 +72,8 @@ class AccountClient {
|
|
|
60
72
|
middleName,
|
|
61
73
|
password,
|
|
62
74
|
orgRole,
|
|
75
|
+
email,
|
|
76
|
+
phone,
|
|
63
77
|
};
|
|
64
78
|
return new Promise((resolvePromise, rejectPromise) => {
|
|
65
79
|
this.client.updateUser(grpcReq, (error, response) => {
|
|
@@ -71,9 +85,43 @@ class AccountClient {
|
|
|
71
85
|
});
|
|
72
86
|
});
|
|
73
87
|
}
|
|
88
|
+
softDeleteUser(data) {
|
|
89
|
+
const grpcReq = {
|
|
90
|
+
id: data.id,
|
|
91
|
+
productKey: data.productKey || this.defaultProductKey,
|
|
92
|
+
};
|
|
93
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
94
|
+
this.client.softDeleteUser(grpcReq, (error, response) => {
|
|
95
|
+
if (error) {
|
|
96
|
+
rejectPromise(error);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
resolvePromise(response);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
hardDeleteUser(data) {
|
|
104
|
+
const grpcReq = {
|
|
105
|
+
id: data.id,
|
|
106
|
+
productKey: data.productKey || this.defaultProductKey,
|
|
107
|
+
};
|
|
108
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
109
|
+
this.client.hardDeleteUser(grpcReq, (error, response) => {
|
|
110
|
+
if (error) {
|
|
111
|
+
rejectPromise(error);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
resolvePromise(response);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
deleteUser(data) {
|
|
119
|
+
return this.softDeleteUser(data);
|
|
120
|
+
}
|
|
74
121
|
updateOrganization(data) {
|
|
75
|
-
const { ownerId, name } = data;
|
|
122
|
+
const { organizationId, ownerId, name } = data;
|
|
76
123
|
const grpcReq = {
|
|
124
|
+
organizationId,
|
|
77
125
|
ownerId,
|
|
78
126
|
name,
|
|
79
127
|
};
|
|
@@ -87,6 +135,56 @@ class AccountClient {
|
|
|
87
135
|
});
|
|
88
136
|
});
|
|
89
137
|
}
|
|
138
|
+
licenseCheck(data) {
|
|
139
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
140
|
+
this.client.licenseCheck(data, (error, response) => {
|
|
141
|
+
if (error) {
|
|
142
|
+
rejectPromise(error);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
resolvePromise(response);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
createMfaSession(data) {
|
|
150
|
+
const grpcReq = {
|
|
151
|
+
userId: data.userId,
|
|
152
|
+
productKey: data.productKey || this.defaultProductKey,
|
|
153
|
+
deviceId: data.deviceId,
|
|
154
|
+
actionScope: data.actionScope,
|
|
155
|
+
};
|
|
156
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
157
|
+
this.client.createMfaSession(grpcReq, (error, response) => {
|
|
158
|
+
if (error) {
|
|
159
|
+
rejectPromise(error);
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
resolvePromise(response);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
exchangeOAuthCode(data) {
|
|
167
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
168
|
+
this.client.exchangeOAuthCode(data, (error, response) => {
|
|
169
|
+
if (error) {
|
|
170
|
+
rejectPromise(error);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
resolvePromise(response);
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
issueSalaryRevealToken(data) {
|
|
178
|
+
return new Promise((resolvePromise, rejectPromise) => {
|
|
179
|
+
this.client.issueSalaryRevealToken(data, (error, response) => {
|
|
180
|
+
if (error) {
|
|
181
|
+
rejectPromise(error);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
resolvePromise(response);
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
}
|
|
90
188
|
}
|
|
91
189
|
exports.AccountClient = AccountClient;
|
|
92
190
|
//# sourceMappingURL=accounts-client.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts-client.js","sourceRoot":"","sources":["../src/accounts-client.ts"],"names":[],"mappings":";;;AAAA,2CAMuB;AACvB,qDAA8C;AAC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"SkyPaper";
|
|
9
9
|
readonly SkyBill: "SkyBill";
|
|
10
|
+
readonly SkyShort: "SkyShort";
|
|
11
|
+
readonly SkyAccount: "SkyAccount";
|
|
10
12
|
};
|
|
11
13
|
export type ProductKey = (typeof ProductKey)[keyof typeof ProductKey];
|
|
12
14
|
/**
|
package/dist/enums.js
CHANGED
package/dist/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":";;;AAAA;;;GAGG;AACU,QAAA,UAAU,GAAG;IACxB,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;CAChB,CAAC;AAIX;;;GAGG;AACU,QAAA,QAAQ,GAAG;IACtB,KAAK,EAAE,OAAO;IACd,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,YAAY,EAAE,cAAc;IAC5B,kBAAkB,EAAE,oBAAoB;IACxC,iBAAiB,EAAE,mBAAmB;IACtC,wBAAwB,EAAE,0BAA0B;CAC5C,CAAC;AAIX,2FAA2F;AAC9E,QAAA,mBAAmB,GAAG;IACjC,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACZ,CAAC"}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,0CAAwB;AACxB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,uDAAqD;AAA5C,mHAAA,eAAe,OAAA;AACxB,qDAAkD;AAAzC,gHAAA,aAAa,OAAA"}
|
package/dist/types.d.ts
CHANGED
|
@@ -57,6 +57,21 @@ export type RetrieveShortUrlResponse = {
|
|
|
57
57
|
expiresAt: string;
|
|
58
58
|
ttlSeconds: number;
|
|
59
59
|
};
|
|
60
|
+
export type UserGetRequest = {
|
|
61
|
+
id: string;
|
|
62
|
+
};
|
|
63
|
+
export type UserGetResponse = {
|
|
64
|
+
id: string;
|
|
65
|
+
firstName?: string;
|
|
66
|
+
lastName?: string;
|
|
67
|
+
password?: string;
|
|
68
|
+
email?: string;
|
|
69
|
+
phone?: string;
|
|
70
|
+
userOrganizations?: {
|
|
71
|
+
organizationId: string;
|
|
72
|
+
name?: string;
|
|
73
|
+
}[];
|
|
74
|
+
};
|
|
60
75
|
export type UserCreateRequest = {
|
|
61
76
|
firstName: string;
|
|
62
77
|
organizationId: string;
|
|
@@ -85,16 +100,68 @@ export type UserUpdateRequest = {
|
|
|
85
100
|
export type UserUpdateResponse = {
|
|
86
101
|
id: string;
|
|
87
102
|
};
|
|
103
|
+
export type UserDeleteRequest = {
|
|
104
|
+
id: string;
|
|
105
|
+
productKey?: ProductKey;
|
|
106
|
+
};
|
|
107
|
+
export type UserDeleteResponse = {
|
|
108
|
+
deleted: boolean;
|
|
109
|
+
};
|
|
88
110
|
export type UpdateOrganizationRequest = {
|
|
111
|
+
organizationId?: string;
|
|
89
112
|
name?: string;
|
|
90
113
|
ownerId?: string;
|
|
91
114
|
};
|
|
115
|
+
export type LicenseCheckRequest = {
|
|
116
|
+
organizationId: string;
|
|
117
|
+
key: string;
|
|
118
|
+
};
|
|
92
119
|
export type UpdateOrganizationResponse = {
|
|
93
120
|
updated: boolean;
|
|
94
121
|
};
|
|
122
|
+
export type LicenseCheckResponse = {
|
|
123
|
+
organizationId: string;
|
|
124
|
+
key: string;
|
|
125
|
+
};
|
|
126
|
+
export type MfaSessionRequest = {
|
|
127
|
+
userId: string;
|
|
128
|
+
productKey?: ProductKey;
|
|
129
|
+
deviceId?: string;
|
|
130
|
+
actionScope?: string;
|
|
131
|
+
};
|
|
132
|
+
export type MfaSessionResponse = {
|
|
133
|
+
mfaToken: string;
|
|
134
|
+
allowedMethods: string[];
|
|
135
|
+
preferredMethod: string;
|
|
136
|
+
mfaRequired: boolean;
|
|
137
|
+
};
|
|
138
|
+
export type OAuthCodeExchangeRequest = {
|
|
139
|
+
clientId: string;
|
|
140
|
+
clientSecret?: string;
|
|
141
|
+
code: string;
|
|
142
|
+
redirectUri: string;
|
|
143
|
+
codeVerifier?: string;
|
|
144
|
+
};
|
|
145
|
+
export type OAuthCodeExchangeResponse = {
|
|
146
|
+
accessToken: string;
|
|
147
|
+
tokenType: string;
|
|
148
|
+
expiresIn: number;
|
|
149
|
+
userId: string;
|
|
150
|
+
firstName?: string;
|
|
151
|
+
lastName?: string;
|
|
152
|
+
avatar?: string;
|
|
153
|
+
};
|
|
95
154
|
export declare enum OrgRole {
|
|
96
|
-
User = "User",
|
|
97
|
-
Admin = "Admin",
|
|
98
155
|
Owner = "Owner",
|
|
156
|
+
Admin = "Admin",
|
|
157
|
+
User = "User",
|
|
99
158
|
Guest = "Guest"
|
|
100
159
|
}
|
|
160
|
+
export type IssueSalaryRevealTokenRequest = {
|
|
161
|
+
userId: string;
|
|
162
|
+
organizationId: string;
|
|
163
|
+
jti: string;
|
|
164
|
+
};
|
|
165
|
+
export type IssueSalaryRevealTokenResponse = {
|
|
166
|
+
token: string;
|
|
167
|
+
};
|
package/dist/types.js
CHANGED
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OrgRole = void 0;
|
|
4
4
|
var OrgRole;
|
|
5
5
|
(function (OrgRole) {
|
|
6
|
-
OrgRole["User"] = "User";
|
|
7
|
-
OrgRole["Admin"] = "Admin";
|
|
8
6
|
OrgRole["Owner"] = "Owner";
|
|
7
|
+
OrgRole["Admin"] = "Admin";
|
|
8
|
+
OrgRole["User"] = "User";
|
|
9
9
|
OrgRole["Guest"] = "Guest";
|
|
10
10
|
})(OrgRole || (exports.OrgRole = OrgRole = {}));
|
|
11
11
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AAgLA,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,0BAAe,CAAA;IACf,0BAAe,CAAA;IACf,wBAAa,CAAA;IACb,0BAAe,CAAA;AACjB,CAAC,EALW,OAAO,uBAAP,OAAO,QAKlB"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@skyiro/sky-client",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Skyiro internal gRPC clients: Notifier
|
|
3
|
+
"version": "0.1.12",
|
|
4
|
+
"description": "Skyiro internal gRPC clients: Accounts, Notifier, and URL shortener, with typed product and event keys",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"files": ["dist", "proto"],
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "tsc -p tsconfig.json",
|
|
10
|
-
"example:publish-event": "tsx example/send-login-otp-email.ts"
|
|
10
|
+
"example:publish-event": "tsx example/send-login-otp-email.ts",
|
|
11
|
+
"example:create-user": "tsx example/create-account-user.ts"
|
|
11
12
|
},
|
|
12
13
|
"publishConfig": {
|
|
13
14
|
"url": "https://registry.npmjs.org/",
|
package/proto/accounts.proto
CHANGED
|
@@ -3,80 +3,155 @@ syntax = "proto3";
|
|
|
3
3
|
package account.v1;
|
|
4
4
|
|
|
5
5
|
service AccountsGrpcService {
|
|
6
|
-
rpc
|
|
7
|
-
rpc
|
|
8
|
-
rpc
|
|
9
|
-
rpc
|
|
6
|
+
rpc getUser (UserGetRequest) returns (UserGetResponse);
|
|
7
|
+
rpc createUser (UserCreateRequest) returns (UserCreateResponse);
|
|
8
|
+
rpc updateUser (UserUpdateRequest) returns (UserUpdateResponse);
|
|
9
|
+
rpc softDeleteUser (UserDeleteRequest) returns (UserDeleteResponse);
|
|
10
|
+
rpc hardDeleteUser (UserDeleteRequest) returns (UserDeleteResponse);
|
|
11
|
+
rpc deleteUser (UserDeleteRequest) returns (UserDeleteResponse);
|
|
12
|
+
rpc updateOrganization (UpdateOrganizationRequest) returns (UpdateOrganizationResponse);
|
|
13
|
+
rpc licenseCheck (LicenseCheckRequest) returns (LicenseCheckResponse);
|
|
14
|
+
rpc createMfaSession (MfaSessionRequest) returns (MfaSessionResponse);
|
|
15
|
+
rpc exchangeOAuthCode (OAuthCodeExchangeRequest) returns (OAuthCodeExchangeResponse);
|
|
16
|
+
rpc issueSalaryRevealToken (IssueSalaryRevealTokenRequest) returns (IssueSalaryRevealTokenResponse);
|
|
10
17
|
}
|
|
11
18
|
|
|
12
|
-
|
|
13
19
|
enum OrganizationRole {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
Owner = 0;
|
|
21
|
+
Admin = 1;
|
|
22
|
+
User = 2;
|
|
23
|
+
Guest = 3;
|
|
18
24
|
}
|
|
19
25
|
|
|
20
26
|
enum ProductKey {
|
|
21
27
|
SkyPeople = 0;
|
|
22
|
-
SkyPaper = 1
|
|
23
|
-
SkyBill = 2
|
|
24
|
-
SkyShort = 3
|
|
25
|
-
SkyAccount = 4
|
|
28
|
+
SkyPaper = 1;
|
|
29
|
+
SkyBill = 2;
|
|
30
|
+
SkyShort = 3;
|
|
31
|
+
SkyAccount = 4;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
message UserGetRequest {
|
|
35
|
+
string id = 1;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
message UserGetResponse {
|
|
39
|
+
string id = 1;
|
|
40
|
+
optional string firstName = 2;
|
|
41
|
+
optional string lastName = 3;
|
|
42
|
+
optional string password = 4;
|
|
43
|
+
optional string email = 5;
|
|
44
|
+
optional string phone = 6;
|
|
45
|
+
repeated UserOrganization userOrganizations = 7;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
message UserOrganization {
|
|
49
|
+
string organizationId = 1;
|
|
50
|
+
optional string name = 2;
|
|
26
51
|
}
|
|
27
52
|
|
|
28
53
|
message UserCreateRequest {
|
|
29
54
|
ProductKey productKey = 1;
|
|
30
|
-
string organizationId= 2;
|
|
55
|
+
string organizationId = 2;
|
|
31
56
|
string firstName = 3;
|
|
32
57
|
string password = 4;
|
|
33
|
-
OrganizationRole orgRole = 5
|
|
58
|
+
OrganizationRole orgRole = 5;
|
|
34
59
|
optional string lastName = 6;
|
|
35
60
|
optional string middleName = 7;
|
|
36
61
|
optional string countryCode = 8;
|
|
37
|
-
optional string email = 9;
|
|
62
|
+
optional string email = 9;
|
|
38
63
|
optional string phone = 10;
|
|
39
|
-
|
|
40
64
|
}
|
|
65
|
+
|
|
41
66
|
message UserUpdateRequest {
|
|
42
67
|
ProductKey productKey = 1;
|
|
43
|
-
string organizationId= 2;
|
|
68
|
+
string organizationId = 2;
|
|
44
69
|
string id = 3;
|
|
45
|
-
optional OrganizationRole orgRole = 4
|
|
70
|
+
optional OrganizationRole orgRole = 4;
|
|
46
71
|
optional string firstName = 5;
|
|
47
72
|
optional string lastName = 6;
|
|
48
73
|
optional string middleName = 7;
|
|
49
|
-
optional string password = 8
|
|
50
|
-
optional string email = 9;
|
|
74
|
+
optional string password = 8;
|
|
75
|
+
optional string email = 9;
|
|
51
76
|
optional string phone = 10;
|
|
52
77
|
}
|
|
53
78
|
|
|
54
79
|
message UserCreateResponse {
|
|
55
|
-
string id = 1
|
|
80
|
+
string id = 1;
|
|
56
81
|
}
|
|
57
82
|
|
|
58
83
|
message UserUpdateResponse {
|
|
59
|
-
string id = 1
|
|
84
|
+
string id = 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
message UserDeleteRequest {
|
|
88
|
+
string id = 1;
|
|
89
|
+
optional ProductKey productKey = 2;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
message UserDeleteResponse {
|
|
93
|
+
bool deleted = 1;
|
|
60
94
|
}
|
|
61
95
|
|
|
62
96
|
message UpdateOrganizationRequest {
|
|
63
|
-
|
|
64
|
-
|
|
97
|
+
string organizationId = 1;
|
|
98
|
+
optional string name = 2;
|
|
99
|
+
optional string ownerId = 3;
|
|
65
100
|
}
|
|
66
101
|
|
|
67
102
|
message UpdateOrganizationResponse {
|
|
68
|
-
bool updated = 1
|
|
103
|
+
bool updated = 1;
|
|
69
104
|
}
|
|
70
105
|
|
|
71
|
-
|
|
72
106
|
message LicenseCheckRequest {
|
|
73
|
-
string organizationId = 1
|
|
74
|
-
string key = 2
|
|
75
|
-
|
|
107
|
+
string organizationId = 1;
|
|
108
|
+
string key = 2;
|
|
76
109
|
}
|
|
77
110
|
|
|
78
111
|
message LicenseCheckResponse {
|
|
79
|
-
string organizationId = 1
|
|
80
|
-
string key = 2
|
|
81
|
-
|
|
112
|
+
string organizationId = 1;
|
|
113
|
+
string key = 2;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
message MfaSessionRequest {
|
|
117
|
+
string userId = 1;
|
|
118
|
+
ProductKey productKey = 2;
|
|
119
|
+
optional string deviceId = 3;
|
|
120
|
+
optional string actionScope = 4;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
message MfaSessionResponse {
|
|
124
|
+
string mfaToken = 1;
|
|
125
|
+
repeated string allowedMethods = 2;
|
|
126
|
+
string preferredMethod = 3;
|
|
127
|
+
bool mfaRequired = 4;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
message OAuthCodeExchangeRequest {
|
|
131
|
+
string clientId = 1;
|
|
132
|
+
optional string clientSecret = 2;
|
|
133
|
+
string code = 3;
|
|
134
|
+
string redirectUri = 4;
|
|
135
|
+
optional string codeVerifier = 5;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
message OAuthCodeExchangeResponse {
|
|
139
|
+
string accessToken = 1;
|
|
140
|
+
string tokenType = 2;
|
|
141
|
+
int32 expiresIn = 3;
|
|
142
|
+
string userId = 4;
|
|
143
|
+
optional string firstName = 5;
|
|
144
|
+
optional string lastName = 6;
|
|
145
|
+
optional string avatar = 7;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
message IssueSalaryRevealTokenRequest {
|
|
150
|
+
string userId = 1;
|
|
151
|
+
string organizationId = 2;
|
|
152
|
+
string jti = 3;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
message IssueSalaryRevealTokenResponse {
|
|
156
|
+
string token = 1;
|
|
82
157
|
}
|