Betting.WebApi

<back to all web services

RegisterUserAccount

Requires Authentication
The following routes are available for this service:
POST/cmd/users/register
package dtos

import (
	"time"
)

type LoginCredentials struct {
	Username *string `json:"username,omitempty"`
	Password *string `json:"password,omitempty"`
}

type Name struct {
	First *string `json:"first,omitempty"`
	Last  *string `json:"last,omitempty"`
	Full  *string `json:"full,omitempty"`
}

type Ref struct {
	Id  string `json:"id"`
	Val string `json:"val"`
}

type GPSCoordinates struct {
	Lat float64 `json:"lat,omitempty"`
	Lng float64 `json:"lng,omitempty"`
}

type Address struct {
	Street     string                           `json:"street"`
	City       string                           `json:"city"`
	State      string                           `json:"state"`
	PostalCode string                           `json:"postalCode"`
	Country    Ref                              `json:"country"`
	Gps        GPSCoordinates                   `json:"gps"`
	Data       RecordDictionary[string, string] `json:"data"`
}

type ContactInfo struct {
	Phone *string `json:"phone,omitempty"`
	Email *string `json:"email,omitempty"`
}

type Person struct {
	Name        *Name        `json:"name,omitempty"`
	Address     *Address     `json:"address,omitempty"`
	DateOfBirth *time.Time   `json:"dateOfBirth,omitempty"`
	ContactInfo *ContactInfo `json:"contactInfo,omitempty"`
}

type AvatarImage struct {
	Base64 *string `json:"base64,omitempty"`
	Tag    *string `json:"tag,omitempty"`
}

type NewUserDTO struct {
	ExternalUserId *string             `json:"externalUserId,omitempty"`
	Credentials    *LoginCredentials   `json:"credentials,omitempty"`
	Person         *Person             `json:"person,omitempty"`
	Roles          *RecordList[string] `json:"roles,omitempty"`
	Avatar         *AvatarImage        `json:"avatar,omitempty"`
}

type RegisterUserAccount struct {
	Id         *string     `json:"id,omitempty"`
	NewUserDTO *NewUserDTO `json:"newUserDTO,omitempty"`
}

type RecordDictionary[TKey any, TVal any] map[TKey]TVal

type RecordList[T any] []T

Go RegisterUserAccount 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 /cmd/users/register HTTP/1.1 
Host: api.bettor.webhop.biz 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	id: String,
	newUserDTO: 
	{
		externalUserId: String,
		credentials: 
		{
			username: String,
			password: String
		},
		person: 
		{
			name: 
			{
				first: String,
				last: String,
				full: String String
			},
			address: 
			{
				street: String,
				city: String,
				state: String,
				postalCode: String,
				country: 
				{
					id: String,
					val: String
				},
				gps: 
				{
					lat: 0,
					lng: 0
				},
				data: 
				{
					String: String
				}
			},
			dateOfBirth: 0001-01-01,
			contactInfo: 
			{
				phone: String,
				email: String
			}
		},
		roles: 
		[
			String
		],
		avatar: 
		{
			base64: String,
			tag: String
		}
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

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