-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #249 from ueckoken/add-connect-handler
Add connect handler
- Loading branch information
Showing
26 changed files
with
3,000 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
"use client"; | ||
import {createPromiseClient} from "@connectrpc/connect"; | ||
import {StateManagerService} from "@/proto/state/v1/state_connectweb"; | ||
import {createConnectTransport} from "@bufbuild/connect-web"; | ||
import {GetBlockStatesRequest} from "@/proto/state/v1/block_pb"; | ||
|
||
export default function Test() { | ||
|
||
const transport = createConnectTransport( | ||
{ | ||
// baseUrl: process.env.NEXT_PUBLIC_API_ENDPOINT!, | ||
baseUrl: "http://localhost:8080", | ||
}); | ||
const sendData = () => { | ||
(async () => { | ||
const client = createPromiseClient(StateManagerService, transport); | ||
const res = await client.getBlockStates(new GetBlockStatesRequest({})); | ||
console.log(res); | ||
})(); | ||
} | ||
|
||
return ( | ||
<div> | ||
<h1>Test</h1> | ||
<button onClick={sendData}>Test</button> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
// | ||
//Block Proto | ||
//閉塞の状態を扱うプロトコル | ||
|
||
// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" | ||
// @generated from file state/v1/block.proto (package state.v1, syntax proto3) | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; | ||
import { Message, proto3 } from "@bufbuild/protobuf"; | ||
|
||
/** | ||
* @generated from enum state.v1.BlockStateEnum | ||
*/ | ||
export declare enum BlockStateEnum { | ||
/** | ||
* @generated from enum value: BLOCK_STATE_UNKNOWN = 0; | ||
*/ | ||
BLOCK_STATE_UNKNOWN = 0, | ||
|
||
/** | ||
* 閉塞が開の状態(列車がいない) | ||
* | ||
* @generated from enum value: BLOCK_STATE_OPEN = 1; | ||
*/ | ||
BLOCK_STATE_OPEN = 1, | ||
|
||
/** | ||
* 閉塞が閉の状態(列車がいない) | ||
* | ||
* @generated from enum value: BLOCK_STATE_CLOSE = 2; | ||
*/ | ||
BLOCK_STATE_CLOSE = 2, | ||
} | ||
|
||
/** | ||
* 閉塞の状態 | ||
* | ||
* @generated from message state.v1.BlockState | ||
*/ | ||
export declare class BlockState extends Message<BlockState> { | ||
/** | ||
* 閉塞のID | ||
* | ||
* @generated from field: string block_id = 1; | ||
*/ | ||
blockId: string; | ||
|
||
/** | ||
* 閉塞の状態 | ||
* | ||
* @generated from field: state.v1.BlockStateEnum state = 2; | ||
*/ | ||
state: BlockStateEnum; | ||
|
||
constructor(data?: PartialMessage<BlockState>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "state.v1.BlockState"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BlockState; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): BlockState; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): BlockState; | ||
|
||
static equals(a: BlockState | PlainMessage<BlockState> | undefined, b: BlockState | PlainMessage<BlockState> | undefined): boolean; | ||
} | ||
|
||
/** | ||
* | ||
* GetBlockStates : 閉塞の状態を取得するAPI | ||
* | ||
* @generated from message state.v1.GetBlockStatesRequest | ||
*/ | ||
export declare class GetBlockStatesRequest extends Message<GetBlockStatesRequest> { | ||
constructor(data?: PartialMessage<GetBlockStatesRequest>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "state.v1.GetBlockStatesRequest"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetBlockStatesRequest; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetBlockStatesRequest; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetBlockStatesRequest; | ||
|
||
static equals(a: GetBlockStatesRequest | PlainMessage<GetBlockStatesRequest> | undefined, b: GetBlockStatesRequest | PlainMessage<GetBlockStatesRequest> | undefined): boolean; | ||
} | ||
|
||
/** | ||
* @generated from message state.v1.GetBlockStatesResponse | ||
*/ | ||
export declare class GetBlockStatesResponse extends Message<GetBlockStatesResponse> { | ||
/** | ||
* @generated from field: repeated state.v1.BlockState states = 1; | ||
*/ | ||
states: BlockState[]; | ||
|
||
constructor(data?: PartialMessage<GetBlockStatesResponse>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "state.v1.GetBlockStatesResponse"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): GetBlockStatesResponse; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): GetBlockStatesResponse; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): GetBlockStatesResponse; | ||
|
||
static equals(a: GetBlockStatesResponse | PlainMessage<GetBlockStatesResponse> | undefined, b: GetBlockStatesResponse | PlainMessage<GetBlockStatesResponse> | undefined): boolean; | ||
} | ||
|
||
/** | ||
* | ||
* UpdateBLockState: 閉塞の状態を更新するAPI | ||
* | ||
* @generated from message state.v1.UpdateBlockStateRequest | ||
*/ | ||
export declare class UpdateBlockStateRequest extends Message<UpdateBlockStateRequest> { | ||
/** | ||
* @generated from field: state.v1.BlockState state = 1; | ||
*/ | ||
state?: BlockState; | ||
|
||
constructor(data?: PartialMessage<UpdateBlockStateRequest>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "state.v1.UpdateBlockStateRequest"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UpdateBlockStateRequest; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UpdateBlockStateRequest; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UpdateBlockStateRequest; | ||
|
||
static equals(a: UpdateBlockStateRequest | PlainMessage<UpdateBlockStateRequest> | undefined, b: UpdateBlockStateRequest | PlainMessage<UpdateBlockStateRequest> | undefined): boolean; | ||
} | ||
|
||
/** | ||
* @generated from message state.v1.UpdateBlockStateResponse | ||
*/ | ||
export declare class UpdateBlockStateResponse extends Message<UpdateBlockStateResponse> { | ||
constructor(data?: PartialMessage<UpdateBlockStateResponse>); | ||
|
||
static readonly runtime: typeof proto3; | ||
static readonly typeName = "state.v1.UpdateBlockStateResponse"; | ||
static readonly fields: FieldList; | ||
|
||
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): UpdateBlockStateResponse; | ||
|
||
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): UpdateBlockStateResponse; | ||
|
||
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): UpdateBlockStateResponse; | ||
|
||
static equals(a: UpdateBlockStateResponse | PlainMessage<UpdateBlockStateResponse> | undefined, b: UpdateBlockStateResponse | PlainMessage<UpdateBlockStateResponse> | undefined): boolean; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// | ||
//Block Proto | ||
//閉塞の状態を扱うプロトコル | ||
|
||
// @generated by protoc-gen-es v1.4.2 with parameter "target=dts+js" | ||
// @generated from file state/v1/block.proto (package state.v1, syntax proto3) | ||
/* eslint-disable */ | ||
// @ts-nocheck | ||
|
||
import { proto3 } from "@bufbuild/protobuf"; | ||
|
||
/** | ||
* @generated from enum state.v1.BlockStateEnum | ||
*/ | ||
export const BlockStateEnum = proto3.makeEnum( | ||
"state.v1.BlockStateEnum", | ||
[ | ||
{no: 0, name: "BLOCK_STATE_UNKNOWN"}, | ||
{no: 1, name: "BLOCK_STATE_OPEN"}, | ||
{no: 2, name: "BLOCK_STATE_CLOSE"}, | ||
], | ||
); | ||
|
||
/** | ||
* 閉塞の状態 | ||
* | ||
* @generated from message state.v1.BlockState | ||
*/ | ||
export const BlockState = proto3.makeMessageType( | ||
"state.v1.BlockState", | ||
() => [ | ||
{ no: 1, name: "block_id", kind: "scalar", T: 9 /* ScalarType.STRING */ }, | ||
{ no: 2, name: "state", kind: "enum", T: proto3.getEnumType(BlockStateEnum) }, | ||
], | ||
); | ||
|
||
/** | ||
* | ||
* GetBlockStates : 閉塞の状態を取得するAPI | ||
* | ||
* @generated from message state.v1.GetBlockStatesRequest | ||
*/ | ||
export const GetBlockStatesRequest = proto3.makeMessageType( | ||
"state.v1.GetBlockStatesRequest", | ||
[], | ||
); | ||
|
||
/** | ||
* @generated from message state.v1.GetBlockStatesResponse | ||
*/ | ||
export const GetBlockStatesResponse = proto3.makeMessageType( | ||
"state.v1.GetBlockStatesResponse", | ||
() => [ | ||
{ no: 1, name: "states", kind: "message", T: BlockState, repeated: true }, | ||
], | ||
); | ||
|
||
/** | ||
* | ||
* UpdateBLockState: 閉塞の状態を更新するAPI | ||
* | ||
* @generated from message state.v1.UpdateBlockStateRequest | ||
*/ | ||
export const UpdateBlockStateRequest = proto3.makeMessageType( | ||
"state.v1.UpdateBlockStateRequest", | ||
() => [ | ||
{ no: 1, name: "state", kind: "message", T: BlockState }, | ||
], | ||
); | ||
|
||
/** | ||
* @generated from message state.v1.UpdateBlockStateResponse | ||
*/ | ||
export const UpdateBlockStateResponse = proto3.makeMessageType( | ||
"state.v1.UpdateBlockStateResponse", | ||
[], | ||
); | ||
|
Oops, something went wrong.