Skip to content

Commit

Permalink
Merge pull request #276 from technicat/delete-profile-images
Browse files Browse the repository at this point in the history
added TootClient.deleteProfileAvatar() and TootClient.deleteProfileHeader()
  • Loading branch information
kkostov committed Apr 19, 2024
2 parents aecaeb4 + 414b4e1 commit 395207b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Sources/TootSDK/TootClient/TootClient+Account.swift
Expand Up @@ -253,6 +253,28 @@ extension TootClient {
return try await fetch([List].self, req)
}

/// Deletes the avatar associated with the user’s profile.
@discardableResult
public func deleteProfileAvatar() async throws -> Account {
let req = HTTPRequestBuilder {
$0.url = getURL(["api", "v1", "profile", "avatar"])
$0.method = .delete
}

return try await fetch(Account.self, req)
}

/// Deletes the header image associated with the user’s profile.
@discardableResult
public func deleteProfileHeader() async throws -> Account {
let req = HTTPRequestBuilder {
$0.url = getURL(["api", "v1", "profile", "header"])
$0.method = .delete
}

return try await fetch(Account.self, req)
}

// TODO: - Lookup account ID from Webfinger address
}

Expand Down

0 comments on commit 395207b

Please sign in to comment.