UNPKG

3.08 kBTypeScriptView Raw
1/*! firebase-admin v10.0.0 */
2/*!
3 * Copyright 2020 Google Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17/**
18 * Firebase ML Model input objects
19 */
20export interface ModelOptionsBase {
21 displayName?: string;
22 tags?: string[];
23}
24export interface GcsTfliteModelOptions extends ModelOptionsBase {
25 tfliteModel: {
26 gcsTfliteUri: string;
27 };
28}
29export interface AutoMLTfliteModelOptions extends ModelOptionsBase {
30 tfliteModel: {
31 automlModel: string;
32 };
33}
34export declare type ModelOptions = ModelOptionsBase | GcsTfliteModelOptions | AutoMLTfliteModelOptions;
35/**
36 * Interface representing options for listing Models.
37 */
38export interface ListModelsOptions {
39 /**
40 * An expression that specifies how to filter the results.
41 *
42 * Examples:
43 *
44 * ```
45 * display_name = your_model
46 * display_name : experimental_*
47 * tags: face_detector AND tags: experimental
48 * state.published = true
49 * ```
50 *
51 * See https://firebase.google.com/docs/ml/manage-hosted-models#list_your_projects_models
52 */
53 filter?: string;
54 /** The number of results to return in each page. */
55 pageSize?: number;
56 /** A token that specifies the result page to return. */
57 pageToken?: string;
58}
59export interface StatusErrorResponse {
60 readonly code: number;
61 readonly message: string;
62}
63export declare type ModelUpdateOptions = ModelOptions & {
64 state?: {
65 published?: boolean;
66 };
67};
68export declare function isGcsTfliteModelOptions(options: ModelOptions): options is GcsTfliteModelOptions;
69export interface ModelContent {
70 readonly displayName?: string;
71 readonly tags?: string[];
72 readonly state?: {
73 readonly validationError?: StatusErrorResponse;
74 readonly published?: boolean;
75 };
76 readonly tfliteModel?: {
77 readonly gcsTfliteUri?: string;
78 readonly automlModel?: string;
79 readonly sizeBytes: number;
80 };
81}
82export interface ModelResponse extends ModelContent {
83 readonly name: string;
84 readonly createTime: string;
85 readonly updateTime: string;
86 readonly etag: string;
87 readonly modelHash?: string;
88 readonly activeOperations?: OperationResponse[];
89}
90export interface ListModelsResponse {
91 readonly models?: ModelResponse[];
92 readonly nextPageToken?: string;
93}
94export interface OperationResponse {
95 readonly name?: string;
96 readonly metadata?: {
97 [key: string]: any;
98 };
99 readonly done: boolean;
100 readonly error?: StatusErrorResponse;
101 readonly response?: ModelResponse;
102}