MyApp

<back to all web services

QueryPlayer

Game
namespace MyApp.ServiceModel

open System
open System.IO
open System.Collections
open System.Collections.Generic
open System.Runtime.Serialization
open ServiceStack
open ServiceStack.DataAnnotations

    [<DataContract>]
    [<AllowNullLiteral>]
    type AuditBase() = 
        [<DataMember(Order=1)>]
        member val CreatedDate:DateTime = new DateTime() with get,set

        [<DataMember(Order=2)>]
        [<Required>]
        member val CreatedBy:String = null with get,set

        [<DataMember(Order=3)>]
        member val ModifiedDate:DateTime = new DateTime() with get,set

        [<DataMember(Order=4)>]
        [<Required>]
        member val ModifiedBy:String = null with get,set

        [<DataMember(Order=5)>]
        member val DeletedDate:Nullable<DateTime> = new Nullable<DateTime>() with get,set

        [<DataMember(Order=6)>]
        member val DeletedBy:String = null with get,set

    type PhoneKind =
        | Home = 0
        | Mobile = 1
        | Work = 2

    [<AllowNullLiteral>]
    type Phone() = 
        member val Kind:PhoneKind = new PhoneKind() with get,set
        member val Number:String = null with get,set
        member val Ext:String = null with get,set

    [<AllowNullLiteral>]
    type PlayerGameItem() = 
        member val Id:Int32 = new Int32() with get,set
        [<References(typeof<Player>)>]
        member val PlayerId:Int32 = new Int32() with get,set

        [<References(typeof<GameItem>)>]
        member val GameItemName:String = null with get,set

    type PlayerRole =
        | Leader = 0
        | Player = 1
        | NonPlayer = 2

    type PlayerRegion =
        | Africa = 1
        | Americas = 2
        | Asia = 3
        | Australasia = 4
        | Europe = 5

    [<AllowNullLiteral>]
    type Profile() = 
        inherit AuditBase()
        member val Id:Int32 = new Int32() with get,set
        member val Role:PlayerRole = new PlayerRole() with get,set
        member val Region:PlayerRegion = new PlayerRegion() with get,set
        member val Username:String = null with get,set
        member val HighScore:Int64 = new Int64() with get,set
        member val GamesPlayed:Int64 = new Int64() with get,set
        member val Energy:Int32 = new Int32() with get,set
        member val ProfileUrl:String = null with get,set
        member val CoverUrl:String = null with get,set
        member val Meta:Dictionary<String, String> = null with get,set

    [<AllowNullLiteral>]
    type Player() = 
        inherit AuditBase()
        member val Id:Int32 = new Int32() with get,set
        [<Required>]
        member val FirstName:String = null with get,set

        member val LastName:String = null with get,set
        member val Email:String = null with get,set
        member val PhoneNumbers:ResizeArray<Phone> = null with get,set
        member val GameItems:ResizeArray<PlayerGameItem> = null with get,set
        member val Profile:Profile = null with get,set
        member val ProfileId:Int32 = new Int32() with get,set
        member val SavedLevelId:Guid = new Guid() with get,set
        member val RowVersion:UInt64 = new UInt64() with get,set

    [<AllowNullLiteral>]
    type QueryPlayer() = 
        inherit QueryDb<Player>()

    [<DataContract>]
    [<AllowNullLiteral>]
    type QueryBase() = 
        [<DataMember(Order=1)>]
        member val Skip:Nullable<Int32> = new Nullable<Int32>() with get,set

        [<DataMember(Order=2)>]
        member val Take:Nullable<Int32> = new Nullable<Int32>() with get,set

        [<DataMember(Order=3)>]
        member val OrderBy:String = null with get,set

        [<DataMember(Order=4)>]
        member val OrderByDesc:String = null with get,set

        [<DataMember(Order=5)>]
        member val Include:String = null with get,set

        [<DataMember(Order=6)>]
        member val Fields:String = null with get,set

        [<DataMember(Order=7)>]
        member val Meta:Dictionary<String, String> = null with get,set

    [<AllowNullLiteral>]
    type QueryDb<T>() = 
        inherit QueryBase()

    [<AllowNullLiteral>]
    type Todo() = 
        member val Id:Int64 = new Int64() with get,set
        member val Text:String = null with get,set
        member val IsFinished:Boolean = new Boolean() with get,set

    [<DataContract>]
    [<AllowNullLiteral>]
    type QueryResponse<T>() = 
        [<DataMember(Order=1)>]
        member val Offset:Int32 = new Int32() with get,set

        [<DataMember(Order=2)>]
        member val Total:Int32 = new Int32() with get,set

        [<DataMember(Order=3)>]
        member val Results:ResizeArray<Todo> = null with get,set

        [<DataMember(Order=4)>]
        member val Meta:Dictionary<String, String> = null with get,set

        [<DataMember(Order=5)>]
        member val ResponseStatus:ResponseStatus = null with get,set

F# QueryPlayer 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/QueryPlayer HTTP/1.1 
Host: blazor-gallery.servicestack.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	skip: 0,
	take: 0,
	orderBy: String,
	orderByDesc: String,
	include: String,
	fields: String,
	meta: 
	{
		String: String
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	offset: 0,
	total: 0,
	results: 
	[
		{
			id: 0,
			firstName: String,
			lastName: String,
			email: String,
			phoneNumbers: 
			[
				{
					kind: Home,
					number: String,
					ext: String
				}
			],
			gameItems: 
			[
				{
					id: 0,
					playerId: 0,
					gameItemName: String
				}
			],
			profile: 
			{
				id: 0,
				role: Leader,
				region: Africa,
				username: String,
				highScore: 0,
				gamesPlayed: 0,
				energy: 0,
				profileUrl: String,
				coverUrl: String,
				meta: 
				{
					String: String
				},
				createdDate: 0001-01-01,
				createdBy: String,
				modifiedDate: 0001-01-01,
				modifiedBy: String,
				deletedDate: 0001-01-01,
				deletedBy: String
			},
			profileId: 0,
			savedLevelId: 00000000000000000000000000000000,
			rowVersion: 0,
			createdDate: 0001-01-01,
			createdBy: String,
			modifiedDate: 0001-01-01,
			modifiedBy: String,
			deletedDate: 0001-01-01,
			deletedBy: String
		}
	],
	meta: 
	{
		String: String
	},
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}