data-gov-ckan 0.4.0

Client for Data.Gov CKAN
Documentation
/*
 * CKAN API
 *
 * Comprehensive Open Data Knowledge (CKAN) REST API for data management and publishing.  CKAN is a powerful data management system that makes data accessible by providing tools to streamline publishing, sharing, finding and using data. This API provides programmatic access to all CKAN functionality including:  - Dataset (Package) management - create, read, update, delete datasets - Resource management - manage files and data resources within datasets   - Organization and Group management - organize datasets into logical groupings - User management - manage user accounts and permissions - Search functionality - powerful search across all data - Metadata and tagging - rich metadata and taxonomy support - Data validation and quality - ensure data integrity  The API follows REST principles and returns JSON responses. Most endpoints support both GET and POST methods.  ## API Versions  - **API v3** (default): Main action API at `/api/3/action/{action}` - **Utility API v1/v2**: Autocomplete and utility functions at `/api/{version}/util/` - **Legacy API v1**: Basic API information at `/api/1`  ## Authentication  Many API calls require authentication via API key passed as: - HTTP Header: `Authorization: {api_key}` - URL Parameter: `?api_key={api_key}`  - POST Data: `{\"api_key\": \"{api_key}\"}`  ## Error Handling  All API responses include: - `success`: Boolean indicating if the request was successful - `result`: The actual data (on success) or error details (on failure) - `help`: URL to documentation for the action  Error responses include structured error information with error type and detailed messages.
 *
 * The version of the OpenAPI document: 3.0
 *
 * Generated by: https://openapi-generator.tech
 */

use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ActionResponse {
    /// URL to documentation for this action
    #[serde(rename = "help")]
    pub help: String,
    /// Whether the action completed successfully
    #[serde(rename = "success")]
    pub success: bool,
    /// The result data (varies by action)
    #[serde(rename = "result", deserialize_with = "Option::deserialize")]
    pub result: Option<serde_json::Value>,
    /// Types and IDs of entities that were created, updated, or deleted
    #[serde(rename = "changed_entities", skip_serializing_if = "Option::is_none")]
    pub changed_entities: Option<std::collections::HashMap<String, Vec<String>>>,
}

impl ActionResponse {
    pub fn new(help: String, success: bool, result: Option<serde_json::Value>) -> ActionResponse {
        ActionResponse {
            help,
            success,
            result,
            changed_entities: None,
        }
    }
}