Blazor Diffusion

<back to all web services

UserData

User
Requires Authentication

export class Likes
{
    public artifactIds: number[] = [];
    public albumIds: number[] = [];

    public constructor(init?: Partial<Likes>) { (Object as any).assign(this, init); }
}

export class AlbumResult
{
    public id: number;
    public name: string;
    public slug: string;
    public albumRef: string;
    public ownerRef: string;
    public primaryArtifactId?: number;
    public score: number;
    public artifactIds: number[] = [];

    public constructor(init?: Partial<AlbumResult>) { (Object as any).assign(this, init); }
}

export class UserResult
{
    public refId: string;
    public handle?: string;
    public avatar?: string;
    public profileUrl?: string;
    public likes: Likes;
    public albums: AlbumResult[] = [];

    public constructor(init?: Partial<UserResult>) { (Object as any).assign(this, init); }
}

export class UserProfile
{
    public displayName: string;
    public avatar?: string;
    public handle?: string;

    public constructor(init?: Partial<UserProfile>) { (Object as any).assign(this, init); }
}

export enum SignupType
{
    Updates = 'Updates',
    Beta = 'Beta',
}

export class UserDataResponse
{
    public user: UserResult;
    public profile: UserProfile;
    public signups: SignupType[] = [];
    public roles: string[] = [];
    public responseStatus: ResponseStatus;

    public constructor(init?: Partial<UserDataResponse>) { (Object as any).assign(this, init); }
}

// @ValidateRequest(Validator="IsAuthenticated")
export class UserData implements IPost
{

    public constructor(init?: Partial<UserData>) { (Object as any).assign(this, init); }
}

TypeScript UserData DTOs

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

HTTP + JSV

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

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

{
	
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	user: 
	{
		refId: String,
		handle: String,
		avatar: String,
		profileUrl: String,
		likes: 
		{
			artifactIds: 
			[
				0
			],
			albumIds: 
			[
				0
			]
		},
		albums: 
		[
			{
				id: 0,
				name: String,
				slug: String,
				albumRef: String,
				ownerRef: String,
				primaryArtifactId: 0,
				score: 0,
				artifactIds: 
				[
					0
				]
			}
		]
	},
	profile: 
	{
		displayName: String,
		avatar: String,
		handle: String
	},
	signups: 
	[
		Updates
	],
	roles: 
	[
		String
	],
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}