@fonoster/sdk 0.9.0 → 0.9.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 +5 -18
- package/dist/node/Users.d.ts +5 -19
- package/dist/node/Users.js +5 -19
- package/dist/node/client/AbstractClient.js +3 -2
- 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 +2 -2
package/README.md
CHANGED
|
@@ -2159,23 +2159,8 @@ Constructs a new Users object.
|
|
|
2159
2159
|
```js
|
|
2160
2160
|
const SDK = require("@fonoster/sdk");
|
|
2161
2161
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
const apiSecret = "your-api-secret"
|
|
2165
|
-
const accessKeyId = "WO00000000000000000000000000000000";
|
|
2166
|
-
|
|
2167
|
-
try {
|
|
2168
|
-
const client = SDK.Client({ accessKeyId });
|
|
2169
|
-
await client.loginWithApiKey(apiKey, apiSecret);
|
|
2170
|
-
|
|
2171
|
-
const users = new SDK.Users(client);
|
|
2172
|
-
const response = await users.createUser(request);
|
|
2173
|
-
|
|
2174
|
-
console.log(response); // successful response
|
|
2175
|
-
} catch (e) {
|
|
2176
|
-
console.error(e); // an error occurred
|
|
2177
|
-
}
|
|
2178
|
-
}
|
|
2162
|
+
const client = SDK.Client();
|
|
2163
|
+
const users = new SDK.Users(client);
|
|
2179
2164
|
|
|
2180
2165
|
const request = {
|
|
2181
2166
|
name: "John Doe",
|
|
@@ -2184,7 +2169,9 @@ const request = {
|
|
|
2184
2169
|
avatar: "https://example.com/avatar.jpg"
|
|
2185
2170
|
};
|
|
2186
2171
|
|
|
2187
|
-
|
|
2172
|
+
users.createUser(request)
|
|
2173
|
+
.then(console.log) // successful response
|
|
2174
|
+
.catch(console.error); // an error occurred
|
|
2188
2175
|
```
|
|
2189
2176
|
<a name="Users+createUser"></a>
|
|
2190
2177
|
|
package/dist/node/Users.d.ts
CHANGED
|
@@ -6,26 +6,10 @@ import { FonosterClient } from "./client/types";
|
|
|
6
6
|
* Note that an active Fonoster deployment is required.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
|
-
*
|
|
10
9
|
* const SDK = require("@fonoster/sdk");
|
|
11
10
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* const apiSecret = "your-api-secret"
|
|
15
|
-
* const accessKeyId = "WO00000000000000000000000000000000";
|
|
16
|
-
*
|
|
17
|
-
* try {
|
|
18
|
-
* const client = SDK.Client({ accessKeyId });
|
|
19
|
-
* await client.loginWithApiKey(apiKey, apiSecret);
|
|
20
|
-
*
|
|
21
|
-
* const users = new SDK.Users(client);
|
|
22
|
-
* const response = await users.createUser(request);
|
|
23
|
-
*
|
|
24
|
-
* console.log(response); // successful response
|
|
25
|
-
* } catch (e) {
|
|
26
|
-
* console.error(e); // an error occurred
|
|
27
|
-
* }
|
|
28
|
-
* }
|
|
11
|
+
* const client = SDK.Client();
|
|
12
|
+
* const users = new SDK.Users(client);
|
|
29
13
|
*
|
|
30
14
|
* const request = {
|
|
31
15
|
* name: "John Doe",
|
|
@@ -34,7 +18,9 @@ import { FonosterClient } from "./client/types";
|
|
|
34
18
|
* avatar: "https://example.com/avatar.jpg"
|
|
35
19
|
* };
|
|
36
20
|
*
|
|
37
|
-
*
|
|
21
|
+
* users.createUser(request)
|
|
22
|
+
* .then(console.log) // successful response
|
|
23
|
+
* .catch(console.error); // an error occurred
|
|
38
24
|
*/
|
|
39
25
|
declare class Users {
|
|
40
26
|
private readonly client;
|
package/dist/node/Users.js
CHANGED
|
@@ -9,26 +9,10 @@ const identity_pb_1 = require("./generated/node/identity_pb");
|
|
|
9
9
|
* Note that an active Fonoster deployment is required.
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
|
-
*
|
|
13
12
|
* const SDK = require("@fonoster/sdk");
|
|
14
13
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* const apiSecret = "your-api-secret"
|
|
18
|
-
* const accessKeyId = "WO00000000000000000000000000000000";
|
|
19
|
-
*
|
|
20
|
-
* try {
|
|
21
|
-
* const client = SDK.Client({ accessKeyId });
|
|
22
|
-
* await client.loginWithApiKey(apiKey, apiSecret);
|
|
23
|
-
*
|
|
24
|
-
* const users = new SDK.Users(client);
|
|
25
|
-
* const response = await users.createUser(request);
|
|
26
|
-
*
|
|
27
|
-
* console.log(response); // successful response
|
|
28
|
-
* } catch (e) {
|
|
29
|
-
* console.error(e); // an error occurred
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
14
|
+
* const client = SDK.Client();
|
|
15
|
+
* const users = new SDK.Users(client);
|
|
32
16
|
*
|
|
33
17
|
* const request = {
|
|
34
18
|
* name: "John Doe",
|
|
@@ -37,7 +21,9 @@ const identity_pb_1 = require("./generated/node/identity_pb");
|
|
|
37
21
|
* avatar: "https://example.com/avatar.jpg"
|
|
38
22
|
* };
|
|
39
23
|
*
|
|
40
|
-
*
|
|
24
|
+
* users.createUser(request)
|
|
25
|
+
* .then(console.log) // successful response
|
|
26
|
+
* .catch(console.error); // an error occurred
|
|
41
27
|
*/
|
|
42
28
|
class Users {
|
|
43
29
|
client;
|
|
@@ -59,14 +59,15 @@ class AbstractClient {
|
|
|
59
59
|
}
|
|
60
60
|
async loginWithOauth2Code(provider, username, code) {
|
|
61
61
|
const { refreshToken, accessToken, idToken } = await (0, makeRpcRequest_1.makeRpcRequest)({
|
|
62
|
-
method: this.identityClient.exchangeOauth2Code,
|
|
62
|
+
method: this.identityClient.exchangeOauth2Code.bind(this.identityClient),
|
|
63
63
|
requestPBObjectConstructor: identity_pb_1.ExchangeOauth2CodeRequest,
|
|
64
64
|
metadata: {},
|
|
65
65
|
request: {
|
|
66
66
|
provider,
|
|
67
67
|
username,
|
|
68
68
|
code
|
|
69
|
-
}
|
|
69
|
+
},
|
|
70
|
+
enumMapping: [["provider", identity_pb_1.ExchangeOauth2CodeRequest.Oauth2Provider]]
|
|
70
71
|
});
|
|
71
72
|
this._refreshToken = refreshToken;
|
|
72
73
|
this._accessToken = accessToken;
|