Skip to content

Commit

Permalink
rename interfaces for convention
Browse files Browse the repository at this point in the history
  • Loading branch information
umitcanbal committed Dec 4, 2023
1 parent 36dabe4 commit e98fcb1
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions _examples/golang-sse/webapp/src/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ export type Fetch = (
init?: RequestInit
) => Promise<Response>;

export interface WebRpcOptions {
export interface WebrpcOptions {
headers?: HeadersInit;
signal?: AbortSignal;
}

export interface WebRpcStreamOptions<T> extends WebRpcOptions {
export interface WebrpcStreamOptions<T> extends WebrpcOptions {
onMessage: (message: T) => void;
onError: (error: WebrpcError) => void;
onOpen?: () => void;
Expand All @@ -49,11 +49,11 @@ export interface Message {
export interface Chat {
sendMessage(
args: SendMessageArgs,
options?: WebRpcOptions
options?: WebrpcOptions
): Promise<SendMessageReturn>;
subscribeMessages(
args: SubscribeMessagesArgs,
options: WebRpcStreamOptions<SubscribeMessagesReturn>
options: WebrpcStreamOptions<SubscribeMessagesReturn>
): Promise<void>;
}

Expand Down Expand Up @@ -91,7 +91,7 @@ export class Chat implements Chat {

sendMessage = (
args: SendMessageArgs,
options?: WebRpcOptions
options?: WebrpcOptions
): Promise<SendMessageReturn> => {
return this.fetch(
this.url("SendMessage"),
Expand All @@ -112,7 +112,7 @@ export class Chat implements Chat {

subscribeMessages = (
args: SubscribeMessagesArgs,
options: WebRpcStreamOptions<SubscribeMessagesReturn>
options: WebrpcStreamOptions<SubscribeMessagesReturn>
): Promise<void> => {
return this.fetch(
this.url("SubscribeMessages"),
Expand All @@ -131,7 +131,7 @@ export class Chat implements Chat {

const createHTTPRequest = (
body: object = {},
options?: WebRpcOptions
options?: WebrpcOptions
): object => {
return {
method: "POST",
Expand Down Expand Up @@ -164,7 +164,7 @@ const buildResponse = (res: Response): Promise<any> => {
});
};

const sseResponse = async (res: Response, options: WebRpcStreamOptions<any>) => {
const sseResponse = async (res: Response, options: WebrpcStreamOptions<any>) => {
const { onMessage, onOpen, onClose, onError } = options;

if (!res.ok) {
Expand Down

0 comments on commit e98fcb1

Please sign in to comment.