Resource

public protocol Resource: class

A protocol describing any of the main resources available on the Giant Bomb wiki. Includes base information required by the framework in creating and parsing resource objects.

  • The base init method for parsing the API’s response JSON to a native resource object.

    Declaration

    Swift

    init(json: [String: AnyObject])
  • An associated type to describe the class type of the resource’s extendedInfo property.

    Declaration

    Swift

    associatedtype ExtendedInfoAlias: ResourceExtendedInfo
  • Fetches extended info for an already partially-parsed resource. - parameter fields: An array of fields to return in the response. See the available options at http://www.giantbomb.com/api/documentation. Pass nil to return everything. - parameter completion: A closure containing an optional RequestError if the request failed.

    Declaration

    Swift

    func fetchExtendedInfo(_ fields: [String]?, completion: @escaping (_ error: RequestError?) -> Void)

    Parameters

    fields

    An array of fields to return in the response. See the available options at http://www.giantbomb.com/api/documentation. Pass nil to return everything.

    completion

    A closure containing an optional RequestError if the request failed.

  • id

    The unique ID for a resource.

    Declaration

    Swift

    var id: Int?
  • A potentially user-facing description of the resource. Not localized.

    Declaration

    Swift

    var prettyDescription: String
  • Deck for the resource.

    Declaration

    Swift

    var deck: String?
  • A main image for the resource. Can be nil for some resource types or if the wiki doens’t include one

    Declaration

    Swift

    var image: ImageURLs?
  • The type of this resource.

    Declaration

    Swift

    var resourceType: ResourceType
  • Extended info about the resource. Fetch this object by calling fetchExtendedInfo upon an instance of it.

    Declaration

    Swift

    var extendedInfo: ExtendedInfoAlias?