Skip to content

Commit

Permalink
Merge pull request #14 from launchdarkly/jb-add-documentation
Browse files Browse the repository at this point in the history
Jb add documentation
  • Loading branch information
cmavromoustakos committed Nov 30, 2015
2 parents 112655b + e52bdd1 commit 84af6cb
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 0 deletions.
57 changes: 57 additions & 0 deletions Darkly/LDClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,71 @@

+ (id)sharedInstance;

/**
* Start the client with a valid configuration and user.
*
* @param inputConfigBuilder Desired configuration for the client
* @param inputUserBuilder Desired user for the client
* @return whether the client was able to be started
*/
- (BOOL)start:(LDConfigBuilder *)inputConfigBuilder userBuilder:(LDUserBuilder *)inputUserBuilder;
/**
* Retrieve a feature flag value. If the configuration for this feature
* flag is retrieved from the server that value is returned, otherwise
* the defaultValue is returned.
*
* @param featureName Name of feature flag
* @param default Default value for feature flag
* @return the feature flag value
*/
- (BOOL)toggle:(NSString *)featureName default:(BOOL)defaultValue;
/**
* Track a custom event.
*
* @param eventName Name of the custom event
* @param data Data to be attached to custom event
* @return whether the event was successfully recorded
*/
- (BOOL)track:(NSString *)eventName data:(NSDictionary *)dataDictionary;
/**
* Update the user after the client has started. This will override
* user information passed in via the start method.
*
* @param builder Desired user for the client
* @return whether the user was successfully updated
*/
- (BOOL)updateUser:(LDUserBuilder *)builder;
/**
* Retrieve the current user.
*
* @return the current user.
*/
- (LDUserBuilder *)currentUserBuilder;
/**
* Set the client to offline mode. No events will be synced to server.
*
* @return whether offline mode was successfully updated.
*/
- (BOOL)offline;
/**
* Set the client to online mode. Events will be synced to server. (Default)
*
* @return whether online mode was successfully updated.
*/
- (BOOL)online;
/**
* Sync all events to the server. Events are synced to the server on a
* regular basis, however this will force all stored events from the client
* to be synced immediately to the server.
*
* @return whether events were able to be flushed.
*/
- (BOOL)flush;
/**
* Stop the client.
*
* @return whether the client was able to be stopped.
*/
- (BOOL)stopClient;

@end
43 changes: 43 additions & 0 deletions Darkly/LDConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,54 @@

}

/**
* Provide an apiKey to the configuration builder. This is the apiKey
* retrieved from the Launch Darkly account settings. (Required)
*
* @param apiKey the apiKey for the configuration
* @return the configuration builder
*/
- (LDConfigBuilder *)withApiKey:(NSString *)apiKey;
/**
* Provide the baseUrl of the Launch Darkly server. This will allow you
* to switch between production and staging environments. (Optional)
*
* @param baseUrl the baseUrl of the server
* @return the configuration builder
*/
- (LDConfigBuilder *)withBaseUrl:(NSString *)baseUrl;
/**
* Provide the capacity for storing feature flag and custom events. Events
* are persisted on the client and then synced to the server on a regular
* basis. If there is ever a prolonged period of time between the last server
* sync, the capacity defined here will determine at what points the events
* are ignored and no longer stored. The default is 100. (Optional)
*
* @param capacity the number of events to store
* @return the configuration builder
*/
- (LDConfigBuilder *)withCapacity:(int)capacity;
/**
* The connection timeout to be used when syncing to the Launch Darkly
* server. The default is 10 seconds. (Optional)
*
* @param connectionTimeout timeout for network connections in seconds
* @return the configuration builder
*/
- (LDConfigBuilder *)withConnectionTimeout:(int)connectionTimeout;
/**
* The interval at which events are synced to the server. The default
* is 30 seconds. (Optional)
*
* @param flushInverval the flush interval in seconds
* @return the configuration builder
*/
- (LDConfigBuilder *)withFlushInterval:(int)flushInterval;
/**
* Enable debug mode to allow things such as logging. (Optional)
*
* @return the configuration builder
*/
- (LDConfigBuilder *)withDebugEnabled:(BOOL)debugEnabled;

-(LDConfig *)build;
Expand Down
91 changes: 91 additions & 0 deletions Darkly/LDUserBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,109 @@
+ (User *)compareNewBuilder:(LDUserBuilder *)iBuilder withUser:(User *)iUser;
+ (LDUserBuilder *)retrieveCurrentBuilder:(User *)iUser;

/**
* Provide a key to the user builder to identify the user. If this key
* is not provided, one will be auto-generated. (Optional)
*
* @param key the key for the user
* @return the user builder
*/
- (LDUserBuilder *)withKey:(NSString *)key;
/**
* Provide the ip address of the user. (Optional)
*
* @param ip the ip of the user
* @return the user builder
*/
- (LDUserBuilder *)withIp:(NSString *)ip;
/**
* Provide the country of the user. (Optional)
*
* @param country the country of the user
* @return the user builder
*/
- (LDUserBuilder *)withCountry:(NSString *)country;
/**
* Provide the first name of the user. (Optional)
*
* @param firstName the firstName of the user
* @return the user builder
*/
- (LDUserBuilder *)withFirstName:(NSString *)firstName;
/**
* Provide the last name of the user. (Optional)
*
* @param lastName the lastName of the user
* @return the user builder
*/
- (LDUserBuilder *)withLastName:(NSString *)lastName;
/**
* Provide the email address of the user. (Optional)
*
* @param email the email of the user
* @return the user builder
*/
- (LDUserBuilder *)withEmail:(NSString *)email;
/**
* Provide the avatar of the user. (Optional)
*
* @param avatar the avatar of the user
* @return the user builder
*/
- (LDUserBuilder *)withAvatar:(NSString *)avatar;
/**
* Provide custom String data for the dictionary associated with
* the user. (Optional)
*
* @param inputKey key for the data
* @param value value for the data
* @return the user builder
*/
- (LDUserBuilder *)withCustomString:(NSString *)inputKey value:(NSString *)value;
/**
* Provide custom BOOL data for the dictionary associated with
* the user. (Optional)
*
* @param inputKey key for the data
* @param value value for the data
* @return the user builder
*/
- (LDUserBuilder *)withCustomBool:(NSString *)inputKey value:(BOOL)value;
/**
* Provide custom NSNumber data for the dictionary associated with
* the user. (Optional)
*
* @param inputKey key for the data
* @param value value for the data
* @return the user builder
*/
- (LDUserBuilder *)withCustomNumber:(NSString *)inputKey value:(NSNumber *)value;
/**
* Provide custom NSArray data for the dictionary associated with
* the user. (Optional)
*
* @param inputKey key for the data
* @param value value for the data
* @return the user builder
*/
- (LDUserBuilder *)withCustomArray:(NSString *)inputKey value:(NSArray *)value;
/**
* Provide custom NSMutableDictionary data for the dictionary associated with
* the user. (Optional)
*
* @param inputKey key for the data
* @param value value for the data
* @return the user builder
*/
- (LDUserBuilder *)withCustomDictionary:(NSMutableDictionary *)inputDictionary;
/**
* Provide whether the user is anonymous. Note, if a key is
* auto-generated for the user, then anonymous is set to YES. Default
* is NO. (Optional)
*
* @param anonymous whether user is anonymous
* @return the user builder
*/
- (LDUserBuilder *)withAnonymous:(BOOL)anonymous;

-(id)build;
Expand Down

0 comments on commit 84af6cb

Please sign in to comment.