Blazor Diffusion

<back to all web services

GetCreative

Creatives
import 'package:servicestack/servicestack.dart';

// @DataContract
abstract class AuditBase
{
    // @DataMember(Order=1)
    DateTime? createdDate;

    // @DataMember(Order=2)
    // @required()
    String? createdBy;

    // @DataMember(Order=3)
    DateTime? modifiedDate;

    // @DataMember(Order=4)
    // @required()
    String? modifiedBy;

    // @DataMember(Order=5)
    DateTime? deletedDate;

    // @DataMember(Order=6)
    String? deletedBy;

    AuditBase({this.createdDate,this.createdBy,this.modifiedDate,this.modifiedBy,this.deletedDate,this.deletedBy});
    AuditBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
        createdBy = json['createdBy'];
        modifiedDate = JsonConverters.fromJson(json['modifiedDate'],'DateTime',context!);
        modifiedBy = json['modifiedBy'];
        deletedDate = JsonConverters.fromJson(json['deletedDate'],'DateTime',context!);
        deletedBy = json['deletedBy'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!),
        'createdBy': createdBy,
        'modifiedDate': JsonConverters.toJson(modifiedDate,'DateTime',context!),
        'modifiedBy': modifiedBy,
        'deletedDate': JsonConverters.toJson(deletedDate,'DateTime',context!),
        'deletedBy': deletedBy
    };

    getTypeName() => "AuditBase";
    TypeContext? context = _ctx;
}

class Artist extends AuditBase implements IConvertible
{
    int? id;
    String? firstName;
    String? lastName;
    int? yearDied;
    List<String>? type;
    int? score;
    int? rank;

    Artist({this.id,this.firstName,this.lastName,this.yearDied,this.type,this.score,this.rank});
    Artist.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        firstName = json['firstName'];
        lastName = json['lastName'];
        yearDied = json['yearDied'];
        type = JsonConverters.fromJson(json['type'],'List<String>',context!);
        score = json['score'];
        rank = json['rank'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'firstName': firstName,
        'lastName': lastName,
        'yearDied': yearDied,
        'type': JsonConverters.toJson(type,'List<String>',context!),
        'score': score,
        'rank': rank
    });

    getTypeName() => "Artist";
    TypeContext? context = _ctx;
}

// @ValidateRequest(Validator="HasRole(`Moderator`)")
class CreativeArtist implements IConvertible
{
    int? id;
    // @References(typeof(Creative))
    int? creativeId;

    // @References(typeof(Artist))
    int? artistId;

    Artist? artist;

    CreativeArtist({this.id,this.creativeId,this.artistId,this.artist});
    CreativeArtist.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        creativeId = json['creativeId'];
        artistId = json['artistId'];
        artist = JsonConverters.fromJson(json['artist'],'Artist',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'creativeId': creativeId,
        'artistId': artistId,
        'artist': JsonConverters.toJson(artist,'Artist',context!)
    };

    getTypeName() => "CreativeArtist";
    TypeContext? context = _ctx;
}

class Modifier extends AuditBase implements IConvertible
{
    int? id;
    String? name;
    String? category;
    String? description;
    int? score;
    int? rank;

    Modifier({this.id,this.name,this.category,this.description,this.score,this.rank});
    Modifier.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        name = json['name'];
        category = json['category'];
        description = json['description'];
        score = json['score'];
        rank = json['rank'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'name': name,
        'category': category,
        'description': description,
        'score': score,
        'rank': rank
    });

    getTypeName() => "Modifier";
    TypeContext? context = _ctx;
}

class CreativeModifier implements IConvertible
{
    int? id;
    // @References(typeof(Creative))
    int? creativeId;

    // @References(typeof(Modifier))
    int? modifierId;

    Modifier? modifier;

    CreativeModifier({this.id,this.creativeId,this.modifierId,this.modifier});
    CreativeModifier.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        creativeId = json['creativeId'];
        modifierId = json['modifierId'];
        modifier = JsonConverters.fromJson(json['modifier'],'Modifier',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'creativeId': creativeId,
        'modifierId': modifierId,
        'modifier': JsonConverters.toJson(modifier,'Modifier',context!)
    };

    getTypeName() => "CreativeModifier";
    TypeContext? context = _ctx;
}

class Artifact extends AuditBase implements IConvertible
{
    int? id;
    // @References(typeof(Creative))
    int? creativeId;

    String? fileName;
    String? filePath;
    String? contentType;
    int? contentLength;
    int? width;
    int? height;
    int? seed;
    String? prompt;
    bool? nsfw;
    int? averageHash;
    int? perceptualHash;
    int? differenceHash;
    String? background;
    String? lqip;
    int? quality;
    int? likesCount;
    int? albumsCount;
    int? downloadsCount;
    int? searchCount;
    int? temporalScore;
    int? score;
    int? rank;
    String? refId;
    Map<String,String?>? versions = {};

    Artifact({this.id,this.creativeId,this.fileName,this.filePath,this.contentType,this.contentLength,this.width,this.height,this.seed,this.prompt,this.nsfw,this.averageHash,this.perceptualHash,this.differenceHash,this.background,this.lqip,this.quality,this.likesCount,this.albumsCount,this.downloadsCount,this.searchCount,this.temporalScore,this.score,this.rank,this.refId,this.versions});
    Artifact.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        creativeId = json['creativeId'];
        fileName = json['fileName'];
        filePath = json['filePath'];
        contentType = json['contentType'];
        contentLength = json['contentLength'];
        width = json['width'];
        height = json['height'];
        seed = json['seed'];
        prompt = json['prompt'];
        nsfw = json['nsfw'];
        averageHash = json['averageHash'];
        perceptualHash = json['perceptualHash'];
        differenceHash = json['differenceHash'];
        background = json['background'];
        lqip = json['lqip'];
        quality = json['quality'];
        likesCount = json['likesCount'];
        albumsCount = json['albumsCount'];
        downloadsCount = json['downloadsCount'];
        searchCount = json['searchCount'];
        temporalScore = json['temporalScore'];
        score = json['score'];
        rank = json['rank'];
        refId = json['refId'];
        versions = JsonConverters.toStringMap(json['versions']);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'creativeId': creativeId,
        'fileName': fileName,
        'filePath': filePath,
        'contentType': contentType,
        'contentLength': contentLength,
        'width': width,
        'height': height,
        'seed': seed,
        'prompt': prompt,
        'nsfw': nsfw,
        'averageHash': averageHash,
        'perceptualHash': perceptualHash,
        'differenceHash': differenceHash,
        'background': background,
        'lqip': lqip,
        'quality': quality,
        'likesCount': likesCount,
        'albumsCount': albumsCount,
        'downloadsCount': downloadsCount,
        'searchCount': searchCount,
        'temporalScore': temporalScore,
        'score': score,
        'rank': rank,
        'refId': refId,
        'versions': versions
    });

    getTypeName() => "Artifact";
    TypeContext? context = _ctx;
}

class Creative extends AuditBase implements IConvertible
{
    int? id;
    String? userPrompt;
    String? prompt;
    int? images;
    int? width;
    int? height;
    int? steps;
    int? curatedArtifactId;
    int? primaryArtifactId;
    List<String>? artistNames = [];
    List<String>? modifierNames = [];
    List<CreativeArtist>? artists = [];
    List<CreativeModifier>? modifiers = [];
    List<Artifact>? artifacts = [];
    String? error;
    int? ownerId;
    String? ownerRef;
    String? key;
    bool? curated;
    int? rating;
    bool? private;
    int? score;
    int? rank;
    String? refId;
    String? requestId;
    String? engineId;

    Creative({this.id,this.userPrompt,this.prompt,this.images,this.width,this.height,this.steps,this.curatedArtifactId,this.primaryArtifactId,this.artistNames,this.modifierNames,this.artists,this.modifiers,this.artifacts,this.error,this.ownerId,this.ownerRef,this.key,this.curated,this.rating,this.private,this.score,this.rank,this.refId,this.requestId,this.engineId});
    Creative.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        id = json['id'];
        userPrompt = json['userPrompt'];
        prompt = json['prompt'];
        images = json['images'];
        width = json['width'];
        height = json['height'];
        steps = json['steps'];
        curatedArtifactId = json['curatedArtifactId'];
        primaryArtifactId = json['primaryArtifactId'];
        artistNames = JsonConverters.fromJson(json['artistNames'],'List<String>',context!);
        modifierNames = JsonConverters.fromJson(json['modifierNames'],'List<String>',context!);
        artists = JsonConverters.fromJson(json['artists'],'List<CreativeArtist>',context!);
        modifiers = JsonConverters.fromJson(json['modifiers'],'List<CreativeModifier>',context!);
        artifacts = JsonConverters.fromJson(json['artifacts'],'List<Artifact>',context!);
        error = json['error'];
        ownerId = json['ownerId'];
        ownerRef = json['ownerRef'];
        key = json['key'];
        curated = json['curated'];
        rating = json['rating'];
        private = json['private'];
        score = json['score'];
        rank = json['rank'];
        refId = json['refId'];
        requestId = json['requestId'];
        engineId = json['engineId'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'id': id,
        'userPrompt': userPrompt,
        'prompt': prompt,
        'images': images,
        'width': width,
        'height': height,
        'steps': steps,
        'curatedArtifactId': curatedArtifactId,
        'primaryArtifactId': primaryArtifactId,
        'artistNames': JsonConverters.toJson(artistNames,'List<String>',context!),
        'modifierNames': JsonConverters.toJson(modifierNames,'List<String>',context!),
        'artists': JsonConverters.toJson(artists,'List<CreativeArtist>',context!),
        'modifiers': JsonConverters.toJson(modifiers,'List<CreativeModifier>',context!),
        'artifacts': JsonConverters.toJson(artifacts,'List<Artifact>',context!),
        'error': error,
        'ownerId': ownerId,
        'ownerRef': ownerRef,
        'key': key,
        'curated': curated,
        'rating': rating,
        'private': private,
        'score': score,
        'rank': rank,
        'refId': refId,
        'requestId': requestId,
        'engineId': engineId
    });

    getTypeName() => "Creative";
    TypeContext? context = _ctx;
}

class GetCreativeResponse implements IConvertible
{
    Creative? result;
    ResponseStatus? responseStatus;

    GetCreativeResponse({this.result,this.responseStatus});
    GetCreativeResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        result = JsonConverters.fromJson(json['result'],'Creative',context!);
        responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'result': JsonConverters.toJson(result,'Creative',context!),
        'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
    };

    getTypeName() => "GetCreativeResponse";
    TypeContext? context = _ctx;
}

class GetCreative implements IGet, IConvertible
{
    int? id;
    int? artifactId;

    GetCreative({this.id,this.artifactId});
    GetCreative.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        artifactId = json['artifactId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'artifactId': artifactId
    };

    getTypeName() => "GetCreative";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'blazordiffusion.com', types: <String, TypeInfo> {
    'Artist': TypeInfo(TypeOf.Class, create:() => Artist()),
    'CreativeArtist': TypeInfo(TypeOf.Class, create:() => CreativeArtist()),
    'Modifier': TypeInfo(TypeOf.Class, create:() => Modifier()),
    'CreativeModifier': TypeInfo(TypeOf.Class, create:() => CreativeModifier()),
    'Artifact': TypeInfo(TypeOf.Class, create:() => Artifact()),
    'Creative': TypeInfo(TypeOf.Class, create:() => Creative()),
    'List<CreativeArtist>': TypeInfo(TypeOf.Class, create:() => <CreativeArtist>[]),
    'List<CreativeModifier>': TypeInfo(TypeOf.Class, create:() => <CreativeModifier>[]),
    'List<Artifact>': TypeInfo(TypeOf.Class, create:() => <Artifact>[]),
    'GetCreativeResponse': TypeInfo(TypeOf.Class, create:() => GetCreativeResponse()),
    'GetCreative': TypeInfo(TypeOf.Class, create:() => GetCreative()),
});

Dart GetCreative 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/GetCreative HTTP/1.1 
Host: blazordiffusion.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

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

<GetCreativeResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BlazorDiffusion.ServiceModel">
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <Result>
    <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>
    <Artifacts>
      <Artifact>
        <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>
        <AlbumsCount>0</AlbumsCount>
        <AverageHash>0</AverageHash>
        <Background>String</Background>
        <ContentLength>0</ContentLength>
        <ContentType>String</ContentType>
        <CreativeId>0</CreativeId>
        <DifferenceHash>0</DifferenceHash>
        <DownloadsCount>0</DownloadsCount>
        <FileName>String</FileName>
        <FilePath>String</FilePath>
        <Height>0</Height>
        <Id>0</Id>
        <LikesCount>0</LikesCount>
        <Lqip>String</Lqip>
        <Nsfw>false</Nsfw>
        <PerceptualHash>0</PerceptualHash>
        <Prompt>String</Prompt>
        <Quality>0</Quality>
        <Rank>0</Rank>
        <RefId>String</RefId>
        <Score>0</Score>
        <SearchCount>0</SearchCount>
        <Seed>0</Seed>
        <TemporalScore>0</TemporalScore>
        <Versions xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </Versions>
        <Width>0</Width>
      </Artifact>
    </Artifacts>
    <ArtistNames xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </ArtistNames>
    <Artists>
      <CreativeArtist>
        <Artist>
          <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>
          <FirstName>String</FirstName>
          <Id>0</Id>
          <LastName>String</LastName>
          <Rank>0</Rank>
          <Score>0</Score>
          <Type xmlns:d6p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
            <d6p1:string>String</d6p1:string>
          </Type>
          <YearDied>0</YearDied>
        </Artist>
        <ArtistId>0</ArtistId>
        <CreativeId>0</CreativeId>
        <Id>0</Id>
      </CreativeArtist>
    </Artists>
    <Curated>false</Curated>
    <CuratedArtifactId>0</CuratedArtifactId>
    <EngineId>String</EngineId>
    <Error>String</Error>
    <Height>0</Height>
    <Id>0</Id>
    <Images>0</Images>
    <Key>String</Key>
    <ModifierNames xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:string>String</d3p1:string>
    </ModifierNames>
    <Modifiers>
      <CreativeModifier>
        <CreativeId>0</CreativeId>
        <Id>0</Id>
        <Modifier>
          <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>
          <Category>String</Category>
          <Description>String</Description>
          <Id>0</Id>
          <Name>String</Name>
          <Rank>0</Rank>
          <Score>0</Score>
        </Modifier>
        <ModifierId>0</ModifierId>
      </CreativeModifier>
    </Modifiers>
    <OwnerId>0</OwnerId>
    <OwnerRef>String</OwnerRef>
    <PrimaryArtifactId>0</PrimaryArtifactId>
    <Private>false</Private>
    <Prompt>String</Prompt>
    <Rank>0</Rank>
    <Rating>0</Rating>
    <RefId>String</RefId>
    <RequestId>String</RequestId>
    <Score>0</Score>
    <Steps>0</Steps>
    <UserPrompt>String</UserPrompt>
    <Width>0</Width>
  </Result>
</GetCreativeResponse>