UNPKG

2.87 kBTypeScriptView Raw
1/*! firebase-admin v12.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 type ModelOptions = ModelOptionsBase | GcsTfliteModelOptions;
30/**
31 * Interface representing options for listing Models.
32 */
33export interface ListModelsOptions {
34 /**
35 * An expression that specifies how to filter the results.
36 *
37 * Examples:
38 *
39 * ```
40 * display_name = your_model
41 * display_name : experimental_*
42 * tags: face_detector AND tags: experimental
43 * state.published = true
44 * ```
45 *
46 * See https://firebase.google.com/docs/ml/manage-hosted-models#list_your_projects_models
47 */
48 filter?: string;
49 /** The number of results to return in each page. */
50 pageSize?: number;
51 /** A token that specifies the result page to return. */
52 pageToken?: string;
53}
54export interface StatusErrorResponse {
55 readonly code: number;
56 readonly message: string;
57}
58export type ModelUpdateOptions = ModelOptions & {
59 state?: {
60 published?: boolean;
61 };
62};
63export declare function isGcsTfliteModelOptions(options: ModelOptions): options is GcsTfliteModelOptions;
64export interface ModelContent {
65 readonly displayName?: string;
66 readonly tags?: string[];
67 readonly state?: {
68 readonly validationError?: StatusErrorResponse;
69 readonly published?: boolean;
70 };
71 readonly tfliteModel?: {
72 readonly gcsTfliteUri?: string;
73 readonly sizeBytes: number;
74 };
75}
76export interface ModelResponse extends ModelContent {
77 readonly name: string;
78 readonly createTime: string;
79 readonly updateTime: string;
80 readonly etag: string;
81 readonly modelHash?: string;
82 readonly activeOperations?: OperationResponse[];
83}
84export interface ListModelsResponse {
85 readonly models?: ModelResponse[];
86 readonly nextPageToken?: string;
87}
88export interface OperationResponse {
89 readonly name?: string;
90 readonly metadata?: {
91 [key: string]: any;
92 };
93 readonly done: boolean;
94 readonly error?: StatusErrorResponse;
95 readonly response?: ModelResponse;
96}