1 /*
2  * Copyright 2022 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.credentials
18 
19 import android.os.Bundle
20 
21 /**
22  * Base custom create response class for the credential creation operation made with the
23  * [CreateCustomCredentialRequest].
24  *
25  * If you get a [CreateCustomCredentialResponse] instead of a type-safe response class such as
26  * [CreatePasswordResponse], [CreatePublicKeyCredentialResponse], etc., then you should check if you
27  * have any other library at interest that supports this custom [type] of credential response, and
28  * if so use its parsing utilities to resolve to a type-safe class within that library.
29  *
30  * Note: The Bundle keys for [data] should not be in the form of androidx.credentials.*` as they are
31  * reserved for internal use by this androidx library.
32  *
33  * @param type the credential type determined by the credential-type-specific subclass for custom
34  *   use cases
35  * @param data the response data in the [Bundle] format for custom use cases (note: bundle keys in
36  *   the form of `androidx.credentials.*` and `android.credentials.*` are reserved for internal
37  *   library usage)
38  * @throws IllegalArgumentException If [type] is empty
39  * @throws NullPointerException If [type] or [data] are null
40  */
41 open class CreateCustomCredentialResponse(type: String, data: Bundle) :
<lambda>null42     CreateCredentialResponse(type, data) {
43     init {
44         require(type.isNotEmpty()) { "type should not be empty" }
45     }
46 }
47