MyApp

<back to all web services

CreatePlayer

Game
import java.math.*;
import java.util.*;
import net.servicestack.client.*;

public class dtos
{

    public static class CreatePlayer implements ICreateDb<Player>
    {
        @Validate(Validator="NotEmpty")
        public String firstName = null;

        public String lastName = null;
        public String email = null;
        public ArrayList<Phone> phoneNumbers = null;
        @Validate(Validator="NotNull")
        public Integer profileId = null;

        public UUID savedLevelId = null;
        
        public String getFirstName() { return firstName; }
        public CreatePlayer setFirstName(String value) { this.firstName = value; return this; }
        public String getLastName() { return lastName; }
        public CreatePlayer setLastName(String value) { this.lastName = value; return this; }
        public String getEmail() { return email; }
        public CreatePlayer setEmail(String value) { this.email = value; return this; }
        public ArrayList<Phone> getPhoneNumbers() { return phoneNumbers; }
        public CreatePlayer setPhoneNumbers(ArrayList<Phone> value) { this.phoneNumbers = value; return this; }
        public Integer getProfileId() { return profileId; }
        public CreatePlayer setProfileId(Integer value) { this.profileId = value; return this; }
        public UUID getSavedLevelId() { return savedLevelId; }
        public CreatePlayer setSavedLevelId(UUID value) { this.savedLevelId = value; return this; }
    }

    public static class Phone
    {
        public PhoneKind kind = null;
        public String number = null;
        public String ext = null;
        
        public PhoneKind getKind() { return kind; }
        public Phone setKind(PhoneKind value) { this.kind = value; return this; }
        public String getNumber() { return number; }
        public Phone setNumber(String value) { this.number = value; return this; }
        public String getExt() { return ext; }
        public Phone setExt(String value) { this.ext = value; return this; }
    }

    public static enum PhoneKind
    {
        Home,
        Mobile,
        Work;
    }

    @DataContract
    public static class IdResponse
    {
        @DataMember(Order=1)
        public String id = null;

        @DataMember(Order=2)
        public ResponseStatus responseStatus = null;
        
        public String getId() { return id; }
        public IdResponse setId(String value) { this.id = value; return this; }
        public ResponseStatus getResponseStatus() { return responseStatus; }
        public IdResponse setResponseStatus(ResponseStatus value) { this.responseStatus = value; return this; }
    }

}

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

{
	firstName: String,
	lastName: String,
	email: String,
	phoneNumbers: 
	[
		{
			kind: Home,
			number: String,
			ext: String
		}
	],
	profileId: 0,
	savedLevelId: 00000000000000000000000000000000
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	id: String,
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}