-
Notifications
You must be signed in to change notification settings - Fork 117
/
DBFILESFileMetadata.h
218 lines (188 loc) · 9.5 KB
/
DBFILESFileMetadata.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
///
/// Copyright (c) 2016 Dropbox, Inc. All rights reserved.
///
/// Auto-generated by Stone, do not modify.
///
#import <Foundation/Foundation.h>
#import "DBFILESMetadata.h"
#import "DBSerializableProtocol.h"
@class DBFILEPROPERTIESPropertyGroup;
@class DBFILESExportInfo;
@class DBFILESFileMetadata;
@class DBFILESFileSharingInfo;
@class DBFILESMediaInfo;
@class DBFILESSymlinkInfo;
NS_ASSUME_NONNULL_BEGIN
#pragma mark - API Object
///
/// The `FileMetadata` struct.
///
/// This class implements the `DBSerializable` protocol (serialize and
/// deserialize instance methods), which is required for all Obj-C SDK API route
/// objects.
///
@interface DBFILESFileMetadata : DBFILESMetadata <DBSerializable, NSCopying>
#pragma mark - Instance fields
/// A unique identifier for the file.
@property (nonatomic, readonly, copy) NSString *id_;
/// For files, this is the modification time set by the desktop client when the
/// file was added to Dropbox. Since this time is not verified (the Dropbox
/// server stores whatever the desktop client sends up), this should only be
/// used for display purposes (such as sorting) and not, for example, to
/// determine if a file has changed or not.
@property (nonatomic, readonly) NSDate *clientModified;
/// The last time the file was modified on Dropbox.
@property (nonatomic, readonly) NSDate *serverModified;
/// A unique identifier for the current revision of a file. This field is the
/// same rev as elsewhere in the API and can be used to detect changes and avoid
/// conflicts.
@property (nonatomic, readonly, copy) NSString *rev;
/// The file size in bytes.
@property (nonatomic, readonly) NSNumber *size;
/// Additional information if the file is a photo or video. This field will not
/// be set on entries returned by `listFolder`, `listFolderContinue`, or
/// `getThumbnailBatch`, starting December 2, 2019.
@property (nonatomic, readonly, nullable) DBFILESMediaInfo *mediaInfo;
/// Set if this file is a symlink.
@property (nonatomic, readonly, nullable) DBFILESSymlinkInfo *symlinkInfo;
/// Set if this file is contained in a shared folder.
@property (nonatomic, readonly, nullable) DBFILESFileSharingInfo *sharingInfo;
/// If true, file can be downloaded directly; else the file must be exported.
@property (nonatomic, readonly) NSNumber *isDownloadable;
/// Information about format this file can be exported to. This filed must be
/// set if isDownloadable is set to false.
@property (nonatomic, readonly, nullable) DBFILESExportInfo *exportInfo;
/// Additional information if the file has custom properties with the property
/// template specified.
@property (nonatomic, readonly, nullable) NSArray<DBFILEPROPERTIESPropertyGroup *> *propertyGroups;
/// This flag will only be present if include_has_explicit_shared_members is
/// true in `listFolder` or `getMetadata`. If this flag is present, it will be
/// true if this file has any explicit shared members. This is different from
/// sharing_info in that this could be true in the case where a file has
/// explicit members but is not contained within a shared folder.
@property (nonatomic, readonly, nullable) NSNumber *hasExplicitSharedMembers;
/// A hash of the file content. This field can be used to verify data integrity.
/// For more information see our Content hash
/// https://www.dropbox.com/developers/reference/content-hash page.
@property (nonatomic, readonly, copy, nullable) NSString *contentHash;
#pragma mark - Constructors
///
/// Full constructor for the struct (exposes all instance variables).
///
/// @param name The last component of the path (including extension). This never
/// contains a slash.
/// @param id_ A unique identifier for the file.
/// @param clientModified For files, this is the modification time set by the
/// desktop client when the file was added to Dropbox. Since this time is not
/// verified (the Dropbox server stores whatever the desktop client sends up),
/// this should only be used for display purposes (such as sorting) and not, for
/// example, to determine if a file has changed or not.
/// @param serverModified The last time the file was modified on Dropbox.
/// @param rev A unique identifier for the current revision of a file. This
/// field is the same rev as elsewhere in the API and can be used to detect
/// changes and avoid conflicts.
/// @param size The file size in bytes.
/// @param pathLower The lowercased full path in the user's Dropbox. This always
/// starts with a slash. This field will be null if the file or folder is not
/// mounted.
/// @param pathDisplay The cased path to be used for display purposes only. In
/// rare instances the casing will not correctly match the user's filesystem,
/// but this behavior will match the path provided in the Core API v1, and at
/// least the last path component will have the correct casing. Changes to only
/// the casing of paths won't be returned by `listFolderContinue`. This field
/// will be null if the file or folder is not mounted.
/// @param parentSharedFolderId Please use `parentSharedFolderId` in
/// `DBFILESFileSharingInfo` or `parentSharedFolderId` in
/// `DBFILESFolderSharingInfo` instead.
/// @param mediaInfo Additional information if the file is a photo or video.
/// This field will not be set on entries returned by `listFolder`,
/// `listFolderContinue`, or `getThumbnailBatch`, starting December 2, 2019.
/// @param symlinkInfo Set if this file is a symlink.
/// @param sharingInfo Set if this file is contained in a shared folder.
/// @param isDownloadable If true, file can be downloaded directly; else the
/// file must be exported.
/// @param exportInfo Information about format this file can be exported to.
/// This filed must be set if isDownloadable is set to false.
/// @param propertyGroups Additional information if the file has custom
/// properties with the property template specified.
/// @param hasExplicitSharedMembers This flag will only be present if
/// include_has_explicit_shared_members is true in `listFolder` or
/// `getMetadata`. If this flag is present, it will be true if this file has
/// any explicit shared members. This is different from sharing_info in that
/// this could be true in the case where a file has explicit members but is not
/// contained within a shared folder.
/// @param contentHash A hash of the file content. This field can be used to
/// verify data integrity. For more information see our Content hash
/// https://www.dropbox.com/developers/reference/content-hash page.
///
/// @return An initialized instance.
///
- (instancetype)initWithName:(NSString *)name
id_:(NSString *)id_
clientModified:(NSDate *)clientModified
serverModified:(NSDate *)serverModified
rev:(NSString *)rev
size:(NSNumber *)size
pathLower:(nullable NSString *)pathLower
pathDisplay:(nullable NSString *)pathDisplay
parentSharedFolderId:(nullable NSString *)parentSharedFolderId
mediaInfo:(nullable DBFILESMediaInfo *)mediaInfo
symlinkInfo:(nullable DBFILESSymlinkInfo *)symlinkInfo
sharingInfo:(nullable DBFILESFileSharingInfo *)sharingInfo
isDownloadable:(nullable NSNumber *)isDownloadable
exportInfo:(nullable DBFILESExportInfo *)exportInfo
propertyGroups:(nullable NSArray<DBFILEPROPERTIESPropertyGroup *> *)propertyGroups
hasExplicitSharedMembers:(nullable NSNumber *)hasExplicitSharedMembers
contentHash:(nullable NSString *)contentHash;
///
/// Convenience constructor (exposes only non-nullable instance variables with
/// no default value).
///
/// @param name The last component of the path (including extension). This never
/// contains a slash.
/// @param id_ A unique identifier for the file.
/// @param clientModified For files, this is the modification time set by the
/// desktop client when the file was added to Dropbox. Since this time is not
/// verified (the Dropbox server stores whatever the desktop client sends up),
/// this should only be used for display purposes (such as sorting) and not, for
/// example, to determine if a file has changed or not.
/// @param serverModified The last time the file was modified on Dropbox.
/// @param rev A unique identifier for the current revision of a file. This
/// field is the same rev as elsewhere in the API and can be used to detect
/// changes and avoid conflicts.
/// @param size The file size in bytes.
///
/// @return An initialized instance.
///
- (instancetype)initWithName:(NSString *)name
id_:(NSString *)id_
clientModified:(NSDate *)clientModified
serverModified:(NSDate *)serverModified
rev:(NSString *)rev
size:(NSNumber *)size;
@end
#pragma mark - Serializer Object
///
/// The serialization class for the `FileMetadata` struct.
///
@interface DBFILESFileMetadataSerializer : NSObject
///
/// Serializes `DBFILESFileMetadata` instances.
///
/// @param instance An instance of the `DBFILESFileMetadata` API object.
///
/// @return A json-compatible dictionary representation of the
/// `DBFILESFileMetadata` API object.
///
+ (nullable NSDictionary<NSString *, id> *)serialize:(DBFILESFileMetadata *)instance;
///
/// Deserializes `DBFILESFileMetadata` instances.
///
/// @param dict A json-compatible dictionary representation of the
/// `DBFILESFileMetadata` API object.
///
/// @return An instantiation of the `DBFILESFileMetadata` object.
///
+ (DBFILESFileMetadata *)deserialize:(NSDictionary<NSString *, id> *)dict;
@end
NS_ASSUME_NONNULL_END