@miradorlabs/web-grpc 2.13.0 → 2.15.0

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.
@@ -21,6 +21,9 @@ export interface OAuthConnection {
21
21
  installedBy: string;
22
22
  createdAt: Date | undefined;
23
23
  updatedAt: Date | undefined;
24
+ providerAccountId: string;
25
+ providerAccountName: string;
26
+ providerRegion: string;
24
27
  }
25
28
 
26
29
  export interface InitiateSlackOAuthRequest {
@@ -71,6 +74,49 @@ export interface SlackChannel {
71
74
  isPrivate: boolean;
72
75
  }
73
76
 
77
+ export interface InitiatePagerDutyOAuthRequest {
78
+ organizationId: string;
79
+ redirectUri: string;
80
+ }
81
+
82
+ export interface InitiatePagerDutyOAuthResponse {
83
+ status: ResponseStatus | undefined;
84
+ oauthUrl: string;
85
+ flowId: string;
86
+ }
87
+
88
+ export interface CompletePagerDutyOAuthRequest {
89
+ organizationId: string;
90
+ code: string;
91
+ redirectUri: string;
92
+ flowId: string;
93
+ }
94
+
95
+ export interface CompletePagerDutyOAuthResponse {
96
+ status: ResponseStatus | undefined;
97
+ oauthConnection: OAuthConnection | undefined;
98
+ }
99
+
100
+ export interface ListPagerDutyServicesRequest {
101
+ organizationId: string;
102
+ query: string;
103
+ limit: number;
104
+ offset: number;
105
+ }
106
+
107
+ export interface ListPagerDutyServicesResponse {
108
+ status: ResponseStatus | undefined;
109
+ services: PagerDutyService[];
110
+ more: boolean;
111
+ limit: number;
112
+ offset: number;
113
+ }
114
+
115
+ export interface PagerDutyService {
116
+ id: string;
117
+ name: string;
118
+ }
119
+
74
120
  function createBaseOAuthConnection(): OAuthConnection {
75
121
  return {
76
122
  id: "",
@@ -81,6 +127,9 @@ function createBaseOAuthConnection(): OAuthConnection {
81
127
  installedBy: "",
82
128
  createdAt: undefined,
83
129
  updatedAt: undefined,
130
+ providerAccountId: "",
131
+ providerAccountName: "",
132
+ providerRegion: "",
84
133
  };
85
134
  }
86
135
 
@@ -110,6 +159,15 @@ export const OAuthConnection: MessageFns<OAuthConnection> = {
110
159
  if (message.updatedAt !== undefined) {
111
160
  Timestamp.encode(toTimestamp(message.updatedAt), writer.uint32(66).fork()).join();
112
161
  }
162
+ if (message.providerAccountId !== "") {
163
+ writer.uint32(74).string(message.providerAccountId);
164
+ }
165
+ if (message.providerAccountName !== "") {
166
+ writer.uint32(82).string(message.providerAccountName);
167
+ }
168
+ if (message.providerRegion !== "") {
169
+ writer.uint32(90).string(message.providerRegion);
170
+ }
113
171
  return writer;
114
172
  },
115
173
 
@@ -184,6 +242,30 @@ export const OAuthConnection: MessageFns<OAuthConnection> = {
184
242
  message.updatedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
185
243
  continue;
186
244
  }
245
+ case 9: {
246
+ if (tag !== 74) {
247
+ break;
248
+ }
249
+
250
+ message.providerAccountId = reader.string();
251
+ continue;
252
+ }
253
+ case 10: {
254
+ if (tag !== 82) {
255
+ break;
256
+ }
257
+
258
+ message.providerAccountName = reader.string();
259
+ continue;
260
+ }
261
+ case 11: {
262
+ if (tag !== 90) {
263
+ break;
264
+ }
265
+
266
+ message.providerRegion = reader.string();
267
+ continue;
268
+ }
187
269
  }
188
270
  if ((tag & 7) === 4 || tag === 0) {
189
271
  break;
@@ -227,6 +309,21 @@ export const OAuthConnection: MessageFns<OAuthConnection> = {
227
309
  : isSet(object.updated_at)
228
310
  ? fromJsonTimestamp(object.updated_at)
229
311
  : undefined,
312
+ providerAccountId: isSet(object.providerAccountId)
313
+ ? globalThis.String(object.providerAccountId)
314
+ : isSet(object.provider_account_id)
315
+ ? globalThis.String(object.provider_account_id)
316
+ : "",
317
+ providerAccountName: isSet(object.providerAccountName)
318
+ ? globalThis.String(object.providerAccountName)
319
+ : isSet(object.provider_account_name)
320
+ ? globalThis.String(object.provider_account_name)
321
+ : "",
322
+ providerRegion: isSet(object.providerRegion)
323
+ ? globalThis.String(object.providerRegion)
324
+ : isSet(object.provider_region)
325
+ ? globalThis.String(object.provider_region)
326
+ : "",
230
327
  };
231
328
  },
232
329
 
@@ -256,6 +353,15 @@ export const OAuthConnection: MessageFns<OAuthConnection> = {
256
353
  if (message.updatedAt !== undefined) {
257
354
  obj.updatedAt = message.updatedAt.toISOString();
258
355
  }
356
+ if (message.providerAccountId !== "") {
357
+ obj.providerAccountId = message.providerAccountId;
358
+ }
359
+ if (message.providerAccountName !== "") {
360
+ obj.providerAccountName = message.providerAccountName;
361
+ }
362
+ if (message.providerRegion !== "") {
363
+ obj.providerRegion = message.providerRegion;
364
+ }
259
365
  return obj;
260
366
  },
261
367
 
@@ -272,6 +378,9 @@ export const OAuthConnection: MessageFns<OAuthConnection> = {
272
378
  message.installedBy = object.installedBy ?? "";
273
379
  message.createdAt = object.createdAt ?? undefined;
274
380
  message.updatedAt = object.updatedAt ?? undefined;
381
+ message.providerAccountId = object.providerAccountId ?? "";
382
+ message.providerAccountName = object.providerAccountName ?? "";
383
+ message.providerRegion = object.providerRegion ?? "";
275
384
  return message;
276
385
  },
277
386
  };
@@ -1062,52 +1171,810 @@ export const SlackChannel: MessageFns<SlackChannel> = {
1062
1171
  },
1063
1172
  };
1064
1173
 
1065
- /** OAuthGatewayService provides web client access to OAuth connection management */
1066
- export interface OAuthGatewayService {
1067
- /** InitiateSlackOAuth returns the Slack OAuth URL for the user to authorize */
1068
- InitiateSlackOAuth(request: InitiateSlackOAuthRequest, metadata?: Metadata): Promise<InitiateSlackOAuthResponse>;
1069
- /** CompleteSlackOAuth exchanges the authorization code for a bot token */
1070
- CompleteSlackOAuth(request: CompleteSlackOAuthRequest, metadata?: Metadata): Promise<CompleteSlackOAuthResponse>;
1071
- /** GetOAuthConnection returns an existing OAuth connection for an organization and provider */
1072
- GetOAuthConnection(request: GetOAuthConnectionRequest, metadata?: Metadata): Promise<GetOAuthConnectionResponse>;
1073
- /** ListSlackChannels lists available Slack channels using the stored bot token */
1074
- ListSlackChannels(request: ListSlackChannelsRequest, metadata?: Metadata): Promise<ListSlackChannelsResponse>;
1174
+ function createBaseInitiatePagerDutyOAuthRequest(): InitiatePagerDutyOAuthRequest {
1175
+ return { organizationId: "", redirectUri: "" };
1075
1176
  }
1076
1177
 
1077
- export const OAuthGatewayServiceServiceName = "gateway.web.v1.OAuthGatewayService";
1078
- export class OAuthGatewayServiceClientImpl implements OAuthGatewayService {
1079
- private readonly rpc: Rpc;
1080
- private readonly service: string;
1081
- constructor(rpc: Rpc, opts?: { service?: string }) {
1082
- this.service = opts?.service || OAuthGatewayServiceServiceName;
1083
- this.rpc = rpc;
1084
- this.InitiateSlackOAuth = this.InitiateSlackOAuth.bind(this);
1085
- this.CompleteSlackOAuth = this.CompleteSlackOAuth.bind(this);
1086
- this.GetOAuthConnection = this.GetOAuthConnection.bind(this);
1087
- this.ListSlackChannels = this.ListSlackChannels.bind(this);
1088
- }
1089
- InitiateSlackOAuth(request: InitiateSlackOAuthRequest, metadata?: Metadata): Promise<InitiateSlackOAuthResponse> {
1090
- const data = InitiateSlackOAuthRequest.encode(request).finish();
1091
- const promise = this.rpc.request(this.service, "InitiateSlackOAuth", data, metadata);
1092
- return promise.then((data) => InitiateSlackOAuthResponse.decode(new BinaryReader(data)));
1093
- }
1178
+ export const InitiatePagerDutyOAuthRequest: MessageFns<InitiatePagerDutyOAuthRequest> = {
1179
+ encode(message: InitiatePagerDutyOAuthRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1180
+ if (message.organizationId !== "") {
1181
+ writer.uint32(10).string(message.organizationId);
1182
+ }
1183
+ if (message.redirectUri !== "") {
1184
+ writer.uint32(18).string(message.redirectUri);
1185
+ }
1186
+ return writer;
1187
+ },
1094
1188
 
1095
- CompleteSlackOAuth(request: CompleteSlackOAuthRequest, metadata?: Metadata): Promise<CompleteSlackOAuthResponse> {
1096
- const data = CompleteSlackOAuthRequest.encode(request).finish();
1097
- const promise = this.rpc.request(this.service, "CompleteSlackOAuth", data, metadata);
1098
- return promise.then((data) => CompleteSlackOAuthResponse.decode(new BinaryReader(data)));
1099
- }
1189
+ decode(input: BinaryReader | Uint8Array, length?: number): InitiatePagerDutyOAuthRequest {
1190
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1191
+ const end = length === undefined ? reader.len : reader.pos + length;
1192
+ const message = createBaseInitiatePagerDutyOAuthRequest();
1193
+ while (reader.pos < end) {
1194
+ const tag = reader.uint32();
1195
+ switch (tag >>> 3) {
1196
+ case 1: {
1197
+ if (tag !== 10) {
1198
+ break;
1199
+ }
1100
1200
 
1101
- GetOAuthConnection(request: GetOAuthConnectionRequest, metadata?: Metadata): Promise<GetOAuthConnectionResponse> {
1102
- const data = GetOAuthConnectionRequest.encode(request).finish();
1103
- const promise = this.rpc.request(this.service, "GetOAuthConnection", data, metadata);
1104
- return promise.then((data) => GetOAuthConnectionResponse.decode(new BinaryReader(data)));
1105
- }
1201
+ message.organizationId = reader.string();
1202
+ continue;
1203
+ }
1204
+ case 2: {
1205
+ if (tag !== 18) {
1206
+ break;
1207
+ }
1106
1208
 
1107
- ListSlackChannels(request: ListSlackChannelsRequest, metadata?: Metadata): Promise<ListSlackChannelsResponse> {
1108
- const data = ListSlackChannelsRequest.encode(request).finish();
1109
- const promise = this.rpc.request(this.service, "ListSlackChannels", data, metadata);
1110
- return promise.then((data) => ListSlackChannelsResponse.decode(new BinaryReader(data)));
1209
+ message.redirectUri = reader.string();
1210
+ continue;
1211
+ }
1212
+ }
1213
+ if ((tag & 7) === 4 || tag === 0) {
1214
+ break;
1215
+ }
1216
+ reader.skip(tag & 7);
1217
+ }
1218
+ return message;
1219
+ },
1220
+
1221
+ fromJSON(object: any): InitiatePagerDutyOAuthRequest {
1222
+ return {
1223
+ organizationId: isSet(object.organizationId)
1224
+ ? globalThis.String(object.organizationId)
1225
+ : isSet(object.organization_id)
1226
+ ? globalThis.String(object.organization_id)
1227
+ : "",
1228
+ redirectUri: isSet(object.redirectUri)
1229
+ ? globalThis.String(object.redirectUri)
1230
+ : isSet(object.redirect_uri)
1231
+ ? globalThis.String(object.redirect_uri)
1232
+ : "",
1233
+ };
1234
+ },
1235
+
1236
+ toJSON(message: InitiatePagerDutyOAuthRequest): unknown {
1237
+ const obj: any = {};
1238
+ if (message.organizationId !== "") {
1239
+ obj.organizationId = message.organizationId;
1240
+ }
1241
+ if (message.redirectUri !== "") {
1242
+ obj.redirectUri = message.redirectUri;
1243
+ }
1244
+ return obj;
1245
+ },
1246
+
1247
+ create<I extends Exact<DeepPartial<InitiatePagerDutyOAuthRequest>, I>>(base?: I): InitiatePagerDutyOAuthRequest {
1248
+ return InitiatePagerDutyOAuthRequest.fromPartial(base ?? ({} as any));
1249
+ },
1250
+ fromPartial<I extends Exact<DeepPartial<InitiatePagerDutyOAuthRequest>, I>>(
1251
+ object: I,
1252
+ ): InitiatePagerDutyOAuthRequest {
1253
+ const message = createBaseInitiatePagerDutyOAuthRequest();
1254
+ message.organizationId = object.organizationId ?? "";
1255
+ message.redirectUri = object.redirectUri ?? "";
1256
+ return message;
1257
+ },
1258
+ };
1259
+
1260
+ function createBaseInitiatePagerDutyOAuthResponse(): InitiatePagerDutyOAuthResponse {
1261
+ return { status: undefined, oauthUrl: "", flowId: "" };
1262
+ }
1263
+
1264
+ export const InitiatePagerDutyOAuthResponse: MessageFns<InitiatePagerDutyOAuthResponse> = {
1265
+ encode(message: InitiatePagerDutyOAuthResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1266
+ if (message.status !== undefined) {
1267
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1268
+ }
1269
+ if (message.oauthUrl !== "") {
1270
+ writer.uint32(18).string(message.oauthUrl);
1271
+ }
1272
+ if (message.flowId !== "") {
1273
+ writer.uint32(26).string(message.flowId);
1274
+ }
1275
+ return writer;
1276
+ },
1277
+
1278
+ decode(input: BinaryReader | Uint8Array, length?: number): InitiatePagerDutyOAuthResponse {
1279
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1280
+ const end = length === undefined ? reader.len : reader.pos + length;
1281
+ const message = createBaseInitiatePagerDutyOAuthResponse();
1282
+ while (reader.pos < end) {
1283
+ const tag = reader.uint32();
1284
+ switch (tag >>> 3) {
1285
+ case 1: {
1286
+ if (tag !== 10) {
1287
+ break;
1288
+ }
1289
+
1290
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1291
+ continue;
1292
+ }
1293
+ case 2: {
1294
+ if (tag !== 18) {
1295
+ break;
1296
+ }
1297
+
1298
+ message.oauthUrl = reader.string();
1299
+ continue;
1300
+ }
1301
+ case 3: {
1302
+ if (tag !== 26) {
1303
+ break;
1304
+ }
1305
+
1306
+ message.flowId = reader.string();
1307
+ continue;
1308
+ }
1309
+ }
1310
+ if ((tag & 7) === 4 || tag === 0) {
1311
+ break;
1312
+ }
1313
+ reader.skip(tag & 7);
1314
+ }
1315
+ return message;
1316
+ },
1317
+
1318
+ fromJSON(object: any): InitiatePagerDutyOAuthResponse {
1319
+ return {
1320
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1321
+ oauthUrl: isSet(object.oauthUrl)
1322
+ ? globalThis.String(object.oauthUrl)
1323
+ : isSet(object.oauth_url)
1324
+ ? globalThis.String(object.oauth_url)
1325
+ : "",
1326
+ flowId: isSet(object.flowId)
1327
+ ? globalThis.String(object.flowId)
1328
+ : isSet(object.flow_id)
1329
+ ? globalThis.String(object.flow_id)
1330
+ : "",
1331
+ };
1332
+ },
1333
+
1334
+ toJSON(message: InitiatePagerDutyOAuthResponse): unknown {
1335
+ const obj: any = {};
1336
+ if (message.status !== undefined) {
1337
+ obj.status = ResponseStatus.toJSON(message.status);
1338
+ }
1339
+ if (message.oauthUrl !== "") {
1340
+ obj.oauthUrl = message.oauthUrl;
1341
+ }
1342
+ if (message.flowId !== "") {
1343
+ obj.flowId = message.flowId;
1344
+ }
1345
+ return obj;
1346
+ },
1347
+
1348
+ create<I extends Exact<DeepPartial<InitiatePagerDutyOAuthResponse>, I>>(base?: I): InitiatePagerDutyOAuthResponse {
1349
+ return InitiatePagerDutyOAuthResponse.fromPartial(base ?? ({} as any));
1350
+ },
1351
+ fromPartial<I extends Exact<DeepPartial<InitiatePagerDutyOAuthResponse>, I>>(
1352
+ object: I,
1353
+ ): InitiatePagerDutyOAuthResponse {
1354
+ const message = createBaseInitiatePagerDutyOAuthResponse();
1355
+ message.status = (object.status !== undefined && object.status !== null)
1356
+ ? ResponseStatus.fromPartial(object.status)
1357
+ : undefined;
1358
+ message.oauthUrl = object.oauthUrl ?? "";
1359
+ message.flowId = object.flowId ?? "";
1360
+ return message;
1361
+ },
1362
+ };
1363
+
1364
+ function createBaseCompletePagerDutyOAuthRequest(): CompletePagerDutyOAuthRequest {
1365
+ return { organizationId: "", code: "", redirectUri: "", flowId: "" };
1366
+ }
1367
+
1368
+ export const CompletePagerDutyOAuthRequest: MessageFns<CompletePagerDutyOAuthRequest> = {
1369
+ encode(message: CompletePagerDutyOAuthRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1370
+ if (message.organizationId !== "") {
1371
+ writer.uint32(10).string(message.organizationId);
1372
+ }
1373
+ if (message.code !== "") {
1374
+ writer.uint32(18).string(message.code);
1375
+ }
1376
+ if (message.redirectUri !== "") {
1377
+ writer.uint32(26).string(message.redirectUri);
1378
+ }
1379
+ if (message.flowId !== "") {
1380
+ writer.uint32(34).string(message.flowId);
1381
+ }
1382
+ return writer;
1383
+ },
1384
+
1385
+ decode(input: BinaryReader | Uint8Array, length?: number): CompletePagerDutyOAuthRequest {
1386
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1387
+ const end = length === undefined ? reader.len : reader.pos + length;
1388
+ const message = createBaseCompletePagerDutyOAuthRequest();
1389
+ while (reader.pos < end) {
1390
+ const tag = reader.uint32();
1391
+ switch (tag >>> 3) {
1392
+ case 1: {
1393
+ if (tag !== 10) {
1394
+ break;
1395
+ }
1396
+
1397
+ message.organizationId = reader.string();
1398
+ continue;
1399
+ }
1400
+ case 2: {
1401
+ if (tag !== 18) {
1402
+ break;
1403
+ }
1404
+
1405
+ message.code = reader.string();
1406
+ continue;
1407
+ }
1408
+ case 3: {
1409
+ if (tag !== 26) {
1410
+ break;
1411
+ }
1412
+
1413
+ message.redirectUri = reader.string();
1414
+ continue;
1415
+ }
1416
+ case 4: {
1417
+ if (tag !== 34) {
1418
+ break;
1419
+ }
1420
+
1421
+ message.flowId = reader.string();
1422
+ continue;
1423
+ }
1424
+ }
1425
+ if ((tag & 7) === 4 || tag === 0) {
1426
+ break;
1427
+ }
1428
+ reader.skip(tag & 7);
1429
+ }
1430
+ return message;
1431
+ },
1432
+
1433
+ fromJSON(object: any): CompletePagerDutyOAuthRequest {
1434
+ return {
1435
+ organizationId: isSet(object.organizationId)
1436
+ ? globalThis.String(object.organizationId)
1437
+ : isSet(object.organization_id)
1438
+ ? globalThis.String(object.organization_id)
1439
+ : "",
1440
+ code: isSet(object.code) ? globalThis.String(object.code) : "",
1441
+ redirectUri: isSet(object.redirectUri)
1442
+ ? globalThis.String(object.redirectUri)
1443
+ : isSet(object.redirect_uri)
1444
+ ? globalThis.String(object.redirect_uri)
1445
+ : "",
1446
+ flowId: isSet(object.flowId)
1447
+ ? globalThis.String(object.flowId)
1448
+ : isSet(object.flow_id)
1449
+ ? globalThis.String(object.flow_id)
1450
+ : "",
1451
+ };
1452
+ },
1453
+
1454
+ toJSON(message: CompletePagerDutyOAuthRequest): unknown {
1455
+ const obj: any = {};
1456
+ if (message.organizationId !== "") {
1457
+ obj.organizationId = message.organizationId;
1458
+ }
1459
+ if (message.code !== "") {
1460
+ obj.code = message.code;
1461
+ }
1462
+ if (message.redirectUri !== "") {
1463
+ obj.redirectUri = message.redirectUri;
1464
+ }
1465
+ if (message.flowId !== "") {
1466
+ obj.flowId = message.flowId;
1467
+ }
1468
+ return obj;
1469
+ },
1470
+
1471
+ create<I extends Exact<DeepPartial<CompletePagerDutyOAuthRequest>, I>>(base?: I): CompletePagerDutyOAuthRequest {
1472
+ return CompletePagerDutyOAuthRequest.fromPartial(base ?? ({} as any));
1473
+ },
1474
+ fromPartial<I extends Exact<DeepPartial<CompletePagerDutyOAuthRequest>, I>>(
1475
+ object: I,
1476
+ ): CompletePagerDutyOAuthRequest {
1477
+ const message = createBaseCompletePagerDutyOAuthRequest();
1478
+ message.organizationId = object.organizationId ?? "";
1479
+ message.code = object.code ?? "";
1480
+ message.redirectUri = object.redirectUri ?? "";
1481
+ message.flowId = object.flowId ?? "";
1482
+ return message;
1483
+ },
1484
+ };
1485
+
1486
+ function createBaseCompletePagerDutyOAuthResponse(): CompletePagerDutyOAuthResponse {
1487
+ return { status: undefined, oauthConnection: undefined };
1488
+ }
1489
+
1490
+ export const CompletePagerDutyOAuthResponse: MessageFns<CompletePagerDutyOAuthResponse> = {
1491
+ encode(message: CompletePagerDutyOAuthResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1492
+ if (message.status !== undefined) {
1493
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1494
+ }
1495
+ if (message.oauthConnection !== undefined) {
1496
+ OAuthConnection.encode(message.oauthConnection, writer.uint32(18).fork()).join();
1497
+ }
1498
+ return writer;
1499
+ },
1500
+
1501
+ decode(input: BinaryReader | Uint8Array, length?: number): CompletePagerDutyOAuthResponse {
1502
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1503
+ const end = length === undefined ? reader.len : reader.pos + length;
1504
+ const message = createBaseCompletePagerDutyOAuthResponse();
1505
+ while (reader.pos < end) {
1506
+ const tag = reader.uint32();
1507
+ switch (tag >>> 3) {
1508
+ case 1: {
1509
+ if (tag !== 10) {
1510
+ break;
1511
+ }
1512
+
1513
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1514
+ continue;
1515
+ }
1516
+ case 2: {
1517
+ if (tag !== 18) {
1518
+ break;
1519
+ }
1520
+
1521
+ message.oauthConnection = OAuthConnection.decode(reader, reader.uint32());
1522
+ continue;
1523
+ }
1524
+ }
1525
+ if ((tag & 7) === 4 || tag === 0) {
1526
+ break;
1527
+ }
1528
+ reader.skip(tag & 7);
1529
+ }
1530
+ return message;
1531
+ },
1532
+
1533
+ fromJSON(object: any): CompletePagerDutyOAuthResponse {
1534
+ return {
1535
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1536
+ oauthConnection: isSet(object.oauthConnection)
1537
+ ? OAuthConnection.fromJSON(object.oauthConnection)
1538
+ : isSet(object.oauth_connection)
1539
+ ? OAuthConnection.fromJSON(object.oauth_connection)
1540
+ : undefined,
1541
+ };
1542
+ },
1543
+
1544
+ toJSON(message: CompletePagerDutyOAuthResponse): unknown {
1545
+ const obj: any = {};
1546
+ if (message.status !== undefined) {
1547
+ obj.status = ResponseStatus.toJSON(message.status);
1548
+ }
1549
+ if (message.oauthConnection !== undefined) {
1550
+ obj.oauthConnection = OAuthConnection.toJSON(message.oauthConnection);
1551
+ }
1552
+ return obj;
1553
+ },
1554
+
1555
+ create<I extends Exact<DeepPartial<CompletePagerDutyOAuthResponse>, I>>(base?: I): CompletePagerDutyOAuthResponse {
1556
+ return CompletePagerDutyOAuthResponse.fromPartial(base ?? ({} as any));
1557
+ },
1558
+ fromPartial<I extends Exact<DeepPartial<CompletePagerDutyOAuthResponse>, I>>(
1559
+ object: I,
1560
+ ): CompletePagerDutyOAuthResponse {
1561
+ const message = createBaseCompletePagerDutyOAuthResponse();
1562
+ message.status = (object.status !== undefined && object.status !== null)
1563
+ ? ResponseStatus.fromPartial(object.status)
1564
+ : undefined;
1565
+ message.oauthConnection = (object.oauthConnection !== undefined && object.oauthConnection !== null)
1566
+ ? OAuthConnection.fromPartial(object.oauthConnection)
1567
+ : undefined;
1568
+ return message;
1569
+ },
1570
+ };
1571
+
1572
+ function createBaseListPagerDutyServicesRequest(): ListPagerDutyServicesRequest {
1573
+ return { organizationId: "", query: "", limit: 0, offset: 0 };
1574
+ }
1575
+
1576
+ export const ListPagerDutyServicesRequest: MessageFns<ListPagerDutyServicesRequest> = {
1577
+ encode(message: ListPagerDutyServicesRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1578
+ if (message.organizationId !== "") {
1579
+ writer.uint32(10).string(message.organizationId);
1580
+ }
1581
+ if (message.query !== "") {
1582
+ writer.uint32(18).string(message.query);
1583
+ }
1584
+ if (message.limit !== 0) {
1585
+ writer.uint32(24).int32(message.limit);
1586
+ }
1587
+ if (message.offset !== 0) {
1588
+ writer.uint32(32).int32(message.offset);
1589
+ }
1590
+ return writer;
1591
+ },
1592
+
1593
+ decode(input: BinaryReader | Uint8Array, length?: number): ListPagerDutyServicesRequest {
1594
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1595
+ const end = length === undefined ? reader.len : reader.pos + length;
1596
+ const message = createBaseListPagerDutyServicesRequest();
1597
+ while (reader.pos < end) {
1598
+ const tag = reader.uint32();
1599
+ switch (tag >>> 3) {
1600
+ case 1: {
1601
+ if (tag !== 10) {
1602
+ break;
1603
+ }
1604
+
1605
+ message.organizationId = reader.string();
1606
+ continue;
1607
+ }
1608
+ case 2: {
1609
+ if (tag !== 18) {
1610
+ break;
1611
+ }
1612
+
1613
+ message.query = reader.string();
1614
+ continue;
1615
+ }
1616
+ case 3: {
1617
+ if (tag !== 24) {
1618
+ break;
1619
+ }
1620
+
1621
+ message.limit = reader.int32();
1622
+ continue;
1623
+ }
1624
+ case 4: {
1625
+ if (tag !== 32) {
1626
+ break;
1627
+ }
1628
+
1629
+ message.offset = reader.int32();
1630
+ continue;
1631
+ }
1632
+ }
1633
+ if ((tag & 7) === 4 || tag === 0) {
1634
+ break;
1635
+ }
1636
+ reader.skip(tag & 7);
1637
+ }
1638
+ return message;
1639
+ },
1640
+
1641
+ fromJSON(object: any): ListPagerDutyServicesRequest {
1642
+ return {
1643
+ organizationId: isSet(object.organizationId)
1644
+ ? globalThis.String(object.organizationId)
1645
+ : isSet(object.organization_id)
1646
+ ? globalThis.String(object.organization_id)
1647
+ : "",
1648
+ query: isSet(object.query) ? globalThis.String(object.query) : "",
1649
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
1650
+ offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
1651
+ };
1652
+ },
1653
+
1654
+ toJSON(message: ListPagerDutyServicesRequest): unknown {
1655
+ const obj: any = {};
1656
+ if (message.organizationId !== "") {
1657
+ obj.organizationId = message.organizationId;
1658
+ }
1659
+ if (message.query !== "") {
1660
+ obj.query = message.query;
1661
+ }
1662
+ if (message.limit !== 0) {
1663
+ obj.limit = Math.round(message.limit);
1664
+ }
1665
+ if (message.offset !== 0) {
1666
+ obj.offset = Math.round(message.offset);
1667
+ }
1668
+ return obj;
1669
+ },
1670
+
1671
+ create<I extends Exact<DeepPartial<ListPagerDutyServicesRequest>, I>>(base?: I): ListPagerDutyServicesRequest {
1672
+ return ListPagerDutyServicesRequest.fromPartial(base ?? ({} as any));
1673
+ },
1674
+ fromPartial<I extends Exact<DeepPartial<ListPagerDutyServicesRequest>, I>>(object: I): ListPagerDutyServicesRequest {
1675
+ const message = createBaseListPagerDutyServicesRequest();
1676
+ message.organizationId = object.organizationId ?? "";
1677
+ message.query = object.query ?? "";
1678
+ message.limit = object.limit ?? 0;
1679
+ message.offset = object.offset ?? 0;
1680
+ return message;
1681
+ },
1682
+ };
1683
+
1684
+ function createBaseListPagerDutyServicesResponse(): ListPagerDutyServicesResponse {
1685
+ return { status: undefined, services: [], more: false, limit: 0, offset: 0 };
1686
+ }
1687
+
1688
+ export const ListPagerDutyServicesResponse: MessageFns<ListPagerDutyServicesResponse> = {
1689
+ encode(message: ListPagerDutyServicesResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1690
+ if (message.status !== undefined) {
1691
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
1692
+ }
1693
+ for (const v of message.services) {
1694
+ PagerDutyService.encode(v!, writer.uint32(18).fork()).join();
1695
+ }
1696
+ if (message.more !== false) {
1697
+ writer.uint32(24).bool(message.more);
1698
+ }
1699
+ if (message.limit !== 0) {
1700
+ writer.uint32(32).int32(message.limit);
1701
+ }
1702
+ if (message.offset !== 0) {
1703
+ writer.uint32(40).int32(message.offset);
1704
+ }
1705
+ return writer;
1706
+ },
1707
+
1708
+ decode(input: BinaryReader | Uint8Array, length?: number): ListPagerDutyServicesResponse {
1709
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1710
+ const end = length === undefined ? reader.len : reader.pos + length;
1711
+ const message = createBaseListPagerDutyServicesResponse();
1712
+ while (reader.pos < end) {
1713
+ const tag = reader.uint32();
1714
+ switch (tag >>> 3) {
1715
+ case 1: {
1716
+ if (tag !== 10) {
1717
+ break;
1718
+ }
1719
+
1720
+ message.status = ResponseStatus.decode(reader, reader.uint32());
1721
+ continue;
1722
+ }
1723
+ case 2: {
1724
+ if (tag !== 18) {
1725
+ break;
1726
+ }
1727
+
1728
+ message.services.push(PagerDutyService.decode(reader, reader.uint32()));
1729
+ continue;
1730
+ }
1731
+ case 3: {
1732
+ if (tag !== 24) {
1733
+ break;
1734
+ }
1735
+
1736
+ message.more = reader.bool();
1737
+ continue;
1738
+ }
1739
+ case 4: {
1740
+ if (tag !== 32) {
1741
+ break;
1742
+ }
1743
+
1744
+ message.limit = reader.int32();
1745
+ continue;
1746
+ }
1747
+ case 5: {
1748
+ if (tag !== 40) {
1749
+ break;
1750
+ }
1751
+
1752
+ message.offset = reader.int32();
1753
+ continue;
1754
+ }
1755
+ }
1756
+ if ((tag & 7) === 4 || tag === 0) {
1757
+ break;
1758
+ }
1759
+ reader.skip(tag & 7);
1760
+ }
1761
+ return message;
1762
+ },
1763
+
1764
+ fromJSON(object: any): ListPagerDutyServicesResponse {
1765
+ return {
1766
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
1767
+ services: globalThis.Array.isArray(object?.services)
1768
+ ? object.services.map((e: any) => PagerDutyService.fromJSON(e))
1769
+ : [],
1770
+ more: isSet(object.more) ? globalThis.Boolean(object.more) : false,
1771
+ limit: isSet(object.limit) ? globalThis.Number(object.limit) : 0,
1772
+ offset: isSet(object.offset) ? globalThis.Number(object.offset) : 0,
1773
+ };
1774
+ },
1775
+
1776
+ toJSON(message: ListPagerDutyServicesResponse): unknown {
1777
+ const obj: any = {};
1778
+ if (message.status !== undefined) {
1779
+ obj.status = ResponseStatus.toJSON(message.status);
1780
+ }
1781
+ if (message.services?.length) {
1782
+ obj.services = message.services.map((e) => PagerDutyService.toJSON(e));
1783
+ }
1784
+ if (message.more !== false) {
1785
+ obj.more = message.more;
1786
+ }
1787
+ if (message.limit !== 0) {
1788
+ obj.limit = Math.round(message.limit);
1789
+ }
1790
+ if (message.offset !== 0) {
1791
+ obj.offset = Math.round(message.offset);
1792
+ }
1793
+ return obj;
1794
+ },
1795
+
1796
+ create<I extends Exact<DeepPartial<ListPagerDutyServicesResponse>, I>>(base?: I): ListPagerDutyServicesResponse {
1797
+ return ListPagerDutyServicesResponse.fromPartial(base ?? ({} as any));
1798
+ },
1799
+ fromPartial<I extends Exact<DeepPartial<ListPagerDutyServicesResponse>, I>>(
1800
+ object: I,
1801
+ ): ListPagerDutyServicesResponse {
1802
+ const message = createBaseListPagerDutyServicesResponse();
1803
+ message.status = (object.status !== undefined && object.status !== null)
1804
+ ? ResponseStatus.fromPartial(object.status)
1805
+ : undefined;
1806
+ message.services = object.services?.map((e) => PagerDutyService.fromPartial(e)) || [];
1807
+ message.more = object.more ?? false;
1808
+ message.limit = object.limit ?? 0;
1809
+ message.offset = object.offset ?? 0;
1810
+ return message;
1811
+ },
1812
+ };
1813
+
1814
+ function createBasePagerDutyService(): PagerDutyService {
1815
+ return { id: "", name: "" };
1816
+ }
1817
+
1818
+ export const PagerDutyService: MessageFns<PagerDutyService> = {
1819
+ encode(message: PagerDutyService, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
1820
+ if (message.id !== "") {
1821
+ writer.uint32(10).string(message.id);
1822
+ }
1823
+ if (message.name !== "") {
1824
+ writer.uint32(18).string(message.name);
1825
+ }
1826
+ return writer;
1827
+ },
1828
+
1829
+ decode(input: BinaryReader | Uint8Array, length?: number): PagerDutyService {
1830
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
1831
+ const end = length === undefined ? reader.len : reader.pos + length;
1832
+ const message = createBasePagerDutyService();
1833
+ while (reader.pos < end) {
1834
+ const tag = reader.uint32();
1835
+ switch (tag >>> 3) {
1836
+ case 1: {
1837
+ if (tag !== 10) {
1838
+ break;
1839
+ }
1840
+
1841
+ message.id = reader.string();
1842
+ continue;
1843
+ }
1844
+ case 2: {
1845
+ if (tag !== 18) {
1846
+ break;
1847
+ }
1848
+
1849
+ message.name = reader.string();
1850
+ continue;
1851
+ }
1852
+ }
1853
+ if ((tag & 7) === 4 || tag === 0) {
1854
+ break;
1855
+ }
1856
+ reader.skip(tag & 7);
1857
+ }
1858
+ return message;
1859
+ },
1860
+
1861
+ fromJSON(object: any): PagerDutyService {
1862
+ return {
1863
+ id: isSet(object.id) ? globalThis.String(object.id) : "",
1864
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
1865
+ };
1866
+ },
1867
+
1868
+ toJSON(message: PagerDutyService): unknown {
1869
+ const obj: any = {};
1870
+ if (message.id !== "") {
1871
+ obj.id = message.id;
1872
+ }
1873
+ if (message.name !== "") {
1874
+ obj.name = message.name;
1875
+ }
1876
+ return obj;
1877
+ },
1878
+
1879
+ create<I extends Exact<DeepPartial<PagerDutyService>, I>>(base?: I): PagerDutyService {
1880
+ return PagerDutyService.fromPartial(base ?? ({} as any));
1881
+ },
1882
+ fromPartial<I extends Exact<DeepPartial<PagerDutyService>, I>>(object: I): PagerDutyService {
1883
+ const message = createBasePagerDutyService();
1884
+ message.id = object.id ?? "";
1885
+ message.name = object.name ?? "";
1886
+ return message;
1887
+ },
1888
+ };
1889
+
1890
+ /** OAuthGatewayService provides web client access to OAuth connection management */
1891
+ export interface OAuthGatewayService {
1892
+ /** InitiateSlackOAuth returns the Slack OAuth URL for the user to authorize */
1893
+ InitiateSlackOAuth(request: InitiateSlackOAuthRequest, metadata?: Metadata): Promise<InitiateSlackOAuthResponse>;
1894
+ /** CompleteSlackOAuth exchanges the authorization code for a bot token */
1895
+ CompleteSlackOAuth(request: CompleteSlackOAuthRequest, metadata?: Metadata): Promise<CompleteSlackOAuthResponse>;
1896
+ /** GetOAuthConnection returns an existing OAuth connection for an organization and provider */
1897
+ GetOAuthConnection(request: GetOAuthConnectionRequest, metadata?: Metadata): Promise<GetOAuthConnectionResponse>;
1898
+ /** ListSlackChannels lists available Slack channels using the stored bot token */
1899
+ ListSlackChannels(request: ListSlackChannelsRequest, metadata?: Metadata): Promise<ListSlackChannelsResponse>;
1900
+ InitiatePagerDutyOAuth(
1901
+ request: InitiatePagerDutyOAuthRequest,
1902
+ metadata?: Metadata,
1903
+ ): Promise<InitiatePagerDutyOAuthResponse>;
1904
+ CompletePagerDutyOAuth(
1905
+ request: CompletePagerDutyOAuthRequest,
1906
+ metadata?: Metadata,
1907
+ ): Promise<CompletePagerDutyOAuthResponse>;
1908
+ ListPagerDutyServices(
1909
+ request: ListPagerDutyServicesRequest,
1910
+ metadata?: Metadata,
1911
+ ): Promise<ListPagerDutyServicesResponse>;
1912
+ }
1913
+
1914
+ export const OAuthGatewayServiceServiceName = "gateway.web.v1.OAuthGatewayService";
1915
+ export class OAuthGatewayServiceClientImpl implements OAuthGatewayService {
1916
+ private readonly rpc: Rpc;
1917
+ private readonly service: string;
1918
+ constructor(rpc: Rpc, opts?: { service?: string }) {
1919
+ this.service = opts?.service || OAuthGatewayServiceServiceName;
1920
+ this.rpc = rpc;
1921
+ this.InitiateSlackOAuth = this.InitiateSlackOAuth.bind(this);
1922
+ this.CompleteSlackOAuth = this.CompleteSlackOAuth.bind(this);
1923
+ this.GetOAuthConnection = this.GetOAuthConnection.bind(this);
1924
+ this.ListSlackChannels = this.ListSlackChannels.bind(this);
1925
+ this.InitiatePagerDutyOAuth = this.InitiatePagerDutyOAuth.bind(this);
1926
+ this.CompletePagerDutyOAuth = this.CompletePagerDutyOAuth.bind(this);
1927
+ this.ListPagerDutyServices = this.ListPagerDutyServices.bind(this);
1928
+ }
1929
+ InitiateSlackOAuth(request: InitiateSlackOAuthRequest, metadata?: Metadata): Promise<InitiateSlackOAuthResponse> {
1930
+ const data = InitiateSlackOAuthRequest.encode(request).finish();
1931
+ const promise = this.rpc.request(this.service, "InitiateSlackOAuth", data, metadata);
1932
+ return promise.then((data) => InitiateSlackOAuthResponse.decode(new BinaryReader(data)));
1933
+ }
1934
+
1935
+ CompleteSlackOAuth(request: CompleteSlackOAuthRequest, metadata?: Metadata): Promise<CompleteSlackOAuthResponse> {
1936
+ const data = CompleteSlackOAuthRequest.encode(request).finish();
1937
+ const promise = this.rpc.request(this.service, "CompleteSlackOAuth", data, metadata);
1938
+ return promise.then((data) => CompleteSlackOAuthResponse.decode(new BinaryReader(data)));
1939
+ }
1940
+
1941
+ GetOAuthConnection(request: GetOAuthConnectionRequest, metadata?: Metadata): Promise<GetOAuthConnectionResponse> {
1942
+ const data = GetOAuthConnectionRequest.encode(request).finish();
1943
+ const promise = this.rpc.request(this.service, "GetOAuthConnection", data, metadata);
1944
+ return promise.then((data) => GetOAuthConnectionResponse.decode(new BinaryReader(data)));
1945
+ }
1946
+
1947
+ ListSlackChannels(request: ListSlackChannelsRequest, metadata?: Metadata): Promise<ListSlackChannelsResponse> {
1948
+ const data = ListSlackChannelsRequest.encode(request).finish();
1949
+ const promise = this.rpc.request(this.service, "ListSlackChannels", data, metadata);
1950
+ return promise.then((data) => ListSlackChannelsResponse.decode(new BinaryReader(data)));
1951
+ }
1952
+
1953
+ InitiatePagerDutyOAuth(
1954
+ request: InitiatePagerDutyOAuthRequest,
1955
+ metadata?: Metadata,
1956
+ ): Promise<InitiatePagerDutyOAuthResponse> {
1957
+ const data = InitiatePagerDutyOAuthRequest.encode(request).finish();
1958
+ const promise = this.rpc.request(this.service, "InitiatePagerDutyOAuth", data, metadata);
1959
+ return promise.then((data) => InitiatePagerDutyOAuthResponse.decode(new BinaryReader(data)));
1960
+ }
1961
+
1962
+ CompletePagerDutyOAuth(
1963
+ request: CompletePagerDutyOAuthRequest,
1964
+ metadata?: Metadata,
1965
+ ): Promise<CompletePagerDutyOAuthResponse> {
1966
+ const data = CompletePagerDutyOAuthRequest.encode(request).finish();
1967
+ const promise = this.rpc.request(this.service, "CompletePagerDutyOAuth", data, metadata);
1968
+ return promise.then((data) => CompletePagerDutyOAuthResponse.decode(new BinaryReader(data)));
1969
+ }
1970
+
1971
+ ListPagerDutyServices(
1972
+ request: ListPagerDutyServicesRequest,
1973
+ metadata?: Metadata,
1974
+ ): Promise<ListPagerDutyServicesResponse> {
1975
+ const data = ListPagerDutyServicesRequest.encode(request).finish();
1976
+ const promise = this.rpc.request(this.service, "ListPagerDutyServices", data, metadata);
1977
+ return promise.then((data) => ListPagerDutyServicesResponse.decode(new BinaryReader(data)));
1111
1978
  }
1112
1979
  }
1113
1980