separate urls
This commit is contained in:
@@ -5,36 +5,6 @@ object VkUrls {
|
||||
const val OAUTH = "https://oauth.vk.com"
|
||||
const val API = "https://api.vk.com/method"
|
||||
|
||||
object Auth {
|
||||
const val DirectAuth = "$OAUTH/token"
|
||||
const val SendSms = "$API/auth.validatePhone"
|
||||
}
|
||||
|
||||
object Conversations {
|
||||
const val Get = "$API/messages.getConversations"
|
||||
const val Delete = "$API/messages.deleteConversation"
|
||||
const val Pin = "$API/messages.pinConversation"
|
||||
const val Unpin = "$API/messages.unpinConversation"
|
||||
const val ReorderPinned = "$API/messages.reorderPinnedConversations"
|
||||
}
|
||||
|
||||
object Users {
|
||||
const val GetById = "$API/users.get"
|
||||
}
|
||||
|
||||
object Messages {
|
||||
const val GetHistory = "$API/messages.getHistory"
|
||||
const val Send = "$API/messages.send"
|
||||
const val MarkAsImportant = "$API/messages.markAsImportant"
|
||||
const val GetLongPollServer = "$API/messages.getLongPollServer"
|
||||
const val GetLongPollHistory = "$API/messages.getLongPollHistory"
|
||||
const val Pin = "$API/messages.pin"
|
||||
const val Unpin = "$API/messages.unpin"
|
||||
const val Delete = "$API/messages.delete"
|
||||
const val Edit = "$API/messages.edit"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.meloda.fast.api.network.auth
|
||||
|
||||
import com.meloda.fast.api.network.Answer
|
||||
import com.meloda.fast.api.network.VkUrls
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Query
|
||||
import retrofit2.http.QueryMap
|
||||
|
||||
interface AuthRepo {
|
||||
|
||||
@GET(VkUrls.Auth.DirectAuth)
|
||||
@GET(AuthUrls.DirectAuth)
|
||||
suspend fun auth(@QueryMap param: Map<String, String?>): Answer<ResponseAuthDirect>
|
||||
|
||||
@GET(VkUrls.Auth.SendSms)
|
||||
@GET(AuthUrls.SendSms)
|
||||
suspend fun sendSms(@Query("sid") validationSid: String): Answer<ResponseSendSms>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.meloda.fast.api.network.auth
|
||||
|
||||
import com.meloda.fast.api.network.VkUrls
|
||||
|
||||
object AuthUrls {
|
||||
|
||||
const val DirectAuth = "${VkUrls.OAUTH}/token"
|
||||
const val SendSms = "${VkUrls.API}/auth.validatePhone"
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.meloda.fast.api.network.conversations
|
||||
|
||||
import com.meloda.fast.api.base.ApiResponse
|
||||
import com.meloda.fast.api.network.Answer
|
||||
import com.meloda.fast.api.network.VkUrls
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
@@ -10,23 +9,23 @@ import retrofit2.http.POST
|
||||
interface ConversationsRepo {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Conversations.Get)
|
||||
@POST(ConversationsUrls.Get)
|
||||
suspend fun get(@FieldMap params: Map<String, String>): Answer<ApiResponse<ConversationsGetResponse>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Conversations.Delete)
|
||||
@POST(ConversationsUrls.Delete)
|
||||
suspend fun delete(@FieldMap params: Map<String, String>): Answer<ApiResponse<Any>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Conversations.Pin)
|
||||
@POST(ConversationsUrls.Pin)
|
||||
suspend fun pin(@FieldMap params: Map<String, String>): Answer<ApiResponse<Any>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Conversations.Unpin)
|
||||
@POST(ConversationsUrls.Unpin)
|
||||
suspend fun unpin(@FieldMap params: Map<String, String>): Answer<ApiResponse<Any>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Conversations.ReorderPinned)
|
||||
@POST(ConversationsUrls.ReorderPinned)
|
||||
suspend fun reorderPinned(@FieldMap params: Map<String, String>): Answer<ApiResponse<Any>>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.meloda.fast.api.network.conversations
|
||||
|
||||
import com.meloda.fast.api.network.VkUrls
|
||||
|
||||
object ConversationsUrls {
|
||||
|
||||
const val Get = "${VkUrls.API}/messages.getConversations"
|
||||
const val Delete = "${VkUrls.API}/messages.deleteConversation"
|
||||
const val Pin = "${VkUrls.API}/messages.pinConversation"
|
||||
const val Unpin = "${VkUrls.API}/messages.unpinConversation"
|
||||
const val ReorderPinned = "${VkUrls.API}/messages.reorderPinnedConversations"
|
||||
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import com.meloda.fast.api.base.ApiResponse
|
||||
import com.meloda.fast.api.model.base.BaseVkLongPoll
|
||||
import com.meloda.fast.api.model.base.BaseVkMessage
|
||||
import com.meloda.fast.api.network.Answer
|
||||
import com.meloda.fast.api.network.VkUrls
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
@@ -12,35 +11,35 @@ import retrofit2.http.POST
|
||||
interface MessagesRepo {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Messages.GetHistory)
|
||||
@POST(MessagesUrls.GetHistory)
|
||||
suspend fun getHistory(@FieldMap params: Map<String, String>): Answer<ApiResponse<MessagesGetHistoryResponse>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Messages.Send)
|
||||
@POST(MessagesUrls.Send)
|
||||
suspend fun send(@FieldMap params: Map<String, String>): Answer<ApiResponse<Int>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Messages.MarkAsImportant)
|
||||
@POST(MessagesUrls.MarkAsImportant)
|
||||
suspend fun markAsImportant(@FieldMap params: Map<String, String>): Answer<ApiResponse<List<Int>>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Messages.GetLongPollServer)
|
||||
@POST(MessagesUrls.GetLongPollServer)
|
||||
suspend fun getLongPollServer(@FieldMap params: Map<String, String>): Answer<ApiResponse<BaseVkLongPoll>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Messages.Pin)
|
||||
@POST(MessagesUrls.Pin)
|
||||
suspend fun pin(@FieldMap params: Map<String, String>): Answer<ApiResponse<BaseVkMessage>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Messages.Unpin)
|
||||
@POST(MessagesUrls.Unpin)
|
||||
suspend fun unpin(@FieldMap params: Map<String, String>): Answer<ApiResponse<Any>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Messages.Delete)
|
||||
@POST(MessagesUrls.Delete)
|
||||
suspend fun delete(@FieldMap params: Map<String, String>): Answer<ApiResponse<Any>>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Messages.Edit)
|
||||
@POST(MessagesUrls.Edit)
|
||||
suspend fun edit(@FieldMap params: Map<String, String>): Answer<ApiResponse<Any>>
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.meloda.fast.api.network.messages
|
||||
|
||||
import com.meloda.fast.api.network.VkUrls
|
||||
|
||||
object MessagesUrls {
|
||||
|
||||
const val GetHistory = "${VkUrls.API}/messages.getHistory"
|
||||
const val Send = "${VkUrls.API}/messages.send"
|
||||
const val MarkAsImportant = "${VkUrls.API}/messages.markAsImportant"
|
||||
const val GetLongPollServer = "${VkUrls.API}/messages.getLongPollServer"
|
||||
const val GetLongPollHistory = "${VkUrls.API}/messages.getLongPollHistory"
|
||||
const val Pin = "${VkUrls.API}/messages.pin"
|
||||
const val Unpin = "${VkUrls.API}/messages.unpin"
|
||||
const val Delete = "${VkUrls.API}/messages.delete"
|
||||
const val Edit = "${VkUrls.API}/messages.edit"
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.meloda.fast.api.network.users
|
||||
import com.meloda.fast.api.base.ApiResponse
|
||||
import com.meloda.fast.api.model.base.BaseVkUser
|
||||
import com.meloda.fast.api.network.Answer
|
||||
import com.meloda.fast.api.network.VkUrls
|
||||
import retrofit2.http.FieldMap
|
||||
import retrofit2.http.FormUrlEncoded
|
||||
import retrofit2.http.POST
|
||||
@@ -11,7 +10,7 @@ import retrofit2.http.POST
|
||||
interface UsersRepo {
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST(VkUrls.Users.GetById)
|
||||
@POST(UsersUrls.GetById)
|
||||
suspend fun getById(
|
||||
@FieldMap params: Map<String, String>?
|
||||
): Answer<ApiResponse<List<BaseVkUser>>>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.meloda.fast.api.network.users
|
||||
|
||||
import com.meloda.fast.api.network.VkUrls
|
||||
|
||||
object UsersUrls {
|
||||
|
||||
const val GetById = "${VkUrls.API}/users.get"
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user