hueplusplus  1.0.0
Public Member Functions | Protected Member Functions | List of all members
hueplusplus::CreateableResourceList< BaseResourceList, CreateType > Class Template Reference

Handles a ResourceList where Resources can be added by the user. More...

#include <hueplusplus/ResourceList.h>

+ Inheritance diagram for hueplusplus::CreateableResourceList< BaseResourceList, CreateType >:
+ Collaboration diagram for hueplusplus::CreateableResourceList< BaseResourceList, CreateType >:

Public Member Functions

BaseResourceList::IdType create (const CreateType &params)
 Create a new resource. More...
 

Protected Member Functions

 CreateableResourceList (CreateableResourceList &&)=default
 Protected defaulted move constructor. More...
 
CreateableResourceListoperator= (CreateableResourceList &&)=default
 Protected defaulted move assignment. More...
 

Detailed Description

template<typename BaseResourceList, typename CreateType>
class hueplusplus::CreateableResourceList< BaseResourceList, CreateType >

Handles a ResourceList where Resources can be added by the user.

Template Parameters
BaseResourceListBase resource list type (ResourceList or SearchableResourceList).
CreateTypeType that provides parameters for creation. Must have a const getRequest() function returning the JSON for the POST request.

Constructor & Destructor Documentation

◆ CreateableResourceList()

template<typename BaseResourceList, typename CreateType>
hueplusplus::CreateableResourceList< BaseResourceList, CreateType >::CreateableResourceList ( CreateableResourceList< BaseResourceList, CreateType > &&  )
protecteddefault

Protected defaulted move constructor.

Member Function Documentation

◆ create()

template<typename BaseResourceList, typename CreateType>
BaseResourceList::IdType hueplusplus::CreateableResourceList< BaseResourceList, CreateType >::create ( const CreateType &  params)
inline

Create a new resource.

Parameters
paramsParameters for the new resource
Returns
The id of the created resource or 0/an empty string if failed.
Exceptions
std::system_errorwhen system or socket operations fail
HueExceptionwhen response contains no body
HueAPIResponseExceptionwhen response contains an error
nlohmann::json::parse_errorwhen response could not be parsed
std::invalid_argumentwhen IdType is int and std::stoi fails

◆ operator=()

template<typename BaseResourceList, typename CreateType>
CreateableResourceList& hueplusplus::CreateableResourceList< BaseResourceList, CreateType >::operator= ( CreateableResourceList< BaseResourceList, CreateType > &&  )
protecteddefault

Protected defaulted move assignment.


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