Skip to content

Commit

Permalink
fix: names
Browse files Browse the repository at this point in the history
  • Loading branch information
y9vad9 committed Sep 27, 2023
1 parent 8a80b9e commit 3df324f
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.timemates.api.rsocket.authorizations.types.sdk
import io.timemates.api.rsocket.common.commands.RSocketCommand
import io.timemates.api.rsocket.common.ext.requestResponse
import io.timemates.sdk.authorization.email.requests.ConfigureNewAccountRequest
import io.timemates.api.rsocket.authorizations.requests.ConfigureAccountRequest as RSocketConfigureAccountRequest
import io.timemates.api.rsocket.authorizations.requests.RSocketConfigureAccountRequest as RSocketConfigureAccountRequest

internal object ConfigureNewAccountCommand : RSocketCommand<ConfigureNewAccountRequest, ConfigureNewAccountRequest.Result> {
override suspend fun execute(rSocket: RSocket, input: ConfigureNewAccountRequest): ConfigureNewAccountRequest.Result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.timemates.api.rsocket.authorizations.types.sdk
import io.timemates.api.rsocket.common.commands.RSocketCommand
import io.timemates.api.rsocket.common.ext.requestResponse
import io.timemates.sdk.authorization.email.requests.ConfirmAuthorizationRequest
import io.timemates.api.rsocket.authorizations.requests.ConfirmAuthorizationRequest as RSocketConfirmAuthorizationRequest
import io.timemates.api.rsocket.authorizations.requests.RSocketConfirmAuthorizationRequest as RSocketConfirmAuthorizationRequest

internal object ConfirmAuthorizationCommand : RSocketCommand<ConfirmAuthorizationRequest, ConfirmAuthorizationRequest.Result> {
override suspend fun execute(rSocket: RSocket, input: ConfirmAuthorizationRequest): ConfirmAuthorizationRequest.Result {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.timemates.api.rsocket.authorizations.commands

import io.rsocket.kotlin.RSocket
import io.timemates.api.rsocket.authorizations.requests.GetAuthorizationsRequest
import io.timemates.api.rsocket.authorizations.requests.RSocketGetAuthorizationsRequest
import io.timemates.api.rsocket.authorizations.types.SerializableAuthorization
import io.timemates.api.rsocket.authorizations.types.sdk
import io.timemates.api.rsocket.common.commands.RSocketCommand
Expand All @@ -16,7 +16,7 @@ internal object GetAuthorizationSessionsCommand : RSocketCommand<GetAuthorizatio
override suspend fun execute(rSocket: RSocket, input: GetAuthorizationSessionsRequest): Page<Authorization> {
return rSocket.requestResponse(
route = "authorizations.list",
data = GetAuthorizationsRequest(input.nextPageToken?.string),
data = RSocketGetAuthorizationsRequest(input.nextPageToken?.string),
accessHash = input.accessHash.string,
).let { result ->
Page(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import io.timemates.sdk.authorization.sessions.requests.RenewAuthorizationReques
import io.timemates.sdk.authorization.types.value.AccessHash
import io.timemates.sdk.common.annotations.ExperimentalTimeMatesApi
import io.timemates.sdk.common.constructor.createOrThrow
import io.timemates.api.rsocket.authorizations.requests.RenewAuthorizationRequest as RSocketRenewAuthorizationRequest
import io.timemates.api.rsocket.authorizations.requests.RSocketRenewAuthorizationRequest as RSocketRenewAuthorizationRequest

@OptIn(ExperimentalTimeMatesApi::class)
internal object RenewAuthorizationCommand : RSocketCommand<RenewAuthorizationRequest, RenewAuthorizationRequest.Result> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import io.timemates.sdk.authorization.email.types.value.VerificationHash
import io.timemates.sdk.common.constructor.createOrThrow
import io.timemates.sdk.common.types.value.Count
import kotlinx.datetime.Instant
import io.timemates.api.rsocket.authorizations.requests.StartAuthorizationRequest as RSocketStartAuthorizationRequest
import io.timemates.api.rsocket.authorizations.requests.RSocketStartAuthorizationRequest as RSocketStartAuthorizationRequest

internal object StartAuthorizationCommand : RSocketCommand<StartAuthorizationRequest, StartAuthorizationRequest.Result> {
override suspend fun execute(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package io.timemates.api.rsocket.authorizations.commands

import io.rsocket.kotlin.RSocket
import io.timemates.api.rsocket.authorizations.requests.TerminateAuthorizationRequest
import io.timemates.api.rsocket.authorizations.requests.RSocketTerminateAuthorizationRequest
import io.timemates.api.rsocket.common.commands.RSocketCommand
import io.timemates.api.rsocket.common.ext.requestResponse
import io.timemates.sdk.authorization.sessions.requests.TerminateCurrentAuthorizationSessionRequest
Expand All @@ -11,7 +11,7 @@ internal object TerminateCurrentAuthorizationCommand : RSocketCommand<TerminateC
override suspend fun execute(rSocket: RSocket, input: TerminateCurrentAuthorizationSessionRequest): Empty {
return rSocket.requestResponse(
route = "authorizations.terminate",
data = TerminateAuthorizationRequest.Current,
data = RSocketTerminateAuthorizationRequest.Current,
accessHash = input.accessHash.string,
).let { _ -> Empty }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import io.timemates.api.rsocket.common.markers.RSocketRequest
import kotlinx.serialization.Serializable

@Serializable
internal data class ConfigureAccountRequest(
internal data class RSocketConfigureAccountRequest(
val verificationHash: String,
val name: String,
val description: String?,
) : RSocketRequest<ConfigureAccountRequest.Result> {
) : RSocketRequest<RSocketConfigureAccountRequest.Result> {
@Serializable
data class Result(
val authorization: SerializableAuthorization,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import io.timemates.api.rsocket.common.markers.RSocketRequest
import kotlinx.serialization.Serializable

@Serializable
internal data class ConfirmAuthorizationRequest(
internal data class RSocketConfirmAuthorizationRequest(
val verificationHash: String,
val confirmationCode: String,
) : RSocketRequest<ConfirmAuthorizationRequest.Response> {
) : RSocketRequest<RSocketConfirmAuthorizationRequest.Response> {
data class Response(
val isNewAccount: Boolean,
val authorization: SerializableAuthorization?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import io.timemates.api.rsocket.common.markers.RSocketRequest
import kotlinx.serialization.Serializable

@Serializable
internal data class GetAuthorizationsRequest(
internal data class RSocketGetAuthorizationsRequest(
val pageToken: String? = null,
) : RSocketRequest<GetAuthorizationsRequest.Result> {
) : RSocketRequest<RSocketGetAuthorizationsRequest.Result> {

@Serializable
data class Result(val list: List<SerializableAuthorization>, val nextPageToken: String?)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import io.timemates.api.rsocket.common.markers.RSocketRequest
import kotlinx.serialization.Serializable

@Serializable
internal data class RenewAuthorizationRequest(
internal data class RSocketRenewAuthorizationRequest(
val refreshHash: String,
) : RSocketRequest<RenewAuthorizationRequest.Result> {
) : RSocketRequest<RSocketRenewAuthorizationRequest.Result> {
@Serializable
data class Result(val accessHash: String)
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import io.timemates.api.rsocket.common.markers.RSocketRequest
import kotlinx.serialization.Serializable

@Serializable
internal data class StartAuthorizationRequest(
internal data class RSocketStartAuthorizationRequest(
val email: String,
val clientMetadata: SerializableAuthMetadata,
) : RSocketRequest<StartAuthorizationRequest.Result> {
) : RSocketRequest<RSocketStartAuthorizationRequest.Result> {
@Serializable
data class Result(
val verificationHash: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
internal sealed class TerminateAuthorizationRequest<R> : RSocketRequest<R> {
internal sealed class RSocketTerminateAuthorizationRequest<R> : RSocketRequest<R> {
/**
* This type of termination request terminates authorization with which
* user has sent termination request.
*/
@SerialName("current")
data object Current : TerminateAuthorizationRequest<Unit>()
data object Current : RSocketTerminateAuthorizationRequest<Unit>()
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ package io.timemates.api.rsocket.users.commands
import io.rsocket.kotlin.RSocket
import io.timemates.api.rsocket.common.commands.RSocketCommand
import io.timemates.api.rsocket.common.ext.requestResponse
import io.timemates.api.rsocket.users.requests.EditUserProfileRequest
import io.timemates.api.rsocket.users.types.serializable
import io.timemates.sdk.common.annotations.ExperimentalTimeMatesApi
import io.timemates.sdk.common.types.Empty
import io.timemates.sdk.users.profile.requests.EditProfileRequest
import io.timemates.sdk.users.settings.requests.EditEmailRequest

@OptIn(ExperimentalTimeMatesApi::class)
internal object EditEmailCommand : RSocketCommand<EditEmailRequest, Empty> {
override suspend fun execute(rSocket: RSocket, input: EditEmailRequest): Empty {
return rSocket.requestResponse(
route = "users.email.edit",
data = io.timemates.api.rsocket.users.requests.EditEmailRequest(
data = io.timemates.api.rsocket.users.requests.RSocketEditEmailRequest(
email = input.newEmail.string,
),
accessHash = input.accessHash.string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package io.timemates.api.rsocket.users.commands
import io.rsocket.kotlin.RSocket
import io.timemates.api.rsocket.common.commands.RSocketCommand
import io.timemates.api.rsocket.common.ext.requestResponse
import io.timemates.api.rsocket.users.requests.EditUserProfileRequest
import io.timemates.api.rsocket.users.requests.RSocketEditUserProfileRequest
import io.timemates.api.rsocket.users.types.serializable
import io.timemates.sdk.common.types.Empty
import io.timemates.sdk.users.profile.requests.EditProfileRequest
Expand All @@ -12,7 +12,7 @@ internal object EditProfileCommand : RSocketCommand<EditProfileRequest, Empty> {
override suspend fun execute(rSocket: RSocket, input: EditProfileRequest): Empty {
return rSocket.requestResponse(
route = "users.profile.edit",
data = EditUserProfileRequest(
data = RSocketEditUserProfileRequest(
name = input.name?.string,
description = input.description?.string,
avatar = input.avatar?.serializable(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import io.timemates.api.rsocket.common.ext.requestResponse
import io.timemates.api.rsocket.users.types.SerializableUser
import io.timemates.api.rsocket.users.types.sdk
import io.timemates.sdk.users.profile.requests.GetUsersRequest
import io.timemates.api.rsocket.users.requests.GetUsersRequest as RSocketGetUsersRequest
import io.timemates.api.rsocket.users.requests.RSocketGetUsersRequest as RSocketGetUsersRequest

internal object GetUsersCommand : RSocketCommand<GetUsersRequest, GetUsersRequest.Result> {
override suspend fun execute(rSocket: RSocket, input: GetUsersRequest): GetUsersRequest.Result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import io.timemates.api.rsocket.common.markers.RSocketRequest
import kotlinx.serialization.Serializable

@Serializable
internal data class EditEmailRequest(
internal data class RSocketEditEmailRequest(
val email: String,
) : RSocketRequest<Unit>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.timemates.api.rsocket.users.types.SerializableAvatar
import kotlinx.serialization.Serializable

@Serializable
internal data class EditUserProfileRequest(
internal data class RSocketEditUserProfileRequest(
val avatar: SerializableAvatar?,
val name: String?,
val description: String?,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import io.timemates.api.rsocket.users.types.SerializableUser
import kotlinx.serialization.Serializable

@Serializable
internal data class GetUsersRequest(
internal data class RSocketGetUsersRequest(
val ids: List<Long>,
) : RSocketRequest<GetUsersRequest.Result> {
) : RSocketRequest<RSocketGetUsersRequest.Result> {
@Serializable
data class Result(val list: List<SerializableUser>)
}

0 comments on commit 3df324f

Please sign in to comment.