Параметры метода wall.edit
Esempio n. 1
0
        public bool Edit(long postId, long? ownerId = null, bool friendsOnly = false,
            string message = null, IEnumerable<MediaAttachment> mediaAttachments = null, string url = null,
            IEnumerable<Services> services = null, bool signed = false, DateTime? publishDate = null,
            double? lat = null, double? @long = null, long? placeId = null)
        {
            if (string.IsNullOrEmpty(message) && (mediaAttachments == null || !mediaAttachments.Any()) && string.IsNullOrEmpty(url))
                throw new ArgumentException("Message and attachments cannot be null or empty at the same time.");
            VkErrors.ThrowIfNumberIsNegative(() => placeId);
            VkErrors.ThrowIfNumberIsNegative(() => postId);
            if (lat.HasValue && (Math.Abs(lat.Value) > 90))
                throw new ArgumentOutOfRangeException("lat", lat, "lat must be at range from -90 to 90");
            if (@long.HasValue && (Math.Abs(@long.Value) > 180))
                throw new ArgumentOutOfRangeException("long", @long, "long must be at range from -90 to 90");

            var parameters = new WallEditParams
            {
                PostId = postId,
                OwnerId = ownerId,
                FriendsOnly = friendsOnly,
                Message = message,
                Attachments = mediaAttachments,
                Services = services,
                Signed = signed,
                PublishDate = publishDate,
                Lat = lat,
                Long = @long,
                PlaceId = placeId
            };

            return Edit(parameters);
        }
Esempio n. 2
0
 /// <summary>
 /// Привести к типу VkParameters.
 /// </summary>
 /// <param name="p">Параметры.</param>
 /// <returns></returns>
 public static VkParameters ToVkParameters(WallEditParams p)
 {
     var parameters = new VkParameters
     {
         { "owner_id", p.OwnerId },
Esempio n. 3
0
        /// <summary>
        /// Привести к типу VkParameters.
        /// </summary>
        /// <param name="p">Параметры.</param>
        /// <returns></returns>
        internal static VkParameters ToVkParameters(WallEditParams p)
        {
            var parameters = new VkParameters
            {
                { "owner_id", p.OwnerId },
                { "post_id", p.PostId },
                { "friends_only", p.FriendsOnly },
                { "message", p.Message },
                { "attachments", p.Attachments },
                { "services", p.Services },
                { "signed", p.Signed },
                { "publish_date", p.PublishDate },
                { "lat", p.Lat },
                { "long", p.Long },
                { "place_id", p.PlaceId }
            };

            return parameters;
        }