Blazor Diffusion

<back to all web services

UpdateArtifactComment

Comments
Requires Authentication
import Foundation
import ServiceStack

// @ValidateRequest(Validator="IsAuthenticated")
public class UpdateArtifactComment : IPatchDb<ArtifactComment>, Codable
{
    public var id:Int
    public var content: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 UpdateArtifactComment DTOs

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

HTTP + XML

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

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

<UpdateArtifactComment xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel">
  <Content>String</Content>
  <Id>0</Id>
</UpdateArtifactComment>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ArtifactComment xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel">
  <CreatedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</CreatedDate>
  <CreatedBy xmlns="http://schemas.servicestack.net/types">String</CreatedBy>
  <ModifiedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</ModifiedDate>
  <ModifiedBy xmlns="http://schemas.servicestack.net/types">String</ModifiedBy>
  <DeletedDate xmlns="http://schemas.servicestack.net/types">0001-01-01T00:00:00</DeletedDate>
  <DeletedBy xmlns="http://schemas.servicestack.net/types">String</DeletedBy>
  <AppUserId>0</AppUserId>
  <ArtifactId>0</ArtifactId>
  <Content>String</Content>
  <DownVotes>0</DownVotes>
  <FlagReason>String</FlagReason>
  <Id>0</Id>
  <Notes>String</Notes>
  <RefId>String</RefId>
  <ReplyId>0</ReplyId>
  <UpVotes>0</UpVotes>
  <Votes>0</Votes>
</ArtifactComment>