Struct govee_api::GoveeClient
source · pub struct GoveeClient { /* private fields */ }Expand description
A client for interacting with Govee devices through their API.
This struct provides methods to control Govee devices using the Govee API. It requires a valid Govee API key and root URL to initialize.
Implementations§
source§impl GoveeClient
impl GoveeClient
Controls a Govee device using the provided payload.
This method sends a PUT request to the Govee API to control a device with the specified payload. The payload should be in the form of a PayloadBody struct.
Arguments
payload- The payload containing the control instructions for the device.
Panics
This method will panic if the PUT request encounters an error.
pub async fn control_device(&self, payload: PayloadBody)
source§impl GoveeClient
impl GoveeClient
Controls a Govee appliance using the provided payload.
This method sends a PUT request to the Govee API to control an appliance with the specified payload. The payload should be in the form of a PayloadBody struct.
Arguments
payload- The payload containing the control instructions for the appliance.
Panics
This method will panic if the PUT request encounters an error.
pub async fn control_appliance(&self, payload: PayloadBody)
source§impl GoveeClient
impl GoveeClient
Retrieves a list of Govee devices.
This method sends a GET request to the Govee API to retrieve a list of devices associated with the Govee account.
Returns
An ApiResponseGoveeDevices containing information about the devices.
Panics
This method will panic if the GET request encounters an error.
pub async fn get_devices(&self) -> ApiResponseGoveeDevices
source§impl GoveeClient
impl GoveeClient
Retrieves a list of Govee appliances.
This method sends a GET request to the Govee API to retrieve a list of appliances associated with the Govee account.
Returns
An ApiResponseGoveeAppliances containing information about the appliances.
Panics
This method will panic if the GET request encounters an error.
pub async fn get_appliances(&self) -> ApiResponseGoveeAppliances
source§impl GoveeClient
impl GoveeClient
Retrieves the state of a Govee device.
This method sends a GET request to the Govee API to retrieve the state of a specific device.
Arguments
device- The device ID or name.model- The model of the device.
Returns
An ApiResponseGoveeDeviceState containing the current state of the device.
Panics
This method will panic if the GET request encounters an error.