AlexaClientSDK  1.20.1
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Types | Public Member Functions | Static Public Member Functions | List of all members
alexaClientSDK::avsCommon::avs::AVSDirective Class Reference

#include <AVSDirective.h>

Inheritance diagram for alexaClientSDK::avsCommon::avs::AVSDirective:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::avsCommon::avs::AVSDirective:
Collaboration graph
[legend]

Public Types

enum  ParseStatus {
  ParseStatus::SUCCESS, ParseStatus::ERROR_INVALID_JSON, ParseStatus::ERROR_MISSING_DIRECTIVE_KEY, ParseStatus::ERROR_MISSING_HEADER_KEY,
  ParseStatus::ERROR_MISSING_NAMESPACE_KEY, ParseStatus::ERROR_MISSING_NAME_KEY, ParseStatus::ERROR_MISSING_MESSAGE_ID_KEY, ParseStatus::ERROR_MISSING_PAYLOAD_KEY
}
 

Public Member Functions

std::unique_ptr< avsCommon::avs::attachment::AttachmentReadergetAttachmentReader (const std::string &contentId, utils::sds::ReaderPolicy readerPolicy) const
 
std::string getUnparsedDirective () const
 
std::string getAttachmentContextId () const
 
- Public Member Functions inherited from alexaClientSDK::avsCommon::avs::AVSMessage
 AVSMessage (std::shared_ptr< AVSMessageHeader > avsMessageHeader, std::string payload, const utils::Optional< AVSMessageEndpoint > &endpoint=utils::Optional< AVSMessageEndpoint >())
 
virtual ~AVSMessage ()=default
 
std::string getNamespace () const
 
std::string getName () const
 
std::string getMessageId () const
 
std::string getCorrelationToken () const
 
std::string getEventCorrelationToken () const
 
std::string getPayloadVersion () const
 
std::string getInstance () const
 
std::string getDialogRequestId () const
 
std::string getPayload () const
 
std::shared_ptr< const AVSMessageHeadergetHeader () const
 
std::string getHeaderAsString () const
 
utils::Optional< AVSMessageEndpointgetEndpoint () const
 

Static Public Member Functions

static std::pair< std::unique_ptr< AVSDirective >, ParseStatuscreate (const std::string &unparsedDirective, std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface > attachmentManager, const std::string &attachmentContextId)
 
static std::unique_ptr< AVSDirectivecreate (const std::string &unparsedDirective, std::shared_ptr< AVSMessageHeader > avsMessageHeader, const std::string &payload, std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface > attachmentManager, const std::string &attachmentContextId, const utils::Optional< AVSMessageEndpoint > &endpoint=utils::Optional< AVSMessageEndpoint >())
 

Detailed Description

A class representation of the AVS directive.

Member Enumeration Documentation

◆ ParseStatus

An enum to indicate the status of parsing an AVS Directive from a JSON string representation.

Enumerator
SUCCESS 

The parse was successful.

ERROR_INVALID_JSON 

The parse failed due to invalid JSON formatting.

ERROR_MISSING_DIRECTIVE_KEY 

The parse failed due to the directive key being missing.

ERROR_MISSING_HEADER_KEY 

The parse failed due to the header key being missing.

ERROR_MISSING_NAMESPACE_KEY 

The parse failed due to the namespace key being missing.

ERROR_MISSING_NAME_KEY 

The parse failed due to the name key being missing.

ERROR_MISSING_MESSAGE_ID_KEY 

The parse failed due to the message id key being missing.

ERROR_MISSING_PAYLOAD_KEY 

The parse failed due to the message payload key being missing.

Member Function Documentation

◆ create() [1/2]

static std::pair<std::unique_ptr<AVSDirective>, ParseStatus> alexaClientSDK::avsCommon::avs::AVSDirective::create ( const std::string &  unparsedDirective,
std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface attachmentManager,
const std::string &  attachmentContextId 
)
static

Creates an AVSDirective.

Parameters
unparsedDirectiveThe unparsed AVS Directive JSON string.
attachmentManagerThe attachment manager.
attachmentContextIdThe contextId required to get attachments from the AttachmentManager.
Returns
A pair of an AVSDirective pointer and a parse status. If the AVSDirective is nullptr, the status will express the parse error.

◆ create() [2/2]

static std::unique_ptr<AVSDirective> alexaClientSDK::avsCommon::avs::AVSDirective::create ( const std::string &  unparsedDirective,
std::shared_ptr< AVSMessageHeader avsMessageHeader,
const std::string &  payload,
std::shared_ptr< avsCommon::avs::attachment::AttachmentManagerInterface attachmentManager,
const std::string &  attachmentContextId,
const utils::Optional< AVSMessageEndpoint > &  endpoint = utils::OptionalAVSMessageEndpoint >() 
)
static

Creates an AVSDirective.

Parameters
unparsedDirectiveThe unparsed AVS Directive JSON string.
avsMessageHeaderThe header fields of the Directive.
payloadThe payload of the Directive.
attachmentManagerThe attachment manager.
attachmentContextIdThe contextId required to get attachments from the AttachmentManager.
endpointOptional parameter used to identify the target endpoint for the given directive.
Returns
The created AVSDirective object or nullptr if creation failed.

◆ getAttachmentContextId()

std::string alexaClientSDK::avsCommon::avs::AVSDirective::getAttachmentContextId ( ) const

Returns the attachmentContextId.

◆ getAttachmentReader()

std::unique_ptr< AttachmentReader > alexaClientSDK::avsCommon::avs::AVSDirective::getAttachmentReader ( const std::string &  contentId,
utils::sds::ReaderPolicy  readerPolicy 
) const

Returns a reader for the attachment associated with this directive.

Parameters
contentIdThe contentId associated with the attachment.
readerPolicyThe policy with which to create the AttachmentReader.
Returns
An attachment reader or nullptr if no attachment was found with the given contentId.

◆ getUnparsedDirective()

std::string alexaClientSDK::avsCommon::avs::AVSDirective::getUnparsedDirective ( ) const

Returns the underlying unparsed directive.


The documentation for this class was generated from the following files:

AlexaClientSDK 1.20.1 - Copyright 2016-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0