@maxim_mazurok/gapi.client.firebaseml-v2beta 0.0.20240404

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.
Files changed (3) hide show
  1. package/index.d.ts +535 -0
  2. package/package.json +20 -0
  3. package/readme.md +73 -0
package/index.d.ts ADDED
@@ -0,0 +1,535 @@
1
+ /* Type definitions for non-npm package Firebase ML API v2beta 0.0 */
2
+ // Project: https://firebase.google.com
3
+ // Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
4
+ // Nick Amoscato <https://github.com/namoscato>
5
+ // Declan Vong <https://github.com/declanvong>
6
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
7
+
8
+ // IMPORTANT
9
+ // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
10
+ // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
11
+ // Generated from: https://firebaseml.googleapis.com/$discovery/rest?version=v2beta
12
+ // Revision: 20240404
13
+
14
+ /// <reference types="gapi.client" />
15
+
16
+ declare namespace gapi.client {
17
+ /** Load Firebase ML API v2beta */
18
+ function load(
19
+ urlOrObject: 'https://firebaseml.googleapis.com/$discovery/rest?version=v2beta'
20
+ ): Promise<void>;
21
+ /** @deprecated Please load APIs with discovery documents. */
22
+ function load(name: 'firebaseml', version: 'v2beta'): Promise<void>;
23
+ /** @deprecated Please load APIs with discovery documents. */
24
+ function load(
25
+ name: 'firebaseml',
26
+ version: 'v2beta',
27
+ callback: () => any
28
+ ): void;
29
+
30
+ namespace firebaseml {
31
+ interface Blob {
32
+ /** Required. Raw bytes. */
33
+ data?: string;
34
+ /** Required. The IANA standard MIME type of the source data. */
35
+ mimeType?: string;
36
+ }
37
+ interface Candidate {
38
+ /** Output only. Source attribution of the generated content. */
39
+ citationMetadata?: CitationMetadata;
40
+ /** Output only. Content parts of the candidate. */
41
+ content?: Content;
42
+ /** Output only. Describes the reason the mode stopped generating tokens in more detail. This is only filled when `finish_reason` is set. */
43
+ finishMessage?: string;
44
+ /** Output only. The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens. */
45
+ finishReason?: string;
46
+ /** Output only. Metadata specifies sources used to ground generated content. */
47
+ groundingMetadata?: GroundingMetadata;
48
+ /** Output only. Index of the candidate. */
49
+ index?: number;
50
+ /** Output only. List of ratings for the safety of a response candidate. There is at most one rating per category. */
51
+ safetyRatings?: SafetyRating[];
52
+ }
53
+ interface Citation {
54
+ /** Output only. End index into the content. */
55
+ endIndex?: number;
56
+ /** Output only. License of the attribution. */
57
+ license?: string;
58
+ /** Output only. Publication date of the attribution. */
59
+ publicationDate?: Date;
60
+ /** Output only. Start index into the content. */
61
+ startIndex?: number;
62
+ /** Output only. Title of the attribution. */
63
+ title?: string;
64
+ /** Output only. Url reference of the attribution. */
65
+ uri?: string;
66
+ }
67
+ interface CitationMetadata {
68
+ /** Output only. List of citations. */
69
+ citations?: Citation[];
70
+ }
71
+ interface Content {
72
+ /** Required. Ordered `Parts` that constitute a single message. Parts may have different IANA MIME types. */
73
+ parts?: Part[];
74
+ /** Optional. The producer of the content. Must be either 'user' or 'model'. Useful to set for multi-turn conversations, otherwise can be left blank or unset. */
75
+ role?: string;
76
+ }
77
+ interface CountTokensRequest {
78
+ /** Required. Input content. */
79
+ contents?: Content[];
80
+ /** Required. The instances that are the input to token counting call. Schema is identical to the prediction schema of the underlying model. */
81
+ instances?: any[];
82
+ /** Required. The name of the publisher model requested to serve the prediction. Format: `projects/{project}/locations/{location}/publishers/*‍/models/*` */
83
+ model?: string;
84
+ }
85
+ interface CountTokensResponse {
86
+ /** The total number of billable characters counted across all instances from the request. */
87
+ totalBillableCharacters?: number;
88
+ /** The total number of tokens counted across all instances from the request. */
89
+ totalTokens?: number;
90
+ }
91
+ interface Date {
92
+ /** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */
93
+ day?: number;
94
+ /** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
95
+ month?: number;
96
+ /** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
97
+ year?: number;
98
+ }
99
+ interface FileData {
100
+ /** Required. URI. */
101
+ fileUri?: string;
102
+ /** Required. The IANA standard MIME type of the source data. */
103
+ mimeType?: string;
104
+ }
105
+ interface FunctionCall {
106
+ /** Optional. Required. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details. */
107
+ args?: {[P in string]: any};
108
+ /** Required. The name of the function to call. Matches [FunctionDeclaration.name]. */
109
+ name?: string;
110
+ }
111
+ interface FunctionCallingConfig {
112
+ /** Optional. Function names to call. Only set when the Mode is ANY. Function names should match [FunctionDeclaration.name]. With mode set to ANY, model will predict a function call from the set of function names provided. */
113
+ allowedFunctionNames?: string[];
114
+ /** Optional. Function calling mode. */
115
+ mode?: string;
116
+ }
117
+ interface FunctionDeclaration {
118
+ /** Optional. Description and purpose of the function. Model uses it to decide how and whether to call the function. */
119
+ description?: string;
120
+ /** Required. The name of the function to call. Must start with a letter or an underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots and dashes, with a maximum length of 64. */
121
+ name?: string;
122
+ /** Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. Parameter names must start with a letter or an underscore and must only contain chars a-z, A-Z, 0-9, or underscores with a maximum length of 64. Example with 1 required and 1 optional parameter: type: OBJECT properties: param1: type: STRING param2: type: INTEGER required: - param1 */
123
+ parameters?: Schema;
124
+ /** Optional. Describes the output from this function in JSON Schema format. Reflects the Open API 3.03 Response Object. The Schema defines the type used for the response value of the function. */
125
+ response?: Schema;
126
+ }
127
+ interface FunctionResponse {
128
+ /** Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name]. */
129
+ name?: string;
130
+ /** Required. The function response in JSON object format. */
131
+ response?: {[P in string]: any};
132
+ }
133
+ interface GenerateContentRequest {
134
+ /** Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. */
135
+ contents?: Content[];
136
+ /** Optional. Generation config. */
137
+ generationConfig?: GenerationConfig;
138
+ /** Optional. Per request settings for blocking unsafe content. Enforced on GenerateContentResponse.candidates. */
139
+ safetySettings?: SafetySetting[];
140
+ /** Optional. The user provided system instructions for the model. Note: only text should be used in parts and content in each part will be in a separate paragraph. */
141
+ systemInstruction?: Content;
142
+ /** Optional. Tool config. This config is shared for all tools provided in the request. */
143
+ toolConfig?: ToolConfig;
144
+ /** Optional. A list of `Tools` the model may use to generate the next response. A `Tool` is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the model. */
145
+ tools?: Tool[];
146
+ }
147
+ interface GenerateContentResponse {
148
+ /** Output only. Generated candidates. */
149
+ candidates?: Candidate[];
150
+ /** Output only. Content filter results for a prompt sent in the request. Note: Sent only in the first stream chunk. Only happens when no candidates were generated due to content violations. */
151
+ promptFeedback?: PromptFeedback;
152
+ /** Usage metadata about the response(s). */
153
+ usageMetadata?: UsageMetadata;
154
+ }
155
+ interface GenerationConfig {
156
+ /** Optional. Number of candidates to generate. */
157
+ candidateCount?: number;
158
+ /** Optional. Frequency penalties. */
159
+ frequencyPenalty?: number;
160
+ /** Optional. The maximum number of output tokens to generate per message. */
161
+ maxOutputTokens?: number;
162
+ /** Optional. Positive penalties. */
163
+ presencePenalty?: number;
164
+ /** Optional. Output response mimetype of the generated candidate text. Supported mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature. */
165
+ responseMimeType?: string;
166
+ /** Optional. Stop sequences. */
167
+ stopSequences?: string[];
168
+ /** Optional. Controls the randomness of predictions. */
169
+ temperature?: number;
170
+ /** Optional. If specified, top-k sampling will be used. */
171
+ topK?: number;
172
+ /** Optional. If specified, nucleus sampling will be used. */
173
+ topP?: number;
174
+ }
175
+ interface GroundingAttribution {
176
+ /** Optional. Output only. Confidence score of the attribution. Ranges from 0 to 1. 1 is the most confident. */
177
+ confidenceScore?: number;
178
+ /** Optional. Attribution from context retrieved by the retrieval tools. */
179
+ retrievedContext?: RetrievedContext;
180
+ /** Output only. Segment of the content this attribution belongs to. */
181
+ segment?: Segment;
182
+ /** Optional. Attribution from the web. */
183
+ web?: Web;
184
+ }
185
+ interface GroundingMetadata {
186
+ /** Optional. List of grounding attributions. */
187
+ groundingAttributions?: GroundingAttribution[];
188
+ /** Optional. Queries executed by the retrieval tools. */
189
+ retrievalQueries?: string[];
190
+ /** Optional. Web search queries for the following-up web search. */
191
+ webSearchQueries?: string[];
192
+ }
193
+ interface ModelOperationMetadata {
194
+ basicOperationStatus?: string;
195
+ /** The name of the model we are creating/updating The name must have the form `projects/{project_id}/models/{model_id}` */
196
+ name?: string;
197
+ }
198
+ interface Part {
199
+ /** Optional. URI based data. */
200
+ fileData?: FileData;
201
+ /** Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values. */
202
+ functionCall?: FunctionCall;
203
+ /** Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model. */
204
+ functionResponse?: FunctionResponse;
205
+ /** Optional. Inlined bytes data. */
206
+ inlineData?: Blob;
207
+ /** Optional. Text part (can be code). */
208
+ text?: string;
209
+ /** Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data. */
210
+ videoMetadata?: VideoMetadata;
211
+ }
212
+ interface PromptFeedback {
213
+ /** Output only. Blocked reason. */
214
+ blockReason?: string;
215
+ /** Output only. A readable block reason message. */
216
+ blockReasonMessage?: string;
217
+ /** Output only. Safety ratings. */
218
+ safetyRatings?: SafetyRating[];
219
+ }
220
+ interface Retrieval {
221
+ /** Optional. Disable using the result from this tool in detecting grounding attribution. This does not affect how the result is given to the model for generation. */
222
+ disableAttribution?: boolean;
223
+ /** Set to use data source powered by Vertex AI Search. */
224
+ vertexAiSearch?: VertexAISearch;
225
+ /** Set to use data source powered by Vertex RAG store. User data is uploaded via the VertexRagDataService. */
226
+ vertexRagStore?: VertexRagStore;
227
+ }
228
+ interface RetrievedContext {
229
+ /** Output only. Title of the attribution. */
230
+ title?: string;
231
+ /** Output only. URI reference of the attribution. */
232
+ uri?: string;
233
+ }
234
+ interface SafetyRating {
235
+ /** Output only. Indicates whether the content was filtered out because of this rating. */
236
+ blocked?: boolean;
237
+ /** Output only. Harm category. */
238
+ category?: string;
239
+ /** Output only. Harm probability levels in the content. */
240
+ probability?: string;
241
+ /** Output only. Harm probability score. */
242
+ probabilityScore?: number;
243
+ /** Output only. Harm severity levels in the content. */
244
+ severity?: string;
245
+ /** Output only. Harm severity score. */
246
+ severityScore?: number;
247
+ }
248
+ interface SafetySetting {
249
+ /** Required. Harm category. */
250
+ category?: string;
251
+ /** Optional. Specify if the threshold is used for probability or severity score. If not specified, the threshold is used for probability score. */
252
+ method?: string;
253
+ /** Required. The harm block threshold. */
254
+ threshold?: string;
255
+ }
256
+ interface Schema {
257
+ /** Optional. Default value of the data. */
258
+ default?: any;
259
+ /** Optional. The description of the data. */
260
+ description?: string;
261
+ /** Optional. Possible values of the element of Type.STRING with enum format. For example we can define an Enum Direction as : {type:STRING, format:enum, enum:["EAST", NORTH", "SOUTH", "WEST"]} */
262
+ enum?: string[];
263
+ /** Optional. Example of the object. Will only populated when the object is the root. */
264
+ example?: any;
265
+ /** Optional. The format of the data. Supported formats: for NUMBER type: "float", "double" for INTEGER type: "int32", "int64" for STRING type: "email", "byte", etc */
266
+ format?: string;
267
+ /** Optional. SCHEMA FIELDS FOR TYPE ARRAY Schema of the elements of Type.ARRAY. */
268
+ items?: Schema;
269
+ /** Optional. Maximum value of the Type.INTEGER and Type.NUMBER */
270
+ maximum?: number;
271
+ /** Optional. Maximum number of the elements for Type.ARRAY. */
272
+ maxItems?: string;
273
+ /** Optional. Maximum length of the Type.STRING */
274
+ maxLength?: string;
275
+ /** Optional. Maximum number of the properties for Type.OBJECT. */
276
+ maxProperties?: string;
277
+ /** Optional. SCHEMA FIELDS FOR TYPE INTEGER and NUMBER Minimum value of the Type.INTEGER and Type.NUMBER */
278
+ minimum?: number;
279
+ /** Optional. Minimum number of the elements for Type.ARRAY. */
280
+ minItems?: string;
281
+ /** Optional. SCHEMA FIELDS FOR TYPE STRING Minimum length of the Type.STRING */
282
+ minLength?: string;
283
+ /** Optional. Minimum number of the properties for Type.OBJECT. */
284
+ minProperties?: string;
285
+ /** Optional. Indicates if the value may be null. */
286
+ nullable?: boolean;
287
+ /** Optional. Pattern of the Type.STRING to restrict a string to a regular expression. */
288
+ pattern?: string;
289
+ /** Optional. SCHEMA FIELDS FOR TYPE OBJECT Properties of Type.OBJECT. */
290
+ properties?: {[P in string]: Schema};
291
+ /** Optional. Required properties of Type.OBJECT. */
292
+ required?: string[];
293
+ /** Optional. The title of the Schema. */
294
+ title?: string;
295
+ /** Optional. The type of the data. */
296
+ type?: string;
297
+ }
298
+ interface Segment {
299
+ /** Output only. End index in the given Part, measured in bytes. Offset from the start of the Part, exclusive, starting at zero. */
300
+ endIndex?: number;
301
+ /** Output only. The index of a Part object within its parent Content object. */
302
+ partIndex?: number;
303
+ /** Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero. */
304
+ startIndex?: number;
305
+ }
306
+ interface Tool {
307
+ /** Optional. Function tool type. One or more function declarations to be passed to the model along with the current user query. Model may decide to call a subset of these functions by populating FunctionCall in the response. User should provide a FunctionResponse for each function call in the next turn. Based on the function responses, Model will generate the final response back to the user. Maximum 64 function declarations can be provided. */
308
+ functionDeclarations?: FunctionDeclaration[];
309
+ /** Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation. */
310
+ retrieval?: Retrieval;
311
+ }
312
+ interface ToolConfig {
313
+ /** Optional. Function calling config. */
314
+ functionCallingConfig?: FunctionCallingConfig;
315
+ }
316
+ interface UsageMetadata {
317
+ /** Number of tokens in the response(s). */
318
+ candidatesTokenCount?: number;
319
+ /** Number of tokens in the request. */
320
+ promptTokenCount?: number;
321
+ totalTokenCount?: number;
322
+ }
323
+ interface VertexAISearch {
324
+ /** Required. Fully-qualified Vertex AI Search's datastore resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */
325
+ datastore?: string;
326
+ }
327
+ interface VertexRagStore {
328
+ /** Required. Vertex RAG Store corpus resource name: `projects/{project}/locations/{location}/ragCorpora/{ragCorpus}` Currently only one corpus is allowed. In the future we may open up multiple corpora support. However, they should be from the same project and location. */
329
+ ragCorpora?: string[];
330
+ /** Optional. Number of top k results to return from the selected corpora. */
331
+ similarityTopK?: number;
332
+ /** Optional. Only return results with vector distance smaller than the threshold. */
333
+ vectorDistanceThreshold?: number;
334
+ }
335
+ interface VideoMetadata {
336
+ /** Optional. The end offset of the video. */
337
+ endOffset?: string;
338
+ /** Optional. The start offset of the video. */
339
+ startOffset?: string;
340
+ }
341
+ interface Web {
342
+ /** Output only. Title of the attribution. */
343
+ title?: string;
344
+ /** Output only. URI reference of the attribution. */
345
+ uri?: string;
346
+ }
347
+ interface ModelsResource {
348
+ /** Perform a token counting. */
349
+ countTokens(request: {
350
+ /** V1 error format. */
351
+ '$.xgafv'?: string;
352
+ /** OAuth access token. */
353
+ access_token?: string;
354
+ /** Data format for response. */
355
+ alt?: string;
356
+ /** JSONP */
357
+ callback?: string;
358
+ /** Required. The name of the Endpoint requested to perform token counting. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` */
359
+ endpoint: string;
360
+ /** Selector specifying which fields to include in a partial response. */
361
+ fields?: string;
362
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
363
+ key?: string;
364
+ /** OAuth 2.0 token for the current user. */
365
+ oauth_token?: string;
366
+ /** Returns response with indentations and line breaks. */
367
+ prettyPrint?: boolean;
368
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
369
+ quotaUser?: string;
370
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
371
+ upload_protocol?: string;
372
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
373
+ uploadType?: string;
374
+ /** Request body */
375
+ resource: CountTokensRequest;
376
+ }): Request<CountTokensResponse>;
377
+ countTokens(
378
+ request: {
379
+ /** V1 error format. */
380
+ '$.xgafv'?: string;
381
+ /** OAuth access token. */
382
+ access_token?: string;
383
+ /** Data format for response. */
384
+ alt?: string;
385
+ /** JSONP */
386
+ callback?: string;
387
+ /** Required. The name of the Endpoint requested to perform token counting. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}` */
388
+ endpoint: string;
389
+ /** Selector specifying which fields to include in a partial response. */
390
+ fields?: string;
391
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
392
+ key?: string;
393
+ /** OAuth 2.0 token for the current user. */
394
+ oauth_token?: string;
395
+ /** Returns response with indentations and line breaks. */
396
+ prettyPrint?: boolean;
397
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
398
+ quotaUser?: string;
399
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
400
+ upload_protocol?: string;
401
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
402
+ uploadType?: string;
403
+ },
404
+ body: CountTokensRequest
405
+ ): Request<CountTokensResponse>;
406
+ /** Generate content with multimodal inputs. */
407
+ generateContent(request: {
408
+ /** V1 error format. */
409
+ '$.xgafv'?: string;
410
+ /** OAuth access token. */
411
+ access_token?: string;
412
+ /** Data format for response. */
413
+ alt?: string;
414
+ /** JSONP */
415
+ callback?: string;
416
+ /** Selector specifying which fields to include in a partial response. */
417
+ fields?: string;
418
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
419
+ key?: string;
420
+ /** Required. The name of the publisher model requested to serve the prediction. Format: `projects/{project}/locations/{location}/publishers/*‍/models/*` */
421
+ model: string;
422
+ /** OAuth 2.0 token for the current user. */
423
+ oauth_token?: string;
424
+ /** Returns response with indentations and line breaks. */
425
+ prettyPrint?: boolean;
426
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
427
+ quotaUser?: string;
428
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
429
+ upload_protocol?: string;
430
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
431
+ uploadType?: string;
432
+ /** Request body */
433
+ resource: GenerateContentRequest;
434
+ }): Request<GenerateContentResponse>;
435
+ generateContent(
436
+ request: {
437
+ /** V1 error format. */
438
+ '$.xgafv'?: string;
439
+ /** OAuth access token. */
440
+ access_token?: string;
441
+ /** Data format for response. */
442
+ alt?: string;
443
+ /** JSONP */
444
+ callback?: string;
445
+ /** Selector specifying which fields to include in a partial response. */
446
+ fields?: string;
447
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
448
+ key?: string;
449
+ /** Required. The name of the publisher model requested to serve the prediction. Format: `projects/{project}/locations/{location}/publishers/*‍/models/*` */
450
+ model: string;
451
+ /** OAuth 2.0 token for the current user. */
452
+ oauth_token?: string;
453
+ /** Returns response with indentations and line breaks. */
454
+ prettyPrint?: boolean;
455
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
456
+ quotaUser?: string;
457
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
458
+ upload_protocol?: string;
459
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
460
+ uploadType?: string;
461
+ },
462
+ body: GenerateContentRequest
463
+ ): Request<GenerateContentResponse>;
464
+ /** Generate content with multimodal inputs with streaming support. */
465
+ streamGenerateContent(request: {
466
+ /** V1 error format. */
467
+ '$.xgafv'?: string;
468
+ /** OAuth access token. */
469
+ access_token?: string;
470
+ /** Data format for response. */
471
+ alt?: string;
472
+ /** JSONP */
473
+ callback?: string;
474
+ /** Selector specifying which fields to include in a partial response. */
475
+ fields?: string;
476
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
477
+ key?: string;
478
+ /** Required. The name of the publisher model requested to serve the prediction. Format: `projects/{project}/locations/{location}/publishers/*‍/models/*` */
479
+ model: string;
480
+ /** OAuth 2.0 token for the current user. */
481
+ oauth_token?: string;
482
+ /** Returns response with indentations and line breaks. */
483
+ prettyPrint?: boolean;
484
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
485
+ quotaUser?: string;
486
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
487
+ upload_protocol?: string;
488
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
489
+ uploadType?: string;
490
+ /** Request body */
491
+ resource: GenerateContentRequest;
492
+ }): Request<GenerateContentResponse>;
493
+ streamGenerateContent(
494
+ request: {
495
+ /** V1 error format. */
496
+ '$.xgafv'?: string;
497
+ /** OAuth access token. */
498
+ access_token?: string;
499
+ /** Data format for response. */
500
+ alt?: string;
501
+ /** JSONP */
502
+ callback?: string;
503
+ /** Selector specifying which fields to include in a partial response. */
504
+ fields?: string;
505
+ /** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
506
+ key?: string;
507
+ /** Required. The name of the publisher model requested to serve the prediction. Format: `projects/{project}/locations/{location}/publishers/*‍/models/*` */
508
+ model: string;
509
+ /** OAuth 2.0 token for the current user. */
510
+ oauth_token?: string;
511
+ /** Returns response with indentations and line breaks. */
512
+ prettyPrint?: boolean;
513
+ /** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
514
+ quotaUser?: string;
515
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
516
+ upload_protocol?: string;
517
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
518
+ uploadType?: string;
519
+ },
520
+ body: GenerateContentRequest
521
+ ): Request<GenerateContentResponse>;
522
+ }
523
+ interface PublishersResource {
524
+ models: ModelsResource;
525
+ }
526
+ interface LocationsResource {
527
+ publishers: PublishersResource;
528
+ }
529
+ interface ProjectsResource {
530
+ locations: LocationsResource;
531
+ }
532
+
533
+ const projects: ProjectsResource;
534
+ }
535
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.firebaseml-v2beta",
3
+ "version": "0.0.20240404",
4
+ "description": "TypeScript typings for Firebase ML API v2beta",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
8
+ },
9
+ "license": "MIT",
10
+ "author": {
11
+ "name": "Maxim Mazurok",
12
+ "email": "maxim@mazurok.com",
13
+ "url": "https://maxim.mazurok.com"
14
+ },
15
+ "types": "index.d.ts",
16
+ "dependencies": {
17
+ "@types/gapi.client": "*",
18
+ "@types/gapi.client.discovery-v1": "*"
19
+ }
20
+ }
package/readme.md ADDED
@@ -0,0 +1,73 @@
1
+ # TypeScript typings for Firebase ML API v2beta
2
+
3
+ Access custom machine learning models hosted via Firebase ML.
4
+ For detailed description please check [documentation](https://firebase.google.com).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Firebase ML API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.firebaseml-v2beta --save-dev
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ You need to initialize Google API client in your code:
17
+
18
+ ```typescript
19
+ gapi.load('client', () => {
20
+ // now we can use gapi.client
21
+ // ...
22
+ });
23
+ ```
24
+
25
+ Then load api client wrapper:
26
+
27
+ ```typescript
28
+ gapi.client.load(
29
+ 'https://firebaseml.googleapis.com/$discovery/rest?version=v2beta',
30
+ () => {
31
+ // now we can use:
32
+ // gapi.client.firebaseml
33
+ }
34
+ );
35
+ ```
36
+
37
+ ```typescript
38
+ // Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
39
+ gapi.client.load('firebaseml', 'v2beta', () => {
40
+ // now we can use:
41
+ // gapi.client.firebaseml
42
+ });
43
+ ```
44
+
45
+ Don't forget to authenticate your client before sending any request to resources:
46
+
47
+ ```typescript
48
+ // declare client_id registered in Google Developers Console
49
+ var client_id = '',
50
+ scope = [
51
+ // See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
52
+ 'https://www.googleapis.com/auth/cloud-platform',
53
+ ],
54
+ immediate = true;
55
+ // ...
56
+
57
+ gapi.auth.authorize(
58
+ {client_id: client_id, scope: scope, immediate: immediate},
59
+ authResult => {
60
+ if (authResult && !authResult.error) {
61
+ /* handle successful authorization */
62
+ } else {
63
+ /* handle authorization error */
64
+ }
65
+ }
66
+ );
67
+ ```
68
+
69
+ After that you can use Firebase ML API resources: <!-- TODO: make this work for multiple namespaces -->
70
+
71
+ ```typescript
72
+
73
+ ```