commonMain.app.cash.zipline.ZiplineFunction.kt Maven / Gradle / Ivy
/*
* Copyright (C) 2022 Block, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package app.cash.zipline
/**
* A function defined on an interface that extends [ZiplineService] and that may be bridged.
*/
interface ZiplineFunction {
/**
* A unique id for this function. By default this is the first 6 bytes of the SHA-256 of the
* function's signature, base64-encoded.
*
* These are sample values that correspond to the sample values in [signature].
*
* * "PnpfScGS"
* * "TTdM8O+x"
* * "o+Bha3Rq"
* * "qr+8pXgn"
*/
val id: String
/**
* Returns a string that uniquely identifies this function. Parameter names are omitted. Parameter
* types are fully-qualified.
*
* These are sample values:
*
* * "var count: kotlin.Int"
* * "val count: kotlin.Int"
* * "fun echo(request: EchoRequest): EchoResponse"
* * "suspend fun echo(request: EchoRequest): EchoResponse"
*/
val signature: String
/** True if this function completes asynchronously. */
val isSuspending: Boolean
/** True if this function is [ZiplineService.close]. */
val isClose: Boolean
}