@fonoster/sdk 0.9.16 → 0.9.20
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/node/Users.d.ts +58 -1
- package/dist/node/Users.js +82 -0
- package/dist/node/client/types/IdentityClient.d.ts +4 -1
- package/dist/node/generated/node/identity_grpc_pb.js +66 -0
- package/dist/node/generated/node/identity_pb.js +516 -0
- package/dist/node/generated/web/IdentityServiceClientPb.ts +129 -0
- package/dist/node/generated/web/identity_pb.d.ts +62 -0
- package/dist/node/generated/web/identity_pb.js +516 -0
- package/dist/node/tsconfig.tsbuildinfo +1 -1
- package/dist/web/fonoster.min.js +1 -1
- package/dist/web/index.esm.js +1 -1
- package/package.json +4 -4
package/dist/node/Users.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseApiObject, CreateUserRequest, UpdateUserRequest, User } from "@fonoster/types";
|
|
1
|
+
import { BaseApiObject, CreateUserRequest, ResetPasswordRequest, UpdateUserRequest, User, CreateUserWithOauth2CodeRequest, ExchangeCredentialsResponse } from "@fonoster/types";
|
|
2
2
|
import { FonosterClient } from "./client/types";
|
|
3
3
|
/**
|
|
4
4
|
* @classdesc Fonoster Users, part of the Fonoster Identity subsystem,
|
|
@@ -57,6 +57,24 @@ declare class Users {
|
|
|
57
57
|
* .catch(console.error); // an error occurred
|
|
58
58
|
*/
|
|
59
59
|
createUser(request: CreateUserRequest): Promise<BaseApiObject>;
|
|
60
|
+
/**
|
|
61
|
+
* Create a new User using an OAuth2 code and return the id, access, and refresh tokens for the User.
|
|
62
|
+
*
|
|
63
|
+
* @param {CreateUserWithOauth2CodeRequest} request - The request object with the OAuth2 code
|
|
64
|
+
* @param {string} request.code - The OAuth2 code of the User
|
|
65
|
+
* @return {Promise<ExchangeCredentialsResponse>} - The response object that contains the id, access, and refresh tokens
|
|
66
|
+
* @example
|
|
67
|
+
* const users = new SDK.Users(client); // Existing client object
|
|
68
|
+
*
|
|
69
|
+
* const request = {
|
|
70
|
+
* code: "fd4d78beb31aa25b93de"
|
|
71
|
+
* };
|
|
72
|
+
*
|
|
73
|
+
* users.createUserWithOauth2Code(request)
|
|
74
|
+
* .then(console.log) // successful response
|
|
75
|
+
* .catch(console.error); // an error occurred
|
|
76
|
+
*/
|
|
77
|
+
createUserWithOauth2Code(request: CreateUserWithOauth2CodeRequest): Promise<ExchangeCredentialsResponse>;
|
|
60
78
|
/**
|
|
61
79
|
* Retrieves an existing User in the Workspace.
|
|
62
80
|
*
|
|
@@ -98,6 +116,45 @@ declare class Users {
|
|
|
98
116
|
* .catch(console.error); // an error occurred
|
|
99
117
|
*/
|
|
100
118
|
updateUser(request: UpdateUserRequest): Promise<BaseApiObject>;
|
|
119
|
+
/**
|
|
120
|
+
* Sends a reset password code to the User.
|
|
121
|
+
*
|
|
122
|
+
* @param {string} username - The username of the User
|
|
123
|
+
* @return {Promise<void>} - The response object that contains the reference to the User
|
|
124
|
+
* @example
|
|
125
|
+
* const users = new SDK.Users(client); // Existing client object
|
|
126
|
+
*
|
|
127
|
+
* const username = "john.doe@example.com";
|
|
128
|
+
*
|
|
129
|
+
* users
|
|
130
|
+
* .sendResetPasswordCode(username)
|
|
131
|
+
* .then(console.log) // successful response
|
|
132
|
+
* .catch(console.error); // an error occurred
|
|
133
|
+
*/
|
|
134
|
+
sendResetPasswordCode(username: string): Promise<BaseApiObject>;
|
|
135
|
+
/**
|
|
136
|
+
* Resets the password of the User.
|
|
137
|
+
*
|
|
138
|
+
* @param {ResetPasswordRequest} request - The request object that contains the necessary information to reset the password of a User
|
|
139
|
+
* @param {string} request.username - The username of the User
|
|
140
|
+
* @param {string} request.password - The new password of the User
|
|
141
|
+
* @param {string} request.verificationCode - The verification code of the User
|
|
142
|
+
* @return {Promise<void>} - The response object that contains the reference to the User
|
|
143
|
+
* @example
|
|
144
|
+
* const users = new SDK.Users(client); // Existing client object
|
|
145
|
+
*
|
|
146
|
+
* const request = {
|
|
147
|
+
* username: "john.doe@example.com",
|
|
148
|
+
* password: "password",
|
|
149
|
+
* verificationCode: "123456"
|
|
150
|
+
* };
|
|
151
|
+
*
|
|
152
|
+
* users
|
|
153
|
+
* .resetPassword(request)
|
|
154
|
+
* .then(console.log) // successful response
|
|
155
|
+
* .catch(console.error); // an error occurred
|
|
156
|
+
*/
|
|
157
|
+
resetPassword(request: ResetPasswordRequest): Promise<void>;
|
|
101
158
|
/**
|
|
102
159
|
* Deletes an existing User from Fonoster.
|
|
103
160
|
* Note that this operation is irreversible.
|
package/dist/node/Users.js
CHANGED
|
@@ -70,6 +70,33 @@ class Users {
|
|
|
70
70
|
request
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a new User using an OAuth2 code and return the id, access, and refresh tokens for the User.
|
|
75
|
+
*
|
|
76
|
+
* @param {CreateUserWithOauth2CodeRequest} request - The request object with the OAuth2 code
|
|
77
|
+
* @param {string} request.code - The OAuth2 code of the User
|
|
78
|
+
* @return {Promise<ExchangeCredentialsResponse>} - The response object that contains the id, access, and refresh tokens
|
|
79
|
+
* @example
|
|
80
|
+
* const users = new SDK.Users(client); // Existing client object
|
|
81
|
+
*
|
|
82
|
+
* const request = {
|
|
83
|
+
* code: "fd4d78beb31aa25b93de"
|
|
84
|
+
* };
|
|
85
|
+
*
|
|
86
|
+
* users.createUserWithOauth2Code(request)
|
|
87
|
+
* .then(console.log) // successful response
|
|
88
|
+
* .catch(console.error); // an error occurred
|
|
89
|
+
*/
|
|
90
|
+
async createUserWithOauth2Code(request) {
|
|
91
|
+
console.log("request", request);
|
|
92
|
+
const client = this.client.getIdentityClient();
|
|
93
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
94
|
+
method: client.createUserWithOauth2Code.bind(client),
|
|
95
|
+
requestPBObjectConstructor: identity_pb_1.CreateUserWithOauth2CodeRequest,
|
|
96
|
+
metadata: this.client.getMetadata(),
|
|
97
|
+
request
|
|
98
|
+
});
|
|
99
|
+
}
|
|
73
100
|
/**
|
|
74
101
|
* Retrieves an existing User in the Workspace.
|
|
75
102
|
*
|
|
@@ -127,6 +154,61 @@ class Users {
|
|
|
127
154
|
request
|
|
128
155
|
});
|
|
129
156
|
}
|
|
157
|
+
/**
|
|
158
|
+
* Sends a reset password code to the User.
|
|
159
|
+
*
|
|
160
|
+
* @param {string} username - The username of the User
|
|
161
|
+
* @return {Promise<void>} - The response object that contains the reference to the User
|
|
162
|
+
* @example
|
|
163
|
+
* const users = new SDK.Users(client); // Existing client object
|
|
164
|
+
*
|
|
165
|
+
* const username = "john.doe@example.com";
|
|
166
|
+
*
|
|
167
|
+
* users
|
|
168
|
+
* .sendResetPasswordCode(username)
|
|
169
|
+
* .then(console.log) // successful response
|
|
170
|
+
* .catch(console.error); // an error occurred
|
|
171
|
+
*/
|
|
172
|
+
async sendResetPasswordCode(username) {
|
|
173
|
+
const client = this.client.getIdentityClient();
|
|
174
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
175
|
+
method: client.sendResetPasswordCode.bind(client),
|
|
176
|
+
requestPBObjectConstructor: identity_pb_1.SendResetPasswordCodeRequest,
|
|
177
|
+
metadata: this.client.getMetadata(),
|
|
178
|
+
request: { username }
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Resets the password of the User.
|
|
183
|
+
*
|
|
184
|
+
* @param {ResetPasswordRequest} request - The request object that contains the necessary information to reset the password of a User
|
|
185
|
+
* @param {string} request.username - The username of the User
|
|
186
|
+
* @param {string} request.password - The new password of the User
|
|
187
|
+
* @param {string} request.verificationCode - The verification code of the User
|
|
188
|
+
* @return {Promise<void>} - The response object that contains the reference to the User
|
|
189
|
+
* @example
|
|
190
|
+
* const users = new SDK.Users(client); // Existing client object
|
|
191
|
+
*
|
|
192
|
+
* const request = {
|
|
193
|
+
* username: "john.doe@example.com",
|
|
194
|
+
* password: "password",
|
|
195
|
+
* verificationCode: "123456"
|
|
196
|
+
* };
|
|
197
|
+
*
|
|
198
|
+
* users
|
|
199
|
+
* .resetPassword(request)
|
|
200
|
+
* .then(console.log) // successful response
|
|
201
|
+
* .catch(console.error); // an error occurred
|
|
202
|
+
*/
|
|
203
|
+
async resetPassword(request) {
|
|
204
|
+
const client = this.client.getIdentityClient();
|
|
205
|
+
return await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
206
|
+
method: client.resetPassword.bind(client),
|
|
207
|
+
requestPBObjectConstructor: identity_pb_1.ResetPasswordRequest,
|
|
208
|
+
metadata: this.client.getMetadata(),
|
|
209
|
+
request
|
|
210
|
+
});
|
|
211
|
+
}
|
|
130
212
|
/**
|
|
131
213
|
* Deletes an existing User from Fonoster.
|
|
132
214
|
* Note that this operation is irreversible.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateApiKeyRequest, CreateApiKeyResponse, CreateUserRequest, CreateUserResponse, CreateWorkspaceRequest, DeleteApiKeyRequest, DeleteApiKeyResponse, DeleteUserRequest, DeleteUserResponse, DeleteWorkspaceRequest, DeleteWorkspaceResponse, ExchangeApiKeyRequest, ExchangeApiKeyResponse, ExchangeCredentialsRequest, ExchangeCredentialsResponse, ExchangeOauth2CodeRequest, ExchangeOauth2CodeResponse, ExchangeRefreshTokenRequest, ExchangeRefreshTokenResponse, GetUserRequest, GetWorkspaceRequest, InviteUserToWorkspaceRequest, InviteUserToWorkspaceResponse, ListApiKeysRequest, ListApiKeysResponse, ListWorkspacesRequest, ListWorkspacesResponse, RegenerateApiKeyRequest, RegenerateApiKeyResponse, RemoveUserFromWorkspaceRequest, RemoveUserFromWorkspaceResponse, ResendWorkspaceMembershipInvitationRequest, ResendWorkspaceMembershipInvitationResponse, ListWorkspaceMembersRequest, ListWorkspaceMembersResponse, SendVerificationCodeRequest, UpdateUserRequest, UpdateWorkspaceRequest, UpdateWorkspaceResponse, User, VerifyCodeRequest, Workspace } from "../../generated/web/identity_pb";
|
|
1
|
+
import { CreateApiKeyRequest, CreateApiKeyResponse, CreateUserRequest, CreateUserWithOauth2CodeRequest, CreateUserResponse, CreateWorkspaceRequest, DeleteApiKeyRequest, DeleteApiKeyResponse, DeleteUserRequest, DeleteUserResponse, DeleteWorkspaceRequest, DeleteWorkspaceResponse, ExchangeApiKeyRequest, ExchangeApiKeyResponse, ExchangeCredentialsRequest, ExchangeCredentialsResponse, ExchangeOauth2CodeRequest, ExchangeOauth2CodeResponse, ExchangeRefreshTokenRequest, ExchangeRefreshTokenResponse, GetUserRequest, GetWorkspaceRequest, InviteUserToWorkspaceRequest, InviteUserToWorkspaceResponse, ListApiKeysRequest, ListApiKeysResponse, ListWorkspacesRequest, ListWorkspacesResponse, RegenerateApiKeyRequest, RegenerateApiKeyResponse, RemoveUserFromWorkspaceRequest, RemoveUserFromWorkspaceResponse, ResendWorkspaceMembershipInvitationRequest, ResendWorkspaceMembershipInvitationResponse, ListWorkspaceMembersRequest, ListWorkspaceMembersResponse, SendVerificationCodeRequest, SendResetPasswordCodeRequest, ResetPasswordRequest, UpdateUserRequest, UpdateWorkspaceRequest, UpdateWorkspaceResponse, User, VerifyCodeRequest, Workspace } from "../../generated/web/identity_pb";
|
|
2
2
|
import { ClientFunction } from "../types";
|
|
3
3
|
type IdentityClient = {
|
|
4
4
|
createApiKey: ClientFunction<CreateApiKeyRequest, CreateApiKeyResponse>;
|
|
@@ -10,11 +10,14 @@ type IdentityClient = {
|
|
|
10
10
|
exchangeOauth2Code: ClientFunction<ExchangeOauth2CodeRequest, ExchangeOauth2CodeResponse>;
|
|
11
11
|
exchangeRefreshToken: ClientFunction<ExchangeRefreshTokenRequest, ExchangeRefreshTokenResponse>;
|
|
12
12
|
createUser: ClientFunction<CreateUserRequest, CreateUserResponse>;
|
|
13
|
+
createUserWithOauth2Code: ClientFunction<CreateUserWithOauth2CodeRequest, ExchangeCredentialsResponse>;
|
|
13
14
|
getUser: ClientFunction<GetUserRequest, User>;
|
|
14
15
|
updateUser: ClientFunction<UpdateUserRequest, CreateUserResponse>;
|
|
15
16
|
deleteUser: ClientFunction<DeleteUserRequest, DeleteUserResponse>;
|
|
16
17
|
sendVerificationCode: ClientFunction<SendVerificationCodeRequest, never>;
|
|
17
18
|
verifyCode: ClientFunction<VerifyCodeRequest, never>;
|
|
19
|
+
sendResetPasswordCode: ClientFunction<SendResetPasswordCodeRequest, never>;
|
|
20
|
+
resetPassword: ClientFunction<ResetPasswordRequest, never>;
|
|
18
21
|
createWorkspace: ClientFunction<CreateWorkspaceRequest, CreateUserResponse>;
|
|
19
22
|
getWorkspace: ClientFunction<GetWorkspaceRequest, Workspace>;
|
|
20
23
|
listWorkspaces: ClientFunction<ListWorkspacesRequest, ListWorkspacesResponse>;
|
|
@@ -67,6 +67,17 @@ function deserialize_fonoster_identity_v1beta2_CreateUserResponse(buffer_arg) {
|
|
|
67
67
|
return identity_pb.CreateUserResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
function serialize_fonoster_identity_v1beta2_CreateUserWithOauth2CodeRequest(arg) {
|
|
71
|
+
if (!(arg instanceof identity_pb.CreateUserWithOauth2CodeRequest)) {
|
|
72
|
+
throw new Error('Expected argument of type fonoster.identity.v1beta2.CreateUserWithOauth2CodeRequest');
|
|
73
|
+
}
|
|
74
|
+
return Buffer.from(arg.serializeBinary());
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function deserialize_fonoster_identity_v1beta2_CreateUserWithOauth2CodeRequest(buffer_arg) {
|
|
78
|
+
return identity_pb.CreateUserWithOauth2CodeRequest.deserializeBinary(new Uint8Array(buffer_arg));
|
|
79
|
+
}
|
|
80
|
+
|
|
70
81
|
function serialize_fonoster_identity_v1beta2_CreateWorkspaceRequest(arg) {
|
|
71
82
|
if (!(arg instanceof identity_pb.CreateWorkspaceRequest)) {
|
|
72
83
|
throw new Error('Expected argument of type fonoster.identity.v1beta2.CreateWorkspaceRequest');
|
|
@@ -430,6 +441,17 @@ function deserialize_fonoster_identity_v1beta2_ResendWorkspaceMembershipInvitati
|
|
|
430
441
|
return identity_pb.ResendWorkspaceMembershipInvitationResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
431
442
|
}
|
|
432
443
|
|
|
444
|
+
function serialize_fonoster_identity_v1beta2_ResetPasswordRequest(arg) {
|
|
445
|
+
if (!(arg instanceof identity_pb.ResetPasswordRequest)) {
|
|
446
|
+
throw new Error('Expected argument of type fonoster.identity.v1beta2.ResetPasswordRequest');
|
|
447
|
+
}
|
|
448
|
+
return Buffer.from(arg.serializeBinary());
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function deserialize_fonoster_identity_v1beta2_ResetPasswordRequest(buffer_arg) {
|
|
452
|
+
return identity_pb.ResetPasswordRequest.deserializeBinary(new Uint8Array(buffer_arg));
|
|
453
|
+
}
|
|
454
|
+
|
|
433
455
|
function serialize_fonoster_identity_v1beta2_RevokeTokenRequest(arg) {
|
|
434
456
|
if (!(arg instanceof identity_pb.RevokeTokenRequest)) {
|
|
435
457
|
throw new Error('Expected argument of type fonoster.identity.v1beta2.RevokeTokenRequest');
|
|
@@ -452,6 +474,17 @@ function deserialize_fonoster_identity_v1beta2_RevokeTokenResponse(buffer_arg) {
|
|
|
452
474
|
return identity_pb.RevokeTokenResponse.deserializeBinary(new Uint8Array(buffer_arg));
|
|
453
475
|
}
|
|
454
476
|
|
|
477
|
+
function serialize_fonoster_identity_v1beta2_SendResetPasswordCodeRequest(arg) {
|
|
478
|
+
if (!(arg instanceof identity_pb.SendResetPasswordCodeRequest)) {
|
|
479
|
+
throw new Error('Expected argument of type fonoster.identity.v1beta2.SendResetPasswordCodeRequest');
|
|
480
|
+
}
|
|
481
|
+
return Buffer.from(arg.serializeBinary());
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
function deserialize_fonoster_identity_v1beta2_SendResetPasswordCodeRequest(buffer_arg) {
|
|
485
|
+
return identity_pb.SendResetPasswordCodeRequest.deserializeBinary(new Uint8Array(buffer_arg));
|
|
486
|
+
}
|
|
487
|
+
|
|
455
488
|
function serialize_fonoster_identity_v1beta2_SendVerificationCodeRequest(arg) {
|
|
456
489
|
if (!(arg instanceof identity_pb.SendVerificationCodeRequest)) {
|
|
457
490
|
throw new Error('Expected argument of type fonoster.identity.v1beta2.SendVerificationCodeRequest');
|
|
@@ -665,6 +698,17 @@ createUser: {
|
|
|
665
698
|
responseSerialize: serialize_fonoster_identity_v1beta2_CreateUserResponse,
|
|
666
699
|
responseDeserialize: deserialize_fonoster_identity_v1beta2_CreateUserResponse,
|
|
667
700
|
},
|
|
701
|
+
createUserWithOauth2Code: {
|
|
702
|
+
path: '/fonoster.identity.v1beta2.Identity/CreateUserWithOauth2Code',
|
|
703
|
+
requestStream: false,
|
|
704
|
+
responseStream: false,
|
|
705
|
+
requestType: identity_pb.CreateUserWithOauth2CodeRequest,
|
|
706
|
+
responseType: identity_pb.ExchangeCredentialsResponse,
|
|
707
|
+
requestSerialize: serialize_fonoster_identity_v1beta2_CreateUserWithOauth2CodeRequest,
|
|
708
|
+
requestDeserialize: deserialize_fonoster_identity_v1beta2_CreateUserWithOauth2CodeRequest,
|
|
709
|
+
responseSerialize: serialize_fonoster_identity_v1beta2_ExchangeCredentialsResponse,
|
|
710
|
+
responseDeserialize: deserialize_fonoster_identity_v1beta2_ExchangeCredentialsResponse,
|
|
711
|
+
},
|
|
668
712
|
getUser: {
|
|
669
713
|
path: '/fonoster.identity.v1beta2.Identity/GetUser',
|
|
670
714
|
requestStream: false,
|
|
@@ -720,6 +764,28 @@ createUser: {
|
|
|
720
764
|
responseSerialize: serialize_google_protobuf_Empty,
|
|
721
765
|
responseDeserialize: deserialize_google_protobuf_Empty,
|
|
722
766
|
},
|
|
767
|
+
sendResetPasswordCode: {
|
|
768
|
+
path: '/fonoster.identity.v1beta2.Identity/SendResetPasswordCode',
|
|
769
|
+
requestStream: false,
|
|
770
|
+
responseStream: false,
|
|
771
|
+
requestType: identity_pb.SendResetPasswordCodeRequest,
|
|
772
|
+
responseType: google_protobuf_empty_pb.Empty,
|
|
773
|
+
requestSerialize: serialize_fonoster_identity_v1beta2_SendResetPasswordCodeRequest,
|
|
774
|
+
requestDeserialize: deserialize_fonoster_identity_v1beta2_SendResetPasswordCodeRequest,
|
|
775
|
+
responseSerialize: serialize_google_protobuf_Empty,
|
|
776
|
+
responseDeserialize: deserialize_google_protobuf_Empty,
|
|
777
|
+
},
|
|
778
|
+
resetPassword: {
|
|
779
|
+
path: '/fonoster.identity.v1beta2.Identity/ResetPassword',
|
|
780
|
+
requestStream: false,
|
|
781
|
+
responseStream: false,
|
|
782
|
+
requestType: identity_pb.ResetPasswordRequest,
|
|
783
|
+
responseType: google_protobuf_empty_pb.Empty,
|
|
784
|
+
requestSerialize: serialize_fonoster_identity_v1beta2_ResetPasswordRequest,
|
|
785
|
+
requestDeserialize: deserialize_fonoster_identity_v1beta2_ResetPasswordRequest,
|
|
786
|
+
responseSerialize: serialize_google_protobuf_Empty,
|
|
787
|
+
responseDeserialize: deserialize_google_protobuf_Empty,
|
|
788
|
+
},
|
|
723
789
|
// ApiKey actions
|
|
724
790
|
createApiKey: {
|
|
725
791
|
path: '/fonoster.identity.v1beta2.Identity/CreateApiKey',
|