AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
ChannelType.h
Go to the documentation of this file.
1 /*
2  * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License").
5  * You may not use this file except in compliance with the License.
6  * A copy of the License is located at
7  *
8  * http://aws.amazon.com/apache2.0/
9  *
10  * or in the "license" file accompanying this file. This file is distributed
11  * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12  * express or implied. See the License for the specific language governing
13  * permissions and limitations under the License.
14  */
15 #ifndef ACSDK_ALEXACHANNELCONTROLLERINTERFACES_CHANNELTYPE_H_
16 #define ACSDK_ALEXACHANNELCONTROLLERINTERFACES_CHANNELTYPE_H_
17 
18 #include <memory>
19 #include <string>
20 
23 
24 namespace alexaClientSDK {
25 namespace alexaChannelControllerTypes {
26 
31 class Channel {
32 public:
46  static std::unique_ptr<Channel> Create(
47  std::string number,
48  std::string callSign,
49  std::string affiliateCallSign,
50  std::string uri,
51  std::string name,
52  std::string imageURL) {
53  if (number.empty() && callSign.empty() && affiliateCallSign.empty() && uri.empty() && name.empty()) {
55  avsCommon::utils::logger::LogEntry("Channel", "CreateFailed").d("reason", "InvalidParams"));
56  return nullptr;
57  }
58  return std::unique_ptr<Channel>(new Channel(
59  std::move(number),
60  std::move(callSign),
61  std::move(affiliateCallSign),
62  std::move(uri),
63  std::move(name),
64  std::move(imageURL)));
65  }
66 
67  /*
68  * Get the number for the channel.
69  *
70  * @return empty string if the number is empty, otherwise the channel number.
71  */
73  return number.value();
74  }
75 
76  /*
77  * Get the call sign for the channel.
78  *
79  * @return empty string if the call sign is empty, otherwise the channel call sign.
80  */
82  return callSign.value();
83  }
84 
85  /*
86  * Get the affiliate call sign for the channel.
87  *
88  * @return empty string if the affiliate call sign is empty, otherwise the channel affiliate call sign.
89  */
91  return affiliateCallSign.value();
92  }
93 
94  /*
95  * Get the URI for the channel.
96  *
97  * @return empty string if the URI is empty, otherwise the channel URI.
98  */
99  std::string getURI() const {
100  return uri.value();
101  }
102 
103  /*
104  * Get the name for the channel.
105  *
106  * @return empty string if the name is empty, otherwise the channel name.
107  */
109  return name.value();
110  }
111 
112  /*
113  * Get the image or logo URL for the channel.
114  *
115  * @return empty string if the image or logo URL is empty, otherwise the image URL.
116  */
118  return imageURL.value();
119  }
120 
121 private:
132  Channel(
133  std::string number,
134  std::string callSign,
135  std::string affiliateCallSign,
136  std::string uri,
137  std::string name,
138  std::string imageURL) :
139  number{std::move(number)},
140  callSign{std::move(callSign)},
141  affiliateCallSign{std::move(affiliateCallSign)},
142  uri{std::move(uri)},
143  name{std::move(name)},
144  imageURL{std::move(imageURL)} {
145  }
146 
152  avsCommon::utils::Optional<std::string> affiliateCallSign;
160 };
161 
162 } // namespace alexaChannelControllerTypes
163 } // namespace alexaClientSDK
164 #endif // ACSDK_ALEXACHANNELCONTROLLERINTERFACES_CHANNELTYPE_H_
std::string getName() const
Definition: ChannelType.h:108
std::string getNumber() const
Definition: ChannelType.h:72
::std::string string
Definition: gtest-port.h:1097
static std::unique_ptr< Channel > Create(std::string number, std::string callSign, std::string affiliateCallSign, std::string uri, std::string name, std::string imageURL)
Definition: ChannelType.h:46
std::string getAffiliateCallSign() const
Definition: ChannelType.h:90
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
std::string getURI() const
Definition: ChannelType.h:99
void acsdkError(const LogEntry &entry)
std::string getImageURL() const
Definition: ChannelType.h:117
std::string getCallSign() const
Definition: ChannelType.h:81
ValueT value() const
Definition: Optional.h:208
const T & move(const T &t)
Definition: gtest-port.h:1317
LogEntry is used to compile the log entry text to log via Logger.
Definition: LogEntry.h:33

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