diff --git a/dependencies.gradle b/dependencies.gradle
index c56c66a0bd..993a5d760f 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -23,8 +23,8 @@ SOFTWARE.
*/
ext.sdkVersions = [
- code : '19',
- name : '2.4.0',
+ code : '21',
+ name : '2.6.0',
minSdk : 21,
targetSdk : 29,
diff --git a/samples/app/sdk/src/.gitignore b/samples/app/sdk/src/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/samples/app/sdk/src/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/samples/app/sdk/src/build.gradle b/samples/app/sdk/src/build.gradle
new file mode 100644
index 0000000000..65f75acc52
--- /dev/null
+++ b/samples/app/sdk/src/build.gradle
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+apply plugin: 'com.android.application'
+apply plugin: 'kotlin-android'
+apply from: '../../dependencies.gradle'
+
+android {
+ compileSdkVersion "$sdkVersions.compileSdk".toInteger()
+ buildToolsVersion "$sdkVersions.buildTools"
+
+ defaultConfig {
+ applicationId = "com.vk.sdk.sample"
+ minSdkVersion "$sdkVersions.minSdk"
+ targetSdkVersion "$sdkVersions.targetSdk"
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ lintOptions {
+ abortOnError true
+ checkReleaseBuilds true
+ }
+
+ dexOptions {
+ preDexLibraries true
+ javaMaxHeapSize "5g"
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: '*.jar')
+ implementation sdkLibraries.kotlin
+ implementation sdkLibrariesSupport.recyclerView
+ implementation sdkLibrariesSupport.appCompat
+ implementation (sdkLibraries.picasso) { transitive = false }
+ implementation sdkLibraries.okHttp
+
+ implementation project(':libapi-sdk-core')
+ implementation project(':libapi-sdk-api')
+ //implementation 'com.vk:androidsdk:2.0.0'
+}
diff --git a/samples/app/sdk/src/main/AndroidManifest.xml b/samples/app/sdk/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..1846374115
--- /dev/null
+++ b/samples/app/sdk/src/main/AndroidManifest.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/app/sdk/src/main/java/com/vk/sdk/sample/PathUtils.kt b/samples/app/sdk/src/main/java/com/vk/sdk/sample/PathUtils.kt
new file mode 100644
index 0000000000..8233032c4a
--- /dev/null
+++ b/samples/app/sdk/src/main/java/com/vk/sdk/sample/PathUtils.kt
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+package com.vk.sdk.sample
+
+import android.content.Context
+import android.net.Uri
+import android.provider.MediaStore
+
+object PathUtils {
+ fun getPath(context: Context, uri: Uri): String {
+ if (uri.scheme == "file") {
+ if (uri.path != null) return uri.path!!
+ return ""
+ }
+ val proj = arrayOf(MediaStore.Images.Media.DATA)
+ val cursor = context.contentResolver.query(uri, proj, null, null, null)
+ val columnIndex = cursor!!.getColumnIndexOrThrow(MediaStore.Images.Media.DATA)
+ cursor.moveToFirst()
+ return "file://" + cursor.getString(columnIndex)
+ }
+}
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/java/com/vk/sdk/sample/SampleApplication.kt b/samples/app/sdk/src/main/java/com/vk/sdk/sample/SampleApplication.kt
new file mode 100644
index 0000000000..61301210ff
--- /dev/null
+++ b/samples/app/sdk/src/main/java/com/vk/sdk/sample/SampleApplication.kt
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+package com.vk.sdk.sample
+
+import android.app.Application
+import com.vk.api.sdk.VK
+import com.vk.api.sdk.VKTokenExpiredHandler
+
+class SampleApplication: Application() {
+ override fun onCreate() {
+ super.onCreate()
+ VK.addTokenExpiredHandler(tokenTracker)
+ }
+
+ private val tokenTracker = object: VKTokenExpiredHandler {
+ override fun onTokenExpired() {
+ WelcomeActivity.startFrom(this@SampleApplication)
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/java/com/vk/sdk/sample/UserActivity.kt b/samples/app/sdk/src/main/java/com/vk/sdk/sample/UserActivity.kt
new file mode 100644
index 0000000000..d132bb57d6
--- /dev/null
+++ b/samples/app/sdk/src/main/java/com/vk/sdk/sample/UserActivity.kt
@@ -0,0 +1,217 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+package com.vk.sdk.sample
+
+import android.app.Activity
+import android.content.Context
+import android.content.Intent
+import android.net.Uri
+import android.os.Bundle
+import android.text.TextUtils
+import android.util.Log
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import android.widget.*
+import androidx.recyclerview.widget.RecyclerView
+import com.squareup.picasso.Picasso
+import com.vk.api.sdk.VK
+import com.vk.api.sdk.VKApiCallback
+import com.vk.sdk.api.friends.dto.FriendsGetFieldsResponseDto
+import com.vk.sdk.api.friends.methods.FriendsGetFields
+import com.vk.sdk.api.users.dto.UsersFields
+import com.vk.sdk.sample.models.VKUser
+import com.vk.sdk.sample.requests.VKUsersCommand
+import com.vk.sdk.sample.requests.VKWallPostCommand
+
+class UserActivity: Activity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.activity_user)
+
+ val logoutBtn = findViewById(R.id.logoutBtn)
+ logoutBtn.setOnClickListener {
+ VK.logout()
+ WelcomeActivity.startFrom(this)
+ finish()
+ }
+ val shareBtn = findViewById(R.id.shareBtn)
+ shareBtn.setOnClickListener {
+ requestPhoto()
+ }
+
+ requestUsers()
+
+ requestFriends()
+ }
+
+ private fun requestUsers() {
+ VK.execute(VKUsersCommand(), object: VKApiCallback> {
+ override fun success(result: List) {
+ if (!isFinishing && !result.isEmpty()) {
+ val nameTV = findViewById(R.id.nameTV)
+ val user = result[0]
+ nameTV.text = "${user.firstName} ${user.lastName}"
+ nameTV.setOnClickListener(createOnClickListener(user.id))
+
+ val avatarIV = findViewById(R.id.avatarIV)
+ if (!TextUtils.isEmpty(user.photo)) {
+ Picasso.get()
+ .load(user.photo)
+ .error(R.drawable.user_placeholder)
+ .into(avatarIV)
+ } else {
+ avatarIV.setImageResource(R.drawable.user_placeholder)
+ }
+ avatarIV.setOnClickListener(createOnClickListener(user.id))
+ }
+ }
+ override fun fail(error: Exception) {
+ Log.e(TAG, error.toString())
+ }
+ })
+ }
+
+ private fun requestFriends() {
+ val fields = listOf(UsersFields.PHOTO_200)
+ VK.execute(FriendsGetFields(fields = fields), object: VKApiCallback {
+ override fun success(result: FriendsGetFieldsResponseDto) {
+ val friends = result.items
+ if (!isFinishing && friends.isNotEmpty()) {
+ val vkUsers = friends.map { friend ->
+ VKUser(
+ id = friend.id ?: 0,
+ firstName = friend.firstName ?: "",
+ lastName = friend.lastName ?: "",
+ photo = friend.photo200 ?: "",
+ deactivated = friend.deactivated != null
+ )
+ }
+ showFriends(vkUsers)
+ }
+ }
+ override fun fail(error: Exception) {
+ Log.e(TAG, error.toString())
+ }
+ })
+ }
+
+ private fun showFriends(friends: List) {
+ val recyclerView = findViewById(R.id.friendsRV)
+ recyclerView.layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this, RecyclerView.HORIZONTAL, false)
+
+ val adapter = FriendsAdapter()
+ adapter.setData(friends)
+
+ recyclerView.adapter = adapter
+ }
+
+ private fun requestPhoto() {
+ val intent = Intent(Intent.ACTION_PICK)
+ intent.type = "image/*"
+ startActivityForResult(intent, IMAGE_REQ_CODE)
+ }
+
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+ super.onActivityResult(requestCode, resultCode, data)
+ if (requestCode == IMAGE_REQ_CODE) {
+ if (resultCode == RESULT_OK && data != null && data.data != null) {
+ sharePost(Uri.parse(PathUtils.getPath(this, data.data!!)))
+ } else {
+ sharePost()
+ }
+ }
+ }
+
+ private fun sharePost(uri: Uri? = null) {
+ val messageField = findViewById(R.id.messageET)
+
+ val photos = ArrayList()
+ uri?.let {
+ photos.add(it)
+ }
+ VK.execute(VKWallPostCommand(messageField.text.toString(), photos), object: VKApiCallback {
+ override fun success(result: Int) {
+ // TODO Use ToastUtils
+ Toast.makeText(this@UserActivity, R.string.wall_ok, Toast.LENGTH_SHORT).show()
+ }
+
+ override fun fail(error: Exception) {
+ Log.e(TAG, error.toString())
+ }
+ })
+ }
+
+ private fun createOnClickListener(userId: Int) = View.OnClickListener {
+ VK.urlResolver.open(it.context, "https://vk.com/id$userId")
+ }
+
+ inner class FriendsAdapter: RecyclerView.Adapter() {
+ private val friends: MutableList = arrayListOf()
+
+ override fun onCreateViewHolder(parent: ViewGroup, viewType: Int)
+ = UserHolder(parent.context)
+
+ override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
+ (holder as UserHolder).bind(friends[position])
+ }
+
+ fun setData(friends: List) {
+ this.friends.clear()
+ this.friends.addAll(friends)
+ notifyDataSetChanged()
+ }
+
+ override fun getItemCount() = friends.size
+ }
+
+ inner class UserHolder(context: Context?): RecyclerView.ViewHolder(
+ LayoutInflater.from(context).inflate(R.layout.item_user, null)) {
+ private val avatarIV: ImageView = itemView.findViewById(R.id.avatarIV)
+ private val nameTV: TextView = itemView.findViewById(R.id.nameTV)
+
+ fun bind(user: VKUser) {
+ nameTV.text = "${user.firstName} ${user.lastName}"
+ nameTV.setOnClickListener(createOnClickListener(user.id))
+ if (!TextUtils.isEmpty(user.photo)) {
+ Picasso.get().load(user.photo).error(R.drawable.user_placeholder).into(avatarIV)
+ } else {
+ avatarIV.setImageResource(R.drawable.user_placeholder)
+ }
+ avatarIV.setOnClickListener(createOnClickListener(user.id))
+ }
+ }
+
+ companion object {
+ private const val TAG = "UserActivity"
+
+ private const val IMAGE_REQ_CODE = 101
+
+ fun startFrom(context: Context) {
+ val intent = Intent(context, UserActivity::class.java)
+ context.startActivity(intent)
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/java/com/vk/sdk/sample/WelcomeActivity.kt b/samples/app/sdk/src/main/java/com/vk/sdk/sample/WelcomeActivity.kt
new file mode 100644
index 0000000000..37f246bdf3
--- /dev/null
+++ b/samples/app/sdk/src/main/java/com/vk/sdk/sample/WelcomeActivity.kt
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+package com.vk.sdk.sample
+
+import android.app.Activity
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import android.widget.Button
+import com.vk.api.sdk.VK
+import com.vk.api.sdk.auth.VKAccessToken
+import com.vk.api.sdk.auth.VKAuthCallback
+import com.vk.api.sdk.auth.VKScope
+
+class WelcomeActivity: Activity() {
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+ if (VK.isLoggedIn()) {
+ UserActivity.startFrom(this)
+ finish()
+ return
+ }
+ setContentView(R.layout.activity_welcome)
+
+ val loginBtn = findViewById(R.id.loginBtn)
+ loginBtn.setOnClickListener {
+ VK.login(this, arrayListOf(VKScope.WALL, VKScope.PHOTOS))
+ }
+ }
+
+ override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
+ val callback = object: VKAuthCallback {
+ override fun onLogin(token: VKAccessToken) {
+ UserActivity.startFrom(this@WelcomeActivity)
+ finish()
+ }
+
+ override fun onLoginFailed(errorCode: Int) {
+ }
+ }
+ if (!VK.onActivityResult(requestCode, resultCode, data, callback)) {
+ super.onActivityResult(requestCode, resultCode, data)
+ }
+ }
+
+ companion object {
+ fun startFrom(context: Context) {
+ val intent = Intent(context, WelcomeActivity::class.java)
+ intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
+ context.startActivity(intent)
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/java/com/vk/sdk/sample/models/UploadModels.kt b/samples/app/sdk/src/main/java/com/vk/sdk/sample/models/UploadModels.kt
new file mode 100644
index 0000000000..fd74849efc
--- /dev/null
+++ b/samples/app/sdk/src/main/java/com/vk/sdk/sample/models/UploadModels.kt
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+package com.vk.sdk.sample.models
+
+class VKSaveInfo(val id: Int,
+ val albumId: Int,
+ val ownerId: Int) {
+ fun getAttachment() = "photo${ownerId}_$id"
+}
+
+class VKFileUploadInfo(val server: String, val photo: String, val hash: String)
+
+class VKServerUploadInfo(val uploadUrl: String, val albumId: Int, val userId: Int)
+
diff --git a/samples/app/sdk/src/main/java/com/vk/sdk/sample/models/VKUser.kt b/samples/app/sdk/src/main/java/com/vk/sdk/sample/models/VKUser.kt
new file mode 100644
index 0000000000..7b5987e735
--- /dev/null
+++ b/samples/app/sdk/src/main/java/com/vk/sdk/sample/models/VKUser.kt
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+package com.vk.sdk.sample.models
+
+import android.os.Parcel
+import android.os.Parcelable
+import org.json.JSONObject
+
+data class VKUser(
+ val id: Int = 0,
+ val firstName: String = "",
+ val lastName: String = "",
+ val photo: String = "",
+ val deactivated: Boolean = false) : Parcelable {
+
+ constructor(parcel: Parcel) : this(
+ parcel.readInt(),
+ parcel.readString()!!,
+ parcel.readString()!!,
+ parcel.readString()!!,
+ parcel.readByte() != 0.toByte())
+
+ override fun writeToParcel(parcel: Parcel, flags: Int) {
+ parcel.writeInt(id)
+ parcel.writeString(firstName)
+ parcel.writeString(lastName)
+ parcel.writeString(photo)
+ parcel.writeByte(if (deactivated) 1 else 0)
+ }
+
+ override fun describeContents(): Int {
+ return 0
+ }
+
+ companion object CREATOR : Parcelable.Creator {
+ override fun createFromParcel(parcel: Parcel): VKUser {
+ return VKUser(parcel)
+ }
+
+ override fun newArray(size: Int): Array {
+ return arrayOfNulls(size)
+ }
+
+ fun parse(json: JSONObject)
+ = VKUser(id = json.optInt("id", 0),
+ firstName = json.optString("first_name", ""),
+ lastName = json.optString("last_name", ""),
+ photo = json.optString("photo_200", ""),
+ deactivated = json.optBoolean("deactivated", false))
+ }
+}
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/java/com/vk/sdk/sample/requests/VKUsersCommand.kt b/samples/app/sdk/src/main/java/com/vk/sdk/sample/requests/VKUsersCommand.kt
new file mode 100644
index 0000000000..0b1b0e22ed
--- /dev/null
+++ b/samples/app/sdk/src/main/java/com/vk/sdk/sample/requests/VKUsersCommand.kt
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+package com.vk.sdk.sample.requests
+
+import com.vk.api.sdk.VKApiManager
+import com.vk.api.sdk.VKApiResponseParser
+import com.vk.api.sdk.VKMethodCall
+import com.vk.api.sdk.exceptions.VKApiIllegalResponseException
+import com.vk.api.sdk.internal.ApiCommand
+import com.vk.sdk.sample.models.VKUser
+import org.json.JSONException
+import org.json.JSONObject
+
+class VKUsersCommand(private val uids: IntArray = intArrayOf()): ApiCommand>() {
+ override fun onExecute(manager: VKApiManager): List {
+
+ if (uids.isEmpty()) {
+ // if no uids, send user's data
+ val call = VKMethodCall.Builder()
+ .method("users.get")
+ .args("fields", "photo_200")
+ .version(manager.config.version)
+ .build()
+ return manager.execute(call, ResponseApiParser())
+ } else {
+ val result = ArrayList()
+ val chunks = uids.toList().chunked(CHUNK_LIMIT)
+ for (chunk in chunks) {
+ val call = VKMethodCall.Builder()
+ .method("users.get")
+ .args("user_ids", chunk.joinToString(","))
+ .args("fields", "photo_200")
+ .version(manager.config.version)
+ .build()
+ result.addAll(manager.execute(call, ResponseApiParser()))
+ }
+ return result
+ }
+ }
+
+ companion object {
+ const val CHUNK_LIMIT = 900
+ }
+
+ private class ResponseApiParser : VKApiResponseParser> {
+ override fun parse(response: String): List {
+ try {
+ val ja = JSONObject(response).getJSONArray("response")
+ val r = ArrayList(ja.length())
+ for (i in 0 until ja.length()) {
+ val user = VKUser.parse(ja.getJSONObject(i))
+ r.add(user)
+ }
+ return r
+ } catch (ex: JSONException) {
+ throw VKApiIllegalResponseException(ex)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/java/com/vk/sdk/sample/requests/VKWallPostCommand.kt b/samples/app/sdk/src/main/java/com/vk/sdk/sample/requests/VKWallPostCommand.kt
new file mode 100644
index 0000000000..381bdc4b0a
--- /dev/null
+++ b/samples/app/sdk/src/main/java/com/vk/sdk/sample/requests/VKWallPostCommand.kt
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ ******************************************************************************/
+
+package com.vk.sdk.sample.requests
+
+import android.net.Uri
+import com.vk.api.sdk.VKApiManager
+import com.vk.api.sdk.VKApiResponseParser
+import com.vk.api.sdk.VKHttpPostCall
+import com.vk.api.sdk.VKMethodCall
+import com.vk.api.sdk.exceptions.VKApiIllegalResponseException
+import com.vk.api.sdk.internal.ApiCommand
+import com.vk.sdk.sample.models.VKFileUploadInfo
+import com.vk.sdk.sample.models.VKSaveInfo
+import com.vk.sdk.sample.models.VKServerUploadInfo
+import org.json.JSONException
+import org.json.JSONObject
+import java.util.concurrent.TimeUnit
+
+class VKWallPostCommand(private val message: String? = null,
+ private val photos: List = listOf(),
+ private val ownerId: Int = 0,
+ private val friendsOnly: Boolean = false,
+ private val fromGroup: Boolean = false): ApiCommand() {
+ override fun onExecute(manager: VKApiManager): Int {
+ val callBuilder = VKMethodCall.Builder()
+ .method("wall.post")
+ .args("friends_only", if (friendsOnly) 1 else 0)
+ .args("from_group", if (fromGroup) 1 else 0)
+ .version(manager.config.version)
+ message?.let {
+ callBuilder.args("message", it)
+ }
+
+ if (ownerId != 0) {
+ callBuilder.args("owner_id", ownerId)
+ }
+
+ if (photos.isNotEmpty()) {
+ val uploadInfo = getServerUploadInfo(manager)
+ val attachments = photos.map { uploadPhoto(it, uploadInfo, manager) }
+
+ callBuilder.args("attachments", attachments.joinToString(","))
+ }
+
+ return manager.execute(callBuilder.build(), ResponseApiParser())
+ }
+
+ private fun getServerUploadInfo(manager: VKApiManager): VKServerUploadInfo {
+ val uploadInfoCall = VKMethodCall.Builder()
+ .method("photos.getWallUploadServer")
+ .version(manager.config.version)
+ .build()
+ return manager.execute(uploadInfoCall, ServerUploadInfoParser())
+ }
+
+ private fun uploadPhoto(uri: Uri, serverUploadInfo: VKServerUploadInfo, manager: VKApiManager): String {
+ val fileUploadCall = VKHttpPostCall.Builder()
+ .url(serverUploadInfo.uploadUrl)
+ .args("photo", uri, "image.jpg")
+ .timeout(TimeUnit.MINUTES.toMillis(5))
+ .retryCount(RETRY_COUNT)
+ .build()
+ val fileUploadInfo = manager.execute(fileUploadCall, null, FileUploadInfoParser())
+
+ val saveCall = VKMethodCall.Builder()
+ .method("photos.saveWallPhoto")
+ .args("server", fileUploadInfo.server)
+ .args("photo", fileUploadInfo.photo)
+ .args("hash", fileUploadInfo.hash)
+ .version(manager.config.version)
+ .build()
+
+ val saveInfo = manager.execute(saveCall, SaveInfoParser())
+
+ return saveInfo.getAttachment()
+ }
+
+ companion object {
+ const val RETRY_COUNT = 3
+ }
+
+ private class ResponseApiParser : VKApiResponseParser {
+ override fun parse(response: String): Int {
+ try {
+ return JSONObject(response).getJSONObject("response").getInt("post_id")
+ } catch (ex: JSONException) {
+ throw VKApiIllegalResponseException(ex)
+ }
+ }
+ }
+
+ private class ServerUploadInfoParser : VKApiResponseParser {
+ override fun parse(response: String): VKServerUploadInfo{
+ try {
+ val joResponse = JSONObject(response).getJSONObject("response")
+ return VKServerUploadInfo(
+ uploadUrl = joResponse.getString("upload_url"),
+ albumId = joResponse.getInt("album_id"),
+ userId = joResponse.getInt("user_id"))
+ } catch (ex: JSONException) {
+ throw VKApiIllegalResponseException(ex)
+ }
+ }
+ }
+
+ private class FileUploadInfoParser: VKApiResponseParser {
+ override fun parse(response: String): VKFileUploadInfo{
+ try {
+ val joResponse = JSONObject(response)
+ return VKFileUploadInfo(
+ server = joResponse.getString("server"),
+ photo = joResponse.getString("photo"),
+ hash = joResponse.getString("hash")
+ )
+ } catch (ex: JSONException) {
+ throw VKApiIllegalResponseException(ex)
+ }
+ }
+ }
+
+ private class SaveInfoParser: VKApiResponseParser {
+ override fun parse(response: String): VKSaveInfo {
+ try {
+ val joResponse = JSONObject(response).getJSONArray("response").getJSONObject(0)
+ return VKSaveInfo(
+ id = joResponse.getInt("id"),
+ albumId = joResponse.getInt("album_id"),
+ ownerId = joResponse.getInt("owner_id")
+ )
+ } catch (ex: JSONException) {
+ throw VKApiIllegalResponseException(ex)
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/res/drawable-hdpi/user_placeholder.png b/samples/app/sdk/src/main/res/drawable-hdpi/user_placeholder.png
new file mode 100644
index 0000000000..382ce1eeb3
Binary files /dev/null and b/samples/app/sdk/src/main/res/drawable-hdpi/user_placeholder.png differ
diff --git a/samples/app/sdk/src/main/res/drawable-mdpi/user_placeholder.png b/samples/app/sdk/src/main/res/drawable-mdpi/user_placeholder.png
new file mode 100644
index 0000000000..c8c776a3ff
Binary files /dev/null and b/samples/app/sdk/src/main/res/drawable-mdpi/user_placeholder.png differ
diff --git a/samples/app/sdk/src/main/res/drawable-xhdpi/user_placeholder.png b/samples/app/sdk/src/main/res/drawable-xhdpi/user_placeholder.png
new file mode 100644
index 0000000000..135ab86a7c
Binary files /dev/null and b/samples/app/sdk/src/main/res/drawable-xhdpi/user_placeholder.png differ
diff --git a/samples/app/sdk/src/main/res/drawable-xxhdpi/user_placeholder.png b/samples/app/sdk/src/main/res/drawable-xxhdpi/user_placeholder.png
new file mode 100644
index 0000000000..aa65639635
Binary files /dev/null and b/samples/app/sdk/src/main/res/drawable-xxhdpi/user_placeholder.png differ
diff --git a/samples/app/sdk/src/main/res/layout/activity_user.xml b/samples/app/sdk/src/main/res/layout/activity_user.xml
new file mode 100644
index 0000000000..ae0d74d81c
--- /dev/null
+++ b/samples/app/sdk/src/main/res/layout/activity_user.xml
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/res/layout/activity_welcome.xml b/samples/app/sdk/src/main/res/layout/activity_welcome.xml
new file mode 100644
index 0000000000..a2387df589
--- /dev/null
+++ b/samples/app/sdk/src/main/res/layout/activity_welcome.xml
@@ -0,0 +1,12 @@
+
+
+
+
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/res/layout/item_user.xml b/samples/app/sdk/src/main/res/layout/item_user.xml
new file mode 100644
index 0000000000..d9d128411e
--- /dev/null
+++ b/samples/app/sdk/src/main/res/layout/item_user.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/res/mipmap-hdpi/ic_launcher_round.png b/samples/app/sdk/src/main/res/mipmap-hdpi/ic_launcher_round.png
new file mode 100644
index 0000000000..1cff8082da
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-hdpi/ic_launcher_round.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-hdpi/mp_launcher.png b/samples/app/sdk/src/main/res/mipmap-hdpi/mp_launcher.png
new file mode 100644
index 0000000000..463dadcf78
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-hdpi/mp_launcher.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-mdpi/ic_launcher_round.png b/samples/app/sdk/src/main/res/mipmap-mdpi/ic_launcher_round.png
new file mode 100644
index 0000000000..80c2094948
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-mdpi/ic_launcher_round.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-mdpi/mp_launcher.png b/samples/app/sdk/src/main/res/mipmap-mdpi/mp_launcher.png
new file mode 100644
index 0000000000..653c573f73
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-mdpi/mp_launcher.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/samples/app/sdk/src/main/res/mipmap-xhdpi/ic_launcher_round.png
new file mode 100644
index 0000000000..30ca89a078
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-xhdpi/ic_launcher_round.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-xhdpi/mp_launcher.png b/samples/app/sdk/src/main/res/mipmap-xhdpi/mp_launcher.png
new file mode 100644
index 0000000000..8dbdd03dde
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-xhdpi/mp_launcher.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/samples/app/sdk/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000000..908ba994b9
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-xxhdpi/ic_launcher_round.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-xxhdpi/mp_launcher.png b/samples/app/sdk/src/main/res/mipmap-xxhdpi/mp_launcher.png
new file mode 100644
index 0000000000..e80e1f832f
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-xxhdpi/mp_launcher.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/samples/app/sdk/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
new file mode 100644
index 0000000000..e7b10004dd
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png differ
diff --git a/samples/app/sdk/src/main/res/mipmap-xxxhdpi/mp_launcher.png b/samples/app/sdk/src/main/res/mipmap-xxxhdpi/mp_launcher.png
new file mode 100644
index 0000000000..420303acf7
Binary files /dev/null and b/samples/app/sdk/src/main/res/mipmap-xxxhdpi/mp_launcher.png differ
diff --git a/samples/app/sdk/src/main/res/values-es/strings.xml b/samples/app/sdk/src/main/res/values-es/strings.xml
new file mode 100644
index 0000000000..6e5ee98ae8
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values-es/strings.xml
@@ -0,0 +1,8 @@
+
+
+ Войти
+ Выйти
+ Publicar en el muro
+ Ваше сообщение
+ Publicada
+
diff --git a/samples/app/sdk/src/main/res/values-kk/strings.xml b/samples/app/sdk/src/main/res/values-kk/strings.xml
new file mode 100644
index 0000000000..30daba69f7
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values-kk/strings.xml
@@ -0,0 +1,8 @@
+
+
+ Кіру
+ Шығу
+ Қабырғаға жіберу
+ Хабарламаңыз
+ Жазба жарияланды
+
diff --git a/samples/app/sdk/src/main/res/values-pt/strings.xml b/samples/app/sdk/src/main/res/values-pt/strings.xml
new file mode 100644
index 0000000000..c02be6543a
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values-pt/strings.xml
@@ -0,0 +1,8 @@
+
+
+ Entrar
+ Sair
+ Publicar no mural
+ Sua mensagem
+ Post publicado
+
diff --git a/samples/app/sdk/src/main/res/values-ru/strings.xml b/samples/app/sdk/src/main/res/values-ru/strings.xml
new file mode 100644
index 0000000000..3d25d4fda2
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values-ru/strings.xml
@@ -0,0 +1,8 @@
+
+
+ Войти
+ Выйти
+ Отправить на стену
+ Ваше сообщение
+ Запись опубликована
+
diff --git a/samples/app/sdk/src/main/res/values-uk/strings.xml b/samples/app/sdk/src/main/res/values-uk/strings.xml
new file mode 100644
index 0000000000..9a3b38adb3
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values-uk/strings.xml
@@ -0,0 +1,8 @@
+
+
+ Увійти
+ Вийти
+ Опублікувати на стіні
+ Ваше повідомлення
+ Запис опубліковано
+
diff --git a/samples/app/sdk/src/main/res/values/attrs.xml b/samples/app/sdk/src/main/res/values/attrs.xml
new file mode 100644
index 0000000000..110c13e5d4
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values/attrs.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/samples/app/sdk/src/main/res/values/colors.xml b/samples/app/sdk/src/main/res/values/colors.xml
new file mode 100644
index 0000000000..3ab3e9cbce
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values/colors.xml
@@ -0,0 +1,6 @@
+
+
+ #3F51B5
+ #303F9F
+ #FF4081
+
diff --git a/samples/app/sdk/src/main/res/values/strings.xml b/samples/app/sdk/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..7298c9baa9
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values/strings.xml
@@ -0,0 +1,8 @@
+
+
+ Войти
+ Выйти
+ Отправить на стену
+ Ваше сообщение
+ Posted
+
diff --git a/samples/app/sdk/src/main/res/values/styles.xml b/samples/app/sdk/src/main/res/values/styles.xml
new file mode 100644
index 0000000000..f047d9fa04
--- /dev/null
+++ b/samples/app/sdk/src/main/res/values/styles.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
diff --git a/samples/app/sdk/src/main/res/xml/network_security_config.xml b/samples/app/sdk/src/main/res/xml/network_security_config.xml
new file mode 100644
index 0000000000..8ec5168796
--- /dev/null
+++ b/samples/app/sdk/src/main/res/xml/network_security_config.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vk-sdk-api/README.md b/vk-sdk-api/README.md
index 7fc87b2404..d74e99a23e 100644
--- a/vk-sdk-api/README.md
+++ b/vk-sdk-api/README.md
@@ -1,7 +1,7 @@
VK SDK api for Android
==========
-Current version is 5.122
+Current version is 5.126
there are 3 packages now
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/Constants.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/Constants.kt
index bd0da18a2a..986760ab19 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/Constants.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/Constants.kt
@@ -30,5 +30,5 @@ package com.vk.sdk.api
import kotlin.String
object Constants {
- const val API_VERSION: String = "5.122"
+ const val API_VERSION: String = "5.126"
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/GsonHolder.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/GsonHolder.kt
index 7d3d848690..2e7faadcef 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/GsonHolder.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/GsonHolder.kt
@@ -47,6 +47,8 @@ object GsonHolder {
com.vk.sdk.api.ads.dto.AdsGetUploadURLAdFormat.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.ads.dto.AdsGetCampaignsFields::class.java,
com.vk.sdk.api.ads.dto.AdsGetCampaignsFields.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.ads.dto.AdsAccessRolePublic::class.java,
+ com.vk.sdk.api.ads.dto.AdsAccessRolePublic.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.ads.dto.AdsGetDemographicsIdsType::class.java,
com.vk.sdk.api.ads.dto.AdsGetDemographicsIdsType.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.ads.dto.AdsAdApproved::class.java,
@@ -125,6 +127,8 @@ object GsonHolder {
com.vk.sdk.api.wall.dto.WallGetFilter.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.wall.dto.WallPostSourceType::class.java,
com.vk.sdk.api.wall.dto.WallPostSourceType.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.wall.dto.WallWallpostDonut.EditMode::class.java,
+ com.vk.sdk.api.wall.dto.WallWallpostDonut.EditMode.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.wall.dto.WallReportCommentReason::class.java,
com.vk.sdk.api.wall.dto.WallReportCommentReason.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.messages.dto.MessagesGetHistoryAttachmentsMediaType::class.java,
@@ -145,6 +149,8 @@ object GsonHolder {
com.vk.sdk.api.messages.dto.MessagesGetConversationsFilter.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.owner.dto.OwnerState.State::class.java,
com.vk.sdk.api.owner.dto.OwnerState.State.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.donut.dto.DonutDonatorSubscriptionInfo.Status::class.java,
+ com.vk.sdk.api.donut.dto.DonutDonatorSubscriptionInfo.Status.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.board.dto.BoardDefaultOrder::class.java,
com.vk.sdk.api.board.dto.BoardDefaultOrder.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.board.dto.BoardGetTopicsOrder::class.java,
@@ -161,10 +167,6 @@ object GsonHolder {
com.vk.sdk.api.likes.dto.LikesGetListFriendsOnly.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.auth.dto.AuthRestoreResponseDto.Success::class.java,
com.vk.sdk.api.auth.dto.AuthRestoreResponseDto.Success.Serializer())
- builder.registerTypeAdapter(com.vk.sdk.api.leads.dto.LeadsCheckedResult::class.java,
- com.vk.sdk.api.leads.dto.LeadsCheckedResult.Serializer())
- builder.registerTypeAdapter(com.vk.sdk.api.leads.dto.LeadsGetUsersStatus::class.java,
- com.vk.sdk.api.leads.dto.LeadsGetUsersStatus.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.appWidgets.dto.AppWidgetsGetAppImageUploadServerImageType::class.java,
com.vk.sdk.api.appWidgets.dto.AppWidgetsGetAppImageUploadServerImageType.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.appWidgets.dto.AppWidgetsGetAppImagesImageType::class.java,
@@ -209,8 +211,6 @@ object GsonHolder {
com.vk.sdk.api.groups.dto.GroupsOwnerXtrBanInfoType.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsGroupSubject::class.java,
com.vk.sdk.api.groups.dto.GroupsGroupSubject.Serializer())
- builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsGroupXtrInvitedByAdminLevel::class.java,
- com.vk.sdk.api.groups.dto.GroupsGroupXtrInvitedByAdminLevel.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsRoleOptions::class.java,
com.vk.sdk.api.groups.dto.GroupsRoleOptions.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsGroupAdminLevel::class.java,
@@ -233,8 +233,6 @@ object GsonHolder {
com.vk.sdk.api.groups.dto.GroupsGroupVideo.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsSearchSort::class.java,
com.vk.sdk.api.groups.dto.GroupsSearchSort.Serializer())
- builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsGroupXtrInvitedByType::class.java,
- com.vk.sdk.api.groups.dto.GroupsGroupXtrInvitedByType.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsSettingsTwitter.Status::class.java,
com.vk.sdk.api.groups.dto.GroupsSettingsTwitter.Status.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsFilter::class.java,
@@ -251,6 +249,8 @@ object GsonHolder {
com.vk.sdk.api.groups.dto.GroupsGetMembersFilter.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsAddressWorkInfoStatus::class.java,
com.vk.sdk.api.groups.dto.GroupsAddressWorkInfoStatus.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsUserXtrRole.WallDefault::class.java,
+ com.vk.sdk.api.groups.dto.GroupsUserXtrRole.WallDefault.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsGroupWiki::class.java,
com.vk.sdk.api.groups.dto.GroupsGroupWiki.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsTagAddTagColor::class.java,
@@ -295,6 +295,8 @@ object GsonHolder {
com.vk.sdk.api.groups.dto.GroupsGroupWall.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsEditAgeLimits::class.java,
com.vk.sdk.api.groups.dto.GroupsEditAgeLimits.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsGroupSuggestedPrivacy::class.java,
+ com.vk.sdk.api.groups.dto.GroupsGroupSuggestedPrivacy.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsGetInvitedUsersNameCase::class.java,
com.vk.sdk.api.groups.dto.GroupsGetInvitedUsersNameCase.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.groups.dto.GroupsGroupAgeLimits::class.java,
@@ -345,6 +347,8 @@ object GsonHolder {
com.vk.sdk.api.users.dto.UsersSearchSort.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.users.dto.UsersUserRelation::class.java,
com.vk.sdk.api.users.dto.UsersUserRelation.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.users.dto.UsersUserXtrCounters.WallDefault::class.java,
+ com.vk.sdk.api.users.dto.UsersUserXtrCounters.WallDefault.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.users.dto.UsersRelative.Type::class.java,
com.vk.sdk.api.users.dto.UsersRelative.Type.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.users.dto.UsersGetNameCase::class.java,
@@ -353,6 +357,8 @@ object GsonHolder {
com.vk.sdk.api.users.dto.UsersGetFollowersNameCase.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.users.dto.UsersReportType::class.java,
com.vk.sdk.api.users.dto.UsersReportType.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.users.dto.UsersUserFull.WallDefault::class.java,
+ com.vk.sdk.api.users.dto.UsersUserFull.WallDefault.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.users.dto.UsersFields::class.java,
com.vk.sdk.api.users.dto.UsersFields.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.users.dto.UsersSearchStatus::class.java,
@@ -381,12 +387,16 @@ object GsonHolder {
com.vk.sdk.api.callback.dto.CallbackGroupMarket.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.callback.dto.CallbackGroupJoinType::class.java,
com.vk.sdk.api.callback.dto.CallbackGroupJoinType.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.friends.dto.FriendsUserXtrLists.WallDefault::class.java,
+ com.vk.sdk.api.friends.dto.FriendsUserXtrLists.WallDefault.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.friends.dto.FriendsSearchNameCase::class.java,
com.vk.sdk.api.friends.dto.FriendsSearchNameCase.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.friends.dto.FriendsGetSuggestionsNameCase::class.java,
com.vk.sdk.api.friends.dto.FriendsGetSuggestionsNameCase.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.friends.dto.FriendsGetRequestsSort::class.java,
com.vk.sdk.api.friends.dto.FriendsGetRequestsSort.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.friends.dto.FriendsUserXtrPhone.WallDefault::class.java,
+ com.vk.sdk.api.friends.dto.FriendsUserXtrPhone.WallDefault.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.friends.dto.FriendsGetOrder::class.java,
com.vk.sdk.api.friends.dto.FriendsGetOrder.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.friends.dto.FriendsGetNameCase::class.java,
@@ -491,22 +501,28 @@ object GsonHolder {
com.vk.sdk.api.base.dto.BaseBoolInt.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.base.dto.BaseLinkButtonActionType::class.java,
com.vk.sdk.api.base.dto.BaseLinkButtonActionType.Serializer())
- builder.registerTypeAdapter(com.vk.sdk.api.base.dto.BaseLinkProductStatus.Value::class.java,
- com.vk.sdk.api.base.dto.BaseLinkProductStatus.Value.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.base.dto.BaseLinkProductStatus::class.java,
+ com.vk.sdk.api.base.dto.BaseLinkProductStatus.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.stats.dto.StatsGetInterval::class.java,
com.vk.sdk.api.stats.dto.StatsGetInterval.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.widgets.dto.WidgetsCommentMediaType::class.java,
com.vk.sdk.api.widgets.dto.WidgetsCommentMediaType.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedItemDigestFooterButton.Style::class.java,
+ com.vk.sdk.api.newsfeed.dto.NewsfeedItemDigestFooterButton.Style.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedItemWallpostFeedbackType::class.java,
com.vk.sdk.api.newsfeed.dto.NewsfeedItemWallpostFeedbackType.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedItemDigest.Template::class.java,
com.vk.sdk.api.newsfeed.dto.NewsfeedItemDigest.Template.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedItemDigestHeader.Style::class.java,
+ com.vk.sdk.api.newsfeed.dto.NewsfeedItemDigestHeader.Style.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedNewsfeedItemType::class.java,
com.vk.sdk.api.newsfeed.dto.NewsfeedNewsfeedItemType.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedItemWallpostType::class.java,
com.vk.sdk.api.newsfeed.dto.NewsfeedItemWallpostType.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedUnsubscribeType::class.java,
com.vk.sdk.api.newsfeed.dto.NewsfeedUnsubscribeType.Serializer())
+ builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedItemDigestFooter.Style::class.java,
+ com.vk.sdk.api.newsfeed.dto.NewsfeedItemDigestFooter.Style.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedFilters::class.java,
com.vk.sdk.api.newsfeed.dto.NewsfeedFilters.Serializer())
builder.registerTypeAdapter(com.vk.sdk.api.newsfeed.dto.NewsfeedGetBannedNameCase::class.java,
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountAccountCounters.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountAccountCounters.kt
index e5d74950c3..adb35d2bb4 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountAccountCounters.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountAccountCounters.kt
@@ -40,6 +40,7 @@ import kotlin.Int
* @param gifts New gifts number
* @param groups New groups number
* @param menuDiscoverBadge
+ * @param menuClipsBadge no description
* @param messages New messages number
* @param memories New memories number
* @param notes New notes number
@@ -66,6 +67,8 @@ data class AccountAccountCounters(
val groups: Int? = null,
@SerializedName(value="menu_discover_badge")
val menuDiscoverBadge: Int? = null,
+ @SerializedName(value="menu_clips_badge")
+ val menuClipsBadge: Int? = null,
@SerializedName(value="messages")
val messages: Int? = null,
@SerializedName(value="memories")
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountGetCountersFilter.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountGetCountersFilter.kt
index 850c27891a..f60c7513e4 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountGetCountersFilter.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountGetCountersFilter.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -56,12 +61,23 @@ enum class AccountGetCountersFilter(
FRIENDS_SUGGESTIONS("friends_suggestions");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AccountGetCountersFilter?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountGetCountersFilter = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountGetCountersFilter {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountGetInfoFields.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountGetInfoFields.kt
index 9a10b28a4d..b80314735f 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountGetInfoFields.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountGetInfoFields.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -48,12 +53,23 @@ enum class AccountGetInfoFields(
LANG("lang");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer
+ {
+ override fun serialize(
+ src: AccountGetInfoFields?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountGetInfoFields = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountGetInfoFields {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountNameRequestStatus.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountNameRequestStatus.kt
index b5d78588df..ec4eb46af5 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountNameRequestStatus.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountNameRequestStatus.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -52,12 +57,23 @@ enum class AccountNameRequestStatus(
RESPONSE_WITH_LINK("response_with_link");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AccountNameRequestStatus?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountNameRequestStatus = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountNameRequestStatus {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountOffer.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountOffer.kt
index e441a22f71..0f79c60202 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountOffer.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountOffer.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import com.google.gson.annotations.SerializedName
import java.lang.reflect.Type
import kotlin.Float
@@ -85,13 +90,23 @@ data class AccountOffer(
APP("app");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: LinkType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): LinkType = values().first { it.value.toString() == json!!.asJsonPrimitive.toString()
- }
+ ): LinkType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsMode.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsMode.kt
index d7d117b3a4..ad2470a6f5 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsMode.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsMode.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -44,12 +49,23 @@ enum class AccountPushParamsMode(
NO_TEXT("no_text");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AccountPushParamsMode?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountPushParamsMode = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountPushParamsMode {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsOnoff.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsOnoff.kt
index 55fbf34b4e..bcf7ce8b30 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsOnoff.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsOnoff.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,23 @@ enum class AccountPushParamsOnoff(
OFF("off");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AccountPushParamsOnoff?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountPushParamsOnoff = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountPushParamsOnoff {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsSettings.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsSettings.kt
index 54af9a930a..0a9440475c 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsSettings.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountPushParamsSettings.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -42,12 +47,23 @@ enum class AccountPushParamsSettings(
FR_OF_FR("fr_of_fr");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AccountPushParamsSettings?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountPushParamsSettings = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountPushParamsSettings {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoBdateVisibility.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoBdateVisibility.kt
index 6f7f566106..3cdec8077c 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoBdateVisibility.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoBdateVisibility.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -42,12 +47,23 @@ enum class AccountSaveProfileInfoBdateVisibility(
HIDE(0);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AccountSaveProfileInfoBdateVisibility?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountSaveProfileInfoBdateVisibility = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountSaveProfileInfoBdateVisibility {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoRelation.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoRelation.kt
index b0e875eb1f..a0c5e3164e 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoRelation.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoRelation.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -52,12 +57,23 @@ enum class AccountSaveProfileInfoRelation(
NOT_SPECIFIED(0);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AccountSaveProfileInfoRelation?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountSaveProfileInfoRelation = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountSaveProfileInfoRelation {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoSex.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoSex.kt
index 730d333d0f..338597d71a 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoSex.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/account/dto/AccountSaveProfileInfoSex.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.account.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -42,12 +47,23 @@ enum class AccountSaveProfileInfoSex(
MALE(2);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AccountSaveProfileInfoSex?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AccountSaveProfileInfoSex = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AccountSaveProfileInfoSex {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/addresses/dto/AddressesFields.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/addresses/dto/AddressesFields.kt
index c2165a678f..d7c0ad42d3 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/addresses/dto/AddressesFields.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/addresses/dto/AddressesFields.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.addresses.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -66,12 +71,22 @@ enum class AddressesFields(
HAS_VK_TAXI("has_vk_taxi");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AddressesFields?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AddressesFields = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AddressesFields {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccessRole.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccessRole.kt
index 17ff1fdc3c..3c06cc0a53 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccessRole.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccessRole.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -42,12 +47,22 @@ enum class AdsAccessRole(
REPORTS("reports");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsAccessRole?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsAccessRole = values().first { it.value.toString() == json!!.asJsonPrimitive.toString()
- }
+ ): AdsAccessRole {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccessRolePublic.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccessRolePublic.kt
new file mode 100644
index 0000000000..0f577f7416
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccessRolePublic.kt
@@ -0,0 +1,66 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.ads.dto
+
+import com.google.gson.JsonDeserializationContext
+import com.google.gson.JsonDeserializer
+import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
+import java.lang.reflect.Type
+import kotlin.String
+
+enum class AdsAccessRolePublic(
+ val value: String
+) {
+ MANAGER("manager"),
+
+ REPORTS("reports");
+
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsAccessRolePublic?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
+ override fun deserialize(
+ json: JsonElement?,
+ typeOfT: Type?,
+ context: JsonDeserializationContext?
+ ): AdsAccessRolePublic {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
+ }
+}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccount.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccount.kt
index af0de61e81..b4a2498688 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccount.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccount.kt
@@ -29,6 +29,7 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.annotations.SerializedName
import com.vk.sdk.api.base.dto.BaseBoolInt
+import kotlin.Boolean
import kotlin.Int
import kotlin.String
@@ -38,6 +39,7 @@ import kotlin.String
* @param accountStatus Information whether account is active
* @param accountType no description
* @param accountName Account name
+ * @param canViewBudget Can user view account budget
*/
data class AdsAccount(
@SerializedName(value="access_role")
@@ -49,5 +51,7 @@ data class AdsAccount(
@SerializedName(value="account_type")
val accountType: AdsAccountType,
@SerializedName(value="account_name")
- val accountName: String
+ val accountName: String,
+ @SerializedName(value="can_view_budget")
+ val canViewBudget: Boolean
)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccountType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccountType.kt
index 51299f0738..cb8d5f7125 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccountType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAccountType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,22 @@ enum class AdsAccountType(
AGENCY("agency");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsAccountType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsAccountType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsAccountType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdApproved.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdApproved.kt
index 0bec348c38..90d1d984b3 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdApproved.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdApproved.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -44,12 +49,22 @@ enum class AdsAdApproved(
REJECTED(3);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsAdApproved?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsAdApproved = values().first { it.value.toString() == json!!.asJsonPrimitive.toString()
- }
+ ): AdsAdApproved {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdCostType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdCostType.kt
index 6d66ced903..f4211780b6 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdCostType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdCostType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -44,12 +49,22 @@ enum class AdsAdCostType(
PER_IMPRESSIONS_OPTIMIZED(3);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsAdCostType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsAdCostType = values().first { it.value.toString() == json!!.asJsonPrimitive.toString()
- }
+ ): AdsAdCostType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdStatus.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdStatus.kt
index 046bbb515f..2a57d15249 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdStatus.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsAdStatus.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -42,11 +47,22 @@ enum class AdsAdStatus(
DELETED(2);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsAdStatus?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsAdStatus = values().first { it.value.toString() == json!!.asJsonPrimitive.toString() }
+ ): AdsAdStatus {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCampaignStatus.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCampaignStatus.kt
index 7cdcd6b4f7..174f2dfcc3 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCampaignStatus.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCampaignStatus.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -42,12 +47,22 @@ enum class AdsCampaignStatus(
DELETED(2);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsCampaignStatus?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsCampaignStatus = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsCampaignStatus {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCampaignType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCampaignType.kt
index 0246371520..c13243649c 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCampaignType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCampaignType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -44,12 +49,22 @@ enum class AdsCampaignType(
PROMOTED_POSTS("promoted_posts");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsCampaignType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsCampaignType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsCampaignType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCheckLinkLinkType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCheckLinkLinkType.kt
index ad39bd3b5a..900db980d4 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCheckLinkLinkType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCheckLinkLinkType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -46,12 +51,23 @@ enum class AdsCheckLinkLinkType(
SITE("site");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer
+ {
+ override fun serialize(
+ src: AdsCheckLinkLinkType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsCheckLinkLinkType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsCheckLinkLinkType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCriteriaSex.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCriteriaSex.kt
index 84de769fb7..6370591194 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCriteriaSex.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsCriteriaSex.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -42,12 +47,22 @@ enum class AdsCriteriaSex(
FEMALE(2);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsCriteriaSex?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsCriteriaSex = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsCriteriaSex {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetCampaignsFields.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetCampaignsFields.kt
index af8f03a610..ae52907969 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetCampaignsFields.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetCampaignsFields.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -38,12 +43,23 @@ enum class AdsGetCampaignsFields(
) {
ADS_COUNT("ads_count");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetCampaignsFields?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetCampaignsFields = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetCampaignsFields {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetDemographicsIdsType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetDemographicsIdsType.kt
index fd0e480910..b44e889897 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetDemographicsIdsType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetDemographicsIdsType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,23 @@ enum class AdsGetDemographicsIdsType(
CAMPAIGN("campaign");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetDemographicsIdsType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetDemographicsIdsType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetDemographicsIdsType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetDemographicsPeriod.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetDemographicsPeriod.kt
index c75dedfa34..c29126e8fd 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetDemographicsPeriod.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetDemographicsPeriod.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -42,12 +47,23 @@ enum class AdsGetDemographicsPeriod(
OVERALL("overall");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetDemographicsPeriod?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetDemographicsPeriod = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetDemographicsPeriod {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetPostsReachIdsType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetPostsReachIdsType.kt
index 8cff4ea854..be76bd43e4 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetPostsReachIdsType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetPostsReachIdsType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,23 @@ enum class AdsGetPostsReachIdsType(
CAMPAIGN("campaign");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetPostsReachIdsType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetPostsReachIdsType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetPostsReachIdsType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsIdsType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsIdsType.kt
index 9aa4617bea..22f81b63c3 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsIdsType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsIdsType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -44,12 +49,23 @@ enum class AdsGetStatisticsIdsType(
OFFICE("office");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetStatisticsIdsType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetStatisticsIdsType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetStatisticsIdsType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsPeriod.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsPeriod.kt
index 29e26a3d82..32912c8304 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsPeriod.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsPeriod.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -42,12 +47,23 @@ enum class AdsGetStatisticsPeriod(
OVERALL("overall");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetStatisticsPeriod?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetStatisticsPeriod = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetStatisticsPeriod {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsStatsFields.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsStatsFields.kt
index c428cde6d9..9e036cbe04 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsStatsFields.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetStatisticsStatsFields.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -38,12 +43,23 @@ enum class AdsGetStatisticsStatsFields(
) {
VIEWS_TIMES("views_times");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetStatisticsStatsFields?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetStatisticsStatsFields = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetStatisticsStatsFields {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetSuggestionsLang.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetSuggestionsLang.kt
index 550938748b..68b1986fb9 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetSuggestionsLang.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetSuggestionsLang.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -42,12 +47,23 @@ enum class AdsGetSuggestionsLang(
ENGLISH("en");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetSuggestionsLang?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetSuggestionsLang = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetSuggestionsLang {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetSuggestionsSection.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetSuggestionsSection.kt
index 7d88658190..cc43d23634 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetSuggestionsSection.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetSuggestionsSection.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -60,12 +65,23 @@ enum class AdsGetSuggestionsSection(
BROWSERS("browsers");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetSuggestionsSection?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetSuggestionsSection = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetSuggestionsSection {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetTargetingStatsAdFormat.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetTargetingStatsAdFormat.kt
index cbec0b7877..caa9946160 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetTargetingStatsAdFormat.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetTargetingStatsAdFormat.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -52,12 +57,23 @@ enum class AdsGetTargetingStatsAdFormat(
APP_BOARD(10);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetTargetingStatsAdFormat?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetTargetingStatsAdFormat = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetTargetingStatsAdFormat {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetUploadURLAdFormat.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetUploadURLAdFormat.kt
index 4f77f6af31..068a1290e4 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetUploadURLAdFormat.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsGetUploadURLAdFormat.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -46,12 +51,23 @@ enum class AdsGetUploadURLAdFormat(
SPECIAL_APP_FORMAT(7);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsGetUploadURLAdFormat?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsGetUploadURLAdFormat = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsGetUploadURLAdFormat {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsLookalikeRequest.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsLookalikeRequest.kt
index bb1673f1b2..3b2b4657a2 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsLookalikeRequest.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsLookalikeRequest.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import com.google.gson.annotations.SerializedName
import java.lang.reflect.Type
import kotlin.Int
@@ -79,13 +84,23 @@ data class AdsLookalikeRequest(
PROMOTED_POST("promoted_post");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: SourceType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): SourceType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): SourceType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
@@ -112,12 +127,23 @@ data class AdsLookalikeRequest(
CANCELED("canceled");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: Status?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): Status = values().first { it.value.toString() == json!!.asJsonPrimitive.toString() }
+ ): Status {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsObjectType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsObjectType.kt
index d07a6ec6a8..c6b575290c 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsObjectType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsObjectType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -44,12 +49,22 @@ enum class AdsObjectType(
OFFICE("office");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsObjectType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsObjectType = values().first { it.value.toString() == json!!.asJsonPrimitive.toString()
- }
+ ): AdsObjectType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsStatsSexValue.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsStatsSexValue.kt
index d5a647f976..fdd6eef4b0 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsStatsSexValue.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsStatsSexValue.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,22 @@ enum class AdsStatsSexValue(
MALE("m");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AdsStatsSexValue?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsStatsSexValue = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsStatsSexValue {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsTargSuggestionsSchoolsType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsTargSuggestionsSchoolsType.kt
index c7923c8849..abaa00c1d0 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsTargSuggestionsSchoolsType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsTargSuggestionsSchoolsType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.ads.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -44,12 +49,23 @@ enum class AdsTargSuggestionsSchoolsType(
CHAIR("chair");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AdsTargSuggestionsSchoolsType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AdsTargSuggestionsSchoolsType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AdsTargSuggestionsSchoolsType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsUserSpecification.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsUserSpecification.kt
index c05bd33996..4b16fce6df 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsUserSpecification.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsUserSpecification.kt
@@ -34,6 +34,7 @@ import kotlin.collections.List
/**
* @param userId no description
+ * @param role no description
* @param grantAccessToAllClients no description
* @param clientIds no description
* @param viewBudget no description
@@ -41,6 +42,8 @@ import kotlin.collections.List
data class AdsUserSpecification(
@SerializedName(value="user_id")
val userId: Int,
+ @SerializedName(value="role")
+ val role: AdsAccessRolePublic,
@SerializedName(value="grant_access_to_all_clients")
val grantAccessToAllClients: Boolean? = null,
@SerializedName(value="client_ids")
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsUserSpecificationCutted.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsUserSpecificationCutted.kt
new file mode 100644
index 0000000000..530f9aa2e9
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/dto/AdsUserSpecificationCutted.kt
@@ -0,0 +1,49 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.ads.dto
+
+import com.google.gson.annotations.SerializedName
+import kotlin.Boolean
+import kotlin.Int
+
+/**
+ * @param userId no description
+ * @param role no description
+ * @param clientId no description
+ * @param viewBudget no description
+ */
+data class AdsUserSpecificationCutted(
+ @SerializedName(value="user_id")
+ val userId: Int,
+ @SerializedName(value="role")
+ val role: AdsAccessRolePublic,
+ @SerializedName(value="client_id")
+ val clientId: Int? = null,
+ @SerializedName(value="view_budget")
+ val viewBudget: Boolean? = null
+)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/methods/AdsAddOfficeUsers.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/methods/AdsAddOfficeUsers.kt
index 8d247fa1ff..72740e68b3 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/methods/AdsAddOfficeUsers.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/methods/AdsAddOfficeUsers.kt
@@ -29,7 +29,7 @@ package com.vk.sdk.api.ads.methods
import com.vk.sdk.api.ApiRequestBase
import com.vk.sdk.api.GsonHolder
-import com.vk.sdk.api.ads.dto.AdsUserSpecification
+import com.vk.sdk.api.ads.dto.AdsUserSpecificationCutted
import com.vk.sdk.api.ads.responses.AdsAddOfficeUsersResponse
import kotlin.Boolean
import kotlin.Int
@@ -44,7 +44,7 @@ import org.json.JSONObject
*/
class AdsAddOfficeUsers(
private val accountId: Int,
- private val data: List
+ private val data: List
) : ApiRequestBase(methodName = "ads.addOfficeUsers") {
init {
addParam("account_id", accountId)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/methods/AdsGetTargetingStats.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/methods/AdsGetTargetingStats.kt
index a6820afa5f..34020e9e7f 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/methods/AdsGetTargetingStats.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/ads/methods/AdsGetTargetingStats.kt
@@ -56,6 +56,8 @@ import org.json.JSONObject
* @param linkDomain Domain of the advertised object.
* @param needPrecise Additionally return recommended cpc and cpm to reach 5,10..95 percents of
* audience.
+ * @param impressionsLimitPeriod Impressions limit period in seconds, must be a multiple of
+ * 86400(day)
*/
class AdsGetTargetingStats(
private val accountId: Int,
@@ -68,7 +70,8 @@ class AdsGetTargetingStats(
private val adPlatformNoWall: String? = null,
private val adPlatformNoAdNetwork: String? = null,
private val linkDomain: String? = null,
- private val needPrecise: Boolean? = null
+ private val needPrecise: Boolean? = null,
+ private val impressionsLimitPeriod: Int? = null
) : ApiRequestBase(methodName = "ads.getTargetingStats") {
init {
addParam("account_id", accountId)
@@ -100,6 +103,9 @@ class AdsGetTargetingStats(
needPrecise?.let { value ->
addParam("need_precise", if (value) 1 else 0)
}
+ impressionsLimitPeriod?.let { value ->
+ addParam("impressions_limit_period", value)
+ }
}
override fun parse(r: JSONObject): AdsTargStats = GsonHolder.gson.fromJson(r.toString(),
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetAppImageUploadServerImageType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetAppImageUploadServerImageType.kt
index 138e73fba4..862227b95b 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetAppImageUploadServerImageType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetAppImageUploadServerImageType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.appWidgets.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -46,12 +51,23 @@ enum class AppWidgetsGetAppImageUploadServerImageType(
FIFTY_ONE_0X128("510x128");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AppWidgetsGetAppImageUploadServerImageType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppWidgetsGetAppImageUploadServerImageType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppWidgetsGetAppImageUploadServerImageType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetAppImagesImageType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetAppImagesImageType.kt
index 69a9634a8e..a9f67a362d 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetAppImagesImageType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetAppImagesImageType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.appWidgets.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -46,12 +51,23 @@ enum class AppWidgetsGetAppImagesImageType(
FIFTY_ONE_0X128("510x128");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AppWidgetsGetAppImagesImageType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppWidgetsGetAppImagesImageType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppWidgetsGetAppImagesImageType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetGroupImageUploadServerImageType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetGroupImageUploadServerImageType.kt
index efb35a1e63..869b7a4052 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetGroupImageUploadServerImageType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetGroupImageUploadServerImageType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.appWidgets.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -46,12 +51,23 @@ enum class AppWidgetsGetGroupImageUploadServerImageType(
FIFTY_ONE_0X128("510x128");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AppWidgetsGetGroupImageUploadServerImageType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppWidgetsGetGroupImageUploadServerImageType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppWidgetsGetGroupImageUploadServerImageType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetGroupImagesImageType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetGroupImagesImageType.kt
index 2d02c103bd..e12f60bc87 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetGroupImagesImageType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsGetGroupImagesImageType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.appWidgets.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -46,12 +51,23 @@ enum class AppWidgetsGetGroupImagesImageType(
FIFTY_ONE_0X128("510x128");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AppWidgetsGetGroupImagesImageType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppWidgetsGetGroupImagesImageType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppWidgetsGetGroupImagesImageType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsUpdateType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsUpdateType.kt
index ec0530addc..1b9d687fd4 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsUpdateType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/appWidgets/dto/AppWidgetsUpdateType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.appWidgets.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -54,12 +59,23 @@ enum class AppWidgetsUpdateType(
TILES("tiles");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer
+ {
+ override fun serialize(
+ src: AppWidgetsUpdateType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppWidgetsUpdateType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppWidgetsUpdateType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsAppLeaderboardType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsAppLeaderboardType.kt
index 878a87891f..030ac639eb 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsAppLeaderboardType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsAppLeaderboardType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -42,12 +47,23 @@ enum class AppsAppLeaderboardType(
POINTS(2);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AppsAppLeaderboardType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsAppLeaderboardType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsAppLeaderboardType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogFilter.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogFilter.kt
index ba29eb3d7a..bf0e17edae 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogFilter.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogFilter.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -44,12 +49,23 @@ enum class AppsGetCatalogFilter(
NEW("new");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer
+ {
+ override fun serialize(
+ src: AppsGetCatalogFilter?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsGetCatalogFilter = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsGetCatalogFilter {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogResponseDto.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogResponseDto.kt
index 0c6a8292ab..abb5d7e8fd 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogResponseDto.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogResponseDto.kt
@@ -28,16 +28,20 @@
package com.vk.sdk.api.apps.dto
import com.google.gson.annotations.SerializedName
+import com.vk.sdk.api.users.dto.UsersUserMin
import kotlin.Int
import kotlin.collections.List
/**
* @param count Total number
* @param items no description
+ * @param profiles no description
*/
data class AppsGetCatalogResponseDto(
@SerializedName(value="count")
val count: Int? = null,
@SerializedName(value="items")
- val items: List? = null
+ val items: List? = null,
+ @SerializedName(value="profiles")
+ val profiles: List? = null
)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogSort.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogSort.kt
index 5d8a642c12..3cba8f0964 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogSort.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetCatalogSort.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -46,12 +51,22 @@ enum class AppsGetCatalogSort(
POPULAR_WEEK("popular_week");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AppsGetCatalogSort?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsGetCatalogSort = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsGetCatalogSort {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetFriendsListType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetFriendsListType.kt
index 621f9e97a6..71a8a438bb 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetFriendsListType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetFriendsListType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,23 @@ enum class AppsGetFriendsListType(
REQUEST("request");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AppsGetFriendsListType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsGetFriendsListType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsGetFriendsListType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetLeaderboardType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetLeaderboardType.kt
index 5f70dc4e37..021e2261b8 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetLeaderboardType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetLeaderboardType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -42,12 +47,23 @@ enum class AppsGetLeaderboardType(
SCORE("score");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: AppsGetLeaderboardType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsGetLeaderboardType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsGetLeaderboardType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetNameCase.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetNameCase.kt
index 7207768192..4a4decbd03 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetNameCase.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetNameCase.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -48,12 +53,22 @@ enum class AppsGetNameCase(
PREPOSITIONAL("abl");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AppsGetNameCase?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsGetNameCase = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsGetNameCase {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetPlatform.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetPlatform.kt
index 66a466f7c3..663d134c96 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetPlatform.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetPlatform.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -44,12 +49,22 @@ enum class AppsGetPlatform(
WINPHONE("winphone");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AppsGetPlatform?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsGetPlatform = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsGetPlatform {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetScopesType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetScopesType.kt
index 39af0aa766..b43f43a2d0 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetScopesType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsGetScopesType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,22 @@ enum class AppsGetScopesType(
USER("user");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AppsGetScopesType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsGetScopesType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsGetScopesType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsScope.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsScope.kt
index ba33491b3b..a9982a1555 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsScope.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsScope.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import com.google.gson.annotations.SerializedName
import java.lang.reflect.Type
import kotlin.String
@@ -69,12 +74,23 @@ data class AppsScope(
MARKET("market");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: Name?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): Name = values().first { it.value.toString() == json!!.asJsonPrimitive.toString() }
+ ): Name {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsSendRequestType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsSendRequestType.kt
index fae86d7d5b..3c3fc57057 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsSendRequestType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/apps/dto/AppsSendRequestType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.apps.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,22 @@ enum class AppsSendRequestType(
REQUEST("request");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: AppsSendRequestType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): AppsSendRequestType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): AppsSendRequestType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/auth/dto/AuthRestoreResponseDto.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/auth/dto/AuthRestoreResponseDto.kt
index b2aca2cd8e..d54e419c0a 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/auth/dto/AuthRestoreResponseDto.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/auth/dto/AuthRestoreResponseDto.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.auth.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import com.google.gson.annotations.SerializedName
import java.lang.reflect.Type
import kotlin.Int
@@ -50,12 +55,23 @@ data class AuthRestoreResponseDto(
) {
OK(1);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: Success?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): Success = values().first { it.value.toString() == json!!.asJsonPrimitive.toString() }
+ ): Success {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseBoolInt.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseBoolInt.kt
index d51ab4e472..bb7a48db55 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseBoolInt.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseBoolInt.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -40,11 +45,22 @@ enum class BaseBoolInt(
YES(1);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: BaseBoolInt?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BaseBoolInt = values().first { it.value.toString() == json!!.asJsonPrimitive.toString() }
+ ): BaseBoolInt {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseCommentsInfo.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseCommentsInfo.kt
index 2fc8542c5d..f0ad3a3901 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseCommentsInfo.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseCommentsInfo.kt
@@ -28,6 +28,7 @@
package com.vk.sdk.api.base.dto
import com.google.gson.annotations.SerializedName
+import com.vk.sdk.api.wall.dto.WallWallpostCommentsDonut
import kotlin.Boolean
import kotlin.Int
@@ -35,6 +36,7 @@ import kotlin.Int
* @param canPost Information whether current user can comment the post
* @param count Comments number
* @param groupsCanPost Information whether groups can comment the post
+ * @param donut no description
*/
data class BaseCommentsInfo(
@SerializedName(value="can_post")
@@ -42,5 +44,7 @@ data class BaseCommentsInfo(
@SerializedName(value="count")
val count: Int? = null,
@SerializedName(value="groups_can_post")
- val groupsCanPost: Boolean? = null
+ val groupsCanPost: Boolean? = null,
+ @SerializedName(value="donut")
+ val donut: WallWallpostCommentsDonut? = null
)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButton.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButton.kt
index 487945988f..c9df4c5cc8 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButton.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButton.kt
@@ -36,6 +36,7 @@ import kotlin.String
* @param title Button title
* @param blockId Target block id
* @param sectionId Target section id
+ * @param curatorId curator id
* @param ownerId Owner id
* @param icon Button icon name, e.g. 'phone' or 'gift'
* @param style no description
@@ -49,6 +50,8 @@ data class BaseLinkButton(
val blockId: String? = null,
@SerializedName(value="section_id")
val sectionId: String? = null,
+ @SerializedName(value="curator_id")
+ val curatorId: Int? = null,
@SerializedName(value="owner_id")
val ownerId: Int? = null,
@SerializedName(value="icon")
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButtonActionType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButtonActionType.kt
index 7d3a650324..4c47c80fc0 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButtonActionType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButtonActionType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -84,14 +89,41 @@ enum class BaseLinkButtonActionType(
CLEAR_RECENT_GROUPS("clear_recent_groups"),
- CLOSE_CATALOG_BANNER("close_catalog_banner");
+ CLOSE_CATALOG_BANNER("close_catalog_banner"),
+
+ ENABLE_TOP_NEWSFEED("enable_top_newsfeed"),
+
+ GROUPS_ADVERTISEMENT("groups_advertisement"),
+
+ OWNER_BUTTON("owner_button"),
+
+ ENTER_EDIT_MODE("enter_edit_mode"),
+
+ PLAYLISTS_LISTS("playlists_lists"),
+
+ UNFOLLOW_CURATOR("unfollow_curator"),
+
+ REORDER_ITEMS("reorder_items"),
+
+ EDIT_ITEMS("edit_items");
+
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: BaseLinkButtonActionType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
- class Serializer : JsonDeserializer {
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BaseLinkButtonActionType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BaseLinkButtonActionType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButtonStyle.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButtonStyle.kt
index fc758ef289..f6f7dacd94 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButtonStyle.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkButtonStyle.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,22 @@ enum class BaseLinkButtonStyle(
SECONDARY("secondary");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: BaseLinkButtonStyle?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BaseLinkButtonStyle = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BaseLinkButtonStyle {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkProduct.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkProduct.kt
index 3b39d7dbc4..95550dd1e9 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkProduct.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkProduct.kt
@@ -35,9 +35,6 @@ import kotlin.String
/**
* @param price no description
* @param merchant no description
- * @param category no description
- * @param geo no description
- * @param status no description
* @param ordersCount no description
*/
data class BaseLinkProduct(
@@ -45,12 +42,6 @@ data class BaseLinkProduct(
val price: MarketPrice,
@SerializedName(value="merchant")
val merchant: String? = null,
- @SerializedName(value="category")
- val category: String? = null,
- @SerializedName(value="geo")
- val geo: BaseGeoCoordinates? = null,
- @SerializedName(value="status")
- val status: BaseLinkProductStatus? = null,
@SerializedName(value="orders_count")
val ordersCount: Int? = null
)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkProductStatus.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkProductStatus.kt
index bb6491a62a..2465b64264 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkProductStatus.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseLinkProductStatus.kt
@@ -30,42 +30,44 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
-import com.google.gson.annotations.SerializedName
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
-import kotlin.Int
import kotlin.String
-/**
- * @param raw Raw integer representation of status
- * @param value String representation of status
- */
-data class BaseLinkProductStatus(
- @SerializedName(value="raw")
- val raw: Int? = null,
- @SerializedName(value="value")
- val value: Value? = null
+enum class BaseLinkProductStatus(
+ val value: String
) {
- enum class Value(
- val value: String
- ) {
- ACTIVE("active"),
+ ACTIVE("active"),
- BLOCKED("blocked"),
+ BLOCKED("blocked"),
- SOLD("sold"),
+ SOLD("sold"),
- DELETED("deleted"),
+ DELETED("deleted"),
- ARCHIVED("archived"),
+ ARCHIVED("archived");
- BOOKED("booked");
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: BaseLinkProductStatus?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
- class Serializer : JsonDeserializer {
- override fun deserialize(
- json: JsonElement?,
- typeOfT: Type?,
- context: JsonDeserializationContext?
- ): Value = values().first { it.value.toString() == json!!.asJsonPrimitive.toString() }
+ override fun deserialize(
+ json: JsonElement?,
+ typeOfT: Type?,
+ context: JsonDeserializationContext?
+ ): BaseLinkProductStatus {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
}
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseOkResponseDto.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseOkResponseDto.kt
index 4579f2754c..7882200eb5 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseOkResponseDto.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseOkResponseDto.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -38,12 +43,22 @@ enum class BaseOkResponseDto(
) {
OK(1);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: BaseOkResponseDto?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BaseOkResponseDto = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BaseOkResponseDto {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BasePropertyExists.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BasePropertyExists.kt
index 53925e5294..96d06f190e 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BasePropertyExists.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BasePropertyExists.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -38,12 +43,22 @@ enum class BasePropertyExists(
) {
PROPERTY_EXISTS(1);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: BasePropertyExists?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BasePropertyExists = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BasePropertyExists {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseRepostsInfo.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseRepostsInfo.kt
index 9a015edd21..ab1edd1630 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseRepostsInfo.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseRepostsInfo.kt
@@ -31,12 +31,18 @@ import com.google.gson.annotations.SerializedName
import kotlin.Int
/**
- * @param count Reposts number
+ * @param count Total reposts counter. Sum of wall and mail reposts counters
+ * @param wallCount Wall reposts counter
+ * @param mailCount Mail reposts counter
* @param userReposted Information whether current user has reposted the post
*/
data class BaseRepostsInfo(
@SerializedName(value="count")
val count: Int? = null,
+ @SerializedName(value="wall_count")
+ val wallCount: Int? = null,
+ @SerializedName(value="mail_count")
+ val mailCount: Int? = null,
@SerializedName(value="user_reposted")
val userReposted: Int? = null
)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseSex.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseSex.kt
index d9be0b58f0..a4dce9def1 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseSex.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseSex.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -42,11 +47,22 @@ enum class BaseSex(
MALE(2);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: BaseSex?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BaseSex = values().first { it.value.toString() == json!!.asJsonPrimitive.toString() }
+ ): BaseSex {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseStickerAnimation.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseStickerAnimation.kt
index efb862a7fe..99d1aaa789 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseStickerAnimation.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseStickerAnimation.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import com.google.gson.annotations.SerializedName
import kotlin.String
@@ -50,12 +55,23 @@ data class BaseStickerAnimation(
DARK("dark");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: Type?,
+ typeOfSrc: java.lang.reflect.Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: java.lang.reflect.Type?,
context: JsonDeserializationContext?
- ): Type = values().first { it.value.toString() == json!!.asJsonPrimitive.toString() }
+ ): Type {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseUserGroupFields.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseUserGroupFields.kt
index 876faf7af0..d854430fee 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseUserGroupFields.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/base/dto/BaseUserGroupFields.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.base.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -236,12 +241,22 @@ enum class BaseUserGroupFields(
VK_ADMIN_STATUS("vk_admin_status");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: BaseUserGroupFields?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BaseUserGroupFields = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BaseUserGroupFields {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardDefaultOrder.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardDefaultOrder.kt
index d10845cc9a..7e81eee627 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardDefaultOrder.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardDefaultOrder.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.board.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -44,12 +49,22 @@ enum class BoardDefaultOrder(
ASC_CREATED(-2);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: BoardDefaultOrder?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BoardDefaultOrder = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BoardDefaultOrder {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetCommentsSort.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetCommentsSort.kt
index f0de901505..6abfca248a 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetCommentsSort.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetCommentsSort.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.board.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -40,12 +45,23 @@ enum class BoardGetCommentsSort(
REVERSE_CHRONOLOGICAL("desc");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer
+ {
+ override fun serialize(
+ src: BoardGetCommentsSort?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BoardGetCommentsSort = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BoardGetCommentsSort {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetTopicsOrder.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetTopicsOrder.kt
index 01ac01f27b..b3f7c42c8d 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetTopicsOrder.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetTopicsOrder.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.board.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -46,12 +51,22 @@ enum class BoardGetTopicsOrder(
AS_BY_ADMINISTRATOR(0);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: BoardGetTopicsOrder?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BoardGetTopicsOrder = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BoardGetTopicsOrder {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetTopicsPreview.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetTopicsPreview.kt
index f45a12354e..9c830b2d51 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetTopicsPreview.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/board/dto/BoardGetTopicsPreview.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.board.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -42,12 +47,23 @@ enum class BoardGetTopicsPreview(
NONE(0);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: BoardGetTopicsPreview?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): BoardGetTopicsPreview = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): BoardGetTopicsPreview {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackConfirmationMessage.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackConfirmationMessage.kt
index 14457fef1d..e9f580d335 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackConfirmationMessage.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackConfirmationMessage.kt
@@ -42,5 +42,5 @@ data class CallbackConfirmationMessage(
@SerializedName(value="group_id")
val groupId: Int,
@SerializedName(value="secret")
- val secret: String
+ val secret: String? = null
)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutMoneyWithdraw.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutMoneyWithdraw.kt
new file mode 100644
index 0000000000..600736171c
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutMoneyWithdraw.kt
@@ -0,0 +1,42 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.callback.dto
+
+import com.google.gson.annotations.SerializedName
+import kotlin.Float
+
+/**
+ * @param amount no description
+ * @param amountWithoutFee no description
+ */
+data class CallbackDonutMoneyWithdraw(
+ @SerializedName(value="amount")
+ val amount: Float,
+ @SerializedName(value="amount_without_fee")
+ val amountWithoutFee: Float
+)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutMoneyWithdrawError.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutMoneyWithdrawError.kt
new file mode 100644
index 0000000000..b5ddfbbec6
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutMoneyWithdrawError.kt
@@ -0,0 +1,39 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.callback.dto
+
+import com.google.gson.annotations.SerializedName
+import kotlin.String
+
+/**
+ * @param reason no description
+ */
+data class CallbackDonutMoneyWithdrawError(
+ @SerializedName(value="reason")
+ val reason: String
+)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionCancelled.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionCancelled.kt
new file mode 100644
index 0000000000..9fb6a3d199
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionCancelled.kt
@@ -0,0 +1,39 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.callback.dto
+
+import com.google.gson.annotations.SerializedName
+import kotlin.Int
+
+/**
+ * @param userId no description
+ */
+data class CallbackDonutSubscriptionCancelled(
+ @SerializedName(value="user_id")
+ val userId: Int? = null
+)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionCreate.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionCreate.kt
new file mode 100644
index 0000000000..17c786cc99
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionCreate.kt
@@ -0,0 +1,46 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.callback.dto
+
+import com.google.gson.annotations.SerializedName
+import kotlin.Float
+import kotlin.Int
+
+/**
+ * @param amount no description
+ * @param amountWithoutFee no description
+ * @param userId no description
+ */
+data class CallbackDonutSubscriptionCreate(
+ @SerializedName(value="amount")
+ val amount: Int,
+ @SerializedName(value="amount_without_fee")
+ val amountWithoutFee: Float,
+ @SerializedName(value="user_id")
+ val userId: Int? = null
+)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionExpired.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionExpired.kt
new file mode 100644
index 0000000000..e12174231a
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionExpired.kt
@@ -0,0 +1,39 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.callback.dto
+
+import com.google.gson.annotations.SerializedName
+import kotlin.Int
+
+/**
+ * @param userId no description
+ */
+data class CallbackDonutSubscriptionExpired(
+ @SerializedName(value="user_id")
+ val userId: Int? = null
+)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionPriceChanged.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionPriceChanged.kt
new file mode 100644
index 0000000000..7df17e9404
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionPriceChanged.kt
@@ -0,0 +1,52 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.callback.dto
+
+import com.google.gson.annotations.SerializedName
+import kotlin.Float
+import kotlin.Int
+
+/**
+ * @param amountOld no description
+ * @param amountNew no description
+ * @param userId no description
+ * @param amountDiff no description
+ * @param amountDiffWithoutFee no description
+ */
+data class CallbackDonutSubscriptionPriceChanged(
+ @SerializedName(value="amount_old")
+ val amountOld: Int,
+ @SerializedName(value="amount_new")
+ val amountNew: Int,
+ @SerializedName(value="user_id")
+ val userId: Int? = null,
+ @SerializedName(value="amount_diff")
+ val amountDiff: Float? = null,
+ @SerializedName(value="amount_diff_without_fee")
+ val amountDiffWithoutFee: Float? = null
+)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionProlonged.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionProlonged.kt
new file mode 100644
index 0000000000..6e40d9226d
--- /dev/null
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackDonutSubscriptionProlonged.kt
@@ -0,0 +1,46 @@
+/**
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019 vk.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+*/
+// *********************************************************************
+// THIS FILE IS AUTO GENERATED!
+// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING.
+// *********************************************************************
+package com.vk.sdk.api.callback.dto
+
+import com.google.gson.annotations.SerializedName
+import kotlin.Float
+import kotlin.Int
+
+/**
+ * @param amount no description
+ * @param amountWithoutFee no description
+ * @param userId no description
+ */
+data class CallbackDonutSubscriptionProlonged(
+ @SerializedName(value="amount")
+ val amount: Int,
+ @SerializedName(value="amount_without_fee")
+ val amountWithoutFee: Float,
+ @SerializedName(value="user_id")
+ val userId: Int? = null
+)
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupJoinType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupJoinType.kt
index 07857d3d6a..3cb4129873 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupJoinType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupJoinType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.callback.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -46,12 +51,23 @@ enum class CallbackGroupJoinType(
REQUEST("request");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: CallbackGroupJoinType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): CallbackGroupJoinType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): CallbackGroupJoinType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupMarket.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupMarket.kt
index 0fa45c1625..bb124f30d4 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupMarket.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupMarket.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.callback.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -40,12 +45,22 @@ enum class CallbackGroupMarket(
OPEN(1);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: CallbackGroupMarket?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): CallbackGroupMarket = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): CallbackGroupMarket {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupOfficerRole.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupOfficerRole.kt
index 9b4fdb137f..98ad2d0ebc 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupOfficerRole.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackGroupOfficerRole.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.callback.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.Int
@@ -44,12 +49,23 @@ enum class CallbackGroupOfficerRole(
ADMINISTRATOR(3);
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: CallbackGroupOfficerRole?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): CallbackGroupOfficerRole = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): CallbackGroupOfficerRole {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackLikeAddRemove.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackLikeAddRemove.kt
index 14d1e72834..59937e5527 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackLikeAddRemove.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackLikeAddRemove.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.callback.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import com.google.gson.annotations.SerializedName
import java.lang.reflect.Type
import kotlin.Int
@@ -80,13 +85,23 @@ data class CallbackLikeAddRemove(
MARKET_COMMENT("market_comment");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: ObjectType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): ObjectType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): ObjectType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackMessageType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackMessageType.kt
index b0fb72d66a..3c494c1089 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackMessageType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/callback/dto/CallbackMessageType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.callback.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -98,12 +103,22 @@ enum class CallbackMessageType(
MESSAGE_EVENT("message_event");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer, JsonDeserializer {
+ override fun serialize(
+ src: CallbackMessageType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): CallbackMessageType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): CallbackMessageType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/docs/dto/DocsDocAttachmentType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/docs/dto/DocsDocAttachmentType.kt
index 53a981413e..3c54b4e6df 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/docs/dto/DocsDocAttachmentType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/docs/dto/DocsDocAttachmentType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.docs.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -42,12 +47,23 @@ enum class DocsDocAttachmentType(
AUDIO_MESSAGE("audio_message");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer {
+ override fun serialize(
+ src: DocsDocAttachmentType?,
+ typeOfSrc: Type?,
+ context: JsonSerializationContext?
+ ): JsonElement = src?.let { JsonPrimitive(src.value) } ?: JsonNull.INSTANCE
+
override fun deserialize(
json: JsonElement?,
typeOfT: Type?,
context: JsonDeserializationContext?
- ): DocsDocAttachmentType = values().first { it.value.toString() ==
- json!!.asJsonPrimitive.toString() }
+ ): DocsDocAttachmentType {
+ val value = values().firstOrNull {
+ it.value.toString() == json?.asJsonPrimitive?.asString
+ }
+ return value ?: throw JsonParseException(json.toString())
+ }
}
}
diff --git a/vk-sdk-api/src/main/java/com/vk/sdk/api/docs/dto/DocsGetMessagesUploadServerType.kt b/vk-sdk-api/src/main/java/com/vk/sdk/api/docs/dto/DocsGetMessagesUploadServerType.kt
index 149b75f665..53f7d72232 100644
--- a/vk-sdk-api/src/main/java/com/vk/sdk/api/docs/dto/DocsGetMessagesUploadServerType.kt
+++ b/vk-sdk-api/src/main/java/com/vk/sdk/api/docs/dto/DocsGetMessagesUploadServerType.kt
@@ -30,6 +30,11 @@ package com.vk.sdk.api.docs.dto
import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
+import com.google.gson.JsonNull
+import com.google.gson.JsonParseException
+import com.google.gson.JsonPrimitive
+import com.google.gson.JsonSerializationContext
+import com.google.gson.JsonSerializer
import java.lang.reflect.Type
import kotlin.String
@@ -42,12 +47,23 @@ enum class DocsGetMessagesUploadServerType(
GRAFFITI("graffiti");
- class Serializer : JsonDeserializer {
+ class Serializer : JsonSerializer,
+ JsonDeserializer