@@ -28,15 +28,15 @@ private protocol HomogeneousArray: Array {
28
28
var items : [ ItemType ] { get }
29
29
}
30
30
31
- /**
32
- Sometimes, when links are unresolvable (for instance, when a linked entry is not published), the API
33
- will return an array of errors, one for each unresolvable link.
34
- */
31
+ /// Sometimes, when links are unresolvable (for instance, when a linked entry is not published), the API
32
+ /// will return an array of errors, one for each unresolvable link.
35
33
public struct ArrayResponseError : Decodable {
36
34
/// The system fields of the error.
37
35
public struct Sys : Decodable {
38
- let id : String
39
- let type : String
36
+ /// The identifer of the error.
37
+ public let id : String
38
+ /// The type identifier for the error.
39
+ public let type : String
40
40
}
41
41
42
42
/// System fields for the unresolvable link.
@@ -45,24 +45,21 @@ public struct ArrayResponseError: Decodable {
45
45
public let sys : ArrayResponseError . Sys
46
46
}
47
47
48
- /**
49
- A list of resources in Contentful
50
-
51
- This is the result type for any request of a collection of resources.
52
- See: <https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/collection-resources-and-pagination>
53
- */
48
+ /// A list of resources in Contentful
49
+ /// This is the result type for any request of a collection of resources.
50
+ /// See: <https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/collection-resources-and-pagination>
54
51
public struct ArrayResponse < ItemType> : HomogeneousArray where ItemType: Decodable & EndpointAccessible {
55
52
56
- /// The resources which are part of the given array
53
+ /// The resources which are part of the array response.
57
54
public let items : [ ItemType ]
58
55
59
- /// The maximum number of resources originally requested
56
+ /// The maximum number of resources originally requested.
60
57
public let limit : UInt
61
58
62
- /// The number of elements skipped when performing the request
59
+ /// The number of elements skipped when performing the request.
63
60
public let skip : UInt
64
61
65
- /// The total number of resources which matched the original request
62
+ /// The total number of resources which matched the original request.
66
63
public let total : UInt
67
64
68
65
/// An array of errors, or partial errors, which describe links which were returned in the response that
@@ -80,15 +77,15 @@ public struct ArrayResponse<ItemType>: HomogeneousArray where ItemType: Decodabl
80
77
}
81
78
82
79
internal struct Includes : Decodable {
83
- let assets : [ Asset ] ?
84
- let entries : [ Entry ] ?
80
+ internal let assets : [ Asset ] ?
81
+ internal let entries : [ Entry ] ?
85
82
86
83
private enum CodingKeys : String , CodingKey {
87
84
case assets = " Asset "
88
85
case entries = " Entry "
89
86
}
90
87
91
- init ( from decoder: Decoder ) throws {
88
+ internal init ( from decoder: Decoder ) throws {
92
89
let values = try decoder. container ( keyedBy: CodingKeys . self)
93
90
assets = try values. decodeIfPresent ( [ Asset ] . self, forKey: . assets)
94
91
entries = try values. decodeIfPresent ( [ Entry ] . self, forKey: . entries)
@@ -172,15 +169,15 @@ extension ArrayResponse: Decodable {
172
169
}
173
170
174
171
internal struct MappedIncludes : Decodable {
175
- let assets : [ Asset ] ?
176
- let entries : [ EntryDecodable ] ?
172
+ internal let assets : [ Asset ] ?
173
+ internal let entries : [ EntryDecodable ] ?
177
174
178
175
private enum CodingKeys : String , CodingKey {
179
176
case assets = " Asset "
180
177
case entries = " Entry "
181
178
}
182
179
183
- init ( from decoder: Decoder ) throws {
180
+ internal init ( from decoder: Decoder ) throws {
184
181
let container = try decoder. container ( keyedBy: CodingKeys . self)
185
182
assets = try container. decodeIfPresent ( [ Asset ] . self, forKey: . assets)
186
183
entries = try container. decodeHeterogeneousEntries ( forKey: . entries,
@@ -197,28 +194,24 @@ internal struct MappedIncludes: Decodable {
197
194
}
198
195
}
199
196
200
-
201
- /**
202
- A list of Contentful entries that have been mapped to types conforming to `EntryDecodable` instances.
203
- A MixedArrayResponse respresents a heterogeneous collection of EntryDecodables being returned,
204
- for instance if hitting the base /entries endpoint with no additional query parameters. If there is no
205
- user-defined type for a particular entry, that entry will not be serialized at all. It is up to you to
206
- introspect the type of each element in the items array to handle the response data properly.
207
-
208
- See: <https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/collection-resources-and-pagination>
209
- */
197
+ /// A list of Contentful entries that have been mapped to types conforming to `EntryDecodable` instances.
198
+ /// A `MixedArrayResponse` respresents a heterogeneous collection of `EntryDecodable` being returned,
199
+ /// for instance, if hitting the base `/entries` endpoint with no additional query parameters. If there is no
200
+ /// user-defined type for a particular entry, that entry will not be deserialized at all. It is up to you to
201
+ /// introspect the type of each element in the items array to handle the response data properly.
202
+ /// See: <https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/collection-resources-and-pagination>
210
203
public struct MixedArrayResponse : Array {
211
204
212
- /// The resources which are part of the given array
205
+ /// The resources which are part of the given array response.
213
206
public let items : [ EntryDecodable ]
214
207
215
208
/// The maximum number of resources originally requested
216
209
public let limit : UInt
217
210
218
- /// The number of elements skipped when performing the request
211
+ /// The number of elements skipped when performing the request.
219
212
public let skip : UInt
220
213
221
- /// The total number of resources which matched the original request
214
+ /// The total number of resources which matched the original request.
222
215
public let total : UInt
223
216
224
217
/// An array of errors, or partial errors, which describe links which were returned in the response that
@@ -261,14 +254,14 @@ extension MixedArrayResponse: Decodable {
261
254
// Convenience method for grabbing the content type information of a json item in an array of resources.
262
255
internal extension Swift . Array where Element == Dictionary < String , Any > {
263
256
264
- func contentTypeInfo( at index: Int ) -> Link ? {
257
+ internal func contentTypeInfo( at index: Int ) -> Link ? {
265
258
guard let sys = self [ index] [ " sys " ] as? [ String : Any ] , let contentTypeInfo = sys [ " contentType " ] as? Link else {
266
259
return nil
267
260
}
268
261
return contentTypeInfo
269
262
}
270
263
271
- func nodeType( at index: Int ) -> NodeType ? {
264
+ internal func nodeType( at index: Int ) -> NodeType ? {
272
265
guard let nodeTypeString = self [ index] [ " nodeType " ] as? String , let nodeType = NodeType ( rawValue: nodeTypeString) else {
273
266
return nil
274
267
}
0 commit comments