You've already forked npm-viz-sdk
52 lines
1.7 KiB
Markdown
52 lines
1.7 KiB
Markdown
# Reflex Platform Core SDK
|
|
|
|
This is the official NPM Core SDK for **Reflex Platform**. It provides client stubs for interacting with Reflex Platform APIs through gRPC.
|
|
|
|
## Usage
|
|
|
|
Import the SDK in your JavaScript or TypeScript project and use it to communicate with **Reflex Platform** services.
|
|
|
|
```js
|
|
import { ProjectServiceClient, GetMyUIContextRequest } from '@reflex-platform/npm-core-sdk';
|
|
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
|
|
import { type RpcOptions, type RpcInterceptor, UnaryCall } from "@protobuf-ts/runtime-rpc";
|
|
|
|
const authInterceptor : RpcInterceptor = {
|
|
interceptUnary(next, method, input, options: RpcOptions): UnaryCall {
|
|
options.meta["Authorization"] = "Bearer YOUR_TOKEN";
|
|
return next(method, input, options);
|
|
}
|
|
}
|
|
|
|
const coreTransportInstance = new GrpcWebFetchTransport({
|
|
baseUrl: "grpc.viz.dev.reflex-platform.com:443",
|
|
interceptors: [authInterceptor]
|
|
});
|
|
|
|
const client = new ProjectServiceClient(coreTransportInstance);
|
|
|
|
const contexts = await client.GetMyUIContext(new GetMyUIContextRequest());
|
|
```
|
|
|
|
## gRPC Endpoint
|
|
|
|
The SDK connects to the following gRPC endpoint:
|
|
|
|
```
|
|
grpc.viz.dev.reflex-platform.com
|
|
```
|
|
|
|
## Example Vue.js Application
|
|
|
|
A more complete Vue.js application that demonstrates how to integrate the **Reflex Platform NPM SDK** is available. This serves as a reference implementation for using the SDK in a frontend application.
|
|
|
|
Repository: [Vue RP Example](https://git.dev.reflex-platform.com/reflex-platform/vue-rp-example)
|
|
|
|
## Additional Resources
|
|
|
|
For more information on using the Reflex Platform SDK, please refer to the [documentation](https://docs.viz.dev.reflex-platform.com).
|
|
|
|
## License
|
|
|
|
This SDK is licensed under **MIT License**.
|