# Structure


```
interface Structure : HasId, HasHomeDevices, HasRooms, HasTraits, HasAutomations, HasCandidates, HasSuggestions
```

<br />

*** ** * ** ***

The top-level organizing construct for the `https://developers.home.google.com/reference/kotlin/com/google/home/Home`. A Structure allows navigating to all the `https://developers.home.google.com/reference/kotlin/com/google/home/Room`s and devices (`https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice` or MatterNode) within that Structure that a caller has permission to access. Each Structure can have a single Google Matter Fabric.

## Summary

| ### Public functions |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<T>` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi <T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/Structure#trait(com.google.home.TraitFactory)(trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)` Gets a `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` that can be used to track changes to a specific `https://developers.home.google.com/reference/kotlin/com/google/home/Trait`. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure#name()` User-given name for the Structure. |

| ### Extension functions |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>>>` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).consentedDeviceTypes()()` Gets an observable flow indicating the device types for which the user has consented for the app. |
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/FeatureConsentType, https://developers.home.google.com/reference/kotlin/com/google/home/ConsentStatus>>` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).featureConsentStatus()()` Gets an observable flow indicating the feature consent status for the structure. |
| `suspend https://developers.home.google.com/reference/kotlin/com/google/home/google/UserMetadataTrait.UserMetadataValues?` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).fetchUserMetadata()()` Fetches signed-in user metadata. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).initiateCloudAccountLink(com.google.home.AvailableAgent,kotlin.String)( agent: https://developers.home.google.com/reference/kotlin/com/google/home/AvailableAgent, baseUrl: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html )` Initiates the CICToCAL (Cloud-Initiated Cloud-to-Cloud Account Linking) flow by resolving the user's email metadata from the structure and constructing the WebBroker URL. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).initiateCloudLink(kotlin.String)(oauthCode: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Initiate a link to the 3P cloud. |
| `suspend https://developers.home.google.com/reference/kotlin/com/google/home/AvailableAgentsResponse` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).listAvailableAgents(kotlin.String,kotlin.Int)(pageToken: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?, pageSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html?)` Lists available 3P agents for Cloud Account Linking. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).setAsCloudLinkDefault()()` Set the current structure as the default for the user's devices. |
| `suspend https://developers.home.google.com/reference/kotlin/com/google/home/Room` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).createRoom(kotlin.String)(name: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Create a `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).deleteRoom(com.google.home.Id)(roomId: https://developers.home.google.com/reference/kotlin/com/google/home/Id)` Delete a `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure, based on the Room's ID. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).deleteRoom(com.google.home.Room)(room: https://developers.home.google.com/reference/kotlin/com/google/home/Room)` Delete a `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).moveDevicesToRoom(com.google.home.Id,kotlin.collections.List)(roomId: https://developers.home.google.com/reference/kotlin/com/google/home/Id, deviceIds: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/Id>)` Move `https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice` devices to a different `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure, based on IDs. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).moveDevicesToRoom(com.google.home.Room,kotlin.collections.List)(room: https://developers.home.google.com/reference/kotlin/com/google/home/Room, devices: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice>)` Move `https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice` devices to a different `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression<https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedEntity<https://developers.home.google.com/reference/kotlin/com/google/home/StructureType>>` | `https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).atExecutionTime()()` An extension function of `https://developers.home.google.com/reference/kotlin/com/google/home/Structure` that produces a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression` of structure entity. |
| `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).deleteHistory(kotlin.collections.List)(eventTypeIds: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html>)` Extension function to delete the history items with the given event type IDs for the structure. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/HistoryManager` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).getHistoryManager(kotlin.Int)(pageSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Extension function to get the history manager for a structure. |
| `https://developers.home.google.com/reference/kotlin/com/google/home/HomeBriefsManager` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).getHomeBriefsManager()()` Extension function to get the home briefs manager for a structure. |
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/google/UserPresenceSettings>` | `@https://developers.home.google.com/reference/kotlin/com/google/home/annotation/HomeExperimentalApi https://developers.home.google.com/reference/kotlin/com/google/home/Structure.https://developers.home.google.com/reference/kotlin/com/google/home/Structure#(com.google.home.Structure).userPresenceSettings()()` Gets an observable flow indicating the user presence settings for the structure. |

### Inherited functions

From [com.google.home.automation.HasAutomations](https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations) `https://developers.home.google.com/reference/kotlin/com/google/home/HomeObjectsFlow<https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation>` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations#automations()()`

List all automations belonging to the structure.
`suspend https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations#createAutomation(com.google.home.automation.BaseAutomation)(automation: https://developers.home.google.com/reference/kotlin/com/google/home/automation/BaseAutomation)`

Create an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`.
`suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations#deleteAutomation(com.google.home.automation.Automation)(automation: https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation)`

Delete an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation`.
`suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasAutomations#deleteAutomation(com.google.home.Id)(automationId: https://developers.home.google.com/reference/kotlin/com/google/home/Id)`

Delete an `https://developers.home.google.com/reference/kotlin/com/google/home/automation/Automation` using an ID.
From [com.google.home.automation.HasCandidates](https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasCandidates) `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate>>` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasCandidates#allCandidates()()`

Returns all the automation `https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate` instances for the receiver and its child objects.
`https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate>>` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasCandidates#candidates()()`

Returns all the automation `https://developers.home.google.com/reference/kotlin/com/google/home/automation/NodeCandidate` instances for the receiver.
From [com.google.home.HasHomeDevices](https://developers.home.google.com/reference/kotlin/com/google/home/HasHomeDevices) `https://developers.home.google.com/reference/kotlin/com/google/home/HomeObjectsFlow<https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice>` `https://developers.home.google.com/reference/kotlin/com/google/home/HasHomeDevices#devices(kotlin.Boolean)(enableMultipartDevices: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`

Gets an observable flow of `https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice`s visible to the logged-in user, dependent on the context of the implementation (`https://developers.home.google.com/reference/kotlin/com/google/home/HomeManager`, `https://developers.home.google.com/reference/kotlin/com/google/home/Structure`, `https://developers.home.google.com/reference/kotlin/com/google/home/Room`).
From [com.google.home.HasRooms](https://developers.home.google.com/reference/kotlin/com/google/home/HasRooms) `https://developers.home.google.com/reference/kotlin/com/google/home/HomeObjectsFlow<https://developers.home.google.com/reference/kotlin/com/google/home/Room>` `https://developers.home.google.com/reference/kotlin/com/google/home/HasRooms#rooms()()`

Gets an observable flow of `https://developers.home.google.com/reference/kotlin/com/google/home/Room`s visible to the logged-in user.
From [com.google.home.automation.HasSuggestions](https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasSuggestions) `suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasSuggestions#clearSuggestionFeedback(kotlin.String)(suggestionId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Clears the suggestion feedback for the given `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasSuggestions#clearSuggestionFeedback(kotlin.String)`.
`suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasSuggestions#dislikeSuggestion(kotlin.String)(suggestionId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Dislikes the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/AutomationSuggestion` with the given `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasSuggestions#dislikeSuggestion(kotlin.String)`.
`suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasSuggestions#likeSuggestion(kotlin.String)(suggestionId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`

Likes the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/AutomationSuggestion` with the given `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasSuggestions#likeSuggestion(kotlin.String)`.
`suspend https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/automation/AutomationSuggestion>` `https://developers.home.google.com/reference/kotlin/com/google/home/automation/HasSuggestions#suggestions()()`

Returns all the `https://developers.home.google.com/reference/kotlin/com/google/home/automation/AutomationSuggestion` instances for the receiver.
From [com.google.home.HasTraits](https://developers.home.google.com/reference/kotlin/com/google/home/HasTraits) `https://developers.home.google.com/reference/kotlin/com/google/home/SourceConnectivity?` `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/HasTraits#getSourceConnectivity(com.google.home.TraitFactory)(trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)`

Gets metadata, such as network locality and connectivity state, about the source of data for a particular trait.
`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` `<T : https://developers.home.google.com/reference/kotlin/com/google/home/Trait> https://developers.home.google.com/reference/kotlin/com/google/home/HasTraits#has(com.google.home.TraitFactory)(trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>)`

Checks if a trait is supported by a device.

### Inherited properties

From [com.google.home.HasId](https://developers.home.google.com/reference/kotlin/com/google/home/HasId) `https://developers.home.google.com/reference/kotlin/com/google/home/Id` `https://developers.home.google.com/reference/kotlin/com/google/home/HasId#id()`

Opaque ID for the object.

## Public functions

### trait

```
@HomeExperimentalApi
fun <T : Trait> trait(trait: TraitFactory<T>): Flow<T>
```

Gets a `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` that can be used to track changes to a specific `https://developers.home.google.com/reference/kotlin/com/google/home/Trait`. When a value is emitted on this Flow it represents a snapshot of the latest Trait attributes.

For example:

```kotlin
structure.trait(HubManagement)
```

| Parameters |
|---|---|
| `trait: https://developers.home.google.com/reference/kotlin/com/google/home/TraitFactory<T>` | the `https://developers.home.google.com/reference/kotlin/com/google/home/Trait` to get a flow for. |

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<T>` | the flow for the specified `https://developers.home.google.com/reference/kotlin/com/google/home/Trait`, otherwise an empty flow if the Trait is not supported by the structure. |

## Public properties

### name

```
val name: String
```

User-given name for the Structure. Empty if not assigned.

## Extension functions

### consentedDeviceTypes

```
@HomeExperimentalApi
fun Structure.consentedDeviceTypes(): Flow<Set<DeviceTypeFactory<DeviceType>>>
```

Gets an observable flow indicating the device types for which the user has consented for the app.

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-set/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceTypeFactory<https://developers.home.google.com/reference/kotlin/com/google/home/DeviceType>>>` | a flow of ConsentedDeviceTypesData. |

### featureConsentStatus

```
@HomeExperimentalApi
fun Structure.featureConsentStatus(): Flow<Map<FeatureConsentType, ConsentStatus>>
```

Gets an observable flow indicating the feature consent status for the structure.

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/FeatureConsentType, https://developers.home.google.com/reference/kotlin/com/google/home/ConsentStatus>>` | a flow of maps, where each map is from a `https://developers.home.google.com/reference/kotlin/com/google/home/FeatureConsentType` to its corresponding `https://developers.home.google.com/reference/kotlin/com/google/home/ConsentStatus`. |

### fetchUserMetadata

```
@HomeExperimentalApi
suspend fun Structure.fetchUserMetadata(): UserMetadataTrait.UserMetadataValues?
```

Fetches signed-in user metadata.

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/google/UserMetadataTrait.UserMetadataValues?` | a UserMetadata object containing the user's metadata. |

### initiateCloudAccountLink

```
suspend fun Structure.initiateCloudAccountLink(
    agent: AvailableAgent,
    baseUrl: String = CloudAccountLinkingWebBroker.DEFAULT_LINK_BASE_URL
): String
```

Initiates the CICToCAL (Cloud-Initiated Cloud-to-Cloud Account Linking) flow by resolving the user's email metadata from the structure and constructing the WebBroker URL.

| Parameters |
|---|---|
| `agent: https://developers.home.google.com/reference/kotlin/com/google/home/AvailableAgent` | The `https://developers.home.google.com/reference/kotlin/com/google/home/AvailableAgent` to link. |
| `baseUrl: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html = CloudAccountLinkingWebBroker.DEFAULT_LINK_BASE_URL` | Optional custom base URL for WebBroker (defaults to `https://developers.home.google.com/reference/kotlin/com/google/home/CloudAccountLinkingWebBroker#DEFAULT_LINK_BASE_URL()`). |

| Returns |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | The complete WebBroker URL with query parameters (agent_id, structure_id, email). |

### initiateCloudLink

```
suspend fun Structure.initiateCloudLink(oauthCode: String): Unit
```

Initiate a link to the 3P cloud. Uses the current structure as the default for new devices.

| Parameters |
|---|---|
| `oauthCode: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | The OAuth authorization code which is short-lived and used to start an exchange for the Refresh/Access tokens. It originates from the calling app's OAuth server, provided by the app to the SDK. To learn more about how this token is used, see https://developers.home.google.com/cloud-to-cloud/project/authorization#handle_token_exchange_requests |

| Throws |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/HomeException` | if the operation did not succeed. HomeException has suberrors to detail the specific error message and code. |

### listAvailableAgents

```
suspend fun Structure.listAvailableAgents(pageToken: String? = null, pageSize: Int? = null): AvailableAgentsResponse
```

Lists available 3P agents for Cloud Account Linking.

| Parameters |
|---|---|
| `pageToken: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html? = null` | The pagination page token. |
| `pageSize: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html? = null` | The maximum number of agents to return. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/AvailableAgentsResponse` | The list of available agents and the next page token. |

| Throws |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/HomeException` | if the operation did not succeed. HomeException has suberrors to detail the specific error message and code. |

### setAsCloudLinkDefault

```
suspend fun Structure.setAsCloudLinkDefault(): Unit
```

Set the current structure as the default for the user's devices. This structure will be used anytime a new device is received via the cloud sync, as long as the sync response does not specify a structure explicitly.

| Throws |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/HomeException` | if the operation did not succeed. HomeException has suberrors to detail the specific error message and code. |

### createRoom

```
suspend fun Structure.createRoom(name: String): Room
```

Create a `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure.

| Parameters |
|---|---|
| `name: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html` | the name of the `Room` to create. |

| Returns |
|---|---|
| `https://developers.home.google.com/reference/kotlin/com/google/home/Room` | the newly created `Room`. |

### deleteRoom

```
suspend fun Structure.deleteRoom(roomId: Id): Unit
```

Delete a `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure, based on the Room's ID.

| Parameters |
|---|---|
| `roomId: https://developers.home.google.com/reference/kotlin/com/google/home/Id` | the ID of the `Room` to delete. |

### deleteRoom

```
suspend fun Structure.deleteRoom(room: Room): Unit
```

Delete a `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure.

| Parameters |
|---|---|
| `room: https://developers.home.google.com/reference/kotlin/com/google/home/Room` | the `Room` to delete. |

### moveDevicesToRoom

```
suspend fun Structure.moveDevicesToRoom(roomId: Id, deviceIds: List<Id>): Unit
```

Move `https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice` devices to a different `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure, based on IDs.

| Parameters |
|---|---|
| `roomId: https://developers.home.google.com/reference/kotlin/com/google/home/Id` | the ID of the `Room` to move devices to. |
| `deviceIds: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/Id>` | the list of device IDs for the `HomeDevice` devices to move. |

### moveDevicesToRoom

```
suspend fun Structure.moveDevicesToRoom(room: Room, devices: List<HomeDevice>): Unit
```

Move `https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice` devices to a different `https://developers.home.google.com/reference/kotlin/com/google/home/Room` within a Structure.

| Parameters |
|---|---|
| `room: https://developers.home.google.com/reference/kotlin/com/google/home/Room` | the `Room` to move devices to. |
| `devices: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-list/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/HomeDevice>` | the list of `HomeDevice` devices to move. |

### atExecutionTime

```
fun Structure.atExecutionTime(): TypedExpression<TypedEntity<StructureType>>
```

An extension function of `https://developers.home.google.com/reference/kotlin/com/google/home/Structure` that produces a `https://developers.home.google.com/reference/kotlin/com/google/home/automation/TypedExpression` of structure entity.

### deleteHistory

```
@HomeExperimentalApi
suspend fun Structure.deleteHistory(eventTypeIds: List<String>): Unit
```

Extension function to delete the history items with the given event type IDs for the structure.

### getHistoryManager

```
@HomeExperimentalApi
fun Structure.getHistoryManager(pageSize: Int = 20): HistoryManager
```

Extension function to get the history manager for a structure.

### getHomeBriefsManager

```
@HomeExperimentalApi
fun Structure.getHomeBriefsManager(): HomeBriefsManager
```

Extension function to get the home briefs manager for a structure.

### userPresenceSettings

```
@HomeExperimentalApi
fun Structure.userPresenceSettings(): Flow<UserPresenceSettings>
```

Gets an observable flow indicating the user presence settings for the structure.

| Returns |
|---|---|
| `https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developers.home.google.com/reference/kotlin/com/google/home/google/UserPresenceSettings>` | a flow of `https://developers.home.google.com/reference/kotlin/com/google/home/google/UserPresenceSettings`. |