From ea8462f26b5b0bf80b11748645fa38f0c3f76a82 Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Wed, 2 Dec 2020 21:18:47 -0800 Subject: [PATCH] Renaming --- ...etionEndpoint.swift => EmptyEndpoint.swift} | 18 +++++++++--------- .../Services/AllIdentitiesService.swift | 2 +- .../Services/IdentityService.swift | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) rename MastodonAPI/Sources/MastodonAPI/Endpoints/{DeletionEndpoint.swift => EmptyEndpoint.swift} (76%) 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() }