-
-
Notifications
You must be signed in to change notification settings - Fork 336
/
Copy pathSentryEnvelope.h
151 lines (117 loc) · 4.94 KB
/
SentryEnvelope.h
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#import <Foundation/Foundation.h>
#import "SentryDefines.h"
@class SentryEvent, SentrySession, SentrySdkInfo, SentryId, SentryUserFeedback, SentryAttachment,
SentryTransaction, SentryTraceContext, SentryClientReport;
NS_ASSUME_NONNULL_BEGIN
@interface SentryEnvelopeHeader : NSObject
SENTRY_NO_INIT
/**
* Initializes an SentryEnvelopeHeader object with the specified eventId.
*
* Sets the sdkInfo from SentryMeta.
*
* @param eventId The identifier of the event. Can be nil if no event in the envelope or attachment
* related to event.
*/
- (instancetype)initWithId:(SentryId *_Nullable)eventId;
/**
* Initializes an SentryEnvelopeHeader object with the specified eventId and traceContext.
*
* @param eventId The identifier of the event. Can be nil if no event in the envelope or attachment
* related to event.
* @param traceContext Current trace state.
*/
- (instancetype)initWithId:(nullable SentryId *)eventId
traceContext:(nullable SentryTraceContext *)traceContext;
/**
* Initializes an SentryEnvelopeHeader object with the specified eventId, skdInfo and traceContext.
*
* It is recommended to use initWithId:traceContext: because it sets the sdkInfo for you.
*
* @param eventId The identifier of the event. Can be nil if no event in the envelope or attachment
* related to event.
* @param sdkInfo sdkInfo Describes the Sentry SDK. Can be nil for backwards compatibility. New
* instances should always provide a version.
* @param traceContext Current trace state.
*/
- (instancetype)initWithId:(nullable SentryId *)eventId
sdkInfo:(nullable SentrySdkInfo *)sdkInfo
traceContext:(nullable SentryTraceContext *)traceContext NS_DESIGNATED_INITIALIZER;
/**
* The event identifier, if available.
* An event id exist if the envelope contains an event of items within it are
* related. i.e Attachments
*/
@property (nullable, nonatomic, readonly, copy) SentryId *eventId;
@property (nullable, nonatomic, readonly, copy) SentrySdkInfo *sdkInfo;
@property (nullable, nonatomic, readonly, copy) SentryTraceContext *traceContext;
@end
@interface SentryEnvelopeItemHeader : NSObject
SENTRY_NO_INIT
- (instancetype)initWithType:(NSString *)type length:(NSUInteger)length NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithType:(NSString *)type
length:(NSUInteger)length
filenname:(NSString *)filename
contentType:(NSString *)contentType;
/**
* The type of the envelope item.
*/
@property (nonatomic, readonly, copy) NSString *type;
@property (nonatomic, readonly) NSUInteger length;
@property (nonatomic, readonly, copy) NSString *_Nullable filename;
@property (nonatomic, readonly, copy) NSString *_Nullable contentType;
@end
@interface SentryEnvelopeItem : NSObject
SENTRY_NO_INIT
- (instancetype)initWithEvent:(SentryEvent *)event;
- (instancetype)initWithSession:(SentrySession *)session;
- (instancetype)initWithUserFeedback:(SentryUserFeedback *)userFeedback;
- (_Nullable instancetype)initWithAttachment:(SentryAttachment *)attachment
maxAttachmentSize:(NSUInteger)maxAttachmentSize;
- (instancetype)initWithHeader:(SentryEnvelopeItemHeader *)header
data:(NSData *)data NS_DESIGNATED_INITIALIZER;
/**
* The envelope item header.
*/
@property (nonatomic, readonly, strong) SentryEnvelopeItemHeader *header;
/**
* The envelope payload.
*/
@property (nonatomic, readonly, strong) NSData *data;
@end
@interface SentryEnvelope : NSObject
SENTRY_NO_INIT
// If no event, or no data related to event, id will be null
- (instancetype)initWithId:(SentryId *_Nullable)id singleItem:(SentryEnvelopeItem *)item;
- (instancetype)initWithHeader:(SentryEnvelopeHeader *)header singleItem:(SentryEnvelopeItem *)item;
// If no event, or no data related to event, id will be null
- (instancetype)initWithId:(SentryId *_Nullable)id items:(NSArray<SentryEnvelopeItem *> *)items;
/**
* Initializes a SentryEnvelope with a single session.
* @param session to init the envelope with.
* @return an initialized SentryEnvelope
*/
- (instancetype)initWithSession:(SentrySession *)session;
/**
* Initializes a SentryEnvelope with a list of sessions.
* Can be used when an operations that starts a session closes an ongoing
* session
* @param sessions to init the envelope with.
* @return an initialized SentryEnvelope
*/
- (instancetype)initWithSessions:(NSArray<SentrySession *> *)sessions;
- (instancetype)initWithHeader:(SentryEnvelopeHeader *)header
items:(NSArray<SentryEnvelopeItem *> *)items NS_DESIGNATED_INITIALIZER;
// Convenience init for a single event
- (instancetype)initWithEvent:(SentryEvent *)event;
- (instancetype)initWithUserFeedback:(SentryUserFeedback *)userFeedback;
/**
* The envelope header.
*/
@property (nonatomic, readonly, strong) SentryEnvelopeHeader *header;
/**
* The envelope items.
*/
@property (nonatomic, readonly, strong) NSArray<SentryEnvelopeItem *> *items;
@end
NS_ASSUME_NONNULL_END