Overview:
Introduction:
First import the Framework and initialize it:
//import the framework before the class begins
import Joomla4iOS
//place this before
your viewDidLoad function
var joomla = Joomla4iOS()
Article Functions:
Get a category artciles:
//the requestURL is your website URL with the jBackend menu item alias
joomla.getCategory(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), id: Int), { (response) in
//Response is the data
which gets returned from the server in JSON format
}
Get an article by its ID:
//the requestURL is your website URL with the jBackend menu item alias
joomla.getArticleByID(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), id: Int), { (response) in
//Response is the data
which gets returned from the server in JSON format
}
Get list of articles by Tag ID:
//the requestURL is your website URL with the jBackend menu item alias, limit and offset are
optional and can be passed as nil
joomla.listOfArticlesByTagID(requestURL: URL(string:
"WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), tagID: Int, limit: Int?, offset: Int?), { (response) in
//Response is the data which gets returned from the server in JSON format
}
Get Article by Alias:
//the requestURL is your website URL with the jBackend menu item alias
joomla.getArticleByAlias(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), alias: String), { (response) in
//Response is the
data which gets returned from the server in JSON format
}
Get list of articles by Tag ID:
//the requestURL is your website URL with the jBackend menu item alias, category ID, max subs,
featured, limit, ordered by, order direction and offset are optional and can be passed as nil
joomla.listOfArticlesByTagID(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), categoryID: Int?, maxSubs: Int?, featured: String?,
limit: Int?, offset: Int?, orderBy: String?, orderDirection: String?), { (response) in
//Response is
the data which gets returned from the server in JSON format
}
Get article by alias:
//the requestURL is your website URL with the jBackend menu item alias
joomla.getArticleByAlias(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), alias: String), { (response) in
//Response is the
data which gets returned from the server in JSON format
}
Get list of articles:
//the requestURL is your website URL with the jBackend menu item alias, category ID, max subs,
featured, limit, ordered by, order direction and offset are optional and can be passed as nil
joomla.getListOfArticles(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), categoryID: Int?, maxSubs: Int?, featured: String?,
limit: Int?, offset: Int?, orderBy: String?, orderDirection: String?), { (response) in
//Response is
the data which gets returned from the server in JSON format
}
Get list of categories:
//the requestURL is your website URL with the jBackend menu item alias, root ID, recursive, and
count items are optional and can be passed as nil
joomla.getListOfArticles(requestURL: URL(string:
"WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), roottID: Int?, recursive: Bool?, countItems: Bool?), { (response)
in
//Response is the data which gets returned from the server in JSON format
}
User Functions:
Login user
//the requestURL is your website URL with the jBackend menu item alias
joomla.userLogin(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), username: String, password: String), { (response) in
//Response is the data which gets returned from the server in JSON format
}
Logout user
//the requestURL is your website URL with the jBackend menu item alias
joomla.userLogout(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS")), { (response) in
//Response is the data which gets
returned from the server in JSON format
}
Send user a password reminder
//the requestURL is your website URL with the jBackend menu item alias
joomla.userPasswordRemind(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), email: String), { (response) in
//Response is the
data which gets returned from the server in JSON format
}
Reset password of an user
//the requestURL is your website URL with the jBackend menu item alias
joomla.userPasswordReset(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), email: String), { (response) in
//Response is the
data which gets returned from the server in JSON format
}
Get status of the current user (guest, registered, etc...)
//the requestURL is your website URL with the jBackend menu item alias
joomla.getUserStatus(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS")), { (response) in
//Response is the data which gets
returned from the server in JSON format
}
Register a new user
//the requestURL is your website URL with the jBackend menu item alias
joomla.userRegistration(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), username: String, password: String, email: String,
firstname: String, lastname: String), { (response) in
//Response is the data which gets returned from
the server in JSON format
}
Update user profile
//the requestURL is your website URL with the jBackend menu item alias, profile and fields are
optional and can be passed as nil
joomla.userProfileUpdate(requestURL: URL(string:
"WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), username: String, password: String, email: String, name: String,
profile: [String: String]?, fields: [String: String]?), { (response) in
//Response is the data which
gets returned from the server in JSON format
}
Get infos about logged in user
//the requestURL is your website URL with the jBackend menu item alias
joomla.getLoggedInUser(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS")), { (response) in
//Response is the data which gets
returned from the server in JSON format
}
Get list of menus
//the requestURL is your website URL with the jBackend menu item alias, limit, offset, order by
and order direction are optional
joomla.getListOfMenus(requestURL: URL(string:
"WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), limit: Int?, offset: Int?, orderBy: Int?, orderDirection:
String?), { (response) in
//Response is the data which gets returned from the server in JSON format
}
Get a menu item by ID
//the requestURL is your website URL with the jBackend menu item alias
joomla.getMenuItem(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), id: Int), { (response) in
//Response is the data
which gets returned from the server in JSON format
}
Get list of menu items from menu
//the requestURL is your website URL with the jBackend menu item alias, parent id, level,
limit, offset, order by and order direction are optional
joomla.getListOfMenuItems(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), menuType: String, parentID: Int?, lvel: Int?, limit:
Int?, offset: Int?, orderBy: Int?, orderDirection: String?), { (response) in
//Response is the data
which gets returned from the server in JSON format
}
Search:
Search database
//the requestURL is your website URL with the jBackend menu item alias, search phrase, limit
start, limit, ordering and areas are optional
joomla.search(requestURL: URL(string:
"WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), searchWord: String, searchPhrase: String?, limitStart: Int?,
limit: Int?, ordering: String?, areas: [String]?), { (response) in
//Response is the data which gets
returned from the server in JSON format
}
Push Notifications:
Register new device for push notifications
//the requestURL is your website URL with the jBackend menu item alias, user id, user email,
alert, sound and badge are optional
joomla.registerForPushNotifications(requestURL: URL(string:
"WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), token: String, appcode: String, userID: Int?, userEmail: String?,
alert: Bool?, badge: Bool?, sound: Bool?), { (response) in
//Response is the data which gets returned
from the server in JSON format
}
Send all scheduled notifications
//the requestURL is your website URL with the jBackend menu item alias
joomla.sendScheduledNotifications(requestURL:
URL(string: "WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS")), { (response) in
//Response is the data which gets
returned from the server in JSON format
}
Send a new push notification
//the requestURL is your website URL with the jBackend menu item alias, payload, context and
auth token are optional
joomla.sendNotification(requestURL: URL(string:
"WEBSITE_URL/JBACKEND_MENU_ITEM_ALIAS"), title: String, message: String, app_code: String, platform:
String, target: String, targetUsers: [String], tagetGroups: [String], tagetDevices: [String], sheduledTime:
Date, payload: String?, context: String?, authToken: String?), { (response) in
//Response is the data
which gets returned from the server in JSON format
}
More:
Also check out the jBackend Documentation to learn more how it works