@getrouter/getrouter-cli 0.1.6 → 0.1.7

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.
@@ -2,92 +2,90 @@
2
2
  /* eslint-disable camelcase */
3
3
  // @ts-nocheck
4
4
 
5
- // Identity represents a user identity such as email or phone.
6
- export type Identity = {
7
- // The unique ID of the identity.
5
+ // UserSubscription represents the subscription details for a user.
6
+ export type UserSubscription = {
7
+ // Associated plan details.
8
+ plan: routercommonv1_Plan | undefined;
9
+ // Current status of the subscription.
10
+ status: routercommonv1_Subscription_Status | undefined;
11
+ // Start time of the subscription.
12
+ startAt: wellKnownTimestamp | undefined;
13
+ // End time of the subscription.
14
+ endAt: wellKnownTimestamp | undefined;
15
+ // Timestamps for subscription creation and last update.
16
+ subscriptions: routercommonv1_Subscription[] | undefined;
17
+ };
18
+
19
+ // Plan represents a subscription plan with its details.
20
+ export type routercommonv1_Plan = {
21
+ // Unique identifier for the plan.
8
22
  id: string | undefined;
9
- // The ID of the user this identity belongs to.
10
- userId: string | undefined;
11
- // The type of the identity.
12
- type: Identity_Type | undefined;
13
- // The identifier of the identity (e.g., email address).
14
- identifier: string | undefined;
15
- // The credential associated with the identity (e.g., password hash).
16
- credential: string | undefined;
17
- // The timestamp at which the identity was created.
23
+ // Name of the plan. (e.g. Free、Starter、Pro、Business)
24
+ name: string | undefined;
25
+ // Description of the plan.
26
+ description: string | undefined;
27
+ // Price of the plan (decimal string, e.g. "9.99").
28
+ price: number | undefined;
29
+ // Currency code (ISO 4217), e.g. "USD".
30
+ currency: string | undefined;
31
+ // Billing cycle in days. E.g., 30 for monthly, 365 for yearly.
32
+ billingCycleDays: number | undefined;
33
+ // Rate limits for the plan. (e.g. Requests per minute 20)
34
+ requestPerMinute: number | undefined;
35
+ // Rate limits for the plan. (e.g. Requests per day 1000)
36
+ requestPerDay: number | undefined;
37
+ // Token limits for the plan. (e.g. Tokens per minute 150K)
38
+ tokenPerMinute: string | undefined;
39
+ // Token limits for the plan. (e.g. Tokens per day 10M)
40
+ tokenPerDay: string | undefined;
41
+ // Timestamp for when the plan was created.
18
42
  createdAt: wellKnownTimestamp | undefined;
19
- // The latest timestamp at which the identity was updated.
43
+ // Timestamp for when the plan was last updated.
20
44
  updatedAt: wellKnownTimestamp | undefined;
21
45
  };
22
46
 
23
- // The type of the identity.
24
- export type Identity_Type =
25
- | "TYPE_UNSPECIFIED"
26
- | "EMAIL"
27
- | "GITHUB";
28
47
  // Encoded using RFC 3339, where generated output will always be Z-normalized
29
48
  // and uses 0, 3, 6 or 9 fractional digits.
30
49
  // Offsets other than "Z" are also accepted.
31
50
  type wellKnownTimestamp = string;
32
51
 
33
- // RegisterRequest is the request message for registering.
34
- export type RegisterRequest = {
35
- // The identity to register.
36
- identity: Identity | undefined;
37
- };
38
-
39
- // UpdatePasswordRequest is the request message for updating password.
40
- export type UpdatePasswordRequest = {
41
- // The new password.
42
- password: string | undefined;
43
- };
44
-
45
- // LoginRequest is the request message for logging in.
46
- export type LoginRequest = {
47
- // The type of the identity.
48
- identity: Identity | undefined;
49
- };
50
-
51
- // ConnectRequest is the request message for initiating OAuth connection.
52
- export type ConnectRequest = {
53
- // The type of the identity.
54
- //
55
- // Behaviors: REQUIRED
56
- type: Identity_Type | undefined;
57
- };
58
-
59
- // CallbackRequest is the request message for handling OAuth callbacks.
60
- export type CallbackRequest = {
61
- // The type of the identity.
62
- //
63
- // Behaviors: REQUIRED
64
- type: Identity_Type | undefined;
65
- // The code received from the OAuth provider.
66
- //
67
- // Behaviors: REQUIRED
68
- code: string | undefined;
69
- // The state parameter to prevent CSRF attacks.
70
- //
71
- // Behaviors: REQUIRED
72
- state: string | undefined;
52
+ // Status of the subscription.
53
+ export type routercommonv1_Subscription_Status =
54
+ // Subscription status is unspecified.
55
+ | "STATUS_UNSPECIFIED"
56
+ // Subscription is active.
57
+ | "ACTIVE"
58
+ // Subscription is inactive.
59
+ | "INACTIVE"
60
+ // Subscription is cancelled.
61
+ | "CANCELLED"
62
+ // Subscription has expired.
63
+ | "EXPIRED";
64
+ // Subscription represents a user's subscription details.
65
+ export type routercommonv1_Subscription = {
66
+ // Unique identifier for the subscription.
67
+ id: string | undefined;
68
+ // User ID associated with the subscription.
69
+ userId: string | undefined;
70
+ // Plan ID of the subscription.
71
+ planId: string | undefined;
72
+ // Current status of the subscription.
73
+ status: routercommonv1_Subscription_Status | undefined;
74
+ // Start time of the subscription.
75
+ startAt: wellKnownTimestamp | undefined;
76
+ // End time of the subscription.
77
+ endAt: wellKnownTimestamp | undefined;
78
+ // Timestamps for subscription creation and last update.
79
+ createdAt: wellKnownTimestamp | undefined;
80
+ // Timestamp for the last update of the subscription.
81
+ updatedAt: wellKnownTimestamp | undefined;
82
+ // Associated plan details.
83
+ plan: routercommonv1_Plan | undefined;
73
84
  };
74
85
 
75
- // IdentityService is the identity service definition.
76
- export interface IdentityService {
77
- // Register a new identity and user.
78
- Register(request: RegisterRequest): Promise<routercommonv1_User>;
79
- // Login an identity and return the associated user.
80
- Login(request: LoginRequest): Promise<routercommonv1_User>;
81
- // Logout the current identity.
82
- Logout(request: wellKnownEmpty): Promise<wellKnownEmpty>;
83
- // Connect initiates the OAuth connection flow for the given identity.
84
- Connect(request: ConnectRequest): Promise<wellKnownEmpty>;
85
- // Callback handles the OAuth callback for the given identity type.
86
- // The type is specified in the URL path.
87
- // For example: /v1/identities/GITHUB/callback
88
- Callback(request: CallbackRequest): Promise<wellKnownEmpty>;
89
- // UpdatePassword updates the password for the current user.
90
- UpdatePassword(request: UpdatePasswordRequest): Promise<wellKnownEmpty>;
86
+ // SubscriptionService is the subscription service definition.
87
+ export interface SubscriptionService {
88
+ CurrentSubscription(request: wellKnownEmpty): Promise<UserSubscription>;
91
89
  }
92
90
 
93
91
  type RequestType = {
@@ -98,94 +96,14 @@ type RequestType = {
98
96
 
99
97
  type RequestHandler = (request: RequestType, meta: { service: string, method: string }) => Promise<unknown>;
100
98
 
101
- export function createIdentityServiceClient(
99
+ export function createSubscriptionServiceClient(
102
100
  handler: RequestHandler
103
- ): IdentityService {
101
+ ): SubscriptionService {
104
102
  return {
105
- Register(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
106
- const path = `v1/dashboard/identities/register`; // eslint-disable-line quotes
107
- const body = JSON.stringify(request?.identity ?? {});
108
- const queryParams: string[] = [];
109
- let uri = path;
110
- if (queryParams.length > 0) {
111
- uri += `?${queryParams.join("&")}`
112
- }
113
- return handler({
114
- path: uri,
115
- method: "POST",
116
- body,
117
- }, {
118
- service: "IdentityService",
119
- method: "Register",
120
- }) as Promise<routercommonv1_User>;
121
- },
122
- Login(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
123
- const path = `v1/dashboard/identities/login`; // eslint-disable-line quotes
124
- const body = JSON.stringify(request?.identity ?? {});
125
- const queryParams: string[] = [];
126
- let uri = path;
127
- if (queryParams.length > 0) {
128
- uri += `?${queryParams.join("&")}`
129
- }
130
- return handler({
131
- path: uri,
132
- method: "POST",
133
- body,
134
- }, {
135
- service: "IdentityService",
136
- method: "Login",
137
- }) as Promise<routercommonv1_User>;
138
- },
139
- Logout(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
140
- const path = `v1/dashboard/identities/logout`; // eslint-disable-line quotes
141
- const body = JSON.stringify(request);
142
- const queryParams: string[] = [];
143
- let uri = path;
144
- if (queryParams.length > 0) {
145
- uri += `?${queryParams.join("&")}`
146
- }
147
- return handler({
148
- path: uri,
149
- method: "POST",
150
- body,
151
- }, {
152
- service: "IdentityService",
153
- method: "Logout",
154
- }) as Promise<wellKnownEmpty>;
155
- },
156
- Connect(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
157
- const path = `v1/dashboard/identities/connect`; // eslint-disable-line quotes
158
- const body = null;
159
- const queryParams: string[] = [];
160
- if (request.type) {
161
- queryParams.push(`type=${encodeURIComponent(request.type.toString())}`)
162
- }
163
- let uri = path;
164
- if (queryParams.length > 0) {
165
- uri += `?${queryParams.join("&")}`
166
- }
167
- return handler({
168
- path: uri,
169
- method: "GET",
170
- body,
171
- }, {
172
- service: "IdentityService",
173
- method: "Connect",
174
- }) as Promise<wellKnownEmpty>;
175
- },
176
- Callback(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
177
- if (!request.type) {
178
- throw new Error("missing required field request.type");
179
- }
180
- const path = `v1/dashboard/identities/${request.type}/callback`; // eslint-disable-line quotes
103
+ CurrentSubscription(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
104
+ const path = `v1/dashboard/subscriptions/current`; // eslint-disable-line quotes
181
105
  const body = null;
182
106
  const queryParams: string[] = [];
183
- if (request.code) {
184
- queryParams.push(`code=${encodeURIComponent(request.code.toString())}`)
185
- }
186
- if (request.state) {
187
- queryParams.push(`state=${encodeURIComponent(request.state.toString())}`)
188
- }
189
107
  let uri = path;
190
108
  if (queryParams.length > 0) {
191
109
  uri += `?${queryParams.join("&")}`
@@ -195,72 +113,37 @@ export function createIdentityServiceClient(
195
113
  method: "GET",
196
114
  body,
197
115
  }, {
198
- service: "IdentityService",
199
- method: "Callback",
200
- }) as Promise<wellKnownEmpty>;
201
- },
202
- UpdatePassword(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
203
- const path = `v1/dashboard/identities/password`; // eslint-disable-line quotes
204
- const body = JSON.stringify(request);
205
- const queryParams: string[] = [];
206
- let uri = path;
207
- if (queryParams.length > 0) {
208
- uri += `?${queryParams.join("&")}`
209
- }
210
- return handler({
211
- path: uri,
212
- method: "PUT",
213
- body,
214
- }, {
215
- service: "IdentityService",
216
- method: "UpdatePassword",
217
- }) as Promise<wellKnownEmpty>;
116
+ service: "SubscriptionService",
117
+ method: "CurrentSubscription",
118
+ }) as Promise<UserSubscription>;
218
119
  },
219
120
  };
220
121
  }
221
- // User is the user message.
222
- export type routercommonv1_User = {
223
- // The unique ID of the user.
224
- id: string | undefined;
225
- // The name of the user.
226
- name: string | undefined;
227
- // The email of the user.
228
- email: string | undefined;
229
- // The phone number of the user.
230
- phone: string | undefined;
231
- // The avatar URL of the user.
232
- avatar: string | undefined;
233
- // The status of the user.
234
- status: routercommonv1_User_Status | undefined;
235
- // The timestamp at which the user was created.
236
- createdAt: wellKnownTimestamp | undefined;
237
- // The latest timestamp at which the user was updated.
238
- updatedAt: wellKnownTimestamp | undefined;
239
- };
240
-
241
- export type routercommonv1_User_Status =
242
- // Unknown status.
243
- | "STATUS_UNSPECIFIED"
244
- // Active user.
245
- | "ACTIVE"
246
- // Inactive user.
247
- | "INACTIVE"
248
- // Banned user.
249
- | "BANNED";
250
122
  // An empty JSON object
251
123
  type wellKnownEmpty = Record<never, never>;
252
124
 
253
- // SubscriptionService is the subscription service definition.
254
- export interface SubscriptionService {
255
- CurrentSubscription(request: wellKnownEmpty): Promise<routercommonv1_Subscription>;
125
+ // ListPlansRequest is the request message for ListPlans.
126
+ export type ListPlansRequest = {
127
+ };
128
+
129
+ // ListPlansResponse is the response message for ListPlans.
130
+ export type ListPlansResponse = {
131
+ // The list of plans.
132
+ plans: routercommonv1_Plan[] | undefined;
133
+ };
134
+
135
+ // PlanService defines the service for managing plans.
136
+ export interface PlanService {
137
+ // ListPlans lists all available plans.
138
+ ListPlans(request: ListPlansRequest): Promise<ListPlansResponse>;
256
139
  }
257
140
 
258
- export function createSubscriptionServiceClient(
141
+ export function createPlanServiceClient(
259
142
  handler: RequestHandler
260
- ): SubscriptionService {
143
+ ): PlanService {
261
144
  return {
262
- CurrentSubscription(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
263
- const path = `v1/dashboard/subscriptions/current`; // eslint-disable-line quotes
145
+ ListPlans(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
146
+ const path = `v1/dashboard/plans`; // eslint-disable-line quotes
264
147
  const body = null;
265
148
  const queryParams: string[] = [];
266
149
  let uri = path;
@@ -272,70 +155,95 @@ export function createSubscriptionServiceClient(
272
155
  method: "GET",
273
156
  body,
274
157
  }, {
275
- service: "SubscriptionService",
276
- method: "CurrentSubscription",
277
- }) as Promise<routercommonv1_Subscription>;
158
+ service: "PlanService",
159
+ method: "ListPlans",
160
+ }) as Promise<ListPlansResponse>;
278
161
  },
279
162
  };
280
163
  }
281
- // Subscription represents a user's subscription details.
282
- export type routercommonv1_Subscription = {
283
- // Unique identifier for the subscription.
284
- id: string | undefined;
285
- // User ID associated with the subscription.
286
- userId: string | undefined;
287
- // Plan ID of the subscription.
288
- planId: string | undefined;
289
- // Current status of the subscription.
290
- status: routercommonv1_Subscription_Status | undefined;
291
- // Start time of the subscription.
292
- startAt: wellKnownTimestamp | undefined;
293
- // End time of the subscription.
294
- endAt: wellKnownTimestamp | undefined;
295
- // Timestamps for subscription creation and last update.
296
- createdAt: wellKnownTimestamp | undefined;
297
- // Timestamp for the last update of the subscription.
298
- updatedAt: wellKnownTimestamp | undefined;
299
- // Associated plan details.
300
- plan: routercommonv1_Plan | undefined;
164
+ // ListUsagesRequest is the request message for ListUsages.
165
+ export type ListUsagesRequest = {
166
+ // The maximum number of usages to return. The service may return fewer than
167
+ // this value, even if more usages exist.
168
+ pageSize: number | undefined;
169
+ // A page token, received from a previous `ListUsages` call.
170
+ // Provide this to retrieve the subsequent page.
171
+ // When paginating, all other parameters provided to `ListUsages` must
172
+ // match the call that provided the page token.
173
+ pageToken: string | undefined;
301
174
  };
302
175
 
303
- // Status of the subscription.
304
- export type routercommonv1_Subscription_Status =
305
- // Subscription status is unspecified.
306
- | "STATUS_UNSPECIFIED"
307
- // Subscription is active.
308
- | "ACTIVE"
309
- // Subscription is inactive.
310
- | "INACTIVE"
311
- // Subscription is cancelled.
312
- | "CANCELLED"
313
- // Subscription has expired.
314
- | "EXPIRED";
315
- // Plan represents a subscription plan with its details.
316
- export type routercommonv1_Plan = {
317
- // Unique identifier for the plan.
176
+ // ListUsagesResponse is the response message for ListUsages.
177
+ export type ListUsagesResponse = {
178
+ // The list of usages.
179
+ usages: routercommonv1_Usage[] | undefined;
180
+ };
181
+
182
+ // Usage represents token usage statistics for a model.
183
+ export type routercommonv1_Usage = {
184
+ // Unique identifier for the usage record.
318
185
  id: string | undefined;
319
- // Name of the plan. (e.g. Free、Starter、Pro、Business)
320
- name: string | undefined;
321
- // Description of the plan.
322
- description: string | undefined;
323
- // Price of the plan (decimal string, e.g. "9.99").
324
- price: number | undefined;
325
- // Currency code (ISO 4217), e.g. "USD".
326
- currency: string | undefined;
327
- // Billing cycle in days. E.g., 30 for monthly, 365 for yearly.
328
- billingCycleDays: number | undefined;
329
- // Rate limits for the plan. (e.g. Requests per minute 20)
330
- requestPerMinute: number | undefined;
331
- // Token limits for the plan. (e.g. Tokens per minute 150K)
332
- tokenPerMinute: string | undefined;
333
- // Timestamp for when the plan was created.
186
+ // Identifier of the user associated with this usage.
187
+ userId: string | undefined;
188
+ // Identifier of the model associated with this usage.
189
+ modelId: string | undefined;
190
+ // Unique identifier for the consumer.
191
+ consumerId: string | undefined;
192
+ // Identifier of the provider.
193
+ providerId: string | undefined;
194
+ // Unique identifier for the request associated with this usage.
195
+ requestId: string | undefined;
196
+ // Detailed usage information in JSON format.
197
+ // e.g. {"input_tokens":11,"input_tokens_details":{"cached_tokens":0},"output_tokens":149,"output_tokens_details":{"reasoning_tokens":128},"total_tokens":160}
198
+ tokensDetails: string | undefined;
199
+ // Number of input tokens used.
200
+ inputTokens: number | undefined;
201
+ // Number of output tokens generated.
202
+ outputTokens: number | undefined;
203
+ // Total number of tokens used.
204
+ totalTokens: number | undefined;
205
+ // Timestamps for usage record creation and last update.
334
206
  createdAt: wellKnownTimestamp | undefined;
335
- // Timestamp for when the plan was last updated.
207
+ // Timestamp for the last update of the usage record.
336
208
  updatedAt: wellKnownTimestamp | undefined;
337
209
  };
338
210
 
211
+ // UsageService defines the usage-related RPCs.
212
+ export interface UsageService {
213
+ // ListUsages lists the usage statistics.
214
+ // Implement aggregation queries grouped by day.
215
+ ListUsage(request: ListUsagesRequest): Promise<ListUsagesResponse>;
216
+ }
217
+
218
+ export function createUsageServiceClient(
219
+ handler: RequestHandler
220
+ ): UsageService {
221
+ return {
222
+ ListUsage(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
223
+ const path = `v1/dashboard/usages`; // eslint-disable-line quotes
224
+ const body = null;
225
+ const queryParams: string[] = [];
226
+ if (request.pageSize) {
227
+ queryParams.push(`pageSize=${encodeURIComponent(request.pageSize.toString())}`)
228
+ }
229
+ if (request.pageToken) {
230
+ queryParams.push(`pageToken=${encodeURIComponent(request.pageToken.toString())}`)
231
+ }
232
+ let uri = path;
233
+ if (queryParams.length > 0) {
234
+ uri += `?${queryParams.join("&")}`
235
+ }
236
+ return handler({
237
+ path: uri,
238
+ method: "GET",
239
+ body,
240
+ }, {
241
+ service: "UsageService",
242
+ method: "ListUsage",
243
+ }) as Promise<ListUsagesResponse>;
244
+ },
245
+ };
246
+ }
339
247
  // CreateConsumerRequest is the request message for CreateConsumer.
340
248
  export type CreateConsumerRequest = {
341
249
  };
@@ -560,123 +468,230 @@ export function createConsumerServiceClient(
560
468
  },
561
469
  };
562
470
  }
563
- // ActivatePromotionRequest is the request message for ActivatePromotion.
564
- export type ActivatePromotionRequest = {
565
- // The promotion code to activate.
566
- //
567
- // Behaviors: REQUIRED
568
- code: string | undefined;
471
+ // ListModelsResponse is the response message for ListModels.
472
+ export type ListModelsRequest = {
473
+ // The maximum number of models to return. The service may return fewer than
474
+ // this value, even if more models exist.
475
+ pageSize: number | undefined;
476
+ // A page token, received from a previous `ListModels` call.
477
+ // Provide this to retrieve the subsequent page.
478
+ // When paginating, all other parameters provided to `ListModels` must
479
+ // match the call that provided the page token.
480
+ pageToken: string | undefined;
481
+ // Optional. The standard list filter.
482
+ // Supported fields:
483
+ // * `name` (i.e. `name="gpt-5"`)
484
+ // * `author` (i.e. `author="openai"`)
485
+ // More detail in [AIP-160](https://google.aip.dev/160).
486
+ filter: string | undefined;
569
487
  };
570
488
 
571
- // PromotionService is the subscription service definition.
572
- export interface PromotionService {
573
- ActivatePromotion(request: ActivatePromotionRequest): Promise<routercommonv1_Promotion>;
489
+ // ListModelsResponse is the response message for ListModels.
490
+ export type ListModelsResponse = {
491
+ // The list of models.
492
+ models: routercommonv1_Model[] | undefined;
493
+ // A token to retrieve the next page of results.
494
+ // Pass this value in the `page_token` field of a subsequent `ListModels`
495
+ // request to retrieve the next page of results.
496
+ // If this field is omitted, there are no subsequent pages.
497
+ nextPageToken: string | undefined;
498
+ };
499
+
500
+ // Model represents a machine learning model with its metadata.
501
+ export type routercommonv1_Model = {
502
+ // Unique identifier for the model. (e.g., gpt-5.2-2025-12-11)
503
+ id: string | undefined;
504
+ // Name of the model. (e.g., GPT-5.2)
505
+ name: string | undefined;
506
+ // Icon representing the model.
507
+ icon: string | undefined;
508
+ // Author of the model.
509
+ author: string | undefined;
510
+ // Website associated with the model.
511
+ website: string | undefined;
512
+ // Description of the model.
513
+ description: string | undefined;
514
+ // Multipliers for the model's capabilities.
515
+ multipliers: number | undefined;
516
+ // Indicates if the model is enabled.
517
+ enabled: boolean | undefined;
518
+ // Timestamps for model creation and last update.
519
+ createdAt: wellKnownTimestamp | undefined;
520
+ // Timestamp for the last update of the model.
521
+ updatedAt: wellKnownTimestamp | undefined;
522
+ // Provider associated with the model.
523
+ providers: routercommonv1_Provider[] | undefined;
524
+ };
525
+
526
+ // Provider represents a service provider in the system.
527
+ export type routercommonv1_Provider = {
528
+ // The unique ID of the provider.
529
+ id: string | undefined;
530
+ // The name of the provider.
531
+ name: string | undefined;
532
+ // The description of the provider.
533
+ description: string | undefined;
534
+ // The model name of the provider.
535
+ modelId: string | undefined;
536
+ // The upstream model of the provider.
537
+ upstreamModel: string | undefined;
538
+ // The target URL for the provider.
539
+ targetUrl: string | undefined;
540
+ // The API key for the provider.
541
+ apiKey: string | undefined;
542
+ // The context window size for the provider. (e.g., 128K)
543
+ contextWindow: string | undefined;
544
+ // The maximum number of tokens for the provider. (e.g., 256K)
545
+ maxTokens: string | undefined;
546
+ // Whether the provider is enabled.
547
+ enabled: boolean | undefined;
548
+ // The tags associated with the provider.
549
+ // Supported request types/features:
550
+ // - /v1/chat/completions (openai)
551
+ // - /v1/responses (openai)
552
+ // - /v1/messages (anthropic)
553
+ // - /codex/responses (openai)
554
+ features: string[] | undefined;
555
+ // The timeout duration for requests to the provider.
556
+ timeout: wellKnownDuration | undefined;
557
+ // The timestamp at which the provider was created.
558
+ createdAt: wellKnownTimestamp | undefined;
559
+ // The latest timestamp at which the provider was updated.
560
+ updatedAt: wellKnownTimestamp | undefined;
561
+ };
562
+
563
+ // Generated output always contains 0, 3, 6, or 9 fractional digits,
564
+ // depending on required precision, followed by the suffix "s".
565
+ // Accepted are any fractional digits (also none) as long as they fit
566
+ // into nano-seconds precision and the suffix "s" is required.
567
+ type wellKnownDuration = string;
568
+
569
+ export interface ModelService {
570
+ ListModels(request: ListModelsRequest): Promise<ListModelsResponse>;
574
571
  }
575
572
 
576
- export function createPromotionServiceClient(
573
+ export function createModelServiceClient(
577
574
  handler: RequestHandler
578
- ): PromotionService {
575
+ ): ModelService {
579
576
  return {
580
- ActivatePromotion(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
581
- const path = `v1/promotion/activate`; // eslint-disable-line quotes
582
- const body = JSON.stringify(request);
577
+ ListModels(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
578
+ const path = `v1/dashboard/models`; // eslint-disable-line quotes
579
+ const body = null;
583
580
  const queryParams: string[] = [];
581
+ if (request.pageSize) {
582
+ queryParams.push(`pageSize=${encodeURIComponent(request.pageSize.toString())}`)
583
+ }
584
+ if (request.pageToken) {
585
+ queryParams.push(`pageToken=${encodeURIComponent(request.pageToken.toString())}`)
586
+ }
587
+ if (request.filter) {
588
+ queryParams.push(`filter=${encodeURIComponent(request.filter.toString())}`)
589
+ }
584
590
  let uri = path;
585
591
  if (queryParams.length > 0) {
586
592
  uri += `?${queryParams.join("&")}`
587
593
  }
588
594
  return handler({
589
595
  path: uri,
590
- method: "POST",
596
+ method: "GET",
591
597
  body,
592
598
  }, {
593
- service: "PromotionService",
594
- method: "ActivatePromotion",
595
- }) as Promise<routercommonv1_Promotion>;
599
+ service: "ModelService",
600
+ method: "ListModels",
601
+ }) as Promise<ListModelsResponse>;
596
602
  },
597
603
  };
598
604
  }
599
- // Promotion represents a promotional offer with its details.
600
- export type routercommonv1_Promotion = {
601
- // Unique identifier for the promotion.
605
+ // Identity represents a user identity such as email or phone.
606
+ export type Identity = {
607
+ // The unique ID of the identity.
602
608
  id: string | undefined;
603
- // Human-entered promotion code.
604
- code: string | undefined;
605
- // Associated plan id for the promotion.
606
- planId: string | undefined;
607
- // Associated user id (recipient/owner).
609
+ // The ID of the user this identity belongs to.
608
610
  userId: string | undefined;
609
- // Current status of the promotion.
610
- status: routercommonv1_Promotion_Status | undefined;
611
- // Timestamp when the promotion was redeemed.
612
- redeemedAt: wellKnownTimestamp | undefined;
613
- // Timestamps for creation and last update.
611
+ // The type of the identity.
612
+ type: Identity_Type | undefined;
613
+ // The identifier of the identity (e.g., email address).
614
+ identifier: string | undefined;
615
+ // The credential associated with the identity (e.g., password hash).
616
+ credential: string | undefined;
617
+ // The timestamp at which the identity was created.
614
618
  createdAt: wellKnownTimestamp | undefined;
615
- // Timestamp for the last update.
619
+ // The latest timestamp at which the identity was updated.
616
620
  updatedAt: wellKnownTimestamp | undefined;
617
621
  };
618
622
 
619
- export type routercommonv1_Promotion_Status =
620
- | "STATUS_UNSPECIFIED"
621
- // Promotion is available and not redeemed yet.
622
- | "AVAILABLE"
623
- // Promotion has been redeemed/used.
624
- | "REDEEMED"
625
- // Promotion has expired.
626
- | "EXPIRED"
627
- // Promotion has been revoked.
628
- | "REVOKED";
629
- // AuthToken is the authentication token message.
630
- export type AuthToken = {
631
- // Required. The access token.
632
- accessToken: string | undefined;
633
- // Required. The refresh token.
634
- refreshToken: string | undefined;
635
- // Required. The token type.
636
- expiresAt: wellKnownTimestamp | undefined;
623
+ // The type of the identity.
624
+ export type Identity_Type =
625
+ | "TYPE_UNSPECIFIED"
626
+ | "EMAIL"
627
+ | "GITHUB";
628
+ // RegisterRequest is the request message for registering.
629
+ export type RegisterRequest = {
630
+ // The identity to register.
631
+ identity: Identity | undefined;
637
632
  };
638
633
 
639
- // AuthorizeRequest is the request message for AuthToken.
640
- export type AuthorizeRequest = {
641
- // Required. The OAuth code to exchange for tokens.
634
+ // UpdatePasswordRequest is the request message for updating password.
635
+ export type UpdatePasswordRequest = {
636
+ // The new password.
637
+ password: string | undefined;
638
+ };
639
+
640
+ // LoginRequest is the request message for logging in.
641
+ export type LoginRequest = {
642
+ // The type of the identity.
643
+ identity: Identity | undefined;
644
+ };
645
+
646
+ // ConnectRequest is the request message for initiating OAuth connection.
647
+ export type ConnectRequest = {
648
+ // The type of the identity.
642
649
  //
643
650
  // Behaviors: REQUIRED
644
- code: string | undefined;
651
+ type: Identity_Type | undefined;
645
652
  };
646
653
 
647
- // CreateAuthRequest is the request message for CreateAuth.
648
- export type CreateAuthRequest = {
649
- // Required. The OAuth code to exchange for tokens.
654
+ // CallbackRequest is the request message for handling OAuth callbacks.
655
+ export type CallbackRequest = {
656
+ // The type of the identity.
657
+ //
658
+ // Behaviors: REQUIRED
659
+ type: Identity_Type | undefined;
660
+ // The code received from the OAuth provider.
650
661
  //
651
662
  // Behaviors: REQUIRED
652
663
  code: string | undefined;
653
- };
654
-
655
- // RefreshTokenRequest is the request message for RefreshToken.
656
- export type RefreshTokenRequest = {
657
- // Required. The refresh token.
664
+ // The state parameter to prevent CSRF attacks.
658
665
  //
659
666
  // Behaviors: REQUIRED
660
- refreshToken: string | undefined;
667
+ state: string | undefined;
661
668
  };
662
669
 
663
- // AuthService is the authentication service definition.
664
- export interface AuthService {
665
- // Authorize exchanges an OAuth code for access and refresh tokens.
666
- Authorize(request: AuthorizeRequest): Promise<AuthToken>;
667
- // CreateAuth exchanges an OAuth code for access and refresh tokens.
668
- CreateAuth(request: CreateAuthRequest): Promise<wellKnownEmpty>;
669
- // RefreshToken refreshes the access token using a refresh token.
670
- RefreshToken(request: RefreshTokenRequest): Promise<AuthToken>;
670
+ // IdentityService is the identity service definition.
671
+ export interface IdentityService {
672
+ // Register a new identity and user.
673
+ Register(request: RegisterRequest): Promise<routercommonv1_User>;
674
+ // Login an identity and return the associated user.
675
+ Login(request: LoginRequest): Promise<routercommonv1_User>;
676
+ // Logout the current identity.
677
+ Logout(request: wellKnownEmpty): Promise<wellKnownEmpty>;
678
+ // Connect initiates the OAuth connection flow for the given identity.
679
+ Connect(request: ConnectRequest): Promise<wellKnownEmpty>;
680
+ // Callback handles the OAuth callback for the given identity type.
681
+ // The type is specified in the URL path.
682
+ // For example: /v1/identities/GITHUB/callback
683
+ Callback(request: CallbackRequest): Promise<wellKnownEmpty>;
684
+ // UpdatePassword updates the password for the current user.
685
+ UpdatePassword(request: UpdatePasswordRequest): Promise<wellKnownEmpty>;
671
686
  }
672
687
 
673
- export function createAuthServiceClient(
688
+ export function createIdentityServiceClient(
674
689
  handler: RequestHandler
675
- ): AuthService {
690
+ ): IdentityService {
676
691
  return {
677
- Authorize(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
678
- const path = `v1/dashboard/auth/authorize`; // eslint-disable-line quotes
679
- const body = JSON.stringify(request);
692
+ Register(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
693
+ const path = `v1/dashboard/identities/register`; // eslint-disable-line quotes
694
+ const body = JSON.stringify(request?.identity ?? {});
680
695
  const queryParams: string[] = [];
681
696
  let uri = path;
682
697
  if (queryParams.length > 0) {
@@ -687,12 +702,29 @@ export function createAuthServiceClient(
687
702
  method: "POST",
688
703
  body,
689
704
  }, {
690
- service: "AuthService",
691
- method: "Authorize",
692
- }) as Promise<AuthToken>;
705
+ service: "IdentityService",
706
+ method: "Register",
707
+ }) as Promise<routercommonv1_User>;
693
708
  },
694
- CreateAuth(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
695
- const path = `v1/dashboard/auth/create`; // eslint-disable-line quotes
709
+ Login(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
710
+ const path = `v1/dashboard/identities/login`; // eslint-disable-line quotes
711
+ const body = JSON.stringify(request?.identity ?? {});
712
+ const queryParams: string[] = [];
713
+ let uri = path;
714
+ if (queryParams.length > 0) {
715
+ uri += `?${queryParams.join("&")}`
716
+ }
717
+ return handler({
718
+ path: uri,
719
+ method: "POST",
720
+ body,
721
+ }, {
722
+ service: "IdentityService",
723
+ method: "Login",
724
+ }) as Promise<routercommonv1_User>;
725
+ },
726
+ Logout(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
727
+ const path = `v1/dashboard/identities/logout`; // eslint-disable-line quotes
696
728
  const body = JSON.stringify(request);
697
729
  const queryParams: string[] = [];
698
730
  let uri = path;
@@ -704,12 +736,58 @@ export function createAuthServiceClient(
704
736
  method: "POST",
705
737
  body,
706
738
  }, {
707
- service: "AuthService",
708
- method: "CreateAuth",
739
+ service: "IdentityService",
740
+ method: "Logout",
709
741
  }) as Promise<wellKnownEmpty>;
710
742
  },
711
- RefreshToken(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
712
- const path = `v1/dashboard/auth/token`; // eslint-disable-line quotes
743
+ Connect(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
744
+ const path = `v1/dashboard/identities/connect`; // eslint-disable-line quotes
745
+ const body = null;
746
+ const queryParams: string[] = [];
747
+ if (request.type) {
748
+ queryParams.push(`type=${encodeURIComponent(request.type.toString())}`)
749
+ }
750
+ let uri = path;
751
+ if (queryParams.length > 0) {
752
+ uri += `?${queryParams.join("&")}`
753
+ }
754
+ return handler({
755
+ path: uri,
756
+ method: "GET",
757
+ body,
758
+ }, {
759
+ service: "IdentityService",
760
+ method: "Connect",
761
+ }) as Promise<wellKnownEmpty>;
762
+ },
763
+ Callback(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
764
+ if (!request.type) {
765
+ throw new Error("missing required field request.type");
766
+ }
767
+ const path = `v1/dashboard/identities/${request.type}/callback`; // eslint-disable-line quotes
768
+ const body = null;
769
+ const queryParams: string[] = [];
770
+ if (request.code) {
771
+ queryParams.push(`code=${encodeURIComponent(request.code.toString())}`)
772
+ }
773
+ if (request.state) {
774
+ queryParams.push(`state=${encodeURIComponent(request.state.toString())}`)
775
+ }
776
+ let uri = path;
777
+ if (queryParams.length > 0) {
778
+ uri += `?${queryParams.join("&")}`
779
+ }
780
+ return handler({
781
+ path: uri,
782
+ method: "GET",
783
+ body,
784
+ }, {
785
+ service: "IdentityService",
786
+ method: "Callback",
787
+ }) as Promise<wellKnownEmpty>;
788
+ },
789
+ UpdatePassword(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
790
+ const path = `v1/dashboard/identities/password`; // eslint-disable-line quotes
713
791
  const body = JSON.stringify(request);
714
792
  const queryParams: string[] = [];
715
793
  let uri = path;
@@ -718,76 +796,93 @@ export function createAuthServiceClient(
718
796
  }
719
797
  return handler({
720
798
  path: uri,
721
- method: "POST",
799
+ method: "PUT",
722
800
  body,
723
801
  }, {
724
- service: "AuthService",
725
- method: "RefreshToken",
726
- }) as Promise<AuthToken>;
802
+ service: "IdentityService",
803
+ method: "UpdatePassword",
804
+ }) as Promise<wellKnownEmpty>;
727
805
  },
728
806
  };
729
807
  }
730
- // ListModelsResponse is the response message for ListModels.
731
- export type ListModelsRequest = {
732
- // The maximum number of models to return. The service may return fewer than
733
- // this value, even if more models exist.
808
+ // User is the user message.
809
+ export type routercommonv1_User = {
810
+ // The unique ID of the user.
811
+ id: string | undefined;
812
+ // The name of the user.
813
+ name: string | undefined;
814
+ // The email of the user.
815
+ email: string | undefined;
816
+ // The phone number of the user.
817
+ phone: string | undefined;
818
+ // The avatar URL of the user.
819
+ avatar: string | undefined;
820
+ // The status of the user.
821
+ status: routercommonv1_User_Status | undefined;
822
+ // The timestamp at which the user was created.
823
+ createdAt: wellKnownTimestamp | undefined;
824
+ // The latest timestamp at which the user was updated.
825
+ updatedAt: wellKnownTimestamp | undefined;
826
+ };
827
+
828
+ export type routercommonv1_User_Status =
829
+ // Unknown status.
830
+ | "STATUS_UNSPECIFIED"
831
+ // Active user.
832
+ | "ACTIVE"
833
+ // Inactive user.
834
+ | "INACTIVE"
835
+ // Banned user.
836
+ | "BANNED";
837
+ export type ListProvidersRequest = {
838
+ // The maximum number of providers to return. The service may return fewer than
839
+ // this value, even if more providers exist.
734
840
  pageSize: number | undefined;
735
- // A page token, received from a previous `ListModels` call.
841
+ // A page token, received from a previous `ListProviders` call.
736
842
  // Provide this to retrieve the subsequent page.
737
- // When paginating, all other parameters provided to `ListModels` must
843
+ // When paginating, all other parameters provided to `ListProviders` must
738
844
  // match the call that provided the page token.
739
845
  pageToken: string | undefined;
740
846
  // Optional. The standard list filter.
741
847
  // Supported fields:
742
- // * `name` (i.e. `name="gpt-5"`)
743
- // * `author` (i.e. `author="openai"`)
848
+ // * `name` (i.e. `name="openai"`)
744
849
  // More detail in [AIP-160](https://google.aip.dev/160).
745
850
  filter: string | undefined;
746
851
  };
747
852
 
748
- // ListModelsResponse is the response message for ListModels.
749
- export type ListModelsResponse = {
750
- // The list of models.
751
- models: routercommonv1_Model[] | undefined;
853
+ // ListProvidersResponse is the response message for ListProviders.
854
+ export type ListProvidersResponse = {
855
+ // The list of providers.
856
+ providers: routercommonv1_Provider[] | undefined;
752
857
  // A token to retrieve the next page of results.
753
- // Pass this value in the `page_token` field of a subsequent `ListModels`
754
- // request to retrieve the next page of results.
755
- // If this field is omitted, there are no subsequent pages.
756
858
  nextPageToken: string | undefined;
757
859
  };
758
860
 
759
- // Model represents a machine learning model with its metadata.
760
- export type routercommonv1_Model = {
761
- // Unique identifier for the model. (e.g., gpt-5.2-2025-12-11)
762
- id: string | undefined;
763
- // Name of the model. (e.g., GPT-5.2)
764
- name: string | undefined;
765
- // Icon representing the model.
766
- icon: string | undefined;
767
- // Author of the model.
768
- author: string | undefined;
769
- // Website associated with the model.
770
- website: string | undefined;
771
- // Description of the model.
772
- description: string | undefined;
773
- // Indicates if the model is enabled.
774
- enabled: boolean | undefined;
775
- // Timestamps for model creation and last update.
776
- createdAt: wellKnownTimestamp | undefined;
777
- // Timestamp for the last update of the model.
778
- updatedAt: wellKnownTimestamp | undefined;
861
+ // ListProviderModelsResponse is the response message for ListProviderModels.
862
+ export type ListProviderModelsRequest = {
863
+ // The provider feature to list models for.
864
+ feature: string | undefined;
779
865
  };
780
866
 
781
- export interface ModelService {
782
- ListModels(request: ListModelsRequest): Promise<ListModelsResponse>;
867
+ // ListProviderModelsResponse is the response message for ListProviderModels.
868
+ export type ListProviderModelsResponse = {
869
+ // The list of provider models.
870
+ models: string[] | undefined;
871
+ };
872
+
873
+ // ListProvidersRequest is the request message for ListProviders.
874
+ export interface ProviderService {
875
+ // ListProviders lists all available providers.
876
+ ListProviders(request: ListProvidersRequest): Promise<ListProvidersResponse>;
877
+ ListProviderModels(request: ListProviderModelsRequest): Promise<ListProviderModelsResponse>;
783
878
  }
784
879
 
785
- export function createModelServiceClient(
880
+ export function createProviderServiceClient(
786
881
  handler: RequestHandler
787
- ): ModelService {
882
+ ): ProviderService {
788
883
  return {
789
- ListModels(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
790
- const path = `v1/dashboard/models`; // eslint-disable-line quotes
884
+ ListProviders(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
885
+ const path = `v1/dashboard/providers`; // eslint-disable-line quotes
791
886
  const body = null;
792
887
  const queryParams: string[] = [];
793
888
  if (request.pageSize) {
@@ -808,135 +903,153 @@ export function createModelServiceClient(
808
903
  method: "GET",
809
904
  body,
810
905
  }, {
811
- service: "ModelService",
812
- method: "ListModels",
813
- }) as Promise<ListModelsResponse>;
906
+ service: "ProviderService",
907
+ method: "ListProviders",
908
+ }) as Promise<ListProvidersResponse>;
909
+ },
910
+ ListProviderModels(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
911
+ const path = `v1/dashboard/providers/models`; // eslint-disable-line quotes
912
+ const body = null;
913
+ const queryParams: string[] = [];
914
+ if (request.feature) {
915
+ queryParams.push(`feature=${encodeURIComponent(request.feature.toString())}`)
916
+ }
917
+ let uri = path;
918
+ if (queryParams.length > 0) {
919
+ uri += `?${queryParams.join("&")}`
920
+ }
921
+ return handler({
922
+ path: uri,
923
+ method: "GET",
924
+ body,
925
+ }, {
926
+ service: "ProviderService",
927
+ method: "ListProviderModels",
928
+ }) as Promise<ListProviderModelsResponse>;
814
929
  },
815
930
  };
816
931
  }
817
- export type ListProvidersRequest = {
818
- // The maximum number of providers to return. The service may return fewer than
819
- // this value, even if more providers exist.
820
- pageSize: number | undefined;
821
- // A page token, received from a previous `ListProviders` call.
822
- // Provide this to retrieve the subsequent page.
823
- // When paginating, all other parameters provided to `ListProviders` must
824
- // match the call that provided the page token.
825
- pageToken: string | undefined;
826
- // Optional. The standard list filter.
827
- // Supported fields:
828
- // * `name` (i.e. `name="openai"`)
829
- // More detail in [AIP-160](https://google.aip.dev/160).
830
- filter: string | undefined;
932
+ // AuthToken is the authentication token message.
933
+ export type AuthToken = {
934
+ // Required. The access token.
935
+ accessToken: string | undefined;
936
+ // Required. The refresh token.
937
+ refreshToken: string | undefined;
938
+ // Required. The token type.
939
+ expiresAt: wellKnownTimestamp | undefined;
831
940
  };
832
941
 
833
- // ListProvidersResponse is the response message for ListProviders.
834
- export type ListProvidersResponse = {
835
- // The list of providers.
836
- providers: routercommonv1_Provider[] | undefined;
837
- // A token to retrieve the next page of results.
838
- nextPageToken: string | undefined;
942
+ // AuthorizeRequest is the request message for AuthToken.
943
+ export type AuthorizeRequest = {
944
+ // Required. The OAuth code to exchange for tokens.
945
+ //
946
+ // Behaviors: REQUIRED
947
+ code: string | undefined;
948
+ };
949
+
950
+ // CreateAuthRequest is the request message for CreateAuth.
951
+ export type CreateAuthRequest = {
952
+ // Required. The OAuth code to exchange for tokens.
953
+ //
954
+ // Behaviors: REQUIRED
955
+ code: string | undefined;
839
956
  };
840
957
 
841
- // Provider represents a service provider in the system.
842
- export type routercommonv1_Provider = {
843
- // The unique ID of the provider.
844
- id: string | undefined;
845
- // The name of the provider.
846
- name: string | undefined;
847
- // The description of the provider.
848
- description: string | undefined;
849
- // The model name of the provider.
850
- modelId: string | undefined;
851
- // The upstream model of the provider.
852
- upstreamModel: string | undefined;
853
- // The base URL for the provider.
854
- baseUrl: string | undefined;
855
- // The API key for the provider.
856
- apiKey: string | undefined;
857
- // The context window size for the provider.
858
- contextWindow: number | undefined;
859
- // The maximum number of tokens for the provider.
860
- maxTokens: number | undefined;
861
- // Whether the provider is enabled.
862
- enabled: boolean | undefined;
863
- // The timeout duration for requests to the provider.
864
- timeout: wellKnownDuration | undefined;
865
- // The timestamp at which the provider was created.
866
- createdAt: wellKnownTimestamp | undefined;
867
- // The latest timestamp at which the provider was updated.
868
- updatedAt: wellKnownTimestamp | undefined;
869
- // The model type of the provider.
870
- model: routercommonv1_Model | undefined;
958
+ // RefreshTokenRequest is the request message for RefreshToken.
959
+ export type RefreshTokenRequest = {
960
+ // Required. The refresh token.
961
+ //
962
+ // Behaviors: REQUIRED
963
+ refreshToken: string | undefined;
871
964
  };
872
965
 
873
- // Generated output always contains 0, 3, 6, or 9 fractional digits,
874
- // depending on required precision, followed by the suffix "s".
875
- // Accepted are any fractional digits (also none) as long as they fit
876
- // into nano-seconds precision and the suffix "s" is required.
877
- type wellKnownDuration = string;
878
-
879
- // ListProvidersRequest is the request message for ListProviders.
880
- export interface ProviderService {
881
- // ListProviders lists all available providers.
882
- ListProviders(request: ListProvidersRequest): Promise<ListProvidersResponse>;
966
+ // AuthService is the authentication service definition.
967
+ export interface AuthService {
968
+ // Authorize exchanges an OAuth code for access and refresh tokens.
969
+ Authorize(request: AuthorizeRequest): Promise<AuthToken>;
970
+ // CreateAuth exchanges an OAuth code for access and refresh tokens.
971
+ CreateAuth(request: CreateAuthRequest): Promise<wellKnownEmpty>;
972
+ // RefreshToken refreshes the access token using a refresh token.
973
+ RefreshToken(request: RefreshTokenRequest): Promise<AuthToken>;
883
974
  }
884
975
 
885
- export function createProviderServiceClient(
976
+ export function createAuthServiceClient(
886
977
  handler: RequestHandler
887
- ): ProviderService {
978
+ ): AuthService {
888
979
  return {
889
- ListProviders(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
890
- const path = `v1/dashboard/providers`; // eslint-disable-line quotes
891
- const body = null;
980
+ Authorize(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
981
+ const path = `v1/dashboard/auth/authorize`; // eslint-disable-line quotes
982
+ const body = JSON.stringify(request);
892
983
  const queryParams: string[] = [];
893
- if (request.pageSize) {
894
- queryParams.push(`pageSize=${encodeURIComponent(request.pageSize.toString())}`)
895
- }
896
- if (request.pageToken) {
897
- queryParams.push(`pageToken=${encodeURIComponent(request.pageToken.toString())}`)
984
+ let uri = path;
985
+ if (queryParams.length > 0) {
986
+ uri += `?${queryParams.join("&")}`
898
987
  }
899
- if (request.filter) {
900
- queryParams.push(`filter=${encodeURIComponent(request.filter.toString())}`)
988
+ return handler({
989
+ path: uri,
990
+ method: "POST",
991
+ body,
992
+ }, {
993
+ service: "AuthService",
994
+ method: "Authorize",
995
+ }) as Promise<AuthToken>;
996
+ },
997
+ CreateAuth(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
998
+ const path = `v1/dashboard/auth/create`; // eslint-disable-line quotes
999
+ const body = JSON.stringify(request);
1000
+ const queryParams: string[] = [];
1001
+ let uri = path;
1002
+ if (queryParams.length > 0) {
1003
+ uri += `?${queryParams.join("&")}`
901
1004
  }
1005
+ return handler({
1006
+ path: uri,
1007
+ method: "POST",
1008
+ body,
1009
+ }, {
1010
+ service: "AuthService",
1011
+ method: "CreateAuth",
1012
+ }) as Promise<wellKnownEmpty>;
1013
+ },
1014
+ RefreshToken(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
1015
+ const path = `v1/dashboard/auth/token`; // eslint-disable-line quotes
1016
+ const body = JSON.stringify(request);
1017
+ const queryParams: string[] = [];
902
1018
  let uri = path;
903
1019
  if (queryParams.length > 0) {
904
1020
  uri += `?${queryParams.join("&")}`
905
1021
  }
906
1022
  return handler({
907
1023
  path: uri,
908
- method: "GET",
1024
+ method: "POST",
909
1025
  body,
910
1026
  }, {
911
- service: "ProviderService",
912
- method: "ListProviders",
913
- }) as Promise<ListProvidersResponse>;
1027
+ service: "AuthService",
1028
+ method: "RefreshToken",
1029
+ }) as Promise<AuthToken>;
914
1030
  },
915
1031
  };
916
1032
  }
917
- // ListPlansRequest is the request message for ListPlans.
918
- export type ListPlansRequest = {
919
- };
920
-
921
- // ListPlansResponse is the response message for ListPlans.
922
- export type ListPlansResponse = {
923
- // The list of plans.
924
- plans: routercommonv1_Plan[] | undefined;
1033
+ // ActivatePromotionRequest is the request message for ActivatePromotion.
1034
+ export type ActivatePromotionRequest = {
1035
+ // The promotion code to activate.
1036
+ //
1037
+ // Behaviors: REQUIRED
1038
+ code: string | undefined;
925
1039
  };
926
1040
 
927
- // PlanService defines the service for managing plans.
928
- export interface PlanService {
929
- // ListPlans lists all available plans.
930
- ListPlans(request: ListPlansRequest): Promise<ListPlansResponse>;
1041
+ // PromotionService is the subscription service definition.
1042
+ export interface PromotionService {
1043
+ ActivatePromotion(request: ActivatePromotionRequest): Promise<routercommonv1_Promotion>;
931
1044
  }
932
1045
 
933
- export function createPlanServiceClient(
1046
+ export function createPromotionServiceClient(
934
1047
  handler: RequestHandler
935
- ): PlanService {
1048
+ ): PromotionService {
936
1049
  return {
937
- ListPlans(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
938
- const path = `v1/dashboard/plans`; // eslint-disable-line quotes
939
- const body = null;
1050
+ ActivatePromotion(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
1051
+ const path = `v1/dashboard/promotions/activate`; // eslint-disable-line quotes
1052
+ const body = JSON.stringify(request);
940
1053
  const queryParams: string[] = [];
941
1054
  let uri = path;
942
1055
  if (queryParams.length > 0) {
@@ -944,15 +1057,47 @@ export function createPlanServiceClient(
944
1057
  }
945
1058
  return handler({
946
1059
  path: uri,
947
- method: "GET",
1060
+ method: "POST",
948
1061
  body,
949
1062
  }, {
950
- service: "PlanService",
951
- method: "ListPlans",
952
- }) as Promise<ListPlansResponse>;
1063
+ service: "PromotionService",
1064
+ method: "ActivatePromotion",
1065
+ }) as Promise<routercommonv1_Promotion>;
953
1066
  },
954
1067
  };
955
1068
  }
1069
+ // Promotion represents a promotional offer with its details.
1070
+ export type routercommonv1_Promotion = {
1071
+ // Unique identifier for the promotion.
1072
+ id: string | undefined;
1073
+ // Human-entered promotion code.
1074
+ code: string | undefined;
1075
+ // Associated plan id for the promotion.
1076
+ planId: string | undefined;
1077
+ // Associated user id (recipient/owner).
1078
+ userId: string | undefined;
1079
+ // Description of the promotion.
1080
+ description: string | undefined;
1081
+ // Current status of the promotion.
1082
+ status: routercommonv1_Promotion_Status | undefined;
1083
+ // Timestamp when the promotion was redeemed.
1084
+ redeemedAt: wellKnownTimestamp | undefined;
1085
+ // Timestamps for creation and last update.
1086
+ createdAt: wellKnownTimestamp | undefined;
1087
+ // Timestamp for the last update.
1088
+ updatedAt: wellKnownTimestamp | undefined;
1089
+ };
1090
+
1091
+ export type routercommonv1_Promotion_Status =
1092
+ | "STATUS_UNSPECIFIED"
1093
+ // Promotion is available and not redeemed yet.
1094
+ | "AVAILABLE"
1095
+ // Promotion has been redeemed/used.
1096
+ | "REDEEMED"
1097
+ // Promotion has expired.
1098
+ | "EXPIRED"
1099
+ // Promotion has been revoked.
1100
+ | "REVOKED";
956
1101
  // UpdateUserRequest is the request message for the UpdateUser method.
957
1102
  export type UpdateUserRequest = {
958
1103
  // Required. The user to update.
@@ -1017,88 +1162,4 @@ export function createUserServiceClient(
1017
1162
  };
1018
1163
  }
1019
1164
 
1020
- // ListUsagesRequest is the request message for ListUsages.
1021
- export type ListUsagesRequest = {
1022
- // The maximum number of usages to return. The service may return fewer than
1023
- // this value, even if more usages exist.
1024
- pageSize: number | undefined;
1025
- // A page token, received from a previous `ListUsages` call.
1026
- // Provide this to retrieve the subsequent page.
1027
- // When paginating, all other parameters provided to `ListUsages` must
1028
- // match the call that provided the page token.
1029
- pageToken: string | undefined;
1030
- };
1031
-
1032
- // ListUsagesResponse is the response message for ListUsages.
1033
- export type ListUsagesResponse = {
1034
- // The list of usages.
1035
- usages: routercommonv1_Usage[] | undefined;
1036
- };
1037
-
1038
- // Usage represents token usage statistics for a model.
1039
- export type routercommonv1_Usage = {
1040
- // Unique identifier for the usage record.
1041
- id: string | undefined;
1042
- // Identifier of the user associated with this usage.
1043
- userId: string | undefined;
1044
- // Identifier of the model associated with this usage.
1045
- modelId: string | undefined;
1046
- // Unique identifier for the consumer.
1047
- consumerId: string | undefined;
1048
- // Identifier of the provider.
1049
- providerId: string | undefined;
1050
- // Unique identifier for the request associated with this usage.
1051
- requestId: string | undefined;
1052
- // Detailed usage information in JSON format.
1053
- // e.g. {"input_tokens":11,"input_tokens_details":{"cached_tokens":0},"output_tokens":149,"output_tokens_details":{"reasoning_tokens":128},"total_tokens":160}
1054
- tokensDetails: string | undefined;
1055
- // Number of input tokens used.
1056
- inputTokens: number | undefined;
1057
- // Number of output tokens generated.
1058
- outputTokens: number | undefined;
1059
- // Total number of tokens used.
1060
- totalTokens: number | undefined;
1061
- // Timestamps for usage record creation and last update.
1062
- createdAt: wellKnownTimestamp | undefined;
1063
- // Timestamp for the last update of the usage record.
1064
- updatedAt: wellKnownTimestamp | undefined;
1065
- };
1066
-
1067
- // UsageService defines the usage-related RPCs.
1068
- export interface UsageService {
1069
- // ListUsages lists the usage statistics.
1070
- // Implement aggregation queries grouped by day.
1071
- ListUsage(request: ListUsagesRequest): Promise<ListUsagesResponse>;
1072
- }
1073
-
1074
- export function createUsageServiceClient(
1075
- handler: RequestHandler
1076
- ): UsageService {
1077
- return {
1078
- ListUsage(request) { // eslint-disable-line @typescript-eslint/no-unused-vars
1079
- const path = `v1/dashboard/usages`; // eslint-disable-line quotes
1080
- const body = null;
1081
- const queryParams: string[] = [];
1082
- if (request.pageSize) {
1083
- queryParams.push(`pageSize=${encodeURIComponent(request.pageSize.toString())}`)
1084
- }
1085
- if (request.pageToken) {
1086
- queryParams.push(`pageToken=${encodeURIComponent(request.pageToken.toString())}`)
1087
- }
1088
- let uri = path;
1089
- if (queryParams.length > 0) {
1090
- uri += `?${queryParams.join("&")}`
1091
- }
1092
- return handler({
1093
- path: uri,
1094
- method: "GET",
1095
- body,
1096
- }, {
1097
- service: "UsageService",
1098
- method: "ListUsage",
1099
- }) as Promise<ListUsagesResponse>;
1100
- },
1101
- };
1102
- }
1103
-
1104
1165
  // @@protoc_insertion_point(typescript-http-eof)