Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev eventbus #91

Merged
merged 7 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 74 additions & 4 deletions api.swagger.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
{
"swagger": "2.0",
"info": {
"title": "handsfree/handsfree.proto",
"title": "node/access/access.proto",
"version": "version not set"
},
"tags": [
{
"name": "HandsfreeService"
},
{
"name": "ShadowService"
},
Expand All @@ -26,6 +23,12 @@
{
"name": "InternalService"
},
{
"name": "EventsService"
},
{
"name": "HandsfreeService"
},
{
"name": "PluginsService"
},
Expand Down Expand Up @@ -1594,6 +1597,37 @@
]
}
},
"/eventbus/stream": {
"get": {
"operationId": "EventsService_Subscribe",
"responses": {
"200": {
"description": "A successful response.(streaming responses)",
"schema": {
"type": "object",
"properties": {
"result": {
"$ref": "#/definitions/eventbusEvent"
},
"error": {
"$ref": "#/definitions/rpcStatus"
}
},
"title": "Stream result of eventbusEvent"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"tags": [
"EventsService"
]
}
},
"/handsfree": {
"post": {
"operationId": "HandsfreeService_Send",
Expand Down Expand Up @@ -3039,6 +3073,42 @@
}
}
},
"eventbusEvent": {
"type": "object",
"properties": {
"eventType": {
"$ref": "#/definitions/eventbusEventType"
},
"account": {
"$ref": "#/definitions/accountsAccount"
},
"namespace": {
"$ref": "#/definitions/namespacesNamespace"
},
"device": {
"$ref": "#/definitions/devicesDevice"
},
"meta": {
"type": "object"
}
}
},
"eventbusEventType": {
"type": "string",
"enum": [
"NONE",
"ACCOUNT_CREATE",
"ACCOUNT_UPDATE",
"ACCOUNT_DELETE",
"NAMESPACE_CREATE",
"NAMESPACE_UPDATE",
"NAMESPACE_DELETE",
"DEVICE_CREATE",
"DEVICE_UPDATE",
"DEVICE_DELETE"
],
"default": "NONE"
},
"handsfreeCode": {
"type": "string",
"enum": [
Expand Down
27 changes: 27 additions & 0 deletions build/es/eventbus/eventbus_connect.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=js+dts"
// @generated from file eventbus/eventbus.proto (package infinimesh.eventbus, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import { EmptyMessage } from "../node/node_pb.js";
import { Event } from "./eventbus_pb.js";
import { MethodKind } from "@bufbuild/protobuf";

/**
* @generated from service infinimesh.eventbus.EventsService
*/
export declare const EventsService: {
readonly typeName: "infinimesh.eventbus.EventsService",
readonly methods: {
/**
* @generated from rpc infinimesh.eventbus.EventsService.Subscribe
*/
readonly subscribe: {
readonly name: "Subscribe",
readonly I: typeof EmptyMessage,
readonly O: typeof Event,
readonly kind: MethodKind.ServerStreaming,
},
}
};

27 changes: 27 additions & 0 deletions build/es/eventbus/eventbus_connect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// @generated by protoc-gen-connect-es v1.3.0 with parameter "target=js+dts"
// @generated from file eventbus/eventbus.proto (package infinimesh.eventbus, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import { EmptyMessage } from "../node/node_pb.js";
import { Event } from "./eventbus_pb.js";
import { MethodKind } from "@bufbuild/protobuf";

/**
* @generated from service infinimesh.eventbus.EventsService
*/
export const EventsService = {
typeName: "infinimesh.eventbus.EventsService",
methods: {
/**
* @generated from rpc infinimesh.eventbus.EventsService.Subscribe
*/
subscribe: {
name: "Subscribe",
I: EmptyMessage,
O: Event,
kind: MethodKind.ServerStreaming,
},
}
};

118 changes: 118 additions & 0 deletions build/es/eventbus/eventbus_pb.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
// @generated by protoc-gen-es v1.7.2 with parameter "target=js+dts"
// @generated from file eventbus/eventbus.proto (package infinimesh.eventbus, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage, Struct } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
import type { Account } from "../node/accounts/accounts_pb.js";
import type { Namespace } from "../node/namespaces/namespaces_pb.js";
import type { Device } from "../node/devices/devices_pb.js";

/**
* @generated from enum infinimesh.eventbus.EventType
*/
export declare enum EventType {
/**
* @generated from enum value: NONE = 0;
*/
NONE = 0,

/**
* @generated from enum value: ACCOUNT_CREATE = 1;
*/
ACCOUNT_CREATE = 1,

/**
* @generated from enum value: ACCOUNT_UPDATE = 2;
*/
ACCOUNT_UPDATE = 2,

/**
* @generated from enum value: ACCOUNT_DELETE = 3;
*/
ACCOUNT_DELETE = 3,

/**
* @generated from enum value: NAMESPACE_CREATE = 4;
*/
NAMESPACE_CREATE = 4,

/**
* @generated from enum value: NAMESPACE_UPDATE = 5;
*/
NAMESPACE_UPDATE = 5,

/**
* @generated from enum value: NAMESPACE_DELETE = 6;
*/
NAMESPACE_DELETE = 6,

/**
* @generated from enum value: DEVICE_CREATE = 7;
*/
DEVICE_CREATE = 7,

/**
* @generated from enum value: DEVICE_UPDATE = 8;
*/
DEVICE_UPDATE = 8,

/**
* @generated from enum value: DEVICE_DELETE = 9;
*/
DEVICE_DELETE = 9,
}

/**
* @generated from message infinimesh.eventbus.Event
*/
export declare class Event extends Message<Event> {
/**
* @generated from field: infinimesh.eventbus.EventType event_type = 1;
*/
eventType: EventType;

/**
* @generated from oneof infinimesh.eventbus.Event.entity
*/
entity: {
/**
* @generated from field: infinimesh.node.accounts.Account account = 2;
*/
value: Account;
case: "account";
} | {
/**
* @generated from field: infinimesh.node.namespaces.Namespace namespace = 3;
*/
value: Namespace;
case: "namespace";
} | {
/**
* @generated from field: infinimesh.node.devices.Device device = 4;
*/
value: Device;
case: "device";
} | { case: undefined; value?: undefined };

/**
* @generated from field: google.protobuf.Struct meta = 5;
*/
meta?: Struct;

constructor(data?: PartialMessage<Event>);

static readonly runtime: typeof proto3;
static readonly typeName = "infinimesh.eventbus.Event";
static readonly fields: FieldList;

static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Event;

static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Event;

static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Event;

static equals(a: Event | PlainMessage<Event> | undefined, b: Event | PlainMessage<Event> | undefined): boolean;
}

43 changes: 43 additions & 0 deletions build/es/eventbus/eventbus_pb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// @generated by protoc-gen-es v1.7.2 with parameter "target=js+dts"
// @generated from file eventbus/eventbus.proto (package infinimesh.eventbus, syntax proto3)
/* eslint-disable */
// @ts-nocheck

import { proto3, Struct } from "@bufbuild/protobuf";
import { Account } from "../node/accounts/accounts_pb.js";
import { Namespace } from "../node/namespaces/namespaces_pb.js";
import { Device } from "../node/devices/devices_pb.js";

/**
* @generated from enum infinimesh.eventbus.EventType
*/
export const EventType = proto3.makeEnum(
"infinimesh.eventbus.EventType",
[
{no: 0, name: "NONE"},
{no: 1, name: "ACCOUNT_CREATE"},
{no: 2, name: "ACCOUNT_UPDATE"},
{no: 3, name: "ACCOUNT_DELETE"},
{no: 4, name: "NAMESPACE_CREATE"},
{no: 5, name: "NAMESPACE_UPDATE"},
{no: 6, name: "NAMESPACE_DELETE"},
{no: 7, name: "DEVICE_CREATE"},
{no: 8, name: "DEVICE_UPDATE"},
{no: 9, name: "DEVICE_DELETE"},
],
);

/**
* @generated from message infinimesh.eventbus.Event
*/
export const Event = proto3.makeMessageType(
"infinimesh.eventbus.Event",
() => [
{ no: 1, name: "event_type", kind: "enum", T: proto3.getEnumType(EventType) },
{ no: 2, name: "account", kind: "message", T: Account, oneof: "entity" },
{ no: 3, name: "namespace", kind: "message", T: Namespace, oneof: "entity" },
{ no: 4, name: "device", kind: "message", T: Device, oneof: "entity" },
{ no: 5, name: "meta", kind: "message", T: Struct },
],
);

Loading
Loading