0.0.53 • Published 2 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
2 years ago
0.0.51
2 years ago
0.0.52
2 years ago
0.0.46
2 years ago
0.0.47
2 years ago
0.0.50
2 years ago
0.0.48
2 years ago
0.0.49
2 years ago
0.0.45
2 years ago
0.0.40
2 years ago
0.0.41
2 years ago
0.0.42
2 years ago
0.0.43
2 years ago
0.0.44
2 years ago
0.0.39
2 years ago
0.0.38
2 years ago
0.0.37
2 years ago
0.0.36
2 years ago
0.0.35
2 years ago
0.0.30
2 years ago
0.0.31
2 years ago
0.0.32
2 years ago
0.0.33
2 years ago
0.0.34
2 years ago
0.0.29
2 years ago
0.0.28
3 years ago
0.0.27
3 years ago
0.0.24
3 years ago
0.0.25
3 years ago
0.0.26
3 years ago
0.0.23
3 years ago
0.0.22
3 years ago
0.0.21
3 years ago
0.0.20
3 years ago
0.0.19
3 years ago
0.0.18
3 years ago
0.0.16
3 years ago
0.0.17
3 years ago
0.0.15
3 years ago
0.0.14
3 years ago
0.0.13
3 years ago
0.0.10
3 years ago
0.0.11
3 years ago
0.0.12
3 years ago
0.0.9
3 years ago
0.0.8
3 years ago
0.0.5
3 years ago
0.0.7
3 years ago
0.0.6
3 years ago
0.0.4
3 years ago
0.0.3
3 years ago
0.0.2
3 years ago