/*
* Asana
*
* This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/developer-docs/master/defs/asana_oas.yaml).
*
* The version of the OpenAPI document: 1.0
*
* Generated by: https://openapi-generator.tech
*/
/// EventResponse : An *event* is an object representing a change to a resource that was observed by an event subscription or delivered asynchronously to the target location of an active webhook. The event may be triggered by a different `user` than the subscriber. For example, if user A subscribes to a task and user B modified it, the event’s user will be user B. Note: Some events are generated by the system, and will have `null` as the user. API consumers should make sure to handle this case. The `resource` that triggered the event may be different from the one that the events were requested for or the webhook is subscribed to. For example, a subscription to a project will contain events for tasks contained within the project. **Note:** pay close attention to the relationship between the fields `Event.action` and `Event.change.action`. `Event.action` represents the action taken on the resource itself, and `Event.change.action` represents how the information within the resource's fields have been modified. For instance, consider these scenarios: * When at task is added to a project, `Event.action` will be `added`, `Event.parent` will be on object with the `id` and `type` of the project, and there will be no `change` field. * When an assignee is set on the task, `Event.parent` will be `null`, `Event.action` will be `changed`, `Event.change.action` will be `changed`, and `changed_value` will be an object with the user's `id` and `type`. * When a collaborator is added to the task, `Event.parent` will be `null`, `Event.action` will be `changed`, `Event.change.action` will be `added`, and `added_value` will be an object with the user's `id` and `type`.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct EventResponse {
#[serde(rename = "user", skip_serializing_if = "Option::is_none")]
pub user: Option<Box<crate::models::UserCompact>>,
#[serde(rename = "resource", skip_serializing_if = "Option::is_none")]
pub resource: Option<Box<crate::models::AsanaNamedResource>>,
/// *Deprecated: Refer to the resource_type of the resource.* The type of the resource that generated the event.
#[serde(rename = "type", skip_serializing_if = "Option::is_none")]
pub _type: Option<String>,
/// The type of action taken on the **resource** that triggered the event. This can be one of `changed`, `added`, `removed`, `deleted`, or `undeleted` depending on the nature of the event.
#[serde(rename = "action", skip_serializing_if = "Option::is_none")]
pub action: Option<String>,
#[serde(rename = "parent", skip_serializing_if = "Option::is_none")]
pub parent: Option<Box<crate::models::AsanaNamedResource>>,
/// The timestamp when the event occurred.
#[serde(rename = "created_at", skip_serializing_if = "Option::is_none")]
pub created_at: Option<String>,
#[serde(rename = "change", skip_serializing_if = "Option::is_none")]
pub change: Option<Box<crate::models::EventResponseChange>>,
}
impl EventResponse {
/// An *event* is an object representing a change to a resource that was observed by an event subscription or delivered asynchronously to the target location of an active webhook. The event may be triggered by a different `user` than the subscriber. For example, if user A subscribes to a task and user B modified it, the event’s user will be user B. Note: Some events are generated by the system, and will have `null` as the user. API consumers should make sure to handle this case. The `resource` that triggered the event may be different from the one that the events were requested for or the webhook is subscribed to. For example, a subscription to a project will contain events for tasks contained within the project. **Note:** pay close attention to the relationship between the fields `Event.action` and `Event.change.action`. `Event.action` represents the action taken on the resource itself, and `Event.change.action` represents how the information within the resource's fields have been modified. For instance, consider these scenarios: * When at task is added to a project, `Event.action` will be `added`, `Event.parent` will be on object with the `id` and `type` of the project, and there will be no `change` field. * When an assignee is set on the task, `Event.parent` will be `null`, `Event.action` will be `changed`, `Event.change.action` will be `changed`, and `changed_value` will be an object with the user's `id` and `type`. * When a collaborator is added to the task, `Event.parent` will be `null`, `Event.action` will be `changed`, `Event.change.action` will be `added`, and `added_value` will be an object with the user's `id` and `type`.
pub fn new() -> EventResponse {
EventResponse {
user: None,
resource: None,
_type: None,
action: None,
parent: None,
created_at: None,
change: None,
}
}
}