Blazor Diffusion

<back to all web services

UpdateCreative

Creatives
Requires Authentication
Imports System
Imports System.IO
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports BlazorDiffusion.ServiceModel

Namespace Global

    Namespace BlazorDiffusion.ServiceModel

        Public Partial Class Artifact
            Inherits AuditBase
            Public Overridable Property Id As Integer
            <References(GetType(Creative))>
            Public Overridable Property CreativeId As Integer

            Public Overridable Property FileName As String
            Public Overridable Property FilePath As String
            Public Overridable Property ContentType As String
            Public Overridable Property ContentLength As Long
            Public Overridable Property Width As Integer
            Public Overridable Property Height As Integer
            Public Overridable Property Seed As UInt64
            Public Overridable Property Prompt As String
            Public Overridable Property Nsfw As Boolean?
            Public Overridable Property AverageHash As Long?
            Public Overridable Property PerceptualHash As Long?
            Public Overridable Property DifferenceHash As Long?
            Public Overridable Property Background As String
            Public Overridable Property Lqip As String
            Public Overridable Property Quality As Integer
            Public Overridable Property LikesCount As Integer
            Public Overridable Property AlbumsCount As Integer
            Public Overridable Property DownloadsCount As Integer
            Public Overridable Property SearchCount As Integer
            Public Overridable Property TemporalScore As Integer
            Public Overridable Property Score As Integer
            Public Overridable Property Rank As Integer
            Public Overridable Property RefId As String
            Public Overridable Property Versions As Dictionary(Of String, String) = New Dictionary(Of String, String)
        End Class

        Public Partial Class Artist
            Inherits AuditBase
            Public Overridable Property Id As Integer
            Public Overridable Property FirstName As String
            Public Overridable Property LastName As String
            Public Overridable Property YearDied As Integer?
            Public Overridable Property Type As List(Of String)
            Public Overridable Property Score As Integer
            Public Overridable Property Rank As Integer
        End Class

        Public Partial Class Creative
            Inherits AuditBase
            Public Overridable Property Id As Integer
            Public Overridable Property UserPrompt As String
            Public Overridable Property Prompt As String
            Public Overridable Property Images As Integer
            Public Overridable Property Width As Integer
            Public Overridable Property Height As Integer
            Public Overridable Property Steps As Integer
            Public Overridable Property CuratedArtifactId As Integer?
            Public Overridable Property PrimaryArtifactId As Integer?
            Public Overridable Property ArtistNames As List(Of String) = New List(Of String)
            Public Overridable Property ModifierNames As List(Of String) = New List(Of String)
            Public Overridable Property Artists As List(Of CreativeArtist) = New List(Of CreativeArtist)
            Public Overridable Property Modifiers As List(Of CreativeModifier) = New List(Of CreativeModifier)
            Public Overridable Property Artifacts As List(Of Artifact) = New List(Of Artifact)
            Public Overridable Property [Error] As String
            Public Overridable Property OwnerId As Integer?
            Public Overridable Property OwnerRef As String
            Public Overridable Property Key As String
            Public Overridable Property Curated As Boolean
            Public Overridable Property Rating As Integer?
            Public Overridable Property [Private] As Boolean
            Public Overridable Property Score As Integer
            Public Overridable Property Rank As Integer
            Public Overridable Property RefId As String
            Public Overridable Property RequestId As String
            Public Overridable Property EngineId As String
        End Class

        <ValidateRequest(Validator:="HasRole(`Moderator`)")>
        Public Partial Class CreativeArtist
            Public Overridable Property Id As Integer
            <References(GetType(Creative))>
            Public Overridable Property CreativeId As Integer

            <References(GetType(Artist))>
            Public Overridable Property ArtistId As Integer

            Public Overridable Property Artist As Artist
        End Class

        Public Partial Class CreativeModifier
            Public Overridable Property Id As Integer
            <References(GetType(Creative))>
            Public Overridable Property CreativeId As Integer

            <References(GetType(Modifier))>
            Public Overridable Property ModifierId As Integer

            Public Overridable Property Modifier As Modifier
        End Class

        Public Partial Class Modifier
            Inherits AuditBase
            Public Overridable Property Id As Integer
            Public Overridable Property Name As String
            Public Overridable Property Category As String
            Public Overridable Property Description As String
            Public Overridable Property Score As Integer
            Public Overridable Property Rank As Integer
        End Class

        <ValidateRequest(Validator:="IsAuthenticated")>
        Public Partial Class UpdateCreative
            Implements IPatchDb(Of Creative)
            Public Overridable Property Id As Integer
            Public Overridable Property PrimaryArtifactId As Integer?
            Public Overridable Property UnpinPrimaryArtifact As Boolean?
        End Class
    End Namespace

    Namespace ServiceStack

        <DataContract>
        Public Partial Class AuditBase
            <DataMember(Order:=1)>
            Public Overridable Property CreatedDate As Date

            <DataMember(Order:=2)>
            <Required>
            Public Overridable Property CreatedBy As String

            <DataMember(Order:=3)>
            Public Overridable Property ModifiedDate As Date

            <DataMember(Order:=4)>
            <Required>
            Public Overridable Property ModifiedBy As String

            <DataMember(Order:=5)>
            Public Overridable Property DeletedDate As Date?

            <DataMember(Order:=6)>
            Public Overridable Property DeletedBy As String
        End Class
    End Namespace
End Namespace

VB.NET UpdateCreative DTOs

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

HTTP + OTHER

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

POST /jsonl/reply/UpdateCreative HTTP/1.1 
Host: blazordiffusion.com 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"id":0,"primaryArtifactId":0,"unpinPrimaryArtifact":false}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"id":0,"userPrompt":"String","prompt":"String","images":0,"width":0,"height":0,"steps":0,"curatedArtifactId":0,"primaryArtifactId":0,"artistNames":["String"],"modifierNames":["String"],"artists":[{"id":0,"creativeId":0,"artistId":0,"artist":{"id":0,"firstName":"String","lastName":"String","yearDied":0,"type":["String"],"score":0,"rank":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"}}],"modifiers":[{"id":0,"creativeId":0,"modifierId":0,"modifier":{"id":0,"name":"String","category":"String","description":"String","score":0,"rank":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"}}],"artifacts":[{"id":0,"creativeId":0,"fileName":"String","filePath":"String","contentType":"String","contentLength":0,"width":0,"height":0,"seed":0,"prompt":"String","nsfw":false,"averageHash":0,"perceptualHash":0,"differenceHash":0,"background":"String","lqip":"String","quality":0,"likesCount":0,"albumsCount":0,"downloadsCount":0,"searchCount":0,"temporalScore":0,"score":0,"rank":0,"refId":"String","versions":{"String":"String"},"createdDate":"0001-01-01T00:00:00","createdBy":"String","modifiedDate":"0001-01-01T00:00:00","modifiedBy":"String","deletedDate":"0001-01-01T00:00:00","deletedBy":"String"}],"error":"String","ownerId":0,"ownerRef":"String","key":"String","curated":false,"rating":0,"private":false,"score":0,"rank":0,"refId":"String","requestId":"String","engineId":"String","createdDate":"0001-01-01T00:00:00","createdBy":"String","modifiedDate":"0001-01-01T00:00:00","modifiedBy":"String","deletedDate":"0001-01-01T00:00:00","deletedBy":"String"}