diff --git a/MastodonAPI/Sources/MastodonAPI/Endpoints/DeletionEndpoint.swift b/MastodonAPI/Sources/MastodonAPI/Endpoints/EmptyEndpoint.swift similarity index 76% rename from MastodonAPI/Sources/MastodonAPI/Endpoints/DeletionEndpoint.swift rename to MastodonAPI/Sources/MastodonAPI/Endpoints/EmptyEndpoint.swift index 57e360e..228b39c 100644 --- a/MastodonAPI/Sources/MastodonAPI/Endpoints/DeletionEndpoint.swift +++ b/MastodonAPI/Sources/MastodonAPI/Endpoints/EmptyEndpoint.swift @@ -4,22 +4,22 @@ import Foundation import HTTP import Mastodon -public enum DeletionEndpoint { +public enum EmptyEndpoint { case oauthRevoke(token: String, clientId: String, clientSecret: String) - case list(id: List.Id) - case filter(id: Filter.Id) + case deleteList(id: List.Id) + case deleteFilter(id: Filter.Id) } -extension DeletionEndpoint: Endpoint { +extension EmptyEndpoint: Endpoint { public typealias ResultType = [String: String] public var context: [String] { switch self { case .oauthRevoke: return ["oauth"] - case .list: + case .deleteList: return defaultContext + ["lists"] - case .filter: + case .deleteFilter: return defaultContext + ["filters"] } } @@ -28,7 +28,7 @@ extension DeletionEndpoint: Endpoint { switch self { case .oauthRevoke: return ["revoke"] - case let .list(id), let .filter(id): + case let .deleteList(id), let .deleteFilter(id): return [id] } } @@ -37,7 +37,7 @@ extension DeletionEndpoint: Endpoint { switch self { case .oauthRevoke: return .post - case .list, .filter: + case .deleteList, .deleteFilter: return .delete } } @@ -46,7 +46,7 @@ extension DeletionEndpoint: Endpoint { switch self { case let .oauthRevoke(token, clientId, clientSecret): return ["token": token, "client_id": clientId, "client_secret": clientSecret] - case .list, .filter: + case .deleteList, .deleteFilter: return nil } } diff --git a/ServiceLayer/Sources/ServiceLayer/Services/AllIdentitiesService.swift b/ServiceLayer/Sources/ServiceLayer/Services/AllIdentitiesService.swift index a5e8dd4..01de9cf 100644 --- a/ServiceLayer/Sources/ServiceLayer/Services/AllIdentitiesService.swift +++ b/ServiceLayer/Sources/ServiceLayer/Services/AllIdentitiesService.swift @@ -99,7 +99,7 @@ public extension AllIdentitiesService { return MastodonAPIClient( session: environment.session, instanceURL: try secrets.getInstanceURL()) - .request(DeletionEndpoint.oauthRevoke( + .request(EmptyEndpoint.oauthRevoke( token: try secrets.getAccessToken(), clientId: try secrets.getClientId(), clientSecret: try secrets.getClientSecret())) diff --git a/ServiceLayer/Sources/ServiceLayer/Services/IdentityService.swift b/ServiceLayer/Sources/ServiceLayer/Services/IdentityService.swift index d5e160d..42eb0a5 100644 --- a/ServiceLayer/Sources/ServiceLayer/Services/IdentityService.swift +++ b/ServiceLayer/Sources/ServiceLayer/Services/IdentityService.swift @@ -87,7 +87,7 @@ public extension IdentityService { } func deleteList(id: List.Id) -> AnyPublisher { - mastodonAPIClient.request(DeletionEndpoint.list(id: id)) + mastodonAPIClient.request(EmptyEndpoint.deleteList(id: id)) .map { _ in id } .flatMap(contentDatabase.deleteList(id:)) .eraseToAnyPublisher() @@ -152,7 +152,7 @@ public extension IdentityService { } func deleteFilter(id: Filter.Id) -> AnyPublisher { - mastodonAPIClient.request(DeletionEndpoint.filter(id: id)) + mastodonAPIClient.request(EmptyEndpoint.deleteFilter(id: id)) .flatMap { _ in contentDatabase.deleteFilter(id: id) } .eraseToAnyPublisher() }