1 /*
2  * Copyright 2025 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package androidx.appfunctions.internal
18 
19 import androidx.appfunctions.AppFunctionSearchSpec
20 import androidx.appfunctions.metadata.AppFunctionMetadata
21 import androidx.appfunctions.metadata.AppFunctionSchemaMetadata
22 import kotlinx.coroutines.flow.Flow
23 
24 /** Searches AppFunctions. */
25 internal interface AppFunctionReader {
26 
27     /**
28      * Searches for app functions based on the provided search specification.
29      *
30      * @param searchFunctionSpec The search specification, which includes filters for searching
31      *   matching documents.
32      * @return A flow emitting a list of app function metadata matching the search criteria.
33      * @see androidx.appfunctions.AppFunctionSearchSpec
34      */
searchAppFunctionsnull35     fun searchAppFunctions(
36         searchFunctionSpec: AppFunctionSearchSpec
37     ): Flow<List<AppFunctionMetadata>>
38 
39     /**
40      * Returns the [AppFunctionSchemaMetadata] of the given app function. Returns null if the
41      * function is not implementing a predefined schema.
42      *
43      * @throws androidx.appfunctions.AppFunctionFunctionNotFoundException if the function does not
44      *   exist.
45      */
46     suspend fun getAppFunctionSchemaMetadata(
47         functionId: String,
48         packageName: String
49     ): AppFunctionSchemaMetadata?
50 }
51