-
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSString *_Nullable challengeId;
Swift
var challengeId: String? { get }
-
Whether the challenge has been accepted.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nullable accepted;
Swift
var accepted: NSNumber? { get }
-
The date the challenge was accepted. Nil if the challenge has not been accepted.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSDate *_Nullable acceptedDate;
Swift
var acceptedDate: Date? { get }
-
The topic id of the challenge.
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSNumber *_Nullable topicId;
Swift
var topicId: NSNumber? { get }
-
The type of the challenge. ‘Meter’, ‘Spending, 'Savings’ or ‘Custom’.
Declaration
Objective-C
@property (nonatomic, copy, readonly) NSString *_Nullable type;
Swift
var type: String? { get }
-
The model for the challenge
Declaration
Objective-C
@property (nonatomic, strong, readonly) NSObject<MNFJsonAdapterDelegate> *_Nullable challengeModel;
Swift
var challengeModel: MNFJsonAdapterDelegate? { get }
-
The title of the challenge.
Warning
This property is only mutable for type ‘CustomSpending.Declaration
Objective-C
@property (nonatomic, copy) NSString *_Nullable title;
Swift
var title: String? { get set }
-
The text description of the challenge.
Warning
This property is only mutable for type ‘CustomSpending.Declaration
Objective-C
@property (nonatomic, copy) NSString *_Nullable challengeDescription;
Swift
var challengeDescription: String? { get set }
-
The start date of the challenge.
Warning
This property is only mutable for type ‘CustomSpending.Declaration
Objective-C
@property (nonatomic, strong) NSDate *_Nullable startDate;
Swift
var startDate: Date? { get set }
-
The end date of the challenge
Warning
This property is only mutable for type ‘CustomSpending.Declaration
Objective-C
@property (nonatomic, strong) NSDate *_Nullable endDate;
Swift
var endDate: Date? { get set }
-
The url of the icon to display with this challenge.
Warning
This property is only mutable for type ‘CustomSpending.Declaration
Objective-C
@property (nonatomic, strong) NSString *_Nullable iconUrl;
Swift
var iconUrl: String? { get set }
-
Fetches a challenge with a given identifier.
Declaration
Objective-C
+ (nonnull MNFJob *) fetchChallengeWithId:(nonnull NSNumber *)identifier completion:(nullable MNFChallengesCompletionHandler)completion;
Swift
class func fetch(withId identifier: NSNumber, completion: MNFChallengesCompletionHandler? = nil) -> MNFJob
Parameters
identifier
The identifier of the challenge.
completion
A completion block returning a challenge and an error.
Return Value
MNFJob A job containing a list of challenges or an error.
-
Fetches challenges, optionally including only accepted and/or expired challenges.
Declaration
Objective-C
+ (nonnull MNFJob *) fetchChallengesWithIncludeExpired:(nullable NSNumber *)includeExpired excludeSuggested:(nullable NSNumber *)excludeSuggested excludeAccepted:(nullable NSNumber *)excludeAccepted includeDisable:(nullable NSNumber *)includeDisabled completion: (nullable MNFMultipleChallengesCompletionHandler) completion;
Swift
class func fetchChallenges(withIncludeExpired includeExpired: NSNumber?, excludeSuggested: NSNumber?, excludeAccepted: NSNumber?, includeDisable includeDisabled: NSNumber?, completion: MNFMultipleChallengesCompletionHandler? = nil) -> MNFJob
Parameters
includeExpired
Whether to include expired challenges or not. If nil fetches all challenges.
completion
A completion block returning a list of challenges and an error.
Return Value
MNFJob A job containing a list of challenges or an error.
-
Fetches a list of previously completed recurring system challenges. When a recurring suggested challenge is accepted a copy of it is created in the system. When fetching challenges you will only see the current recurring challenge. In order to see previously accepted and completed copies of that challenge you should use this method to retrieve them.
Declaration
Objective-C
- (nonnull MNFJob *) fetchChallengeHistoryWithSkip:(nullable NSNumber *)skip take:(nullable NSNumber *)take completion: (nullable MNFMultipleChallengesCompletionHandler) completion;
Swift
func fetchHistory(withSkip skip: NSNumber?, take: NSNumber?, completion: MNFMultipleChallengesCompletionHandler? = nil) -> MNFJob
Parameters
skip
The number of items to skip. Defaults to zero.
take
The number of items to fetch. Defaults to all items.
completion
A completion block returning a list of challenges and an error.
Return Value
MNFJob A job containing a list of challenges and an error.
-
Accepts a challenge.
Declaration
Objective-C
- (nonnull MNFJob *) acceptChallengeWithTargetAmount:(nullable NSNumber *)targetAmount waitTime:(nullable NSNumber *)waitTime completion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func accept(withTargetAmount targetAmount: NSNumber?, waitTime: NSNumber?, completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
targetAmount
The target amount for the challenge.
waitTime
The time in milliseconds to wait while the server completes calculating the parameters of the challenge.
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
Saves changes made to the challenge to the server.
Declaration
Objective-C
- (nonnull MNFJob *)saveWithCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func save(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
Deletes a challenge from the server.
Warning
The challenge must have been accepted by the user.
Declaration
Objective-C
- (nonnull MNFJob *)deleteWithCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func delete(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
Refreshes a challenge with data from the server.
Declaration
Objective-C
- (nonnull MNFJob *)refreshWithCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func refresh(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
Resumes a previously enabled challenge.
Declaration
Objective-C
- (nonnull MNFJob *)enableWithCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func enable(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
Pauses a previously accepted challenge. For suggested challenges not accepted yet an acceptance is made but in disabled state. Disabled challenges can be re-enabled by using the enable endpoint.
Declaration
Objective-C
- (nonnull MNFJob *)disableWithCompletion: (nullable MNFErrorOnlyCompletionHandler)completion;
Swift
func disable(completion: MNFErrorOnlyCompletionHandler? = nil) -> MNFJob
Parameters
completion
A completion block returning an error.
Return Value
MNFJob A job containing an error.
-
Create a new challenge.
Declaration
Objective-C
+ (nonnull MNFJob *)challengeWithTitle:(nullable NSString *)title description:(nullable NSString *)description startDate:(nullable NSDate *)startDate endDate:(nullable NSDate *)endDate iconUrl:(nullable NSString *)iconUrl typeData:(nullable NSDictionary *)typeData completion:(nullable MNFChallengesCompletionHandler) completion;
Swift
class func challenge(withTitle title: String?, description: String?, start startDate: Date?, end endDate: Date?, iconUrl: String?, typeData: [AnyHashable : Any]?, completion: MNFChallengesCompletionHandler? = nil) -> MNFJob
Parameters
title
The title of the challenge.
description
The text description of the challenge.
startDate
The starting date of the challenge.
endDate
The end date of the challenge.
iconUrl
The icon url to display with this challenge.
typeData
The typeData for the challenge.
completion
A completion block returning a challenge and an error.
Return Value
MNFJob A job containing a challenge and an error.
-
Fetch a list of icon identifiers used to fetch icon image data.
Declaration
Objective-C
+ (nonnull MNFJob *) fetchIconIdentifiersWithFormat:(nullable NSString *)format completion: (nullable MNFChallengeIconIdentifiersCompletionHandler) completion;
Swift
class func fetchIconIdentifiers(withFormat format: String?, completion: MNFChallengeIconIdentifiersCompletionHandler? = nil) -> MNFJob
Parameters
format
The format for the icons, ‘png’ or ‘svg’. If nil returns both.
completion
A completion block returning a list of strings and an error.
Return Value
MNFJob A job containing a list of strings and an error.
-
Fetch a challenge icon resource with a give identifier.
Declaration
Objective-C
+ (nonnull MNFJob *) fetchIconWithIdentifier:(nonnull NSString *)iconIdentifier completion: (nullable MNFChallengeIconImageDataCompletionHandler) completion;
Swift
class func fetchIcon(withIdentifier iconIdentifier: String, completion: MNFChallengeIconImageDataCompletionHandler? = nil) -> MNFJob
Parameters
iconIdentifier
The identifier of the icon to fetch.
completion
A completion block returning image data and an error.
Return Value
MNFJob A job containing image data and an error.