BackofficeApi

<back to all web services

PlaceAddRequest

Backoffice
Requires Authentication
Required role:Backoffice
The following routes are available for this service:
POST/place/add

library BackofficeApi;
import 'package:servicestack/servicestack.dart';

class PlaceAddress implements IConvertible
{
    String? street;
    String? postalCode;
    String? region;
    String? countryCode;

    PlaceAddress({this.street,this.postalCode,this.region,this.countryCode});
    PlaceAddress.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        street = json['street'];
        postalCode = json['postalCode'];
        region = json['region'];
        countryCode = json['countryCode'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'street': street,
        'postalCode': postalCode,
        'region': region,
        'countryCode': countryCode
    };

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

enum PlaceState
{
    Draft,
    Active,
    Paused,
    Archived,
}

class TimeZoneDto implements IConvertible
{
    Duration? baseUtcOffset;
    String? daylightName;
    String? displayName;
    String? id;
    String? standardName;
    bool? supportsDaylightSavingTime;

    TimeZoneDto({this.baseUtcOffset,this.daylightName,this.displayName,this.id,this.standardName,this.supportsDaylightSavingTime});
    TimeZoneDto.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        baseUtcOffset = JsonConverters.fromJson(json['baseUtcOffset'],'Duration',context!);
        daylightName = json['daylightName'];
        displayName = json['displayName'];
        id = json['id'];
        standardName = json['standardName'];
        supportsDaylightSavingTime = json['supportsDaylightSavingTime'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'baseUtcOffset': JsonConverters.toJson(baseUtcOffset,'Duration',context!),
        'daylightName': daylightName,
        'displayName': displayName,
        'id': id,
        'standardName': standardName,
        'supportsDaylightSavingTime': supportsDaylightSavingTime
    };

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

class PlaceContact implements IConvertible
{
    String? phone;
    String? email;
    String? website;
    String? webShop;

    PlaceContact({this.phone,this.email,this.website,this.webShop});
    PlaceContact.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        phone = json['phone'];
        email = json['email'];
        website = json['website'];
        webShop = json['webShop'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'phone': phone,
        'email': email,
        'website': website,
        'webShop': webShop
    };

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

enum BusinessRole
{
    Owner,
    Manager,
    Sales,
    Marketing,
    Other,
}

TypeContext _ctx = TypeContext(library: 'BackofficeApi', types: <String, TypeInfo> {
    'PlaceAddress': TypeInfo(TypeOf.Class, create:() => PlaceAddress()),
    'PlaceState': TypeInfo(TypeOf.Enum, enumValues:PlaceState.values),
    'TimeZoneDto': TypeInfo(TypeOf.Class, create:() => TimeZoneDto()),
    'PlaceContact': TypeInfo(TypeOf.Class, create:() => PlaceContact()),
    'BusinessRole': TypeInfo(TypeOf.Enum, enumValues:BusinessRole.values),
});

Dart PlaceAddRequest 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 /place/add HTTP/1.1 
Host: unstable-backoffice-api.brovs.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	name: String,
	organizationNumber: String,
	businessId: 0,
	address: 
	{
		street: String,
		postalCode: String,
		region: String,
		countryCode: String
	},
	rootCategoryAbsoluteSlug: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	place: 
	{
		id: 0,
		name: String,
		longitude: 0,
		latitude: 0,
		rootCategory: 
		{
			id: 0,
			name: String,
			slug: String,
			absoluteSlug: String,
			parentId: 0,
			state: String,
			position: 0
		},
		claimed: False,
		organizationNumber: String,
		state: Draft,
		countryCode: String,
		overview: String,
		timeZoneDto: 
		{
			baseUtcOffset: PT0S,
			daylightName: String,
			displayName: String,
			id: String,
			standardName: String,
			supportsDaylightSavingTime: False
		},
		businessId: 0,
		contact: 
		{
			phone: String,
			email: String,
			website: String,
			webShop: String
		},
		address: 
		{
			street: String,
			postalCode: String,
			region: String,
			countryCode: String
		},
		backofficeGrantedStaffAccess: 
		[
			{
				id: 0,
				firstName: String,
				lastName: String,
				email: String,
				role: Owner,
				placeId: 0,
				businessId: 0,
				userId: 0,
				placeName: String,
				businessName: String,
				mobileNumber: String,
				businessRole: Owner,
				lastActiveOn: 0001-01-01T00:00:00.0000000+00:00
			}
		]
	}
}