1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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,
}
}
}