@miradorlabs/web-grpc 3.45.0 → 3.46.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.
@@ -119,6 +119,42 @@ export interface PagerDutyService {
119
119
  name: string;
120
120
  }
121
121
 
122
+ export interface InitiateLinearOAuthRequest {
123
+ organizationId: string;
124
+ redirectUri: string;
125
+ }
126
+
127
+ export interface InitiateLinearOAuthResponse {
128
+ status: ResponseStatus | undefined;
129
+ oauthUrl: string;
130
+ flowId: string;
131
+ }
132
+
133
+ export interface CompleteLinearOAuthRequest {
134
+ organizationId: string;
135
+ code: string;
136
+ /** The redirect_uri InitiateLinearOAuth was given. */
137
+ redirectUri: string;
138
+ flowId: string;
139
+ }
140
+
141
+ export interface CompleteLinearOAuthResponse {
142
+ status: ResponseStatus | undefined;
143
+ oauthConnection: OAuthConnection | undefined;
144
+ }
145
+
146
+ export interface DisconnectLinearRequest {
147
+ organizationId: string;
148
+ }
149
+
150
+ export interface DisconnectLinearResponse {
151
+ status:
152
+ | ResponseStatus
153
+ | undefined;
154
+ /** False when there was no connection to delete. */
155
+ deleted: boolean;
156
+ }
157
+
122
158
  function createBaseOAuthConnection(): OAuthConnection {
123
159
  return {
124
160
  id: "",
@@ -2042,94 +2078,713 @@ export const PagerDutyService: MessageFns<PagerDutyService> = {
2042
2078
  },
2043
2079
  };
2044
2080
 
2045
- /** OAuthGatewayService provides web client access to OAuth connection management */
2046
- export interface OAuthGatewayService {
2047
- /** InitiateSlackOAuth returns the Slack OAuth URL for the user to authorize */
2048
- InitiateSlackOAuth(request: InitiateSlackOAuthRequest, metadata?: Metadata): Promise<InitiateSlackOAuthResponse>;
2049
- /** CompleteSlackOAuth exchanges the authorization code for a bot token */
2050
- CompleteSlackOAuth(request: CompleteSlackOAuthRequest, metadata?: Metadata): Promise<CompleteSlackOAuthResponse>;
2051
- /** GetOAuthConnection returns an existing OAuth connection for an organization and provider */
2052
- GetOAuthConnection(request: GetOAuthConnectionRequest, metadata?: Metadata): Promise<GetOAuthConnectionResponse>;
2053
- /** ListSlackChannels lists available Slack channels using the stored bot token */
2054
- ListSlackChannels(request: ListSlackChannelsRequest, metadata?: Metadata): Promise<ListSlackChannelsResponse>;
2055
- InitiatePagerDutyOAuth(
2056
- request: InitiatePagerDutyOAuthRequest,
2057
- metadata?: Metadata,
2058
- ): Promise<InitiatePagerDutyOAuthResponse>;
2059
- CompletePagerDutyOAuth(
2060
- request: CompletePagerDutyOAuthRequest,
2061
- metadata?: Metadata,
2062
- ): Promise<CompletePagerDutyOAuthResponse>;
2063
- ListPagerDutyServices(
2064
- request: ListPagerDutyServicesRequest,
2065
- metadata?: Metadata,
2066
- ): Promise<ListPagerDutyServicesResponse>;
2081
+ function createBaseInitiateLinearOAuthRequest(): InitiateLinearOAuthRequest {
2082
+ return { organizationId: "", redirectUri: "" };
2067
2083
  }
2068
2084
 
2069
- export const OAuthGatewayServiceServiceName = "gateway.web.v1.OAuthGatewayService";
2070
- export class OAuthGatewayServiceClientImpl implements OAuthGatewayService {
2071
- private readonly rpc: Rpc;
2072
- private readonly service: string;
2073
- constructor(rpc: Rpc, opts?: { service?: string }) {
2074
- this.service = opts?.service || OAuthGatewayServiceServiceName;
2075
- this.rpc = rpc;
2076
- this.InitiateSlackOAuth = this.InitiateSlackOAuth.bind(this);
2077
- this.CompleteSlackOAuth = this.CompleteSlackOAuth.bind(this);
2078
- this.GetOAuthConnection = this.GetOAuthConnection.bind(this);
2079
- this.ListSlackChannels = this.ListSlackChannels.bind(this);
2080
- this.InitiatePagerDutyOAuth = this.InitiatePagerDutyOAuth.bind(this);
2081
- this.CompletePagerDutyOAuth = this.CompletePagerDutyOAuth.bind(this);
2082
- this.ListPagerDutyServices = this.ListPagerDutyServices.bind(this);
2083
- }
2084
- InitiateSlackOAuth(request: InitiateSlackOAuthRequest, metadata?: Metadata): Promise<InitiateSlackOAuthResponse> {
2085
- const data = InitiateSlackOAuthRequest.encode(request).finish();
2086
- const promise = this.rpc.request(this.service, "InitiateSlackOAuth", data, metadata);
2087
- return promise.then((data) => InitiateSlackOAuthResponse.decode(new BinaryReader(data)));
2088
- }
2085
+ export const InitiateLinearOAuthRequest: MessageFns<InitiateLinearOAuthRequest> = {
2086
+ encode(message: InitiateLinearOAuthRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2087
+ if (message.organizationId !== "") {
2088
+ writer.uint32(10).string(message.organizationId);
2089
+ }
2090
+ if (message.redirectUri !== "") {
2091
+ writer.uint32(18).string(message.redirectUri);
2092
+ }
2093
+ return writer;
2094
+ },
2089
2095
 
2090
- CompleteSlackOAuth(request: CompleteSlackOAuthRequest, metadata?: Metadata): Promise<CompleteSlackOAuthResponse> {
2091
- const data = CompleteSlackOAuthRequest.encode(request).finish();
2092
- const promise = this.rpc.request(this.service, "CompleteSlackOAuth", data, metadata);
2093
- return promise.then((data) => CompleteSlackOAuthResponse.decode(new BinaryReader(data)));
2094
- }
2096
+ decode(input: BinaryReader | Uint8Array, length?: number): InitiateLinearOAuthRequest {
2097
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2098
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2099
+ if (previousRecursionDepth >= 100) {
2100
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2101
+ }
2102
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2103
+ try {
2104
+ const end = length === undefined ? reader.len : reader.pos + length;
2105
+ const message = createBaseInitiateLinearOAuthRequest();
2106
+ while (reader.pos < end) {
2107
+ const tag = reader.uint32();
2108
+ switch (tag >>> 3) {
2109
+ case 1: {
2110
+ if (tag !== 10) {
2111
+ break;
2112
+ }
2095
2113
 
2096
- GetOAuthConnection(request: GetOAuthConnectionRequest, metadata?: Metadata): Promise<GetOAuthConnectionResponse> {
2097
- const data = GetOAuthConnectionRequest.encode(request).finish();
2098
- const promise = this.rpc.request(this.service, "GetOAuthConnection", data, metadata);
2099
- return promise.then((data) => GetOAuthConnectionResponse.decode(new BinaryReader(data)));
2100
- }
2114
+ message.organizationId = reader.string();
2115
+ continue;
2116
+ }
2117
+ case 2: {
2118
+ if (tag !== 18) {
2119
+ break;
2120
+ }
2101
2121
 
2102
- ListSlackChannels(request: ListSlackChannelsRequest, metadata?: Metadata): Promise<ListSlackChannelsResponse> {
2103
- const data = ListSlackChannelsRequest.encode(request).finish();
2104
- const promise = this.rpc.request(this.service, "ListSlackChannels", data, metadata);
2105
- return promise.then((data) => ListSlackChannelsResponse.decode(new BinaryReader(data)));
2106
- }
2122
+ message.redirectUri = reader.string();
2123
+ continue;
2124
+ }
2125
+ }
2126
+ if ((tag & 7) === 4 || tag === 0) {
2127
+ break;
2128
+ }
2129
+ reader.skip(tag & 7);
2130
+ }
2131
+ return message;
2132
+ } finally {
2133
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2134
+ }
2135
+ },
2107
2136
 
2108
- InitiatePagerDutyOAuth(
2109
- request: InitiatePagerDutyOAuthRequest,
2110
- metadata?: Metadata,
2111
- ): Promise<InitiatePagerDutyOAuthResponse> {
2112
- const data = InitiatePagerDutyOAuthRequest.encode(request).finish();
2113
- const promise = this.rpc.request(this.service, "InitiatePagerDutyOAuth", data, metadata);
2114
- return promise.then((data) => InitiatePagerDutyOAuthResponse.decode(new BinaryReader(data)));
2115
- }
2137
+ fromJSON(object: any): InitiateLinearOAuthRequest {
2138
+ return {
2139
+ organizationId: isSet(object.organizationId)
2140
+ ? globalThis.String(object.organizationId)
2141
+ : isSet(object.organization_id)
2142
+ ? globalThis.String(object.organization_id)
2143
+ : "",
2144
+ redirectUri: isSet(object.redirectUri)
2145
+ ? globalThis.String(object.redirectUri)
2146
+ : isSet(object.redirect_uri)
2147
+ ? globalThis.String(object.redirect_uri)
2148
+ : "",
2149
+ };
2150
+ },
2116
2151
 
2117
- CompletePagerDutyOAuth(
2118
- request: CompletePagerDutyOAuthRequest,
2119
- metadata?: Metadata,
2120
- ): Promise<CompletePagerDutyOAuthResponse> {
2121
- const data = CompletePagerDutyOAuthRequest.encode(request).finish();
2122
- const promise = this.rpc.request(this.service, "CompletePagerDutyOAuth", data, metadata);
2123
- return promise.then((data) => CompletePagerDutyOAuthResponse.decode(new BinaryReader(data)));
2124
- }
2152
+ toJSON(message: InitiateLinearOAuthRequest): unknown {
2153
+ const obj: any = {};
2154
+ if (message.organizationId !== "") {
2155
+ obj.organizationId = message.organizationId;
2156
+ }
2157
+ if (message.redirectUri !== "") {
2158
+ obj.redirectUri = message.redirectUri;
2159
+ }
2160
+ return obj;
2161
+ },
2125
2162
 
2126
- ListPagerDutyServices(
2127
- request: ListPagerDutyServicesRequest,
2128
- metadata?: Metadata,
2129
- ): Promise<ListPagerDutyServicesResponse> {
2130
- const data = ListPagerDutyServicesRequest.encode(request).finish();
2131
- const promise = this.rpc.request(this.service, "ListPagerDutyServices", data, metadata);
2132
- return promise.then((data) => ListPagerDutyServicesResponse.decode(new BinaryReader(data)));
2163
+ create<I extends Exact<DeepPartial<InitiateLinearOAuthRequest>, I>>(base?: I): InitiateLinearOAuthRequest {
2164
+ return InitiateLinearOAuthRequest.fromPartial(base ?? ({} as any));
2165
+ },
2166
+ fromPartial<I extends Exact<DeepPartial<InitiateLinearOAuthRequest>, I>>(object: I): InitiateLinearOAuthRequest {
2167
+ const message = createBaseInitiateLinearOAuthRequest();
2168
+ message.organizationId = object.organizationId ?? "";
2169
+ message.redirectUri = object.redirectUri ?? "";
2170
+ return message;
2171
+ },
2172
+ };
2173
+
2174
+ function createBaseInitiateLinearOAuthResponse(): InitiateLinearOAuthResponse {
2175
+ return { status: undefined, oauthUrl: "", flowId: "" };
2176
+ }
2177
+
2178
+ export const InitiateLinearOAuthResponse: MessageFns<InitiateLinearOAuthResponse> = {
2179
+ encode(message: InitiateLinearOAuthResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2180
+ if (message.status !== undefined) {
2181
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2182
+ }
2183
+ if (message.oauthUrl !== "") {
2184
+ writer.uint32(18).string(message.oauthUrl);
2185
+ }
2186
+ if (message.flowId !== "") {
2187
+ writer.uint32(26).string(message.flowId);
2188
+ }
2189
+ return writer;
2190
+ },
2191
+
2192
+ decode(input: BinaryReader | Uint8Array, length?: number): InitiateLinearOAuthResponse {
2193
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2194
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2195
+ if (previousRecursionDepth >= 100) {
2196
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2197
+ }
2198
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2199
+ try {
2200
+ const end = length === undefined ? reader.len : reader.pos + length;
2201
+ const message = createBaseInitiateLinearOAuthResponse();
2202
+ while (reader.pos < end) {
2203
+ const tag = reader.uint32();
2204
+ switch (tag >>> 3) {
2205
+ case 1: {
2206
+ if (tag !== 10) {
2207
+ break;
2208
+ }
2209
+
2210
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2211
+ continue;
2212
+ }
2213
+ case 2: {
2214
+ if (tag !== 18) {
2215
+ break;
2216
+ }
2217
+
2218
+ message.oauthUrl = reader.string();
2219
+ continue;
2220
+ }
2221
+ case 3: {
2222
+ if (tag !== 26) {
2223
+ break;
2224
+ }
2225
+
2226
+ message.flowId = reader.string();
2227
+ continue;
2228
+ }
2229
+ }
2230
+ if ((tag & 7) === 4 || tag === 0) {
2231
+ break;
2232
+ }
2233
+ reader.skip(tag & 7);
2234
+ }
2235
+ return message;
2236
+ } finally {
2237
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2238
+ }
2239
+ },
2240
+
2241
+ fromJSON(object: any): InitiateLinearOAuthResponse {
2242
+ return {
2243
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2244
+ oauthUrl: isSet(object.oauthUrl)
2245
+ ? globalThis.String(object.oauthUrl)
2246
+ : isSet(object.oauth_url)
2247
+ ? globalThis.String(object.oauth_url)
2248
+ : "",
2249
+ flowId: isSet(object.flowId)
2250
+ ? globalThis.String(object.flowId)
2251
+ : isSet(object.flow_id)
2252
+ ? globalThis.String(object.flow_id)
2253
+ : "",
2254
+ };
2255
+ },
2256
+
2257
+ toJSON(message: InitiateLinearOAuthResponse): unknown {
2258
+ const obj: any = {};
2259
+ if (message.status !== undefined) {
2260
+ obj.status = ResponseStatus.toJSON(message.status);
2261
+ }
2262
+ if (message.oauthUrl !== "") {
2263
+ obj.oauthUrl = message.oauthUrl;
2264
+ }
2265
+ if (message.flowId !== "") {
2266
+ obj.flowId = message.flowId;
2267
+ }
2268
+ return obj;
2269
+ },
2270
+
2271
+ create<I extends Exact<DeepPartial<InitiateLinearOAuthResponse>, I>>(base?: I): InitiateLinearOAuthResponse {
2272
+ return InitiateLinearOAuthResponse.fromPartial(base ?? ({} as any));
2273
+ },
2274
+ fromPartial<I extends Exact<DeepPartial<InitiateLinearOAuthResponse>, I>>(object: I): InitiateLinearOAuthResponse {
2275
+ const message = createBaseInitiateLinearOAuthResponse();
2276
+ message.status = (object.status !== undefined && object.status !== null)
2277
+ ? ResponseStatus.fromPartial(object.status)
2278
+ : undefined;
2279
+ message.oauthUrl = object.oauthUrl ?? "";
2280
+ message.flowId = object.flowId ?? "";
2281
+ return message;
2282
+ },
2283
+ };
2284
+
2285
+ function createBaseCompleteLinearOAuthRequest(): CompleteLinearOAuthRequest {
2286
+ return { organizationId: "", code: "", redirectUri: "", flowId: "" };
2287
+ }
2288
+
2289
+ export const CompleteLinearOAuthRequest: MessageFns<CompleteLinearOAuthRequest> = {
2290
+ encode(message: CompleteLinearOAuthRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2291
+ if (message.organizationId !== "") {
2292
+ writer.uint32(10).string(message.organizationId);
2293
+ }
2294
+ if (message.code !== "") {
2295
+ writer.uint32(18).string(message.code);
2296
+ }
2297
+ if (message.redirectUri !== "") {
2298
+ writer.uint32(26).string(message.redirectUri);
2299
+ }
2300
+ if (message.flowId !== "") {
2301
+ writer.uint32(34).string(message.flowId);
2302
+ }
2303
+ return writer;
2304
+ },
2305
+
2306
+ decode(input: BinaryReader | Uint8Array, length?: number): CompleteLinearOAuthRequest {
2307
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2308
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2309
+ if (previousRecursionDepth >= 100) {
2310
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2311
+ }
2312
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2313
+ try {
2314
+ const end = length === undefined ? reader.len : reader.pos + length;
2315
+ const message = createBaseCompleteLinearOAuthRequest();
2316
+ while (reader.pos < end) {
2317
+ const tag = reader.uint32();
2318
+ switch (tag >>> 3) {
2319
+ case 1: {
2320
+ if (tag !== 10) {
2321
+ break;
2322
+ }
2323
+
2324
+ message.organizationId = reader.string();
2325
+ continue;
2326
+ }
2327
+ case 2: {
2328
+ if (tag !== 18) {
2329
+ break;
2330
+ }
2331
+
2332
+ message.code = reader.string();
2333
+ continue;
2334
+ }
2335
+ case 3: {
2336
+ if (tag !== 26) {
2337
+ break;
2338
+ }
2339
+
2340
+ message.redirectUri = reader.string();
2341
+ continue;
2342
+ }
2343
+ case 4: {
2344
+ if (tag !== 34) {
2345
+ break;
2346
+ }
2347
+
2348
+ message.flowId = reader.string();
2349
+ continue;
2350
+ }
2351
+ }
2352
+ if ((tag & 7) === 4 || tag === 0) {
2353
+ break;
2354
+ }
2355
+ reader.skip(tag & 7);
2356
+ }
2357
+ return message;
2358
+ } finally {
2359
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2360
+ }
2361
+ },
2362
+
2363
+ fromJSON(object: any): CompleteLinearOAuthRequest {
2364
+ return {
2365
+ organizationId: isSet(object.organizationId)
2366
+ ? globalThis.String(object.organizationId)
2367
+ : isSet(object.organization_id)
2368
+ ? globalThis.String(object.organization_id)
2369
+ : "",
2370
+ code: isSet(object.code) ? globalThis.String(object.code) : "",
2371
+ redirectUri: isSet(object.redirectUri)
2372
+ ? globalThis.String(object.redirectUri)
2373
+ : isSet(object.redirect_uri)
2374
+ ? globalThis.String(object.redirect_uri)
2375
+ : "",
2376
+ flowId: isSet(object.flowId)
2377
+ ? globalThis.String(object.flowId)
2378
+ : isSet(object.flow_id)
2379
+ ? globalThis.String(object.flow_id)
2380
+ : "",
2381
+ };
2382
+ },
2383
+
2384
+ toJSON(message: CompleteLinearOAuthRequest): unknown {
2385
+ const obj: any = {};
2386
+ if (message.organizationId !== "") {
2387
+ obj.organizationId = message.organizationId;
2388
+ }
2389
+ if (message.code !== "") {
2390
+ obj.code = message.code;
2391
+ }
2392
+ if (message.redirectUri !== "") {
2393
+ obj.redirectUri = message.redirectUri;
2394
+ }
2395
+ if (message.flowId !== "") {
2396
+ obj.flowId = message.flowId;
2397
+ }
2398
+ return obj;
2399
+ },
2400
+
2401
+ create<I extends Exact<DeepPartial<CompleteLinearOAuthRequest>, I>>(base?: I): CompleteLinearOAuthRequest {
2402
+ return CompleteLinearOAuthRequest.fromPartial(base ?? ({} as any));
2403
+ },
2404
+ fromPartial<I extends Exact<DeepPartial<CompleteLinearOAuthRequest>, I>>(object: I): CompleteLinearOAuthRequest {
2405
+ const message = createBaseCompleteLinearOAuthRequest();
2406
+ message.organizationId = object.organizationId ?? "";
2407
+ message.code = object.code ?? "";
2408
+ message.redirectUri = object.redirectUri ?? "";
2409
+ message.flowId = object.flowId ?? "";
2410
+ return message;
2411
+ },
2412
+ };
2413
+
2414
+ function createBaseCompleteLinearOAuthResponse(): CompleteLinearOAuthResponse {
2415
+ return { status: undefined, oauthConnection: undefined };
2416
+ }
2417
+
2418
+ export const CompleteLinearOAuthResponse: MessageFns<CompleteLinearOAuthResponse> = {
2419
+ encode(message: CompleteLinearOAuthResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2420
+ if (message.status !== undefined) {
2421
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2422
+ }
2423
+ if (message.oauthConnection !== undefined) {
2424
+ OAuthConnection.encode(message.oauthConnection, writer.uint32(18).fork()).join();
2425
+ }
2426
+ return writer;
2427
+ },
2428
+
2429
+ decode(input: BinaryReader | Uint8Array, length?: number): CompleteLinearOAuthResponse {
2430
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2431
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2432
+ if (previousRecursionDepth >= 100) {
2433
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2434
+ }
2435
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2436
+ try {
2437
+ const end = length === undefined ? reader.len : reader.pos + length;
2438
+ const message = createBaseCompleteLinearOAuthResponse();
2439
+ while (reader.pos < end) {
2440
+ const tag = reader.uint32();
2441
+ switch (tag >>> 3) {
2442
+ case 1: {
2443
+ if (tag !== 10) {
2444
+ break;
2445
+ }
2446
+
2447
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2448
+ continue;
2449
+ }
2450
+ case 2: {
2451
+ if (tag !== 18) {
2452
+ break;
2453
+ }
2454
+
2455
+ message.oauthConnection = OAuthConnection.decode(reader, reader.uint32());
2456
+ continue;
2457
+ }
2458
+ }
2459
+ if ((tag & 7) === 4 || tag === 0) {
2460
+ break;
2461
+ }
2462
+ reader.skip(tag & 7);
2463
+ }
2464
+ return message;
2465
+ } finally {
2466
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2467
+ }
2468
+ },
2469
+
2470
+ fromJSON(object: any): CompleteLinearOAuthResponse {
2471
+ return {
2472
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2473
+ oauthConnection: isSet(object.oauthConnection)
2474
+ ? OAuthConnection.fromJSON(object.oauthConnection)
2475
+ : isSet(object.oauth_connection)
2476
+ ? OAuthConnection.fromJSON(object.oauth_connection)
2477
+ : undefined,
2478
+ };
2479
+ },
2480
+
2481
+ toJSON(message: CompleteLinearOAuthResponse): unknown {
2482
+ const obj: any = {};
2483
+ if (message.status !== undefined) {
2484
+ obj.status = ResponseStatus.toJSON(message.status);
2485
+ }
2486
+ if (message.oauthConnection !== undefined) {
2487
+ obj.oauthConnection = OAuthConnection.toJSON(message.oauthConnection);
2488
+ }
2489
+ return obj;
2490
+ },
2491
+
2492
+ create<I extends Exact<DeepPartial<CompleteLinearOAuthResponse>, I>>(base?: I): CompleteLinearOAuthResponse {
2493
+ return CompleteLinearOAuthResponse.fromPartial(base ?? ({} as any));
2494
+ },
2495
+ fromPartial<I extends Exact<DeepPartial<CompleteLinearOAuthResponse>, I>>(object: I): CompleteLinearOAuthResponse {
2496
+ const message = createBaseCompleteLinearOAuthResponse();
2497
+ message.status = (object.status !== undefined && object.status !== null)
2498
+ ? ResponseStatus.fromPartial(object.status)
2499
+ : undefined;
2500
+ message.oauthConnection = (object.oauthConnection !== undefined && object.oauthConnection !== null)
2501
+ ? OAuthConnection.fromPartial(object.oauthConnection)
2502
+ : undefined;
2503
+ return message;
2504
+ },
2505
+ };
2506
+
2507
+ function createBaseDisconnectLinearRequest(): DisconnectLinearRequest {
2508
+ return { organizationId: "" };
2509
+ }
2510
+
2511
+ export const DisconnectLinearRequest: MessageFns<DisconnectLinearRequest> = {
2512
+ encode(message: DisconnectLinearRequest, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2513
+ if (message.organizationId !== "") {
2514
+ writer.uint32(10).string(message.organizationId);
2515
+ }
2516
+ return writer;
2517
+ },
2518
+
2519
+ decode(input: BinaryReader | Uint8Array, length?: number): DisconnectLinearRequest {
2520
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2521
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2522
+ if (previousRecursionDepth >= 100) {
2523
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2524
+ }
2525
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2526
+ try {
2527
+ const end = length === undefined ? reader.len : reader.pos + length;
2528
+ const message = createBaseDisconnectLinearRequest();
2529
+ while (reader.pos < end) {
2530
+ const tag = reader.uint32();
2531
+ switch (tag >>> 3) {
2532
+ case 1: {
2533
+ if (tag !== 10) {
2534
+ break;
2535
+ }
2536
+
2537
+ message.organizationId = reader.string();
2538
+ continue;
2539
+ }
2540
+ }
2541
+ if ((tag & 7) === 4 || tag === 0) {
2542
+ break;
2543
+ }
2544
+ reader.skip(tag & 7);
2545
+ }
2546
+ return message;
2547
+ } finally {
2548
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2549
+ }
2550
+ },
2551
+
2552
+ fromJSON(object: any): DisconnectLinearRequest {
2553
+ return {
2554
+ organizationId: isSet(object.organizationId)
2555
+ ? globalThis.String(object.organizationId)
2556
+ : isSet(object.organization_id)
2557
+ ? globalThis.String(object.organization_id)
2558
+ : "",
2559
+ };
2560
+ },
2561
+
2562
+ toJSON(message: DisconnectLinearRequest): unknown {
2563
+ const obj: any = {};
2564
+ if (message.organizationId !== "") {
2565
+ obj.organizationId = message.organizationId;
2566
+ }
2567
+ return obj;
2568
+ },
2569
+
2570
+ create<I extends Exact<DeepPartial<DisconnectLinearRequest>, I>>(base?: I): DisconnectLinearRequest {
2571
+ return DisconnectLinearRequest.fromPartial(base ?? ({} as any));
2572
+ },
2573
+ fromPartial<I extends Exact<DeepPartial<DisconnectLinearRequest>, I>>(object: I): DisconnectLinearRequest {
2574
+ const message = createBaseDisconnectLinearRequest();
2575
+ message.organizationId = object.organizationId ?? "";
2576
+ return message;
2577
+ },
2578
+ };
2579
+
2580
+ function createBaseDisconnectLinearResponse(): DisconnectLinearResponse {
2581
+ return { status: undefined, deleted: false };
2582
+ }
2583
+
2584
+ export const DisconnectLinearResponse: MessageFns<DisconnectLinearResponse> = {
2585
+ encode(message: DisconnectLinearResponse, writer: BinaryWriter = new BinaryWriter()): BinaryWriter {
2586
+ if (message.status !== undefined) {
2587
+ ResponseStatus.encode(message.status, writer.uint32(10).fork()).join();
2588
+ }
2589
+ if (message.deleted !== false) {
2590
+ writer.uint32(16).bool(message.deleted);
2591
+ }
2592
+ return writer;
2593
+ },
2594
+
2595
+ decode(input: BinaryReader | Uint8Array, length?: number): DisconnectLinearResponse {
2596
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
2597
+ const previousRecursionDepth = (reader as any).__tsProtoDecodeDepth ?? 0;
2598
+ if (previousRecursionDepth >= 100) {
2599
+ throw new globalThis.Error("protobuf decode recursion limit exceeded");
2600
+ }
2601
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth + 1;
2602
+ try {
2603
+ const end = length === undefined ? reader.len : reader.pos + length;
2604
+ const message = createBaseDisconnectLinearResponse();
2605
+ while (reader.pos < end) {
2606
+ const tag = reader.uint32();
2607
+ switch (tag >>> 3) {
2608
+ case 1: {
2609
+ if (tag !== 10) {
2610
+ break;
2611
+ }
2612
+
2613
+ message.status = ResponseStatus.decode(reader, reader.uint32());
2614
+ continue;
2615
+ }
2616
+ case 2: {
2617
+ if (tag !== 16) {
2618
+ break;
2619
+ }
2620
+
2621
+ message.deleted = reader.bool();
2622
+ continue;
2623
+ }
2624
+ }
2625
+ if ((tag & 7) === 4 || tag === 0) {
2626
+ break;
2627
+ }
2628
+ reader.skip(tag & 7);
2629
+ }
2630
+ return message;
2631
+ } finally {
2632
+ (reader as any).__tsProtoDecodeDepth = previousRecursionDepth;
2633
+ }
2634
+ },
2635
+
2636
+ fromJSON(object: any): DisconnectLinearResponse {
2637
+ return {
2638
+ status: isSet(object.status) ? ResponseStatus.fromJSON(object.status) : undefined,
2639
+ deleted: isSet(object.deleted) ? globalThis.Boolean(object.deleted) : false,
2640
+ };
2641
+ },
2642
+
2643
+ toJSON(message: DisconnectLinearResponse): unknown {
2644
+ const obj: any = {};
2645
+ if (message.status !== undefined) {
2646
+ obj.status = ResponseStatus.toJSON(message.status);
2647
+ }
2648
+ if (message.deleted !== false) {
2649
+ obj.deleted = message.deleted;
2650
+ }
2651
+ return obj;
2652
+ },
2653
+
2654
+ create<I extends Exact<DeepPartial<DisconnectLinearResponse>, I>>(base?: I): DisconnectLinearResponse {
2655
+ return DisconnectLinearResponse.fromPartial(base ?? ({} as any));
2656
+ },
2657
+ fromPartial<I extends Exact<DeepPartial<DisconnectLinearResponse>, I>>(object: I): DisconnectLinearResponse {
2658
+ const message = createBaseDisconnectLinearResponse();
2659
+ message.status = (object.status !== undefined && object.status !== null)
2660
+ ? ResponseStatus.fromPartial(object.status)
2661
+ : undefined;
2662
+ message.deleted = object.deleted ?? false;
2663
+ return message;
2664
+ },
2665
+ };
2666
+
2667
+ /** OAuthGatewayService provides web client access to OAuth connection management */
2668
+ export interface OAuthGatewayService {
2669
+ /** InitiateSlackOAuth returns the Slack OAuth URL for the user to authorize */
2670
+ InitiateSlackOAuth(request: InitiateSlackOAuthRequest, metadata?: Metadata): Promise<InitiateSlackOAuthResponse>;
2671
+ /** CompleteSlackOAuth exchanges the authorization code for a bot token */
2672
+ CompleteSlackOAuth(request: CompleteSlackOAuthRequest, metadata?: Metadata): Promise<CompleteSlackOAuthResponse>;
2673
+ /** GetOAuthConnection returns an existing OAuth connection for an organization and provider */
2674
+ GetOAuthConnection(request: GetOAuthConnectionRequest, metadata?: Metadata): Promise<GetOAuthConnectionResponse>;
2675
+ /** ListSlackChannels lists available Slack channels using the stored bot token */
2676
+ ListSlackChannels(request: ListSlackChannelsRequest, metadata?: Metadata): Promise<ListSlackChannelsResponse>;
2677
+ InitiatePagerDutyOAuth(
2678
+ request: InitiatePagerDutyOAuthRequest,
2679
+ metadata?: Metadata,
2680
+ ): Promise<InitiatePagerDutyOAuthResponse>;
2681
+ CompletePagerDutyOAuth(
2682
+ request: CompletePagerDutyOAuthRequest,
2683
+ metadata?: Metadata,
2684
+ ): Promise<CompletePagerDutyOAuthResponse>;
2685
+ ListPagerDutyServices(
2686
+ request: ListPagerDutyServicesRequest,
2687
+ metadata?: Metadata,
2688
+ ): Promise<ListPagerDutyServicesResponse>;
2689
+ /**
2690
+ * Org admin of a Terma organization. Returns Linear's authorize URL (scope read); send flow_id back with the code.
2691
+ * GetOAuthConnection with provider "linear" reads the connection.
2692
+ */
2693
+ InitiateLinearOAuth(request: InitiateLinearOAuthRequest, metadata?: Metadata): Promise<InitiateLinearOAuthResponse>;
2694
+ /**
2695
+ * Org admin. Exchanges the code for the flow InitiateLinearOAuth started (single use) and stores the connection;
2696
+ * provider_team_id is the Linear organization id.
2697
+ */
2698
+ CompleteLinearOAuth(request: CompleteLinearOAuthRequest, metadata?: Metadata): Promise<CompleteLinearOAuthResponse>;
2699
+ /** Org admin. Deletes the Linear connection and revokes its grant at Linear. */
2700
+ DisconnectLinear(request: DisconnectLinearRequest, metadata?: Metadata): Promise<DisconnectLinearResponse>;
2701
+ }
2702
+
2703
+ export const OAuthGatewayServiceServiceName = "gateway.web.v1.OAuthGatewayService";
2704
+ export class OAuthGatewayServiceClientImpl implements OAuthGatewayService {
2705
+ private readonly rpc: Rpc;
2706
+ private readonly service: string;
2707
+ constructor(rpc: Rpc, opts?: { service?: string }) {
2708
+ this.service = opts?.service || OAuthGatewayServiceServiceName;
2709
+ this.rpc = rpc;
2710
+ this.InitiateSlackOAuth = this.InitiateSlackOAuth.bind(this);
2711
+ this.CompleteSlackOAuth = this.CompleteSlackOAuth.bind(this);
2712
+ this.GetOAuthConnection = this.GetOAuthConnection.bind(this);
2713
+ this.ListSlackChannels = this.ListSlackChannels.bind(this);
2714
+ this.InitiatePagerDutyOAuth = this.InitiatePagerDutyOAuth.bind(this);
2715
+ this.CompletePagerDutyOAuth = this.CompletePagerDutyOAuth.bind(this);
2716
+ this.ListPagerDutyServices = this.ListPagerDutyServices.bind(this);
2717
+ this.InitiateLinearOAuth = this.InitiateLinearOAuth.bind(this);
2718
+ this.CompleteLinearOAuth = this.CompleteLinearOAuth.bind(this);
2719
+ this.DisconnectLinear = this.DisconnectLinear.bind(this);
2720
+ }
2721
+ InitiateSlackOAuth(request: InitiateSlackOAuthRequest, metadata?: Metadata): Promise<InitiateSlackOAuthResponse> {
2722
+ const data = InitiateSlackOAuthRequest.encode(request).finish();
2723
+ const promise = this.rpc.request(this.service, "InitiateSlackOAuth", data, metadata);
2724
+ return promise.then((data) => InitiateSlackOAuthResponse.decode(new BinaryReader(data)));
2725
+ }
2726
+
2727
+ CompleteSlackOAuth(request: CompleteSlackOAuthRequest, metadata?: Metadata): Promise<CompleteSlackOAuthResponse> {
2728
+ const data = CompleteSlackOAuthRequest.encode(request).finish();
2729
+ const promise = this.rpc.request(this.service, "CompleteSlackOAuth", data, metadata);
2730
+ return promise.then((data) => CompleteSlackOAuthResponse.decode(new BinaryReader(data)));
2731
+ }
2732
+
2733
+ GetOAuthConnection(request: GetOAuthConnectionRequest, metadata?: Metadata): Promise<GetOAuthConnectionResponse> {
2734
+ const data = GetOAuthConnectionRequest.encode(request).finish();
2735
+ const promise = this.rpc.request(this.service, "GetOAuthConnection", data, metadata);
2736
+ return promise.then((data) => GetOAuthConnectionResponse.decode(new BinaryReader(data)));
2737
+ }
2738
+
2739
+ ListSlackChannels(request: ListSlackChannelsRequest, metadata?: Metadata): Promise<ListSlackChannelsResponse> {
2740
+ const data = ListSlackChannelsRequest.encode(request).finish();
2741
+ const promise = this.rpc.request(this.service, "ListSlackChannels", data, metadata);
2742
+ return promise.then((data) => ListSlackChannelsResponse.decode(new BinaryReader(data)));
2743
+ }
2744
+
2745
+ InitiatePagerDutyOAuth(
2746
+ request: InitiatePagerDutyOAuthRequest,
2747
+ metadata?: Metadata,
2748
+ ): Promise<InitiatePagerDutyOAuthResponse> {
2749
+ const data = InitiatePagerDutyOAuthRequest.encode(request).finish();
2750
+ const promise = this.rpc.request(this.service, "InitiatePagerDutyOAuth", data, metadata);
2751
+ return promise.then((data) => InitiatePagerDutyOAuthResponse.decode(new BinaryReader(data)));
2752
+ }
2753
+
2754
+ CompletePagerDutyOAuth(
2755
+ request: CompletePagerDutyOAuthRequest,
2756
+ metadata?: Metadata,
2757
+ ): Promise<CompletePagerDutyOAuthResponse> {
2758
+ const data = CompletePagerDutyOAuthRequest.encode(request).finish();
2759
+ const promise = this.rpc.request(this.service, "CompletePagerDutyOAuth", data, metadata);
2760
+ return promise.then((data) => CompletePagerDutyOAuthResponse.decode(new BinaryReader(data)));
2761
+ }
2762
+
2763
+ ListPagerDutyServices(
2764
+ request: ListPagerDutyServicesRequest,
2765
+ metadata?: Metadata,
2766
+ ): Promise<ListPagerDutyServicesResponse> {
2767
+ const data = ListPagerDutyServicesRequest.encode(request).finish();
2768
+ const promise = this.rpc.request(this.service, "ListPagerDutyServices", data, metadata);
2769
+ return promise.then((data) => ListPagerDutyServicesResponse.decode(new BinaryReader(data)));
2770
+ }
2771
+
2772
+ InitiateLinearOAuth(request: InitiateLinearOAuthRequest, metadata?: Metadata): Promise<InitiateLinearOAuthResponse> {
2773
+ const data = InitiateLinearOAuthRequest.encode(request).finish();
2774
+ const promise = this.rpc.request(this.service, "InitiateLinearOAuth", data, metadata);
2775
+ return promise.then((data) => InitiateLinearOAuthResponse.decode(new BinaryReader(data)));
2776
+ }
2777
+
2778
+ CompleteLinearOAuth(request: CompleteLinearOAuthRequest, metadata?: Metadata): Promise<CompleteLinearOAuthResponse> {
2779
+ const data = CompleteLinearOAuthRequest.encode(request).finish();
2780
+ const promise = this.rpc.request(this.service, "CompleteLinearOAuth", data, metadata);
2781
+ return promise.then((data) => CompleteLinearOAuthResponse.decode(new BinaryReader(data)));
2782
+ }
2783
+
2784
+ DisconnectLinear(request: DisconnectLinearRequest, metadata?: Metadata): Promise<DisconnectLinearResponse> {
2785
+ const data = DisconnectLinearRequest.encode(request).finish();
2786
+ const promise = this.rpc.request(this.service, "DisconnectLinear", data, metadata);
2787
+ return promise.then((data) => DisconnectLinearResponse.decode(new BinaryReader(data)));
2133
2788
  }
2134
2789
  }
2135
2790