Skip to content

Commit

Permalink
fix(#96-add-support-quit-meeting-request): rename from quit to leave
Browse files Browse the repository at this point in the history
  • Loading branch information
y9Kap committed Mar 13, 2024
1 parent 0acb707 commit 99f8c75
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public class KtorMeetacyEngine(
is ListMeetingsMapRequest -> meetings.listMeetingsMap(request) as T
is CreateMeetingRequest -> meetings.createMeeting(request) as T
is ParticipateMeetingRequest -> meetings.participateMeeting(request) as T
is QuitMeetingRequest -> meetings.quitMeeting(request) as T
is LeaveMeetingRequest -> meetings.leaveMeeting(request) as T
is GetMeetingRequest -> meetings.getMeeting(request) as T
is EditMeetingRequest -> meetings.editMeeting(request) as T
is ListMeetingParticipantsRequest -> meetings.listMeetingParticipants(request) as T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,12 +232,12 @@ internal class MeetingsEngine(
}

@Serializable
private data class QuitMeetingBody(val meetingId: MeetingIdSerializable)
private data class LeaveMeetingBody(val meetingId: MeetingIdSerializable)

private fun QuitMeetingRequest.toBody() = QuitMeetingBody(meetingId.serializable())
private fun LeaveMeetingRequest.toBody() = LeaveMeetingBody(meetingId.serializable())

suspend fun quitMeeting(request: QuitMeetingRequest) {
val url = baseUrl / "quit"
suspend fun leaveMeeting(request: LeaveMeetingRequest) {
val url = baseUrl / "leave"
val body = request.toBody()
httpClient.post(url.string) {
apiVersion(request.apiVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package app.meetacy.sdk.engine.requests
import app.meetacy.sdk.types.auth.Token
import app.meetacy.sdk.types.meeting.MeetingId

public data class QuitMeetingRequest(
public data class LeaveMeetingRequest(
val token: Token,
val meetingId: MeetingId
) : SimpleMeetacyRequest
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class AuthorizedMeetingRepository(
api.meetings.participate(data.id)
}

public suspend fun quit() {
api.meetings.quit(data.id)
public suspend fun leave() {
api.meetings.leave(data.id)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ public class AuthorizedMeetingsApi(
base.participate(api.token, meetingId)
}

public suspend fun quit(meetingId: MeetingId) {
base.quit(api.token, meetingId)
public suspend fun leave(meetingId: MeetingId) {
base.leave(api.token, meetingId)
}

public suspend fun get(meetingId: MeetingId): AuthorizedMeetingRepository {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ public class MeetingRepository(
api.meetings.participate(token, id)
}

public suspend fun quit(token: Token) {
api.meetings.quit(token, id)
public suspend fun leave(token: Token) {
api.meetings.leave(token, id)
}

public suspend fun updated(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public class MeetingsApi(private val api: MeetacyApi) {
api.engine.execute(ParticipateMeetingRequest(token, meetingId))
}

public suspend fun quit(token: Token, meetingId: MeetingId) {
api.engine.execute(QuitMeetingRequest(token, meetingId))
public suspend fun leave(token: Token, meetingId: MeetingId) {
api.engine.execute(LeaveMeetingRequest(token, meetingId))
}

public suspend fun get(token: Token, meetingId: MeetingId): MeetingRepository {
Expand Down

0 comments on commit 99f8c75

Please sign in to comment.