GeniuslinkAPI

<back to all web services

PostAutopilotOptionsRequest

Requires Authentication
The following routes are available for this service:
POST/v4/autopilot-options
POST/v3.5/autopilot-options
<?php namespace dtos;

use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};


// @DataContract
class PostAutopilotOptionsResponse implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="responseStatus")
        /** @var ResponseStatus|null */
        public ?ResponseStatus $responseStatus=null,

        // @DataMember(Name="success")
        /** @var bool|null */
        public ?bool $success=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
        if (isset($o['success'])) $this->success = $o['success'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
        if (isset($this->success)) $o['success'] = $this->success;
        return empty($o) ? new class(){} : $o;
    }
}

enum AutopilotFrequency : string
{
    case Daily = 'Daily';
    case Hourly = 'Hourly';
    case Once = 'Once';
}

enum AutopilotLevel : string
{
    case ShortLink = 'ShortLink';
    case Group = 'Group';
    case Account = 'Account';
}

// @DataContract
class PostAutopilotOptionsRequest implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="frequency")
        /** @var AutopilotFrequency|null */
        public ?AutopilotFrequency $frequency=null,

        // @DataMember(Name="level")
        /** @var AutopilotLevel|null */
        public ?AutopilotLevel $level=null,

        // @DataMember(Name="enabled")
        /** @var bool|null */
        public ?bool $enabled=null,

        // @DataMember(Name="identifier")
        /** @var string|null */
        public ?string $identifier=null,

        // @DataMember(Name="choicePageOptions")
        /** @var array<string,string>|null */
        public ?array $choicePageOptions=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['frequency'])) $this->frequency = JsonConverters::from('AutopilotFrequency', $o['frequency']);
        if (isset($o['level'])) $this->level = JsonConverters::from('AutopilotLevel', $o['level']);
        if (isset($o['enabled'])) $this->enabled = $o['enabled'];
        if (isset($o['identifier'])) $this->identifier = $o['identifier'];
        if (isset($o['choicePageOptions'])) $this->choicePageOptions = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['choicePageOptions']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->frequency)) $o['frequency'] = JsonConverters::to('AutopilotFrequency', $this->frequency);
        if (isset($this->level)) $o['level'] = JsonConverters::to('AutopilotLevel', $this->level);
        if (isset($this->enabled)) $o['enabled'] = $this->enabled;
        if (isset($this->identifier)) $o['identifier'] = $this->identifier;
        if (isset($this->choicePageOptions)) $o['choicePageOptions'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->choicePageOptions);
        return empty($o) ? new class(){} : $o;
    }
}

PHP PostAutopilotOptionsRequest 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 /v4/autopilot-options HTTP/1.1 
Host: geniuslink-api-zane.dev.platform.georiot.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	frequency: Daily,
	level: ShortLink,
	enabled: False,
	identifier: String,
	choicePageOptions: 
	{
		String: String
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

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