examples to new tsrpc-cli
This commit is contained in:
1
examples/transfer-encryption/frontend/src/shared
Symbolic link
1
examples/transfer-encryption/frontend/src/shared
Symbolic link
@@ -0,0 +1 @@
|
||||
../../backend/src/shared
|
@@ -1,17 +0,0 @@
|
||||
export class EncryptUtil {
|
||||
|
||||
static encrypt(buf: Uint8Array): Uint8Array {
|
||||
for (let i = 0; i < buf.length; ++i) {
|
||||
buf[i] -= 1;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
static decrypt(buf: Uint8Array): Uint8Array {
|
||||
for (let i = 0; i < buf.length; ++i) {
|
||||
buf[i] += 1;
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
// This is a demo code file
|
||||
// Feel free to delete it
|
||||
|
||||
export interface ReqAddData {
|
||||
content: string;
|
||||
}
|
||||
|
||||
export interface ResAddData {
|
||||
time: Date
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
// This is a demo code file
|
||||
// Feel free to delete it
|
||||
|
||||
export interface ReqGetData {
|
||||
|
||||
}
|
||||
|
||||
export interface ResGetData {
|
||||
data: {
|
||||
content: string,
|
||||
time: Date
|
||||
}[]
|
||||
}
|
@@ -1,98 +0,0 @@
|
||||
import { ServiceProto } from 'tsrpc-proto';
|
||||
import { ReqAddData, ResAddData } from './PtlAddData';
|
||||
import { ReqGetData, ResGetData } from './PtlGetData';
|
||||
|
||||
// This is a demo service proto file (auto generated)
|
||||
// Feel free to delete it
|
||||
|
||||
export interface ServiceType {
|
||||
api: {
|
||||
"AddData": {
|
||||
req: ReqAddData,
|
||||
res: ResAddData
|
||||
},
|
||||
"GetData": {
|
||||
req: ReqGetData,
|
||||
res: ResGetData
|
||||
}
|
||||
},
|
||||
msg: {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"version": 1,
|
||||
"services": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "AddData",
|
||||
"type": "api"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "GetData",
|
||||
"type": "api"
|
||||
}
|
||||
],
|
||||
"types": {
|
||||
"PtlAddData/ReqAddData": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "content",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlAddData/ResAddData": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "time",
|
||||
"type": {
|
||||
"type": "Date"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlGetData/ReqGetData": {
|
||||
"type": "Interface"
|
||||
},
|
||||
"PtlGetData/ResGetData": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "data",
|
||||
"type": {
|
||||
"type": "Array",
|
||||
"elementType": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "content",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "time",
|
||||
"type": {
|
||||
"type": "Date"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user