API definitions can be found at https://github.com/cs3org/cs3apis
npm i @cs3org/cs3apis
Official Javascript CS3APIS
API definitions can be found at https://github.com/cs3org/cs3apis
npm i @cs3org/cs3apis
Can someone explain the difference between https://github.com/cs3org/js-cs3apis and https://github.com/cs3org/node-cs3apis? Would be good to link these two repos from their readme's.
This might be a user problem, but I'm investigating the following error:
const util = require('util');
const grpc = require('grpc');
const { GatewayAPIClient } = require('@cs3org/node-cs3apis/cs3/gateway/v1beta1/gateway_api_grpc_pb');
const { AuthenticateRequest, WhoAmIRequest } = require('@cs3org/node-cs3apis/cs3/gateway/v1beta1/gateway_api_pb');
const { ListReceivedOCMSharesRequest } = require('@cs3org/node-cs3apis/cs3/sharing/ocm/v1beta1/ocm_api_pb');
const TARGET = process.env.TARGET || 'localhost:19000';
function promisifyMethods(instance, methodNames) {
const result = {};
methodNames.forEach(methodName => {
result[methodName] = util.promisify(instance[methodName].bind(instance));
});
return result;
}
const client = promisifyMethods(new GatewayAPIClient(TARGET, grpc.credentials.createInsecure()), [
'authenticate',
'listReceivedOCMShares',
'whoAmI'
]);
async function example() {
try {
const req1 = new AuthenticateRequest();
req1.setType('basic');
req1.setClientId('einstein');
req1.setClientSecret('relativity');
const res1 = await client.authenticate(req1);
// 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(res1.getUser().getDisplayName());
const req2 = new WhoAmIRequest();
// req2.setIncludeInstance(true);
const res2 = await client.whoAmI(req2);
console.log(res2);
const shares = await client.listReceivedOCMShares(new ListReceivedOCMSharesRequest());
console.log(shares);
} catch (e) {
console.error(e);
}
}
// ...
example();
Outputs:
Albert Einstein
{
wrappers_: {
'1': {
wrappers_: null,
messageId_: undefined,
arrayIndexOffset_: -1,
array: [Array],
pivot_: 1.7976931348623157e+308,
convertedPrimitiveFields_: {}
}
},
messageId_: undefined,
arrayIndexOffset_: -1,
array: [
[
9,
'error dismantling token',
'b1df4dfd84d77f1586d68ad56a11995a'
]
],
pivot_: 1.7976931348623157e+308,
convertedPrimitiveFields_: {}
}
Error: 2 UNKNOWN: gateway: error calling ListReceivedShares: rpc error: code = Unauthenticated desc = auth: core access token not found
at Object.exports.createStatusError (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/common.js:91:15)
at Object.onReceiveStatus (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/client_interceptors.js:1209:28)
at InterceptingListener._callNext (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/client_interceptors.js:568:42)
at InterceptingListener.onReceiveStatus (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/client_interceptors.js:618:8)
at callback (/Users/michiel/gh/cs3org/ocm-test-suite/node_modules/grpc/src/client_interceptors.js:847:24) {
code: 2,
metadata: Metadata { _internal_repr: {}, flags: 0 },
details: 'gateway: error calling ListReceivedShares: rpc error: code = Unauthenticated desc = auth: core access token not found'
}
When using the latest release (0.0.35) I get the error TypeError: Cannot read property 'MethodInfo' of undefined
when trying to import the GatewayAPIClient
.
import {
GatewayAPIClient,
} from "@cs3org/cs3apis/cs3/gateway/v1beta1/gateway_api_grpc_web_pb.js";
However, if I edit the file gateway_api_grpc_web_pb.js
and add the following code at line 13 (just after grpc.web = require('grpc-web')
) the import statement works.
grpc.web.AbstractClientBase = {
MethodInfo: function() {}
}
Version of grpc-web is 1.3.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.