# Hooks

### `Actions`

**Hook Pattern:** `gf_hey_todos_process_{$resource_type}_data`

**Available Resource Types:**

* `gf_hey_todos_process_projects_data`
* `gf_hey_todos_process_sections_data`
* `gf_hey_todos_process_labels_data`
* `gf_hey_todos_process_collaborators_data`
* `gf_hey_todos_process_users_data`

**Parameters:**

* `$sync_data` (array) - The resource data retrieved from the API for the specific resource type

**Usage:**

```php
// Hook into projects data processing
add_action( 'gf_hey_todos_process_projects_data', 'my_custom_projects_handler' );

function my_custom_projects_handler( $projects_data ) {
    // Process projects data
    foreach ( $projects_data as $project ) {
        // Handle individual project data
    }
}

// Hook into labels data processing
add_action( 'gf_hey_todos_process_labels_data', 'my_custom_labels_handler' );

function my_custom_labels_handler( $labels_data ) {
    // Process labels data
}
```

#### `gf_hey_todos_task_creation_failed`

**Description:** Triggered when a Todoist task can't be completed.

**Parameters:**

```php
/**
 * Trigger an action when task creation fails.
 *
 * @param string $error The error.
 * @param array $feed The feed.
 * @param array $entry The entry.
 * @param array $form The form.
 */
```

#### `gf_hey_todos_task_creation_succeeded`

**Description:** Triggered when a Todoist task is created.

**Parameters:**

```php
/**
 * Trigger an action when task creation succeeds.
 *
 * @param array $api_request_body The API request body.
 * @param array $feed The feed.
 * @param array $entry The entry.
 * @param array $form The form.
 */
```

### `Filters`

#### \`gf\_hey\_todos\_process\_feed\_api\_request\_body

**Description:** Filter the API request body before it is sent to the Todoist API.

**Parameters:**

```php
/**
 * Filter the API request body.
 *
 * @param array $api_request_body The API request body.
 * @param array $feed The feed.
 * @param array $entry The entry.
 * @param array $form The form.
 *
 * @return array The API request body.
 */
```

**Return:** Todoist API Request Body

#### `gf_hey_todos_scripts`

**Description:** Filters the JavaScript scripts array before they are enqueued in the admin. This uses Gravity Forms script syntax.

**Parameters:**

* `$scripts` (array) - Array of script configurations

**Return:** Array of script configurations

**Usage:**

```php
add_filter( 'gf_hey_todos_scripts', 'my_custom_scripts_filter' );

function my_custom_scripts_filter( $scripts ) {
    // Add custom scripts or modify existing ones
    $scripts['my_custom_script'] = array(
        'handle'  => 'my-custom-script',
        'src'     => plugin_dir_url( __FILE__ ) . 'js/custom.js',
        'version' => '1.0.0',
        'deps'    => array( 'jquery' ),
        'in_footer' => true,
    );
    
    return $scripts;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dlxplugins.com/heytodos/developers/hooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
