예제 #1
0
        /// <summary>
        /// Creates or modifies a listing in Marketplace. You may only create and modify a listing for a user
        /// who has granted the application the extended permission create_listing.
        /// </summary>
        /// <param name="listing_id">The listing ID to modify, or 0 if the user is creating a new listing.</param>
        /// <param name="show_on_profile">A privacy control indicating whether to display the listing on the poster's profile.</param>
        /// <param name="listing_attrs">Collection of Marketplace Listing Attributes.</param>
        /// <returns>This method returns the listing ID of the modified/created listing. If you are modifying a listing, it is the same as the listing ID provided to the method.</returns>
        public long createListing(long listing_id, bool show_on_profile, Dictionary <string, string> listing_attrs)
        {
            var parameterList = new Dictionary <string, string> {
                { "method", "facebook.marketplace.createListing" }
            };

            _api.AddRequiredParameter(parameterList, "listing_id", listing_id);
            _api.AddParameter(parameterList, "subcategory", show_on_profile);
            _api.AddJSONAssociativeArray(parameterList, "listing_attrs", listing_attrs);

            var response = _api.SendRequest(parameterList);

            return(!string.IsNullOrEmpty(response) ? marketplace_createListing_response.Parse(response).TypedValue : 0);
        }