@caronashow/api 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +9 -0
- package/README.md +80 -0
- package/dist/gen/caronashow/pooler/v1/pooler_pb.d.ts +219 -0
- package/dist/gen/caronashow/types/v1/user_pb.d.ts +36 -0
- package/dist/index.cjs +2995 -0
- package/dist/index.d.ts +2 -0
- package/package.json +30 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CaronaShow
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @caronashow/api
|
|
2
|
+
|
|
3
|
+
TypeScript/JavaScript client library for the CaronaShow API. This package provides type-safe access to the CaronaShow service APIs.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @caronashow/api
|
|
9
|
+
# or
|
|
10
|
+
yarn add @caronashow/api
|
|
11
|
+
# or
|
|
12
|
+
pnpm add @caronashow/api
|
|
13
|
+
# or
|
|
14
|
+
bun install @caronashow/api
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
### Basic Setup Example
|
|
20
|
+
|
|
21
|
+
```typescript
|
|
22
|
+
import { createClient } from "@connectrpc/connect";
|
|
23
|
+
import { createGrpcWebTransport } from "@connectrpc/connect-web";
|
|
24
|
+
import { PoolerService } from "@caronashow/api";
|
|
25
|
+
|
|
26
|
+
// Create a transport
|
|
27
|
+
const transport = createGrpcWebTransport({
|
|
28
|
+
baseUrl: "https://dev.carona.show",
|
|
29
|
+
useBinaryFormat: true,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Create the client
|
|
33
|
+
const client = createClient(PoolerService, transport);
|
|
34
|
+
|
|
35
|
+
// Example: Using the positions service
|
|
36
|
+
const position = await client.getPosition({ deviceId: "device-123" });
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### API Documentation
|
|
40
|
+
|
|
41
|
+
#### Types
|
|
42
|
+
|
|
43
|
+
The package includes the following type definitions:
|
|
44
|
+
|
|
45
|
+
- `Position` - Represents a device's location with latitude, longitude, altitude, speed, and heading
|
|
46
|
+
- `DevicePosition` - Combines a device ID with its position
|
|
47
|
+
- `Device` - Device information including ID and name
|
|
48
|
+
- `User` - User information including ID, name, and associated devices
|
|
49
|
+
- `Group` - Group information including ID, name, description, and associated users
|
|
50
|
+
|
|
51
|
+
#### Services
|
|
52
|
+
|
|
53
|
+
This is not a full list of services. These are just some examples.
|
|
54
|
+
|
|
55
|
+
- `PositionsService` - Service for managing device positions
|
|
56
|
+
- `sendPositions(positions: DevicePosition[]): Promise<SendPositionsResponse>` - Send multiple device position updates
|
|
57
|
+
- `getGroup(groupId: string): Promise<GetGroupResponse>` - Get a group by ID, including user data and their devices
|
|
58
|
+
- `getGroupPositions(groupId: string): Promise<GetGroupPositionsResponse>` - Get positions for all devices in a group
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
This package is automatically generated from Protocol Buffer definitions. Do not modify the generated code directly. Instead, make changes to the proto files in the parent repository.
|
|
63
|
+
|
|
64
|
+
### Building
|
|
65
|
+
|
|
66
|
+
The package is built using the following tools:
|
|
67
|
+
|
|
68
|
+
- `buf` - Protocol Buffer compiler
|
|
69
|
+
- `protoc-gen-es` - TypeScript code generator
|
|
70
|
+
- `protoc-gen-connect-es` - Connect-ES code generator
|
|
71
|
+
|
|
72
|
+
To rebuild the package:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
make generate
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
MIT License - see LICENSE file for details.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Duration, Timestamp } from "@bufbuild/protobuf/wkt";
|
|
3
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
4
|
+
/**
|
|
5
|
+
* Describes the file caronashow/pooler/v1/pooler.proto.
|
|
6
|
+
*/
|
|
7
|
+
export declare const file_caronashow_pooler_v1_pooler: GenFile;
|
|
8
|
+
/**
|
|
9
|
+
* @generated from message caronashow.pooler.v1.Operation
|
|
10
|
+
*/
|
|
11
|
+
export type Operation = Message<"caronashow.pooler.v1.Operation"> & {
|
|
12
|
+
/**
|
|
13
|
+
* @generated from field: string operation_id = 1;
|
|
14
|
+
*/
|
|
15
|
+
operationId: string;
|
|
16
|
+
/**
|
|
17
|
+
* @generated from field: string dataset_id = 2;
|
|
18
|
+
*/
|
|
19
|
+
datasetId: string;
|
|
20
|
+
/**
|
|
21
|
+
* @generated from field: google.protobuf.Timestamp started_at = 3;
|
|
22
|
+
*/
|
|
23
|
+
startedAt?: Timestamp;
|
|
24
|
+
/**
|
|
25
|
+
* @generated from field: google.protobuf.Duration time_elapsed = 4;
|
|
26
|
+
*/
|
|
27
|
+
timeElapsed?: Duration;
|
|
28
|
+
/**
|
|
29
|
+
* @generated from field: caronashow.pooler.v1.OperationState state = 5;
|
|
30
|
+
*/
|
|
31
|
+
state: OperationState;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Describes the message caronashow.pooler.v1.Operation.
|
|
35
|
+
* Use `create(OperationSchema)` to create a new message.
|
|
36
|
+
*/
|
|
37
|
+
export declare const OperationSchema: GenMessage<Operation>;
|
|
38
|
+
/**
|
|
39
|
+
* @generated from message caronashow.pooler.v1.ExecuteMatchingAlgorithmOnDatasetRequest
|
|
40
|
+
*/
|
|
41
|
+
export type ExecuteMatchingAlgorithmOnDatasetRequest = Message<"caronashow.pooler.v1.ExecuteMatchingAlgorithmOnDatasetRequest"> & {
|
|
42
|
+
/**
|
|
43
|
+
* @generated from field: string dataset_id = 1;
|
|
44
|
+
*/
|
|
45
|
+
datasetId: string;
|
|
46
|
+
/**
|
|
47
|
+
* @generated from field: caronashow.pooler.v1.MatchingAlgorithm algorithm = 2;
|
|
48
|
+
*/
|
|
49
|
+
algorithm: MatchingAlgorithm;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* Describes the message caronashow.pooler.v1.ExecuteMatchingAlgorithmOnDatasetRequest.
|
|
53
|
+
* Use `create(ExecuteMatchingAlgorithmOnDatasetRequestSchema)` to create a new message.
|
|
54
|
+
*/
|
|
55
|
+
export declare const ExecuteMatchingAlgorithmOnDatasetRequestSchema: GenMessage<ExecuteMatchingAlgorithmOnDatasetRequest>;
|
|
56
|
+
/**
|
|
57
|
+
* @generated from message caronashow.pooler.v1.ExecuteMatchingAlgorithmOnDatasetResponse
|
|
58
|
+
*/
|
|
59
|
+
export type ExecuteMatchingAlgorithmOnDatasetResponse = Message<"caronashow.pooler.v1.ExecuteMatchingAlgorithmOnDatasetResponse"> & {
|
|
60
|
+
/**
|
|
61
|
+
* @generated from field: caronashow.pooler.v1.Operation operation = 1;
|
|
62
|
+
*/
|
|
63
|
+
operation?: Operation;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Describes the message caronashow.pooler.v1.ExecuteMatchingAlgorithmOnDatasetResponse.
|
|
67
|
+
* Use `create(ExecuteMatchingAlgorithmOnDatasetResponseSchema)` to create a new message.
|
|
68
|
+
*/
|
|
69
|
+
export declare const ExecuteMatchingAlgorithmOnDatasetResponseSchema: GenMessage<ExecuteMatchingAlgorithmOnDatasetResponse>;
|
|
70
|
+
/**
|
|
71
|
+
* @generated from message caronashow.pooler.v1.ListOperationsRequest
|
|
72
|
+
*/
|
|
73
|
+
export type ListOperationsRequest = Message<"caronashow.pooler.v1.ListOperationsRequest"> & {
|
|
74
|
+
/**
|
|
75
|
+
* @generated from field: optional int32 limit = 1;
|
|
76
|
+
*/
|
|
77
|
+
limit?: number;
|
|
78
|
+
/**
|
|
79
|
+
* @generated from field: optional caronashow.pooler.v1.OperationState state = 2;
|
|
80
|
+
*/
|
|
81
|
+
state?: OperationState;
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* Describes the message caronashow.pooler.v1.ListOperationsRequest.
|
|
85
|
+
* Use `create(ListOperationsRequestSchema)` to create a new message.
|
|
86
|
+
*/
|
|
87
|
+
export declare const ListOperationsRequestSchema: GenMessage<ListOperationsRequest>;
|
|
88
|
+
/**
|
|
89
|
+
* @generated from message caronashow.pooler.v1.ListOperationsResponse
|
|
90
|
+
*/
|
|
91
|
+
export type ListOperationsResponse = Message<"caronashow.pooler.v1.ListOperationsResponse"> & {
|
|
92
|
+
/**
|
|
93
|
+
* @generated from field: repeated caronashow.pooler.v1.Operation operations = 1;
|
|
94
|
+
*/
|
|
95
|
+
operations: Operation[];
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Describes the message caronashow.pooler.v1.ListOperationsResponse.
|
|
99
|
+
* Use `create(ListOperationsResponseSchema)` to create a new message.
|
|
100
|
+
*/
|
|
101
|
+
export declare const ListOperationsResponseSchema: GenMessage<ListOperationsResponse>;
|
|
102
|
+
/**
|
|
103
|
+
* @generated from message caronashow.pooler.v1.GetStateOfOperationRequest
|
|
104
|
+
*/
|
|
105
|
+
export type GetStateOfOperationRequest = Message<"caronashow.pooler.v1.GetStateOfOperationRequest"> & {
|
|
106
|
+
/**
|
|
107
|
+
* @generated from field: string operation_id = 1;
|
|
108
|
+
*/
|
|
109
|
+
operationId: string;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Describes the message caronashow.pooler.v1.GetStateOfOperationRequest.
|
|
113
|
+
* Use `create(GetStateOfOperationRequestSchema)` to create a new message.
|
|
114
|
+
*/
|
|
115
|
+
export declare const GetStateOfOperationRequestSchema: GenMessage<GetStateOfOperationRequest>;
|
|
116
|
+
/**
|
|
117
|
+
* @generated from message caronashow.pooler.v1.GetStateOfOperationResponse
|
|
118
|
+
*/
|
|
119
|
+
export type GetStateOfOperationResponse = Message<"caronashow.pooler.v1.GetStateOfOperationResponse"> & {
|
|
120
|
+
/**
|
|
121
|
+
* @generated from field: caronashow.pooler.v1.Operation operation = 1;
|
|
122
|
+
*/
|
|
123
|
+
operation?: Operation;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* Describes the message caronashow.pooler.v1.GetStateOfOperationResponse.
|
|
127
|
+
* Use `create(GetStateOfOperationResponseSchema)` to create a new message.
|
|
128
|
+
*/
|
|
129
|
+
export declare const GetStateOfOperationResponseSchema: GenMessage<GetStateOfOperationResponse>;
|
|
130
|
+
/**
|
|
131
|
+
* @generated from enum caronashow.pooler.v1.MatchingAlgorithm
|
|
132
|
+
*/
|
|
133
|
+
export declare enum MatchingAlgorithm {
|
|
134
|
+
/**
|
|
135
|
+
* @generated from enum value: MATCHING_ALGORITHM_UNSPECIFIED = 0;
|
|
136
|
+
*/
|
|
137
|
+
UNSPECIFIED = 0,
|
|
138
|
+
/**
|
|
139
|
+
* @generated from enum value: MATCHING_ALGORITHM_RANDOM = 1;
|
|
140
|
+
*/
|
|
141
|
+
RANDOM = 1,
|
|
142
|
+
/**
|
|
143
|
+
* @generated from enum value: MATCHING_ALGORITHM_ROUTE_SIMILARITY = 2;
|
|
144
|
+
*/
|
|
145
|
+
ROUTE_SIMILARITY = 2,
|
|
146
|
+
/**
|
|
147
|
+
* @generated from enum value: MATCHING_ALGORITHM_POINT_DISTANCE = 3;
|
|
148
|
+
*/
|
|
149
|
+
POINT_DISTANCE = 3,
|
|
150
|
+
/**
|
|
151
|
+
* @generated from enum value: MATCHING_ALGORITHM_FULL = 4;
|
|
152
|
+
*/
|
|
153
|
+
FULL = 4
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Describes the enum caronashow.pooler.v1.MatchingAlgorithm.
|
|
157
|
+
*/
|
|
158
|
+
export declare const MatchingAlgorithmSchema: GenEnum<MatchingAlgorithm>;
|
|
159
|
+
/**
|
|
160
|
+
* @generated from enum caronashow.pooler.v1.OperationState
|
|
161
|
+
*/
|
|
162
|
+
export declare enum OperationState {
|
|
163
|
+
/**
|
|
164
|
+
* @generated from enum value: OPERATION_STATE_UNSPECIFIED = 0;
|
|
165
|
+
*/
|
|
166
|
+
UNSPECIFIED = 0,
|
|
167
|
+
/**
|
|
168
|
+
* @generated from enum value: OPERATION_STATE_PENDING = 1;
|
|
169
|
+
*/
|
|
170
|
+
PENDING = 1,
|
|
171
|
+
/**
|
|
172
|
+
* @generated from enum value: OPERATION_STATE_RUNNING = 2;
|
|
173
|
+
*/
|
|
174
|
+
RUNNING = 2,
|
|
175
|
+
/**
|
|
176
|
+
* @generated from enum value: OPERATION_STATE_SUCCEEDED = 3;
|
|
177
|
+
*/
|
|
178
|
+
SUCCEEDED = 3,
|
|
179
|
+
/**
|
|
180
|
+
* @generated from enum value: OPERATION_STATE_FAILED = 4;
|
|
181
|
+
*/
|
|
182
|
+
FAILED = 4
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Describes the enum caronashow.pooler.v1.OperationState.
|
|
186
|
+
*/
|
|
187
|
+
export declare const OperationStateSchema: GenEnum<OperationState>;
|
|
188
|
+
/**
|
|
189
|
+
* Service executing the main carpooling algorithm on
|
|
190
|
+
* datasets defined directly in the database
|
|
191
|
+
*
|
|
192
|
+
* @generated from service caronashow.pooler.v1.PoolerService
|
|
193
|
+
*/
|
|
194
|
+
export declare const PoolerService: GenService<{
|
|
195
|
+
/**
|
|
196
|
+
* @generated from rpc caronashow.pooler.v1.PoolerService.ExecuteMatchingAlgorithmOnDataset
|
|
197
|
+
*/
|
|
198
|
+
executeMatchingAlgorithmOnDataset: {
|
|
199
|
+
methodKind: "unary";
|
|
200
|
+
input: typeof ExecuteMatchingAlgorithmOnDatasetRequestSchema;
|
|
201
|
+
output: typeof ExecuteMatchingAlgorithmOnDatasetResponseSchema;
|
|
202
|
+
};
|
|
203
|
+
/**
|
|
204
|
+
* @generated from rpc caronashow.pooler.v1.PoolerService.ListOperations
|
|
205
|
+
*/
|
|
206
|
+
listOperations: {
|
|
207
|
+
methodKind: "unary";
|
|
208
|
+
input: typeof ListOperationsRequestSchema;
|
|
209
|
+
output: typeof ListOperationsResponseSchema;
|
|
210
|
+
};
|
|
211
|
+
/**
|
|
212
|
+
* @generated from rpc caronashow.pooler.v1.PoolerService.GetStateOfOperation
|
|
213
|
+
*/
|
|
214
|
+
getStateOfOperation: {
|
|
215
|
+
methodKind: "unary";
|
|
216
|
+
input: typeof GetStateOfOperationRequestSchema;
|
|
217
|
+
output: typeof GetStateOfOperationResponseSchema;
|
|
218
|
+
};
|
|
219
|
+
}>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2";
|
|
2
|
+
import type { Message } from "@bufbuild/protobuf";
|
|
3
|
+
/**
|
|
4
|
+
* Describes the file caronashow/types/v1/user.proto.
|
|
5
|
+
*/
|
|
6
|
+
export declare const file_caronashow_types_v1_user: GenFile;
|
|
7
|
+
/**
|
|
8
|
+
* @generated from message caronashow.types.v1.User
|
|
9
|
+
*/
|
|
10
|
+
export type User = Message<"caronashow.types.v1.User"> & {
|
|
11
|
+
/**
|
|
12
|
+
* @generated from field: string id = 1;
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
/**
|
|
16
|
+
* @generated from field: string username = 2;
|
|
17
|
+
*/
|
|
18
|
+
username: string;
|
|
19
|
+
/**
|
|
20
|
+
* @generated from field: string first_name = 3;
|
|
21
|
+
*/
|
|
22
|
+
firstName: string;
|
|
23
|
+
/**
|
|
24
|
+
* @generated from field: string last_name = 4;
|
|
25
|
+
*/
|
|
26
|
+
lastName: string;
|
|
27
|
+
/**
|
|
28
|
+
* @generated from field: string email = 5;
|
|
29
|
+
*/
|
|
30
|
+
email: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Describes the message caronashow.types.v1.User.
|
|
34
|
+
* Use `create(UserSchema)` to create a new message.
|
|
35
|
+
*/
|
|
36
|
+
export declare const UserSchema: GenMessage<User>;
|