From 45c4283cbc4994427ba94e84ab9a16ace297816d Mon Sep 17 00:00:00 2001 From: Philip Chu Date: Mon, 8 Apr 2024 20:56:10 -0600 Subject: [PATCH 1/4] deleteProfileAvatar and deleteProfileHeader --- .../TootClient/TootClient+Account.swift | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Sources/TootSDK/TootClient/TootClient+Account.swift b/Sources/TootSDK/TootClient/TootClient+Account.swift index dfc1c549..f51b8b42 100644 --- a/Sources/TootSDK/TootClient/TootClient+Account.swift +++ b/Sources/TootSDK/TootClient/TootClient+Account.swift @@ -253,6 +253,26 @@ extension TootClient { return try await fetch([List].self, req) } + /// Deletes the avatar associated with the user’s profile. + 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. + 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 } From 4b0d0f183c2934b70b10d99b0dc6110f79707926 Mon Sep 17 00:00:00 2001 From: Philip Chu Date: Wed, 17 Apr 2024 15:46:40 -0600 Subject: [PATCH 2/4] swift format --- Sources/TootSDK/TootClient/TootClient+Account.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/TootSDK/TootClient/TootClient+Account.swift b/Sources/TootSDK/TootClient/TootClient+Account.swift index f51b8b42..2e7dce4e 100644 --- a/Sources/TootSDK/TootClient/TootClient+Account.swift +++ b/Sources/TootSDK/TootClient/TootClient+Account.swift @@ -264,7 +264,7 @@ extension TootClient { } /// Deletes the header image associated with the user’s profile. - public func deleteProfileHeader() async throws -> Account{ + public func deleteProfileHeader() async throws -> Account { let req = HTTPRequestBuilder { $0.url = getURL(["api", "v1", "profile", "header"]) $0.method = .delete From 4b91aa35673b7ef054236fbb0200af6ca413ec85 Mon Sep 17 00:00:00 2001 From: Phil Chu Date: Thu, 18 Apr 2024 00:38:08 -0600 Subject: [PATCH 3/4] Update Sources/TootSDK/TootClient/TootClient+Account.swift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Łukasz Rutkowski --- Sources/TootSDK/TootClient/TootClient+Account.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/TootSDK/TootClient/TootClient+Account.swift b/Sources/TootSDK/TootClient/TootClient+Account.swift index 2e7dce4e..f5144946 100644 --- a/Sources/TootSDK/TootClient/TootClient+Account.swift +++ b/Sources/TootSDK/TootClient/TootClient+Account.swift @@ -254,6 +254,7 @@ extension TootClient { } /// 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"]) From 414b4e18235cfaef7347e0cd16d39d519e23d3ea Mon Sep 17 00:00:00 2001 From: Phil Chu Date: Thu, 18 Apr 2024 00:38:24 -0600 Subject: [PATCH 4/4] Update Sources/TootSDK/TootClient/TootClient+Account.swift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Łukasz Rutkowski --- Sources/TootSDK/TootClient/TootClient+Account.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/TootSDK/TootClient/TootClient+Account.swift b/Sources/TootSDK/TootClient/TootClient+Account.swift index f5144946..5ae3cc00 100644 --- a/Sources/TootSDK/TootClient/TootClient+Account.swift +++ b/Sources/TootSDK/TootClient/TootClient+Account.swift @@ -265,6 +265,7 @@ extension TootClient { } /// 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"])