com.github.stormbit.sdk.utils.vkapi.Session.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vk-bot-sdk-kotlin Show documentation
Show all versions of vk-bot-sdk-kotlin Show documentation
The Kotlin library for working with VK api
package com.github.stormbit.sdk.utils.vkapi
import net.dongliu.requests.Cookie
import net.dongliu.requests.RequestBuilder
import net.dongliu.requests.Requests
import net.dongliu.requests.Session
import java.net.URL
@Suppress("unused")
class Session {
private val session: Session = Requests.session()
private var cookies: MutableList = this.session.currentCookies()
constructor()
constructor(cookies: MutableList) {
this.cookies = cookies
}
fun get(url: String): RequestBuilder {
return this.session.get(url).cookies(cookies)
}
fun post(url: String): RequestBuilder {
return this.session.post(url).cookies(cookies)
}
fun put(url: String): RequestBuilder {
return this.session.put(url).cookies(cookies)
}
fun head(url: String): RequestBuilder {
return this.session.head(url).cookies(cookies)
}
fun delete(url: String): RequestBuilder {
return this.session.delete(url).cookies(cookies)
}
fun patch(url: String): RequestBuilder {
return this.session.patch(url).cookies(cookies)
}
fun get(url: URL): RequestBuilder {
return this.session.patch(url).cookies(cookies)
}
fun post(url: URL): RequestBuilder {
return this.session.post(url).cookies(cookies)
}
fun put(url: URL): RequestBuilder {
return this.session.put(url).cookies(cookies)
}
fun head(url: URL): RequestBuilder {
return this.session.head(url).cookies(cookies)
}
fun delete(url: URL): RequestBuilder {
return this.session.delete(url).cookies(cookies)
}
fun patch(url: URL): RequestBuilder {
return this.session.patch(url).cookies(cookies)
}
fun sessionCookies(): MutableList {
return this.session.currentCookies()
}
fun cookies(): MutableList {
return cookies
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy