Blazor Diffusion

<back to all web services

AdminUpdateArtifactComment

Admin
Requires Authentication
Required role:Admin
import Foundation
import ServiceStack

// @ValidateRequest(Validator="IsAdmin")
public class AdminUpdateArtifactComment : IPatchDb<ArtifactComment>, Codable
{
    public var id:Int
    public var replyId:Int?
    // @Validate(Validator="Length(1,280)")
    public var content:String

    public var notes:String
    public var flagReason:String

    required public init(){}
}

public class ArtifactComment : AuditBase
{
    public var id:Int
    public var artifactId:Int
    public var replyId:Int?
    public var content:String
    public var upVotes:Int
    public var downVotes:Int
    public var votes:Int
    public var flagReason:String
    public var notes:String
    public var refId:String
    public var appUserId:Int

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case id
        case artifactId
        case replyId
        case content
        case upVotes
        case downVotes
        case votes
        case flagReason
        case notes
        case refId
        case appUserId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        id = try container.decodeIfPresent(Int.self, forKey: .id)
        artifactId = try container.decodeIfPresent(Int.self, forKey: .artifactId)
        replyId = try container.decodeIfPresent(Int.self, forKey: .replyId)
        content = try container.decodeIfPresent(String.self, forKey: .content)
        upVotes = try container.decodeIfPresent(Int.self, forKey: .upVotes)
        downVotes = try container.decodeIfPresent(Int.self, forKey: .downVotes)
        votes = try container.decodeIfPresent(Int.self, forKey: .votes)
        flagReason = try container.decodeIfPresent(String.self, forKey: .flagReason)
        notes = try container.decodeIfPresent(String.self, forKey: .notes)
        refId = try container.decodeIfPresent(String.self, forKey: .refId)
        appUserId = try container.decodeIfPresent(Int.self, forKey: .appUserId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if id != nil { try container.encode(id, forKey: .id) }
        if artifactId != nil { try container.encode(artifactId, forKey: .artifactId) }
        if replyId != nil { try container.encode(replyId, forKey: .replyId) }
        if content != nil { try container.encode(content, forKey: .content) }
        if upVotes != nil { try container.encode(upVotes, forKey: .upVotes) }
        if downVotes != nil { try container.encode(downVotes, forKey: .downVotes) }
        if votes != nil { try container.encode(votes, forKey: .votes) }
        if flagReason != nil { try container.encode(flagReason, forKey: .flagReason) }
        if notes != nil { try container.encode(notes, forKey: .notes) }
        if refId != nil { try container.encode(refId, forKey: .refId) }
        if appUserId != nil { try container.encode(appUserId, forKey: .appUserId) }
    }
}


Swift AdminUpdateArtifactComment DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /json/reply/AdminUpdateArtifactComment HTTP/1.1 
Host: blazordiffusion.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"id":0,"replyId":0,"content":"String","notes":"String","flagReason":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"id":0,"artifactId":0,"replyId":0,"content":"String","upVotes":0,"downVotes":0,"votes":0,"flagReason":"String","notes":"String","refId":"String","appUserId":0,"createdDate":"0001-01-01T00:00:00","createdBy":"String","modifiedDate":"0001-01-01T00:00:00","modifiedBy":"String","deletedDate":"0001-01-01T00:00:00","deletedBy":"String"}