Пример #1
0
		/// <summary>
		/// Creates the <see cref="PostData"/> for an audio post.
		/// </summary>
		/// <param name="audioFile">
		/// The audio file to upload, defined as a <see cref="BinaryFile"/> instance.
		/// </param>
		/// <param name="caption">
		/// The caption for the audio post.
		/// </param>
		/// <param name="tags">
		/// The tags to associate with the post.
		/// </param>
		/// <returns>
		/// A <see cref="PostData"/> instance representing the post.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="audioFile"/> is <b>null</b>.
		/// </exception>
		public static PostData CreateAudio(BinaryFile audioFile, string caption, IEnumerable<string> tags)
		{
			return CreateAudio(audioFile, caption, tags, PostCreationState.Published);
		}
Пример #2
0
		/// <summary>
		/// Creates the <see cref="PostData"/> for an audio post.
		/// </summary>
		/// <param name="audioFile">
		/// The audio file to upload, defined as a <see cref="BinaryFile"/> instance.
		/// </param>
		/// <param name="caption">
		/// The caption for the audio post.
		/// </param>
		/// <param name="tags">
		/// The tags to associate with the post.
		/// </param>
		/// <param name="state">
		/// The <see cref="PostCreationState"/> of the post.
		/// </param>
		/// <returns>
		/// A <see cref="PostData"/> instance representing the post.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="audioFile"/> is <b>null</b>.
		/// </exception>
		public static PostData CreateAudio(BinaryFile audioFile, string caption, IEnumerable<string> tags, PostCreationState state)
		{
			if (audioFile == null)
				throw new ArgumentNullException("audioFile");

			var postData = new PostData(state, tags);
			postData.parameters.Add("type", "audio");
			postData.parameters.Add(new BinaryMethodParameter("data", audioFile.Data, audioFile.FileName, audioFile.MimeType));
			postData.parameters.Add("caption", caption, null);

			return postData;
		}
Пример #3
0
		/// <summary>
		/// Creates the <see cref="PostData"/> for an audio post.
		/// </summary>
		/// <param name="audioFile">
		/// The audio file to upload, defined as a <see cref="BinaryFile"/> instance.
		/// </param>
		/// <param name="caption">
		/// The caption for the audio post.
		/// </param>
		/// <returns>
		/// A <see cref="PostData"/> instance representing the post.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="audioFile"/> is <b>null</b>.
		/// </exception>
		public static PostData CreateAudio(BinaryFile audioFile, string caption)
		{
			return CreateAudio(audioFile, caption, null, PostCreationState.Published);
		}
Пример #4
0
		/// <summary>
		/// Creates the <see cref="PostData"/> for an audio post.
		/// </summary>
		/// <param name="audioFile">
		/// The audio file to upload, defined as a <see cref="BinaryFile"/> instance.
		/// </param>
		/// <returns>
		/// A <see cref="PostData"/> instance representing the post.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="audioFile"/> is <b>null</b>.
		/// </exception>
		public static PostData CreateAudio(BinaryFile audioFile)
		{
			return CreateAudio(audioFile, null, null, PostCreationState.Published);
		}
Пример #5
0
		/// <summary>
		/// Creates the <see cref="PostData"/> for a photo post.
		/// </summary>
		/// <param name="photo">
		/// A photo to upload, defined as a <see cref="BinaryFile"/> instance.
		/// </param>
		/// <param name="caption">
		/// The caption for the photo post.
		/// </param>
		/// <returns>
		/// A <see cref="PostData"/> instance representing the post.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="photo"/> is <b>null</b>.
		/// </exception>
		public static PostData CreatePhoto(BinaryFile photo, string caption)
		{
			if (photo == null)
				throw new ArgumentNullException("photo");

			var photos = new BinaryFile[] { photo };
			return CreatePhoto(photos, caption, null, null, PostCreationState.Published);
		}
Пример #6
0
		/// <summary>
		/// Creates the <see cref="PostData"/> for a video post.
		/// </summary>
		/// <param name="videoFile">
		/// The video file to upload, defined as a <see cref="BinaryFile"/> instance.
		/// </param>
		/// <param name="caption">
		/// The caption for the video post.
		/// </param>
		/// <returns>
		/// A <see cref="PostData"/> instance representing the post.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="videoFile"/> is <b>null</b>.
		/// </exception>
		public static PostData CreateVideo(BinaryFile videoFile, string caption)
		{
			return CreateVideo(videoFile, caption, null, PostCreationState.Published);
		}
Пример #7
0
		/// <summary>
		/// Creates the <see cref="PostData"/> for a video post.
		/// </summary>
		/// <param name="videoFile">
		/// The video file to upload, defined as a <see cref="BinaryFile"/> instance.
		/// </param>
		/// <returns>
		/// A <see cref="PostData"/> instance representing the post.
		/// </returns>
		/// <exception cref="ArgumentNullException">
		/// <paramref name="videoFile"/> is <b>null</b>.
		/// </exception>
		public static PostData CreateVideo(BinaryFile videoFile)
		{
			return CreateVideo(videoFile, null, null, PostCreationState.Published);
		}