/// <summary> /// Изменить/Добавить объявление. Если параметр ad_id указан, то редактирование. В противном случае создаётся новый /// </summary> /// <param name="price_equation"></param> /// <param name="lat"></param> /// <param name="lon"></param> /// <param name="city"></param> /// <param name="location_string"></param> /// <param name="countrycode"></param> /// <param name="currency"></param> /// <param name="account_info"></param> /// <param name="bank_name"></param> /// <param name="msg"></param> /// <param name="sms_verification_required"></param> /// <param name="track_max_amount"></param> /// <param name="require_trusted_by_advertiser"></param> /// <param name="require_identification"></param> /// <param name="min_amount"></param> /// <param name="max_amount"></param> /// <param name="opening_hours"></param> /// <param name="limit_to_fiat_amounts"></param> /// <param name="require_trade_volume"></param> /// <param name="require_feedback_score"></param> /// <param name="first_time_limit_btc"></param> /// <param name="volume_coefficient_btc"></param> /// <param name="reference_type"></param> /// <param name="display_reference"></param> /// <param name="payment_window_minutes"></param> /// <param name="floating"></param> /// <param name="trade_type"></param> /// <param name="online_provider"></param> /// <param name="visible"></param> /// <returns></returns> protected string editAd_as_string(string price_equation, string lat, string lon, string city, string location_string, string countrycode, string currency, string account_info, string bank_name, string msg, string sms_verification_required, string track_max_amount, string require_trusted_by_advertiser, string require_identification, string ad_id, string min_amount = "", string max_amount = "", string opening_hours = "", string limit_to_fiat_amounts = "", /*Опционально для ONLINE_SELL ads:*/ string require_trade_volume = "", string require_feedback_score = "", string first_time_limit_btc = "", string volume_coefficient_btc = "", string reference_type = "", string display_reference = "", string details_phone_number = "", /*Опционально для ONLINE_BUY ads:*/ string payment_window_minutes = "", /*Опционально для LOCAL_SELL ads:*/ string floating = "", /*Только при создании:*/ LB_TradeTypes trade_type = LB_TradeTypes.ALL, string online_provider = "", /*Только при редактировании:*/ string visible = "") { if (ad_id == "" && trade_type == LB_TradeTypes.ALL) { return("Для создания объявления - укажите конкретный тип торгов"); } Dictionary <string, string> _params = new Dictionary <string, string>() { { "price_equation", price_equation }, { "lat", lat }, { "lon", lon }, { "city", city }, { "location_string", location_string }, { "countrycode", countrycode }, { "currency", currency }, { "account_info", account_info }, { "bank_name", bank_name }, { "msg", msg }, { "sms_verification_required", sms_verification_required }, { "track_max_amount", track_max_amount }, { "require_trusted_by_advertiser", require_trusted_by_advertiser }, { "require_identification", require_identification } }; if (min_amount != "") { _params.Add("min_amount", min_amount); } if (max_amount != "") { _params.Add("max_amount", max_amount); } if (opening_hours != "") { _params.Add("opening_hours", opening_hours); } if (limit_to_fiat_amounts != "limit_to_fiat_amounts") { _params.Add("limit_to_fiat_amounts", limit_to_fiat_amounts); } if (trade_type == LB_TradeTypes.ONLINE_BUY) { if (payment_window_minutes != "") { _params.Add("payment_window_minutes", payment_window_minutes); } } else if (trade_type == LB_TradeTypes.ONLINE_SELL) { if (require_trade_volume != "") { _params.Add("require_trade_volume", require_trade_volume); } if (require_feedback_score != "") { _params.Add("require_feedback_score", require_feedback_score); } if (first_time_limit_btc != "") { _params.Add("first_time_limit_btc", first_time_limit_btc); } if (volume_coefficient_btc != "") { _params.Add("volume_coefficient_btc", volume_coefficient_btc); } if (reference_type != "") { _params.Add("reference_type", reference_type); } if (display_reference != "") { _params.Add("display_reference", display_reference); } if (details_phone_number != "") { _params.Add("details-phone_number", details_phone_number); } } else if (trade_type == LB_TradeTypes.LOCAL_SELL) { if (floating != "") { _params.Add("floating", floating); } } if (ad_id != "") { _params.Add("visible", visible); } else if (ad_id == "" && online_provider != "") { _params.Add("online_provider", online_provider); _params.Add("trade_type", Enum.GetName(typeof(LB_TradeTypes), trade_type)); } // if (ad_id == "") { return(sendRequest("/api/ad-create/", _params, "post"));// Creation } else { return(sendRequest("/api/ad/" + ad_id + "/", _params, "post"));// Editing } }
/// <summary> /// Список объявлений (можно накладывать фильтр) /// https://localbitcoins.com/api-docs/#api_toc23 /// </summary> /// <returns></returns> protected string getOwnAds_as_string(LB_TradeVisibleStatus visible = LB_TradeVisibleStatus.All, LB_TradeTypes trade_type = LB_TradeTypes.ALL, string currency = "", string countrycode = "") { Dictionary <string, string> _params = new Dictionary <string, string>(); if (visible != LB_TradeVisibleStatus.All) { _params.Add("visible", visible.ToString()); } if (trade_type != LB_TradeTypes.ALL) { _params.Add("trade_type", Enum.GetName(typeof(LB_TradeTypes), trade_type)); } if (currency != "") { _params.Add("currency", currency); } if (countrycode != "") { _params.Add("countrycode", countrycode); } return(sendRequest("/api/ads/", _params, "post")); }