AssetQuery
public final class AssetQuery : ResourceQuery
Queries on Asset types. All methods from ChainableQuery are available.
-
Convenience initializer for creating an
AssetQuerywith the “mimetype_group” parameter specified. Example usage:let query = AssetQuery.where(mimetypeGroup: .image)Declaration
Swift
public static func `where`(mimetypeGroup: MimetypeGroup) -> AssetQueryParameters
mimetypeGroupThe
mimetype_groupwhich all returned Assets will match.Return Value
A newly initialized
AssetQueryquery. -
Instance method for mutating the query further to specify the mimetype group when querying assets.
Declaration
Swift
@discardableResult public func `where`(mimetypeGroup: MimetypeGroup) -> AssetQueryParameters
mimetypeGroupThe
mimetype_groupwhich all returned Assets will match.Return Value
A reference to the receiving query to enable chaining.
-
Static method for creating a new
AssetQuerywith a select operation: an operation in which only the fields specified in the fieldNames parameter will be returned in the JSON response. This variation for initialization guarantees correct query contruction by utilizing the typesafeAsset.FieldKeys. The “sys” dictionary is always requested by the SDK.Example usage:
let query = AssetQuery.select(fieldsNamed: [.file]) client.fetchArray(of: Asset.self, matching: query) { (result: Result<ArrayResponse<Asset>>) in switch result { case .success(let arrayResponse): let assets = arrayResponse.items // Do stuff with assets. case .failure(let error): print(error) } }Declaration
Swift
public static func select(fields fieldsKeys: [Asset.Fields]) -> AssetQueryParameters
fieldsKeysAn array of
Asset.FieldKeysof the asset you are performing your select operation against.Return Value
A newly initialized
AssetQueryquery. -
Instance method for mutating an
AssetQuerywith a select operation: an operation in which only the fields specified in the fieldNames parameter will be returned in the JSON response. This variation for initialization guarantees correct query contruction by utilizing the typesafeAsset.FieldKeys. The “sys” dictionary is always requested by the SDK.let query = AssetQuery.select(fieldsNamed: [.file]) client.fetchMappedEntries(with: query).then { catsResponse in let cats = catsResponse.items // Do stuff with cats. }Declaration
Swift
@discardableResult public func select(fields fieldsKeys: [Asset.Fields]) -> AssetQueryParameters
fieldsKeysAn array of
Asset.FieldKeysof the asset you are performing your select operation against.Return Value
A reference to the receiving query to enable chaining.
View on GitHub
AssetQuery Class Reference