noaa_weather_client 1.3.0

A client library for the NOAA weather.gov API
Documentation
use serde::{Deserialize, Serialize};

/// ProblemDetail : Detail about an error. This document conforms to RFC 7807 (Problem Details for HTTP APIs).
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ProblemDetail {
    /// A URI reference (RFC 3986) that identifies the problem type. This is only an identifier and is not necessarily a resolvable URL.
    #[serde(rename = "type")]
    pub r#type: String,
    /// A short, human-readable summary of the problem type.
    #[serde(rename = "title")]
    pub title: String,
    /// The HTTP status code (RFC 7231, Section 6) generated by the origin server for this occurrence of the problem.
    #[serde(rename = "status")]
    pub status: f64,
    /// A human-readable explanation specific to this occurrence of the problem.
    #[serde(rename = "detail")]
    pub detail: String,
    /// A URI reference (RFC 3986) that identifies the specific occurrence of the problem. This is only an identifier and is not necessarily a resolvable URL.
    #[serde(rename = "instance")]
    pub instance: String,
    /// A unique identifier for the request, used for NWS debugging purposes. Please include this identifier with any correspondence to help us investigate your issue.
    #[serde(rename = "correlationId")]
    pub correlation_id: String,
}

impl ProblemDetail {
    /// Detail about an error. This document conforms to RFC 7807 (Problem Details for HTTP APIs).
    pub fn new(
        r#type: String,
        title: String,
        status: f64,
        detail: String,
        instance: String,
        correlation_id: String,
    ) -> ProblemDetail {
        ProblemDetail {
            r#type,
            title,
            status,
            detail,
            instance,
            correlation_id,
        }
    }
}