//core/com.petersamokhin.vksdk.core.client/VkApiClient
VkApiClient¶
[common]\ class VkApiClient(id: Int, token: String, type: VkApiClient.Type, settings: VkSettings)
VK API client: abstract, common.
Abstract because it is not possible for now to have the default methods in expect classes
Parameters¶
common
| token | Access Token |
Constructors¶
| VkApiClient | [common] fun VkApiClient(id: Int, token: String, type: VkApiClient.Type, settings: VkSettings) Access Token |
Types¶
| Name | Summary |
|---|---|
| AppInfo | [common] data class AppInfo(clientId: Int, clientSecret: String, redirectUri: String) https://vk.com/apps? |
| Companion | [common] object Companion |
| Type | [common] enum Type : Enum<VkApiClient.Type> Type of VK client |
Functions¶
| Name | Summary |
|---|---|
| api | [common] fun api(): VkApi Exposed internal API object |
| call | [common] @JvmOverloads() fun call(method: String, params: Parameters = Parameters()): VkRequest Create a VkRequest |
| clearLongPollListeners | [common] fun clearLongPollListeners() Clear all the long polling event listeners |
| flows | [common] fun flows(): VkApiClientFlows Wrapper for coroutines flows |
| get | [common] fun get(item: BatchRequestItem) fun get(items: Collection<BatchRequestItem>) Put some API call into queue. [common] fun get(vararg items: BatchRequestItem) @JvmOverloads() fun get(request: VkRequest, callback: Callback Call some API method and receive the response string, parsed into JsonElement [common] @JvmOverloads() suspend fun get(method: String, params: Parameters = Parameters()): JsonElement Call some API method and receive the response string as JsonElement. |
| onEachEvent | [common] fun onEachEvent(listener: EventCallback<RawEvent>) fun onEachEvent(block: (RawEvent) -> Unit) Handle each event using listener. |
| onMessage | [common] fun onMessage(listener: EventCallback<MessageNew>) fun onMessage(block: (MessageNew) -> Unit) Handle each message_new event using listener |
| sendMessage | [common] fun sendMessage(message: Message): VkRequest fun sendMessage(block: Message.() -> Unit): VkRequest Send message. |
| startLongPolling | [common] @JvmOverloads() suspend fun startLongPolling(restart: Boolean = false, settings: VkBotsLongPollApi.Settings = VkBotsLongPollApi.Settings()) Start the long polling, documentation. |
| stopLongPolling | [common] fun stopLongPolling() Stop the long polling loop |
| unregisterListener | [common] fun unregisterListener(listener: EventCallback<*>) Remove Callback API listener |
| uploader | [common] fun uploader(): VkApiUploader Wrapper for files uploading |
Properties¶
| Name | Summary |
|---|---|
| id | [common] val id: Int Client ID |
| settings | [common] val settings: VkSettings |
| token | [common] val token: String Access Token |
| type | [common] val type: VkApiClient.Type Type of the client: Type.User or Type.Community |