fixed create/edit rant request

This commit is contained in:
Wilhelm Oks 2024-12-23 16:25:34 +01:00
parent fa362e24b6
commit bf033acc93
2 changed files with 4 additions and 5 deletions

View File

@ -360,7 +360,7 @@ public extension DevRantRequest {
var parameters = config.urlParameters var parameters = config.urlParameters
parameters["content"] = text parameters["rant"] = text
parameters["tags"] = tags parameters["tags"] = tags
parameters["type"] = String(kind.rawValue) parameters["type"] = String(kind.rawValue)
@ -411,11 +411,10 @@ public extension DevRantRequest {
/// - Parameters: /// - Parameters:
/// - token: The token from the `logIn` call response. /// - token: The token from the `logIn` call response.
/// - rantId: The id of the rant. /// - rantId: The id of the rant.
/// - kind: The type of the rant.
/// - text: The text content of the rant. /// - text: The text content of the rant.
/// - tags: The rants's associated tags. /// - tags: The rants's associated tags.
/// - image: An image to attach to the rant. /// - image: An image to attach to the rant.
func editRant(token: AuthToken, rantId: Int, kind: Rant.Kind, text: String, tags: String, image: Data?, imageConversion: [ImageDataConverter] = [.unsupportedToJpeg]) async throws { func editRant(token: AuthToken, rantId: Int, text: String, tags: String, image: Data?, imageConversion: [ImageDataConverter] = [.unsupportedToJpeg]) async throws {
let boundary = UUID().uuidString let boundary = UUID().uuidString
let config = makeMultipartConfig(.post, path: "devrant/rants/\(rantId)", boundary: boundary, token: token) let config = makeMultipartConfig(.post, path: "devrant/rants/\(rantId)", boundary: boundary, token: token)
@ -424,7 +423,6 @@ public extension DevRantRequest {
parameters["rant"] = text parameters["rant"] = text
parameters["tags"] = tags parameters["tags"] = tags
parameters["type"] = String(kind.rawValue)
let convertedImage = image.flatMap { imageConversion.convert($0) } let convertedImage = image.flatMap { imageConversion.convert($0) }

View File

@ -10,7 +10,8 @@ public struct Link: Hashable, Sendable {
/// The full URL. /// The full URL.
public let url: String public let url: String
public let shortURL: String? //TODO: what is this and what is it used for? /// No idea what this is and what it is supposed to be used for.
public let shortURL: String?
/// The url as it is visible in the text of the rant or comment. /// The url as it is visible in the text of the rant or comment.
public let title: String public let title: String