コード例 #1
0
    /// <summary>
    /// Sends an Open Graph action which will create a new object.
    /// </summary>
    /// <param name="actionId">Carrot action id.</param>
    /// <param name="actionProperties">Parameters to be submitted with the action.</param>
    /// <param name="viralObject">A <see cref="ViralObject"/> describing the object to be created.</param>
    /// <param name="callback">Optional <see cref="CarrotRequestResponse"/> which will be used to deliver the reply.</param>
    public void postAction(string actionId, IDictionary actionProperties,
                           ViralObject viralObject,
                           CarrotRequestResponse callback = null)
    {
        if(string.IsNullOrEmpty(actionId))
        {
            throw new ArgumentNullException("actionId must not be null or empty string.", "actionId");
        }

        if(viralObject == null)
        {
            throw new ArgumentNullException("viralObject must not be null.", "viralObject");
        }

        Dictionary<string, object> parameters = new Dictionary<string, object>() {
            {"action_id", actionId},
            {"action_properties", actionProperties == null ? new Dictionary<string, object>() : actionProperties},
            {"object_properties", viralObject.toDictionary()}
        };
        StartCoroutine(cachedRequestCoroutine(ServiceType.Post, "/me/actions.json", parameters, callback));
    }
コード例 #2
0
 /// <summary>
 /// Sends an Open Graph action which will create a new object.
 /// </summary>
 /// <param name="actionId">Carrot action id.</param>
 /// <param name="viralObject">A <see cref="ViralObject"/> describing the object to be created.</param>
 /// <param name="callback">Optional <see cref="CarrotRequestResponse"/> which will be used to deliver the reply.</param>
 public void postAction(string actionId, ViralObject viralObject,
                        CarrotRequestResponse callback = null)
 {
     postAction(actionId, null, viralObject, callback);
 }