public override void AppRequest(
            string message,
            OGActionType actionType,
            string objectId,
            string[] to = null,
            string filters = "",
            string[] excludeIds = null,
            int? maxRecipients = null,
            string data = "",
            string title = "",
            FacebookDelegate callback = null)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentNullException("message", "message cannot be null or empty!");
            }

            if (actionType != null && string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("objectId", "You cannot provide an actionType without an objectId");
            }

            if (actionType == null && !string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("actionType", "You cannot provide an objectId without an actionType");
            }

            var paramsDict = new Dictionary<string, object>();
            // Marshal all the above into the thing

            paramsDict["message"] = message;

            if (callback != null)
            {
                paramsDict["callback_id"] = AddFacebookDelegate(callback);
            }

            if (actionType != null && !string.IsNullOrEmpty(objectId))
            {
                paramsDict["action_type"] = actionType.ToString();
                paramsDict["object_id"] = objectId;
            }

            if (to != null)
            {
                paramsDict["to"] = string.Join(",", to);
            }

            if (!string.IsNullOrEmpty(filters))
            {
                paramsDict["filters"] = filters;
            }

            if (maxRecipients != null)
            {
                paramsDict["max_recipients"] = maxRecipients.Value;
            }

            if (!string.IsNullOrEmpty(data))
            {
                paramsDict["data"] = data;
            }

            if (!string.IsNullOrEmpty(title))
            {
                paramsDict["title"] = title;
            }

            CallFB("AppRequest", MiniJSON.Json.Serialize(paramsDict));
        }
Ejemplo n.º 2
0
        public override void AppRequest(
                string message,
                OGActionType actionType,
                string objectId,
                string[] to = null,
                List<object> filters = null,
                string[] excludeIds = null,
                int? maxRecipients = null,
                string data = "",
                string title = "",
                FacebookDelegate callback = null)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentNullException("message", "message cannot be null or empty!");
            }

            if (actionType != null && string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("objectId", "You cannot provide an actionType without an objectId");
            }

            if (actionType == null && !string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("actionType", "You cannot provide an objectId without an actionType");
            }

            var paramsDict = new Dictionary<string, object>();
            paramsDict["message"] = message;
            if (to != null)
            {
                paramsDict["to"] = string.Join(",", to);
            }
            if (actionType != null && !string.IsNullOrEmpty(objectId))
            {
                paramsDict["action_type"] = actionType.ToString();
                paramsDict["object_id"] = objectId;
            }
            if (filters != null)
            {
                paramsDict["filters"] = filters;
            }
            if (excludeIds != null)
            {
                paramsDict["exclude_ids"] = excludeIds;
            }
            if (maxRecipients.HasValue)
            {
                paramsDict["max_recipients"] = maxRecipients.Value;
            }
            if (!string.IsNullOrEmpty(data))
            {
                paramsDict["data"] = data;
            }
            if (!string.IsNullOrEmpty(title))
            {
                paramsDict["title"] = title;
            }

            UI(MethodAppRequests, paramsDict, callback);
        }
        public override void AppRequest(
            string message,
            OGActionType actionType,
            string objectId,
            string[] to = null,
            List<object> filters = null,
            string[] excludeIds = null,
            int? maxRecipients = null,
            string data = "",
            string title = "",
            FacebookDelegate callback = null)
        {
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentNullException("message", "message cannot be null or empty!");
            }

            if (actionType != null && string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("objectId", "You cannot provide an actionType without an objectId");
            }

            if (actionType == null && !string.IsNullOrEmpty(objectId))
            {
                throw new ArgumentNullException("actionType", "You cannot provide an objectId without an actionType");
            }

            string mobileFilter = null;
            if(filters != null && filters.Count > 0) {
                mobileFilter = filters[0] as string;
            }

            iosAppRequest(
                Convert.ToInt32(AddFacebookDelegate(callback)),
                message,
                (actionType != null) ? actionType.ToString() : null,
                objectId,
                to,
                to != null ? to.Length : 0,
                mobileFilter != null ? mobileFilter : "",
                excludeIds,
                excludeIds != null ? excludeIds.Length : 0,
                maxRecipients.HasValue,
                maxRecipients.HasValue ? maxRecipients.Value : 0,
                data,
                title);
        }