@@ -15,6 +15,7 @@ public final class SentryEnvelopeItemHeader implements JsonSerializable, JsonUnk
15
15
16
16
private final @ Nullable String contentType ;
17
17
private final @ Nullable String fileName ;
18
+ private final @ Nullable String platform ;
18
19
private final @ NotNull SentryItemType type ;
19
20
private final int length ;
20
21
@ Nullable private final Callable <Integer > getLength ;
@@ -46,19 +47,25 @@ public int getLength() {
46
47
return fileName ;
47
48
}
48
49
50
+ public @ Nullable String getPlatform () {
51
+ return platform ;
52
+ }
53
+
49
54
@ ApiStatus .Internal
50
55
public SentryEnvelopeItemHeader (
51
56
final @ NotNull SentryItemType type ,
52
57
int length ,
53
58
final @ Nullable String contentType ,
54
59
final @ Nullable String fileName ,
55
- final @ Nullable String attachmentType ) {
60
+ final @ Nullable String attachmentType ,
61
+ final @ Nullable String platform ) {
56
62
this .type = Objects .requireNonNull (type , "type is required" );
57
63
this .contentType = contentType ;
58
64
this .length = length ;
59
65
this .fileName = fileName ;
60
66
this .getLength = null ;
61
67
this .attachmentType = attachmentType ;
68
+ this .platform = platform ;
62
69
}
63
70
64
71
SentryEnvelopeItemHeader (
@@ -67,12 +74,23 @@ public SentryEnvelopeItemHeader(
67
74
final @ Nullable String contentType ,
68
75
final @ Nullable String fileName ,
69
76
final @ Nullable String attachmentType ) {
77
+ this (type , getLength , contentType , fileName , attachmentType , null );
78
+ }
79
+
80
+ SentryEnvelopeItemHeader (
81
+ final @ NotNull SentryItemType type ,
82
+ final @ Nullable Callable <Integer > getLength ,
83
+ final @ Nullable String contentType ,
84
+ final @ Nullable String fileName ,
85
+ final @ Nullable String attachmentType ,
86
+ final @ Nullable String platform ) {
70
87
this .type = Objects .requireNonNull (type , "type is required" );
71
88
this .contentType = contentType ;
72
89
this .length = -1 ;
73
90
this .fileName = fileName ;
74
91
this .getLength = getLength ;
75
92
this .attachmentType = attachmentType ;
93
+ this .platform = platform ;
76
94
}
77
95
78
96
SentryEnvelopeItemHeader (
@@ -100,6 +118,7 @@ public static final class JsonKeys {
100
118
public static final String TYPE = "type" ;
101
119
public static final String ATTACHMENT_TYPE = "attachment_type" ;
102
120
public static final String LENGTH = "length" ;
121
+ public static final String PLATFORM = "platform" ;
103
122
}
104
123
105
124
@ Override
@@ -116,6 +135,9 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger
116
135
if (attachmentType != null ) {
117
136
writer .name (JsonKeys .ATTACHMENT_TYPE ).value (attachmentType );
118
137
}
138
+ if (platform != null ) {
139
+ writer .name (JsonKeys .PLATFORM ).value (platform );
140
+ }
119
141
writer .name (JsonKeys .LENGTH ).value (getLength ());
120
142
if (unknown != null ) {
121
143
for (String key : unknown .keySet ()) {
@@ -138,6 +160,7 @@ public static final class Deserializer implements JsonDeserializer<SentryEnvelop
138
160
SentryItemType type = null ;
139
161
int length = 0 ;
140
162
String attachmentType = null ;
163
+ String platform = null ;
141
164
Map <String , Object > unknown = null ;
142
165
143
166
while (reader .peek () == JsonToken .NAME ) {
@@ -158,6 +181,9 @@ public static final class Deserializer implements JsonDeserializer<SentryEnvelop
158
181
case JsonKeys .ATTACHMENT_TYPE :
159
182
attachmentType = reader .nextStringOrNull ();
160
183
break ;
184
+ case JsonKeys .PLATFORM :
185
+ platform = reader .nextStringOrNull ();
186
+ break ;
161
187
default :
162
188
if (unknown == null ) {
163
189
unknown = new HashMap <>();
@@ -170,7 +196,8 @@ public static final class Deserializer implements JsonDeserializer<SentryEnvelop
170
196
throw missingRequiredFieldException (JsonKeys .TYPE , logger );
171
197
}
172
198
SentryEnvelopeItemHeader sentryEnvelopeItemHeader =
173
- new SentryEnvelopeItemHeader (type , length , contentType , fileName , attachmentType );
199
+ new SentryEnvelopeItemHeader (
200
+ type , length , contentType , fileName , attachmentType , platform );
174
201
sentryEnvelopeItemHeader .setUnknown (unknown );
175
202
reader .endObject ();
176
203
return sentryEnvelopeItemHeader ;
0 commit comments