chore: rename reblog API
This commit is contained in:
parent
441a6aee9e
commit
51b6455c37
|
@ -160,15 +160,15 @@ extension StatusProviderFacade {
|
|||
let responseFeedbackGenerator = UIImpactFeedbackGenerator(style: .medium)
|
||||
|
||||
toot
|
||||
.compactMap { toot -> (NSManagedObjectID, Mastodon.API.Status.Reblog.BoostKind)? in
|
||||
.compactMap { toot -> (NSManagedObjectID, Mastodon.API.Reblog.BoostKind)? in
|
||||
guard let toot = toot?.reblog ?? toot else { return nil }
|
||||
let boostKind: Mastodon.API.Status.Reblog.BoostKind = {
|
||||
let boostKind: Mastodon.API.Reblog.BoostKind = {
|
||||
let isBoosted = toot.rebloggedBy.flatMap { $0.contains(where: { $0.id == mastodonUserID }) } ?? false
|
||||
return isBoosted ? .undoBoost : .boost
|
||||
}()
|
||||
return (toot.objectID, boostKind)
|
||||
}
|
||||
.map { tootObjectID, boostKind -> AnyPublisher<(Toot.ID, Mastodon.API.Status.Reblog.BoostKind), Error> in
|
||||
.map { tootObjectID, boostKind -> AnyPublisher<(Toot.ID, Mastodon.API.Reblog.BoostKind), Error> in
|
||||
return context.apiService.boost(
|
||||
tootObjectID: tootObjectID,
|
||||
mastodonUserObjectID: mastodonUserObjectID,
|
||||
|
|
|
@ -18,7 +18,7 @@ extension APIService {
|
|||
func boost(
|
||||
tootObjectID: NSManagedObjectID,
|
||||
mastodonUserObjectID: NSManagedObjectID,
|
||||
boostKind: Mastodon.API.Status.Reblog.BoostKind
|
||||
boostKind: Mastodon.API.Reblog.BoostKind
|
||||
) -> AnyPublisher<Toot.ID, Error> {
|
||||
var _targetTootID: Toot.ID?
|
||||
let managedObjectContext = backgroundManagedObjectContext
|
||||
|
@ -51,13 +51,13 @@ extension APIService {
|
|||
// send boost request to remote
|
||||
func boost(
|
||||
statusID: Mastodon.Entity.Status.ID,
|
||||
boostKind: Mastodon.API.Status.Reblog.BoostKind,
|
||||
boostKind: Mastodon.API.Reblog.BoostKind,
|
||||
mastodonAuthenticationBox: AuthenticationService.MastodonAuthenticationBox
|
||||
) -> AnyPublisher<Mastodon.Response.Content<Mastodon.Entity.Status>, Error> {
|
||||
let domain = mastodonAuthenticationBox.domain
|
||||
let authorization = mastodonAuthenticationBox.userAuthorization
|
||||
let requestMastodonUserID = mastodonAuthenticationBox.userID
|
||||
return Mastodon.API.Status.Reblog.boost(
|
||||
return Mastodon.API.Reblog.boost(
|
||||
session: session,
|
||||
domain: domain,
|
||||
statusID: statusID,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
import Foundation
|
||||
import Combine
|
||||
|
||||
extension Mastodon.API.Status.Reblog {
|
||||
extension Mastodon.API.Reblog {
|
||||
|
||||
static func boostedByEndpointURL(domain: String, statusID: Mastodon.Entity.Status.ID) -> URL {
|
||||
let pathComponent = "statuses/" + statusID + "/reblogged_by"
|
||||
|
@ -52,7 +52,7 @@ extension Mastodon.API.Status.Reblog {
|
|||
|
||||
}
|
||||
|
||||
extension Mastodon.API.Status.Reblog {
|
||||
extension Mastodon.API.Reblog {
|
||||
|
||||
static func reblogEndpointURL(domain: String, statusID: Mastodon.Entity.Status.ID) -> URL {
|
||||
let pathComponent = "statuses/" + statusID + "/reblog"
|
||||
|
@ -107,7 +107,7 @@ extension Mastodon.API.Status.Reblog {
|
|||
|
||||
}
|
||||
|
||||
extension Mastodon.API.Status.Reblog {
|
||||
extension Mastodon.API.Reblog {
|
||||
|
||||
static func unreblogEndpointURL(domain: String, statusID: Mastodon.Entity.Status.ID) -> URL {
|
||||
let pathComponent = "statuses/" + statusID + "/unreblog"
|
||||
|
@ -151,7 +151,7 @@ extension Mastodon.API.Status.Reblog {
|
|||
|
||||
}
|
||||
|
||||
extension Mastodon.API.Status.Reblog {
|
||||
extension Mastodon.API.Reblog {
|
||||
|
||||
public enum BoostKind {
|
||||
case boost
|
|
@ -7,6 +7,4 @@
|
|||
|
||||
import Foundation
|
||||
|
||||
extension Mastodon.API.Status {
|
||||
public enum Reblog { }
|
||||
}
|
||||
extension Mastodon.API.Status { }
|
||||
|
|
|
@ -95,6 +95,7 @@ extension Mastodon.API {
|
|||
public enum OAuth { }
|
||||
public enum Onboarding { }
|
||||
public enum Polls { }
|
||||
public enum Reblog { }
|
||||
public enum Status { }
|
||||
public enum Timeline { }
|
||||
public enum Favorites { }
|
||||
|
|
Loading…
Reference in New Issue