@@ -15,6 +15,7 @@ public final class SentryEnvelopeItemHeader implements JsonSerializable, JsonUnk
1515
1616 private final @ Nullable String contentType ;
1717 private final @ Nullable String fileName ;
18+ private final @ Nullable String platform ;
1819 private final @ NotNull SentryItemType type ;
1920 private final int length ;
2021 @ Nullable private final Callable <Integer > getLength ;
@@ -46,19 +47,25 @@ public int getLength() {
4647 return fileName ;
4748 }
4849
50+ public @ Nullable String getPlatform () {
51+ return platform ;
52+ }
53+
4954 @ ApiStatus .Internal
5055 public SentryEnvelopeItemHeader (
5156 final @ NotNull SentryItemType type ,
5257 int length ,
5358 final @ Nullable String contentType ,
5459 final @ Nullable String fileName ,
55- final @ Nullable String attachmentType ) {
60+ final @ Nullable String attachmentType ,
61+ final @ Nullable String platform ) {
5662 this .type = Objects .requireNonNull (type , "type is required" );
5763 this .contentType = contentType ;
5864 this .length = length ;
5965 this .fileName = fileName ;
6066 this .getLength = null ;
6167 this .attachmentType = attachmentType ;
68+ this .platform = platform ;
6269 }
6370
6471 SentryEnvelopeItemHeader (
@@ -67,12 +74,23 @@ public SentryEnvelopeItemHeader(
6774 final @ Nullable String contentType ,
6875 final @ Nullable String fileName ,
6976 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 ) {
7087 this .type = Objects .requireNonNull (type , "type is required" );
7188 this .contentType = contentType ;
7289 this .length = -1 ;
7390 this .fileName = fileName ;
7491 this .getLength = getLength ;
7592 this .attachmentType = attachmentType ;
93+ this .platform = platform ;
7694 }
7795
7896 SentryEnvelopeItemHeader (
@@ -100,6 +118,7 @@ public static final class JsonKeys {
100118 public static final String TYPE = "type" ;
101119 public static final String ATTACHMENT_TYPE = "attachment_type" ;
102120 public static final String LENGTH = "length" ;
121+ public static final String PLATFORM = "platform" ;
103122 }
104123
105124 @ Override
@@ -116,6 +135,9 @@ public void serialize(final @NotNull ObjectWriter writer, final @NotNull ILogger
116135 if (attachmentType != null ) {
117136 writer .name (JsonKeys .ATTACHMENT_TYPE ).value (attachmentType );
118137 }
138+ if (platform != null ) {
139+ writer .name (JsonKeys .PLATFORM ).value (platform );
140+ }
119141 writer .name (JsonKeys .LENGTH ).value (getLength ());
120142 if (unknown != null ) {
121143 for (String key : unknown .keySet ()) {
@@ -138,6 +160,7 @@ public static final class Deserializer implements JsonDeserializer<SentryEnvelop
138160 SentryItemType type = null ;
139161 int length = 0 ;
140162 String attachmentType = null ;
163+ String platform = null ;
141164 Map <String , Object > unknown = null ;
142165
143166 while (reader .peek () == JsonToken .NAME ) {
@@ -158,6 +181,9 @@ public static final class Deserializer implements JsonDeserializer<SentryEnvelop
158181 case JsonKeys .ATTACHMENT_TYPE :
159182 attachmentType = reader .nextStringOrNull ();
160183 break ;
184+ case JsonKeys .PLATFORM :
185+ platform = reader .nextStringOrNull ();
186+ break ;
161187 default :
162188 if (unknown == null ) {
163189 unknown = new HashMap <>();
@@ -170,7 +196,8 @@ public static final class Deserializer implements JsonDeserializer<SentryEnvelop
170196 throw missingRequiredFieldException (JsonKeys .TYPE , logger );
171197 }
172198 SentryEnvelopeItemHeader sentryEnvelopeItemHeader =
173- new SentryEnvelopeItemHeader (type , length , contentType , fileName , attachmentType );
199+ new SentryEnvelopeItemHeader (
200+ type , length , contentType , fileName , attachmentType , platform );
174201 sentryEnvelopeItemHeader .setUnknown (unknown );
175202 reader .endObject ();
176203 return sentryEnvelopeItemHeader ;
0 commit comments