0.0.53 • Published 3 years ago
@cs3org/node-cs3apis v0.0.53
CS3APIS for Node.js
API definitions can be found at https://github.com/cs3org/cs3apis
Install with npm
npm i @cs3org/node-cs3apis
Example usage
const grpc = require('grpc');
const { GatewayAPIClient } = require('@cs3org/node-cs3apis/cs3/gateway/v1beta1/gateway_api_grpc_pb');
const { AuthenticateRequest } = require('@cs3org/node-cs3apis/cs3/gateway/v1beta1/gateway_api_pb');
const TARGET = process.env.TARGET || 'localhost:19000';
const client = new GatewayAPIClient(TARGET, grpc.credentials.createInsecure());
function authenticate(authType, clientId, clientSecret) {
const req = new AuthenticateRequest();
req.setType(authType);
req.setClientId(clientId);
req.setClientSecret(clientSecret);
return new Promise((resolve, reject) => {
client.authenticate(req, (err, response) => {
if (err) {
reject(err);
} else {
resolve(response);
}
});
});
}
async function example() {
try {
const res = await authenticate('basic', 'einstein', 'relativity');
// See:
// * AuthenticateResponse https://github.com/cs3org/cs3apis/blob/a86e5cb6ac360/cs3/gateway/v1beta1/gateway_api.proto#L415
// * User https://github.com/cs3org/cs3apis/blob/a86e5cb6ac360/cs3/identity/user/v1beta1/resources.proto#L53
console.log(res.getUser().getDisplayName());
} catch (e) {
console.error(e);
}
}
// ...
example();
0.0.53
3 years ago
0.0.51
3 years ago
0.0.52
3 years ago
0.0.46
3 years ago
0.0.47
3 years ago
0.0.50
3 years ago
0.0.48
3 years ago
0.0.49
3 years ago
0.0.45
3 years ago
0.0.40
3 years ago
0.0.41
3 years ago
0.0.42
3 years ago
0.0.43
3 years ago
0.0.44
3 years ago
0.0.39
3 years ago
0.0.38
3 years ago
0.0.37
3 years ago
0.0.36
3 years ago
0.0.35
3 years ago
0.0.30
3 years ago
0.0.31
3 years ago
0.0.32
3 years ago
0.0.33
3 years ago
0.0.34
3 years ago
0.0.29
4 years ago
0.0.28
4 years ago
0.0.27
4 years ago
0.0.24
4 years ago
0.0.25
4 years ago
0.0.26
4 years ago
0.0.23
4 years ago
0.0.22
4 years ago
0.0.21
4 years ago
0.0.20
4 years ago
0.0.19
4 years ago
0.0.18
4 years ago
0.0.16
4 years ago
0.0.17
4 years ago
0.0.15
4 years ago
0.0.14
4 years ago
0.0.13
4 years ago
0.0.10
4 years ago
0.0.11
4 years ago
0.0.12
4 years ago
0.0.9
4 years ago
0.0.8
4 years ago
0.0.5
4 years ago
0.0.7
4 years ago
0.0.6
4 years ago
0.0.4
4 years ago
0.0.3
4 years ago
0.0.2
4 years ago