![]() |
Global Lender
A Pebble app for finding new and interesting loans on kiva.org
|
MagPebApp_ErrCode KivaModel_addKivaCountry | ( | KivaModel * | this, |
const char * | countryId, | ||
const char * | countryName | ||
) |
Adds a new country to the list of Kiva-recognized countries. The countryId and countryName parameters are copied; ownership of those parameters is not transferred by this function. The caller is still responsible for freeing that data.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | countryId | ID of the country to add; a two-character ISO-3361 country code |
[in] | countryName | Name of the country to add |
MagPebApp_ErrCode KivaModel_addLenderCountry | ( | KivaModel * | this, |
const char * | countryId, | ||
const char * | countryName | ||
) |
Adds a country ID to the list of countries supported by the lender.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | countryId | ID of the country to add; a two-character ISO-3361 country code. Ownership is not transferred from the caller, so the caller should free this variable. If the countryId is not yet in the list of recognized Kiva countries, then it will be added to the hash. |
[in] | countryName | Name of the country to add. If countryId is already a recognized Kiva country, then the countryName will be ignored. If the countryId is not yet in the list of countries that this KivaModel recognizes, then this will be the new country name for this ID. If NULL, then the countryId will be used as the name. Ownership is not transferred from the caller, so the caller should free this variable. |
MagPebApp_ErrCode KivaModel_addPreferredLoan | ( | KivaModel * | this, |
const LoanInfo | loanInfo | ||
) |
Adds a new loan to the list of preferred loans. Preferred loans are a list of fundraising loans in which the lender has indicated an interest. The heap-allocated members of loanInfo are copied; ownership of those parameters is not transferred by this function. The caller is still responsible for freeing that data.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | loanInfo | information about the preferred loan |
MagPebApp_ErrCode KivaModel_clearPreferredLoans | ( | KivaModel * | this | ) |
KivaModel* KivaModel_create | ( | const char * | lenderId | ) |
Constructor
[in] | lenderId | Pointer to the lender ID C-string. Identifies the lender uniquely on kiva.org. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |
MagPebApp_ErrCode KivaModel_destroy | ( | KivaModel * | this | ) |
KivaModel_PrefLoan_CIter* KivaModel_firstPrefLoan | ( | const KivaModel * | this | ) |
Used to iterate through the list of preferred loans.
[in,out] | this | Pointer to KivaModel; must be already allocated |
MagPebApp_ErrCode KivaModel_getKivaCountryName | ( | const KivaModel * | this, |
const char * | countryId, | ||
const char ** | countryName | ||
) |
Provides a pointer to the country name identified by the specified ID.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | countryId | ID of the country to add; a two-character ISO-3361 country code. Ownership of this parameter is not transferred, so the caller is still responsible for freeing this variable. |
[out] | countryName | If the country ID is recognized by this KivaModel, this parameter will be replaced with a pointer to the recognized country name. Must be NULL upon entry to this function. If the country ID is not recognized, then this parameter will remain NULL. Caller does not own (should not free) the memory associated with countryName. |
MagPebApp_ErrCode KivaModel_getKivaCountryQty | ( | const KivaModel * | this, |
int * | kivaCountryQty | ||
) |
Gets the quantity of countries actively served by Kiva.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | kivaCountryQty | Pointer to the Kiva country quantity int variable |
MagPebApp_ErrCode KivaModel_getLenderCountryCodes | ( | const KivaModel * | this, |
const bool | support, | ||
char ** | countryCodes | ||
) |
Gets a list of country codes relative to the registered lender.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | support | If true, returns a list of country codes that registered lender has supported with loans. If false, returns a list of country codes that the registered lender has NOT yet supported with loans. |
[out] | countryCodes | If countries exist that meet the support criteria relative to the lender in this KivaModel, then this parameter will be replaced with a pointer to a string of comma- separated country codes. Must be NULL upon entry to this function. If there are no countries that meet the criteria, then this parameter will remain NULL. Ownership of this string is transferred to the caller after this function call. Caller owns (and must free) the memory associated with countryCodes (if the string is not NULL). |
MagPebApp_ErrCode KivaModel_getLenderCountryQty | ( | const KivaModel * | this, |
int * | lenderCountryQty | ||
) |
Gets the quantity of countries supported by the registered lender.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderCountryQty | Pointer to the lender country quantity int variable |
MagPebApp_ErrCode KivaModel_getLenderId | ( | const KivaModel * | this, |
char ** | lenderId | ||
) |
Gets the currently-stored lender ID.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderId | Pointer to the lender ID C-string; must be NULL on entry. Ownership is not transferred to the caller, so the caller should not free this variable. |
MagPebApp_ErrCode KivaModel_getLenderLoanQty | ( | const KivaModel * | this, |
int * | lenderLoanQty | ||
) |
Gets the quantity of loans by the registered lender.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderQty | Pointer to the lender loan quantity int variable |
MagPebApp_ErrCode KivaModel_getLenderLoc | ( | const KivaModel * | this, |
char ** | lenderLoc | ||
) |
Gets the currently-stored lender location.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderLoc | Pointer to the lender location C-string; must be NULL on entry. Ownership is not transferred to the caller, so the caller should not free this variable. |
MagPebApp_ErrCode KivaModel_getLenderName | ( | const KivaModel * | this, |
char ** | lenderName | ||
) |
Gets the currently-stored lender name.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[out] | lenderName | Pointer to the lender name C-string; must be NULL on entry. Ownership is not transferred to the caller, so the caller should not free this variable. |
MagPebApp_ErrCode KivaModel_getMods | ( | const KivaModel * | this, |
KivaModel_Modified * | mods | ||
) |
Indicates which parts of the data model were modified since the last time the data was retrieved from a "getter" member function.
MagPebApp_ErrCode KivaModel_getPreferredLoanQty | ( | const KivaModel * | this, |
uint16_t * | prefLoanQty | ||
) |
Returns the number of preferred loans stored in this model.
Preferred loans are a list of fundraising loans in which the lender has indicated an interest.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in,out] | prefLoanQty | The quantity of preferred loans stored |
MagPebApp_ErrCode KivaModel_init | ( | KivaModel * | this, |
const char * | lenderId | ||
) |
Internal initialization
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | lenderId | Pointer to the lender ID C-string. Identifies the lender uniquely on kiva.org. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |
KivaModel_PrefLoan_CIter* KivaModel_nextPrefLoan | ( | const KivaModel * | this, |
KivaModel_PrefLoan_CIter * | plIter | ||
) |
MagPebApp_ErrCode KivaModel_setLenderId | ( | KivaModel * | this, |
const char * | lenderId | ||
) |
Sets the Lender ID and resets any lender-specific data so that it will be NULL or empty until it is reloaded.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | lenderId | Pointer to the lender ID C-string. Identifies the lender uniquely on kiva.org. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |
MagPebApp_ErrCode KivaModel_setLenderLoanQty | ( | KivaModel * | this, |
const int | lenderLoanQty | ||
) |
MagPebApp_ErrCode KivaModel_setLenderLoc | ( | KivaModel * | this, |
const char * | lenderLoc | ||
) |
Sets the lender location for the registered lender.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | lenderName | Pointer to the lender location C-string, as it appears on kiva.org. This is a free format text field. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |
MagPebApp_ErrCode KivaModel_setLenderName | ( | KivaModel * | this, |
const char * | lenderName | ||
) |
Sets the lender name for the registered lender.
[in,out] | this | Pointer to KivaModel; must be already allocated |
[in] | lenderName | Pointer to the lender name C-string, as it is written on kiva.org. This may be a first name and last name, but is not limited to that format. Ownership is not transferred to this function, so the caller is still responsible for freeing this variable. |