Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
646 lines (605 sloc) 39.7 KB
package facebook
/*
Copyright © 2011 MLstate
This file is part of Opa.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/*
* Author : Nicolas Glondu <nicolas.glondu@mlstate.com>
**/
/**
* Facebook generic API module
*
* @category api
* @author Nicolas Glondu, 2011
* @destination public
*/
import stdlib.apis.common
/**
* {1 About this module}
*
* This module provides some generic elements common to all facebook submodules
* Important :
* Any application using this must respect
* {{:http://developers.facebook.com/policy}Facebook policy}
*
* {1 Where should I start?}
*
* You should first {{:https://www.facebook.com/developers/}register an app}
* to get a application id, an api key and an application secret. You will
* also have to configure various parameters on your application. Once done,
* look the module [FbAuth] to obtain an access token from users. You can
* now use any Facebook API.
*/
/**
* Configuration for Facebook Graph API
* All these are obtained after creating an application using Facebook
* Developper app: https://www.facebook.com/developers/
*/
type Facebook.config = {
app_id : string
api_key : string
app_secret : string
}
/**
* A Facebook error
* - [error] Short message identifying the error. Errors starting with "opa_" are
generated by this module while others are sent back by Facebook.
* - [error_description] Longer description of the error (in English). Errors
generated by this module start with [OPA]. You should not show these errors
end errors.
*/
type Facebook.error = {
error : string
error_description : string
}
/**
* Permissions that can be requested to active user
* A list of all permissions with what they stand for can be obtained at:
* https://developers.facebook.com/docs/authentication/permissions/
*/
type Facebook.permission =
/* Data permissions - self */
{ user_about_me } /** Provides access to the "About Me" section of the profile in the about property */
/ { user_activities } /** Provides access to the user's list of activities as the activities connection */
/ { user_birthday } /** Provides access to the birthday with year as the birthday_date property */
/ { user_checkins } /** Provides read access to the authorized user's check-ins or a friend's check-ins that the user can see. This permission is superseded by user_status for new applications as of March, 2012. */
/ { user_education_history } /** Provides access to education history as the education property */
/ { user_events } /** Provides access to the list of events the user is attending as the events connection */
/ { user_groups } /** Provides access to the list of groups the user is a member of as the groups connection */
/ { user_hometown } /** Provides access to the user's hometown in the hometown property */
/ { user_interests } /** Provides access to the user's list of interests as the interests connection */
/ { user_likes } /** Provides access to the list of all of the pages the user has liked as the likes connection */
/ { user_location } /** Provides access to the user's current location as the location property */
/ { user_notes } /** Provides access to the user's notes as the notes connection */
/ { user_photos } /** Provides access to the photos the user has uploaded */
/ { user_questions } /** Provides access to the questions the user or friend has asked */
/ { user_relationships } /** Provides access to the user's family and personal relationships and rela
tionship status */
/ { user_relationship_details } /** Provides access to the user's relationship preferences */
/ { user_religion_politics } /** Provides access to the user's religious and political affiliations */
/ { user_status } /** Provides access to the user's most recent status message */
/ { user_subscriptions } /** Provides access to the user's subscribers and subscribees */
/ { user_videos } /** Provides access to the videos the user has uploaded */
/ { user_website } /** Provides access to the user's web site URL */
/ { user_work_history } /** Provides access to work history as the work property */
/ { email } /** Provides access to the user's primary email address in the email property. Do not spam users. Your use of email must comply both with Facebook policies and with the CAN-SPAM Act. */
/* Data permissions - friends */
/ { friends_about_me } /** Provides access to the "About Me" section of the profile in the about property */
/ { friends_activities } /** Provides access to the friend's list of activities as the activities connection */
/ { friends_birthday } /** Provides access to the birthday with year as the birthday_date property */
/ { friends_checkins } /** Provides read access to the authorized friend's check-ins or a friend's check-ins that the friend can see. This permission is superseded by friend_status for new applications as of March, 2012. */
/ { friends_education_history } /** Provides access to education history as the education property */
/ { friends_events } /** Provides access to the list of events the friend is attending as the events connection */
/ { friends_groups } /** Provides access to the list of groups the friend is a member of as the groups connection */
/ { friends_hometown } /** Provides access to the friend's hometown in the hometown property */
/ { friends_interests } /** Provides access to the friend's list of interests as the interests connection */
/ { friends_likes } /** Provides access to the list of all of the pages the friend has liked as the likes connection */
/ { friends_location } /** Provides access to the friend's current location as the location property */
/ { friends_notes } /** Provides access to the friend's notes as the notes connection */
/ { friends_photos } /** Provides access to the photos the friend has uploaded */
/ { friends_questions } /** Provides access to the questions the friend or friend has asked */
/ { friends_relationships } /** Provides access to the friend's family and personal relationships and relationship status */
/ { friends_relationship_details } /** Provides access to the friend's relationship preferences */
/ { friends_religion_politics } /** Provides access to the friend's religious and political affiliations */
/ { friends_status } /** Provides access to the friend's most recent status message */
/ { friends_subscriptions } /** Provides access to the friend's subscribers and subscribees */
/ { friends_videos } /** Provides access to the videos the friend has uploaded */
/ { friends_website } /** Provides access to the friend's web site URL */
/ { friends_work_history } /** Provides access to work history as the work property */
/* Extended permissions */
/ { read_friendlists } /** Provides access to any friend lists the user created. All user's friends are provided as part of basic data, this extended permission grants access to the lists of friends a user has created, and should only be requested if your application utilizes lists of friends. */
/ { read_insights } /** Provides read access to the Insights data for pages, applications, and domains the user owns. */
/ { read_mailbox } /** Provides the ability to read from a user's Facebook Inbox. */
/ { read_requests } /** Provides read access to the user's friend requests */
/ { read_stream } /** Provides access to all the posts in the user's News Feed and enables your application to perform searches against the user's News Feed */
/ { xmpp_login } /** Provides applications that integrate with Facebook Chat the ability to log in users. */
/ { ads_management } /** Provides the ability to manage ads and call the Facebook Ads API on behalf of a user. */
/ { create_event } /** Enables your application to create and modify events on the user's behalf */
/ { manage_friendlists } /** Provides access to any friend lists the user created. All user's friends are provided as part of basic data, this extended permission grants access to the lists of friends a user has created, and should only be requested if your application utilizes lists of friends. */
/ { manage_notifications } /** Enables your app to read notifications and mark them as read. Intended usage: This permission should be used to let users read and act on their notifications; it should not be used to for the purposes of modeling user behavior or data mining. Apps that misuse this permission may be banned from requesting it. */
/* Publishing permissions */
/ { user_online_presence } /** Provides access to the user's online/offline presence */
/ { friends_online_presence } /** Provides access to the friend's online/offline presence */
/ { publish_checkins } /** Enables your application to perform checkins on behalf of the user */
/ { publish_stream } /** Enables your app to post content, comments, and likes to a user's stream and to the streams of the user's friends. This is a superset publishing permission which also includes publish_actions. However, please note that Facebook recommends a user-initiated sharing model. Please read the Platform Policies to ensure you understand how to properly use this permission. Note, you do not need to request the publish_stream permission in order to use the Feed Dialog, the Requests Dialog or the Send Dialog. */
/ { rsvp_event } /** Enables your application to RSVP to events on the user's behalf */
/* Open Graph Permissions */
/ { publish_actions } /** Allows your app to publish to the Open Graph using Built-in Actions, Achievements, Scores, or Custom Actions. Your app can also publish other activity which is detailed in the Publishing Permissions doc. Note: The user-prompt for this permission will be displayed in the first screen of the Enhanced Auth Dialog and cannot be revoked as part of the authentication flow. However, a user can later revoke this permission in their Account Settings. If you want to be notified if this happens, you should subscribe to the permissions object within the Realtime API. */
/ { user_actions_music } /** Allows you to retrieve the actions published by all applications using the built-in music.listens action. */
/ { friends_actions_music } /** Allows you to retrieve the actions published by all applications using the built-in music.listens action. */
/ { user_actions_news } /** Allows you to retrieve the actions published by all applications using the built-in news.reads action. */
/ { friends_actions_news } /** Allows you to retrieve the actions published by all applications using the built-in news.reads action. */
/ { user_actions_video } /** Allows you to retrieve the actions published by all applications using the built-in video.watches action. */
/ { friends_actions_video } /** Allows you to retrieve the actions published by all applications using the built-in video.watches action. */
/ { user_actions_namespace:string } /** Allows you retrieve the actions published by another application as specified by the app namespace. For example, to request the ability to retrieve the actions published by an app which has the namespace awesomeapp, prompt the user for the users_actions:awesomeapp and/or friends_actions:awesomeapp permissions. */
/ { friends_actions_namespace:string } /** Allows you retrieve the actions published by another application as specified by the app namespace. For example, to request the ability to retrieve the actions published by an app which has the namespace awesomeapp, prompt the user for the users_actions:awesomeapp and/or friends_actions:awesomeapp permissions. */
/ { user_games_activity } /** Allows you post and retrieve game achievement activity. */
/ { friends_games_activity } /** Allows you post and retrieve game achievement activity. */
/* Page permissions */
/ { manage_pages } /** Enables your application to retrieve access_tokens for Pages and Applications that the user administrates. The access tokens can be queried by calling /<user_id>/accounts via the Graph API. This permission is only compatible with the Graph API, not the deprecated REST API. See https://developers.facebook.com/roadmap/offline-access-removal/#page_access_token for generating long-lived Page access tokens that do not expire after 60 days.*/
/* These are not in the current docs but get returned anyway, deprecated? */
/ {installed}
/ {status_update}
/ {photo_upload}
/ {video_upload}
/ {sms}
/ {create_note}
/ {share_item}
/ {user_photo_video_tags}
/ {friends_photo_video_tags}
/ {bookmarked}
/**
* Link in a feed
* [text] short text describing the link
* [href] uri of the link. Note that Facebook will not transform the link, which
* means you can put either an absolute or a relative address.
*/
type Facebook.feed_link = {
text : string /* also known as name */
href : string /* also known as link */
}
/**
* Property of a feed
* See [Facebook.feed_options] for more information on feeds.
*/
type Facebook.feed_property =
{ simple : string } /** A simple text property */
/ { link : Facebook.feed_link } /** A property with a link */
/**
* A Facebook feed for [FbDialog.full_feed] and [FbGraph.Post.feed].
* Default value is [Facebook.empty_feed].
* - [from] ID or username of the user posting the message. If this is
* unspecified, it defaults to the current user. If specified, it must be
* the ID of the user or of a page that the user administers. NOT usable
* in [FbGraph.Post.feed].
* - [to] ID or username of the profile on which this feed will be published
* If this is unspecified, it defaults to the the value of [from]. NOT
* usable with [FbGraph.Post.feed].
* - [message] Message of the feed. If used in a dialog, it will prefill the text
* field that the user will type in. In this case, to be compliant with
* Facebook Platform Policies, your application may only set this field if
* the user manually generated the content earlier in the workflow. Most
* applications should not set this.
* - [link] Link attached to this post
* - [picture] URL of a picture attached to this post.
* - [source] URL of a media file (e.g., a SWF or video file) attached to
* this post. If both source and picture are specified, only source is used.
* - [name] Name of the link attachment.
* - [caption] Caption of the link (appears beneath the link name).
* - [description] Description of the link (appears beneath the link caption).
* - [properties] List of [FbDialog.feed_property] which will appear in
* the stream attachment beneath the description, with each property on its
* own line. Keys must be strings, and values can be either strings or JSON
* objects with the keys text and href. Will only appear if there is a link.
* - [actions] List of [FbDialog.feed_link] which will appear next to
* the "Comment" and "Like" link under posts.
*/
type Facebook.feed = {
from : string
to : string
message : string
link : string
picture : string
source : string
name : string
caption : string
description : string
properties : list(Facebook.feed_property)
actions : list(Facebook.feed_link)
}
/** A Facebook post for [FbGraph.Post.post]. */
type Facebook.post = {
message : option(string)
link : option(string)
picture : option(string)
name : option(string)
caption : option(string)
description : option(string)
actions : list(Facebook.feed_link)
privacy : option(string)
}
type Facebook.property =
{ id } /** The application ID string */
/ { name } /** The title of the application string */
/ { description } /** The description of the application written by the 3rd party developers string */
/ { category } /** The category of the application string */
/ { company } /** The company the application belongs to string */
/ { icon_url } /** The URL of the application's icon string */
/ { subcategory } /** The subcategory of the application string */
/ { link } /** A link to the Application's profile page string */
/ { logo_url } /** The URL of the application's logo string */
/ { daily_active_users } /** The number of daily active users the application has string */
/ { weekly_active_users } /** The number of weekly active users the application has string */
/ { monthly_active_users } /** The number of monthly active users the application has string */
/ { migrations } /** Migrations settings for app profile */
/ { namespace } /** The namespace for the app */
/ { restrictions } /** Demographic restrictions set for this app (Object with one or more of the following fields: type, location, age, and age_distr) */
/ { app_domains } /** Domains and subdomains this app can use (array) */
/ { auth_dialog_data_help_url } /** The URL of a special landing page that helps users of an app begin publishing Open Graph activity (string) */
/ { auth_dialog_description } /** The description of an app that appears in the Auth Dialog (string) */
/ { auth_dialog_headline } /** One line description of an app that appears in the Auth Dialog (string) */
/ { auth_dialog_perms_explanation } /** The text to explain why an app needs additional permissions that appears in the Auth Dialog (string) */
/ { auth_referral_user_perms } /** Basic user permissions that a user must grant when Authenticated Referrals are enabled (array) */
/ { auth_referral_friend_perms } /** Basic friends permissions that a user must grant when Authenticated Referrals are enabled (array) */
/ { auth_referral_default_activity_privacy } /** The default privacy setting selected for Open Graph activities in the Auth Dialog (string which is one of: SELF, EVERYONE, ALL_FRIENDS or NONE) */
/ { auth_referral_enabled } /** Indicates whether Authenticated Referrals are enabled (bool) */
/ { auth_referral_extended_perms } /** Extended permissions that a user can choose to grant when Authenticated Referrals are enabled (array) */
/ { auth_referral_response_type } /** The format that an app receives the Auth token from the Auth Dialog in (string which is one of: code or token) */
/ { canvas_fluid_height } /** Indicates whether app uses fluid or settable height values for Canvas (bool) */
/ { canvas_fluid_width } /** Indicates whether app uses fluid or fixed width values for Canvas (bool) */
/ { canvas_url } /** The non-secure URL from which Canvas app content is loaded (string) */
/ { contact_email } /** Email address listed for users to contact developers (string) */
/ { created_time } /** Unix timestamp that indicates when the app was created int */
/ { creator_uid } /** User ID of the creator of this app int */
/ { deauth_callback_url } /** URL that is pinged whenever a user removes the app (string) */
/ { iphone_app_store_id } /** ID of the app in the iPhone App Store string */
/ { hosting_url } /** Webspace created with one of our hosting partners for this app string */
/ { mobile_web_url } /** URL to which Mobile users will be directed when using the app (string) */
/ { page_tab_default_name } /** The title of the app when used in a Page Tab (string) */
/ { page_tab_url } /** The non-secure URL from which Page Tab app content is loaded (string) */
/ { privacy_policy_url } /** The URL that links to a Privacy Policy for the app (string) */
/ { secure_canvas_url } /** The secure URL from which Canvas app content is loaded (string) */
/ { secure_page_tab_url } /** The secure URL from which Page Tab app content is loaded (string) */
/ { server_ip_whitelist } /** App requests must originate from this comma-separated list of IP addresses (string) */
/ { social_discovery } /** Indicates whether app usage stories show up in the Ticker or News Feed (bool) */
/ { terms_of_service_url } /** URL to Terms of Service which is linked to in Auth Dialog (string) */
/ { user_support_email } /** Main contact email for this app (string) */
/ { user_support_url } /** URL of support for users of an app shown in Canvas footer (string) */
/ { website_url } /** URL of a website that integrates with this app (string) */
type Facebook.properties = list(Facebook.property)
Facebook = {{
/* Facebook static */
server_url = "https://www.facebook.com"
/* Errors */
make_error(error, descr) : Facebook.error = {
error = error
error_description = descr
}
/**
* One of the errors generated by this module. Returned when incorrect
* parameters are provided to a function.
*/
data_error = make_error("opa_data_error", "[OPA]Error in data")
/**
* One of the errors generated by this module. Returned when
* trying to acces an object fails.
*/
access_denied = make_error("opa_access_denied", "[OPA]Error: access denied")
/**
* One of the errors generated by this module. Returned after a communication
* error with Facebook server. May happen if no internet access is available.
*/
network_error = make_error("opa_network_error", "[OPA]Error during transmission")
/**
* Error during JSON parsing. Should not happen.
*/
parse_error(res) = make_error("opa_parse_error", "[OPA]Error during treatments: \n {res} \n --- is not JSON ---")
/* to_string functions */
permission_to_string(p) =
match p:Facebook.permission with
| { user_about_me } -> "user_about_me"
| { user_activities } -> "user_activities"
| { user_birthday } -> "user_birthday"
| { user_checkins } -> "user_checkins"
| { user_education_history } -> "user_education_history"
| { user_events } -> "user_events"
| { user_groups } -> "user_groups"
| { user_hometown } -> "user_hometown"
| { user_interests } -> "user_interests"
| { user_likes } -> "user_likes"
| { user_location } -> "user_location"
| { user_notes } -> "user_notes"
| { user_photos } -> "user_photos"
| { user_questions } -> "user_questions"
| { user_relationships } -> "user_relationships"
| { user_relationship_details } -> "user_relationship_details"
| { user_religion_politics } -> "user_religion_politics"
| { user_status } -> "user_status"
| { user_subscriptions } -> "user_subscriptions"
| { user_videos } -> "user_videos"
| { user_website } -> "user_website"
| { user_work_history } -> "user_work_history"
| { email } -> "email"
| { friends_about_me } -> "friends_about_me"
| { friends_activities } -> "friends_activities"
| { friends_birthday } -> "friends_birthday"
| { friends_checkins } -> "friends_checkins"
| { friends_education_history } -> "friends_education_history"
| { friends_events } -> "friends_events"
| { friends_groups } -> "friends_groups"
| { friends_hometown } -> "friends_hometown"
| { friends_interests } -> "friends_interests"
| { friends_likes } -> "friends_likes"
| { friends_location } -> "friends_location"
| { friends_notes } -> "friends_notes"
| { friends_photos } -> "friends_photos"
| { friends_questions } -> "friends_questions"
| { friends_relationships } -> "friends_relationships"
| { friends_relationship_details } -> "friends_relationship_details"
| { friends_religion_politics } -> "friends_religion_politics"
| { friends_status } -> "friends_status"
| { friends_subscriptions } -> "friends_subscriptions"
| { friends_videos } -> "friends_videos"
| { friends_website } -> "friends_website"
| { friends_work_history } -> "friends_work_history"
| { read_friendlists } -> "read_friendlists"
| { read_insights } -> "read_insights"
| { read_mailbox } -> "read_mailbox"
| { read_requests } -> "read_requests"
| { read_stream } -> "read_stream"
| { xmpp_login } -> "xmpp_login"
| { ads_management } -> "ads_management"
| { create_event } -> "create_event"
| { manage_friendlists } -> "manage_friendlists"
| { manage_notifications } -> "manage_notifications"
| { user_online_presence } -> "user_online_presence"
| { friends_online_presence } -> "friends_online_presence"
| { publish_checkins } -> "publish_checkins"
| { publish_stream } -> "publish_stream"
| { rsvp_event } -> "rsvp_event"
| { publish_actions } -> "publish_actions"
| { user_actions_music } -> "user_actions.music"
| { user_actions_news } -> "user_actions.news"
| { user_actions_video } -> "user_actions.video"
| { ~user_actions_namespace } -> "user_actions:{user_actions_namespace}"
| { user_games_activity } -> "user_games_activity"
| { friends_actions_music } -> "friends_actions.music"
| { friends_actions_news } -> "friends_actions.news"
| { friends_actions_video } -> "friends_actions.video"
| { ~friends_actions_namespace } -> "friends_actions:{friends_actions_namespace}"
| { friends_games_activity } -> "friends_games_activity"
| { manage_pages } -> "manage_pages"
| {installed} -> "installed"
| {status_update} -> "status_update"
| {photo_upload} -> "photo_upload"
| {video_upload} -> "video_upload"
| {sms} -> "sms"
| {create_note} -> "create_note"
| {share_item} -> "share_item"
| {user_photo_video_tags} -> "user_photo_video_tags"
| {friends_photo_video_tags} -> "friends_photo_video_tags"
| {bookmarked} -> "bookmarked"
permission_of_string(p) : option(Facebook.permission) =
len = String.length(p)
if String.has_prefix("user_actions:",p) && len > 13
then {some={user_actions_namespace=String.substring(13,len-13,p)}}
else if String.has_prefix("friends_actions:",p) && len > 16
then {some={friends_actions_namespace=String.substring(16,len-16,p)}}
else
match p with
| "user_about_me" -> {some={ user_about_me }}
| "user_activities" -> {some={ user_activities }}
| "user_birthday" -> {some={ user_birthday }}
| "user_checkins" -> {some={ user_checkins }}
| "user_education_history" -> {some={ user_education_history }}
| "user_events" -> {some={ user_events }}
| "user_groups" -> {some={ user_groups }}
| "user_hometown" -> {some={ user_hometown }}
| "user_interests" -> {some={ user_interests }}
| "user_likes" -> {some={ user_likes }}
| "user_location" -> {some={ user_location }}
| "user_notes" -> {some={ user_notes }}
| "user_photos" -> {some={ user_photos }}
| "user_questions" -> {some={ user_questions }}
| "user_relationships" -> {some={ user_relationships }}
| "user_relationship_details" -> {some={ user_relationship_details }}
| "user_religion_politics" -> {some={ user_religion_politics }}
| "user_status" -> {some={ user_status }}
| "user_subscriptions" -> {some={ user_subscriptions }}
| "user_videos" -> {some={ user_videos }}
| "user_website" -> {some={ user_website }}
| "user_work_history" -> {some={ user_work_history }}
| "email" -> {some={ email }}
| "friends_about_me" -> {some={ friends_about_me }}
| "friends_activities" -> {some={ friends_activities }}
| "friends_birthday" -> {some={ friends_birthday }}
| "friends_checkins" -> {some={ friends_checkins }}
| "friends_education_history" -> {some={ friends_education_history }}
| "friends_events" -> {some={ friends_events }}
| "friends_groups" -> {some={ friends_groups }}
| "friends_hometown" -> {some={ friends_hometown }}
| "friends_interests" -> {some={ friends_interests }}
| "friends_likes" -> {some={ friends_likes }}
| "friends_location" -> {some={ friends_location }}
| "friends_notes" -> {some={ friends_notes }}
| "friends_photos" -> {some={ friends_photos }}
| "friends_questions" -> {some={ friends_questions }}
| "friends_relationships" -> {some={ friends_relationships }}
| "friends_relationship_details" -> {some={ friends_relationship_details }}
| "friends_religion_politics" -> {some={ friends_religion_politics }}
| "friends_status" -> {some={ friends_status }}
| "friends_subscriptions" -> {some={ friends_subscriptions }}
| "friends_videos" -> {some={ friends_videos }}
| "friends_website" -> {some={ friends_website }}
| "friends_work_history" -> {some={ friends_work_history }}
| "read_friendlists" -> {some={ read_friendlists }}
| "read_insights" -> {some={ read_insights }}
| "read_mailbox" -> {some={ read_mailbox }}
| "read_requests" -> {some={ read_requests }}
| "read_stream" -> {some={ read_stream }}
| "xmpp_login" -> {some={ xmpp_login }}
| "ads_management" -> {some={ ads_management }}
| "create_event" -> {some={ create_event }}
| "manage_friendlists" -> {some={ manage_friendlists }}
| "manage_notifications" -> {some={ manage_notifications }}
| "user_online_presence" -> {some={ user_online_presence }}
| "friends_online_presence" -> {some={ friends_online_presence }}
| "publish_checkins" -> {some={ publish_checkins }}
| "publish_stream" -> {some={ publish_stream }}
| "rsvp_event" -> {some={ rsvp_event }}
| "publish_actions" -> {some={ publish_actions }}
| "user_actions.music" -> {some={ user_actions_music }}
| "user_actions.news" -> {some={ user_actions_news }}
| "user_actions.video" -> {some={ user_actions_video }}
| "user_games_activity" -> {some={ user_games_activity }}
| "friends_actions.music" -> {some={ friends_actions_music }}
| "friends_actions.news" -> {some={ friends_actions_news }}
| "friends_actions.video" -> {some={ friends_actions_video }}
| "friends_games_activity" -> {some={ friends_games_activity }}
| "manage_pages" -> {some={ manage_pages }}
| "installed" -> {some={installed}}
| "status_update" -> {some={status_update}}
| "photo_upload" -> {some={photo_upload}}
| "video_upload" -> {some={video_upload}}
| "sms" -> {some={sms}}
| "create_note" -> {some={create_note}}
| "share_item" -> {some={share_item}}
| "user_photo_video_tags" -> {some={user_photo_video_tags}}
| "friends_photo_video_tags" -> {some={friends_photo_video_tags}}
| "bookmarked" -> {some={bookmarked}}
| _ -> {none}
string_of_property(property:Facebook.property) : string =
match property with
| { id } -> "id"
| { name } -> "name"
| { description } -> "description"
| { category } -> "category"
| { company } -> "company"
| { icon_url } -> "icon_url"
| { subcategory } -> "subcategory"
| { link } -> "link"
| { logo_url } -> "logo_url"
| { daily_active_users } -> "daily_active_users"
| { weekly_active_users } -> "weekly_active_users"
| { monthly_active_users } -> "monthly_active_users"
| { migrations } -> "migrations"
| { namespace } -> "namespace"
| { restrictions } -> "restrictions"
| { app_domains } -> "app_domains"
| { auth_dialog_data_help_url } -> "auth_dialog_data_help_url"
| { auth_dialog_description } -> "auth_dialog_description"
| { auth_dialog_headline } -> "auth_dialog_headline"
| { auth_dialog_perms_explanation } -> "auth_dialog_perms_explanation"
| { auth_referral_user_perms } -> "auth_referral_user_perms"
| { auth_referral_friend_perms } -> "auth_referral_friend_perms"
| { auth_referral_default_activity_privacy } -> "auth_referral_default_activity_privacy"
| { auth_referral_enabled } -> "auth_referral_enabled"
| { auth_referral_extended_perms } -> "auth_referral_extended_perms"
| { auth_referral_response_type } -> "auth_referral_response_type"
| { canvas_fluid_height } -> "canvas_fluid_height"
| { canvas_fluid_width } -> "canvas_fluid_width"
| { canvas_url } -> "canvas_url"
| { contact_email } -> "contact_email"
| { created_time } -> "created_time"
| { creator_uid } -> "creator_uid"
| { deauth_callback_url } -> "deauth_callback_url"
| { iphone_app_store_id } -> "iphone_app_store_id"
| { hosting_url } -> "hosting_url"
| { mobile_web_url } -> "mobile_web_url"
| { page_tab_default_name } -> "page_tab_default_name"
| { page_tab_url } -> "page_tab_url"
| { privacy_policy_url } -> "privacy_policy_url"
| { secure_canvas_url } -> "secure_canvas_url"
| { secure_page_tab_url } -> "secure_page_tab_url"
| { server_ip_whitelist } -> "server_ip_whitelist"
| { social_discovery } -> "social_discovery"
| { terms_of_service_url } -> "terms_of_service_url"
| { user_support_email } -> "user_support_email"
| { user_support_url } -> "user_support_url"
| { website_url } -> "website_url"
property_of_string(s:string) : option(Facebook.property) =
match s with
| "id" -> {some={ id }}
| "name" -> {some={ name }}
| "description" -> {some={ description }}
| "category" -> {some={ category }}
| "company" -> {some={ company }}
| "icon_url" -> {some={ icon_url }}
| "subcategory" -> {some={ subcategory }}
| "link" -> {some={ link }}
| "logo_url" -> {some={ logo_url }}
| "daily_active_users" -> {some={ daily_active_users }}
| "weekly_active_users" -> {some={ weekly_active_users }}
| "monthly_active_users" -> {some={ monthly_active_users }}
| "migrations" -> {some={ migrations }}
| "namespace" -> {some={ namespace }}
| "restrictions" -> {some={ restrictions }}
| "app_domains" -> {some={ app_domains }}
| "auth_dialog_data_help_url" -> {some={ auth_dialog_data_help_url }}
| "auth_dialog_description" -> {some={ auth_dialog_description }}
| "auth_dialog_headline" -> {some={ auth_dialog_headline }}
| "auth_dialog_perms_explanation" -> {some={ auth_dialog_perms_explanation }}
| "auth_referral_user_perms" -> {some={ auth_referral_user_perms }}
| "auth_referral_friend_perms" -> {some={ auth_referral_friend_perms }}
| "auth_referral_default_activity_privacy" -> {some={ auth_referral_default_activity_privacy }}
| "auth_referral_enabled" -> {some={ auth_referral_enabled }}
| "auth_referral_extended_perms" -> {some={ auth_referral_extended_perms }}
| "auth_referral_response_type" -> {some={ auth_referral_response_type }}
| "canvas_fluid_height" -> {some={ canvas_fluid_height }}
| "canvas_fluid_width" -> {some={ canvas_fluid_width }}
| "canvas_url" -> {some={ canvas_url }}
| "contact_email" -> {some={ contact_email }}
| "created_time" -> {some={ created_time }}
| "creator_uid" -> {some={ creator_uid }}
| "deauth_callback_url" -> {some={ deauth_callback_url }}
| "iphone_app_store_id" -> {some={ iphone_app_store_id }}
| "hosting_url" -> {some={ hosting_url }}
| "mobile_web_url" -> {some={ mobile_web_url }}
| "page_tab_default_name" -> {some={ page_tab_default_name }}
| "page_tab_url" -> {some={ page_tab_url }}
| "privacy_policy_url" -> {some={ privacy_policy_url }}
| "secure_canvas_url" -> {some={ secure_canvas_url }}
| "secure_page_tab_url" -> {some={ secure_page_tab_url }}
| "server_ip_whitelist" -> {some={ server_ip_whitelist }}
| "social_discovery" -> {some={ social_discovery }}
| "terms_of_service_url" -> {some={ terms_of_service_url }}
| "user_support_email" -> {some={ user_support_email }}
| "user_support_url" -> {some={ user_support_url }}
| "website_url" -> {some={ website_url }}
| _ -> {none}
is_editable_property(property:Facebook.property) : bool =
match property with
| { id } -> false
| { name } -> false
| { description } -> false
| { category } -> false
| { company } -> false
| { icon_url } -> false
| { subcategory } -> false
| { link } -> false
| { logo_url } -> false
| { daily_active_users } -> false
| { weekly_active_users } -> false
| { monthly_active_users } -> false
| { created_time } -> false
| { creator_uid } -> false
| { iphone_app_store_id } -> false
| { hosting_url } -> false
| _ -> true
empty_feed = {
from = ""
to = ""
message = ""
link = ""
picture = ""
source = ""
name = ""
caption = ""
description = ""
properties = []
actions = []
} : Facebook.feed
}}
Jump to Line
Something went wrong with that request. Please try again.