Esempio n. 1
0
        public Task<RecivedId> Add(string body, ByteFile file)
        {
            if (string.IsNullOrWhiteSpace(body))
                throw new ArgumentException("Argument is null or whitespace", nameof(body));
            if (file == null) throw new ArgumentNullException(nameof(file));

            var parameters = GetApiParameterSet();
            var postParameters = new SortedSet<PostParameter>
            {
                new StringPostParameter("accountkey", Client.AccountKey),
                new StringPostParameter("body", body),
                new BytePostParameter("embed", file)
            };

            return Client.CallApiMethodWithAuth<RecivedId>(
                new ApiMethod(ApiV1Constants.EntriesAdd, HttpMethod.Post, parameters, postParameters)
                );
        }
Esempio n. 2
0
        public Task<RecivedId> Add(string body, ByteFile file, int linkId, int precedentCommentId = -1)
        {
            if (file == null) throw new ArgumentNullException(nameof(file));
            if (String.IsNullOrWhiteSpace(body))
                throw new ArgumentException("Argument is null or whitespace", nameof(body));

            var parameters = GetApiParameterSet();
            var methodParameters = new SortedSet<StringMethodParameter>
            {
                new StringMethodParameter("param1", linkId)
            };
            if (precedentCommentId != -1)
                methodParameters.Add(new StringMethodParameter("param2", precedentCommentId));

            var postParameters = new SortedSet<PostParameter>
            {
                new StringPostParameter("body", body),
                new BytePostParameter("embed", file)
            };
            
            return Client.CallApiMethodWithAuth<RecivedId>(
                new ApiMethod(ApiV1Constants.CommentsAdd, HttpMethod.Post, parameters, methodParameters, postParameters)
                );
        }
        public Task<BooleanModel> Send(string username, string body, ByteFile file)
        {
            if (file == null) throw new ArgumentNullException(nameof(file));
            if (string.IsNullOrWhiteSpace(username))
                throw new ArgumentException("Argument is null or whitespace", nameof(username));
            if (string.IsNullOrWhiteSpace(body))
                throw new ArgumentException("Argument is null or whitespace", nameof(body));

            var parameters = GetApiParameterSet();
            var methodParameters = new SortedSet<StringMethodParameter>
            {
                new StringMethodParameter("param1", username)
            };
            var postParameters = new SortedSet<PostParameter>
            {
                new StringPostParameter("body", body),
                new BytePostParameter("embed", file)
            };
            
            return Client.CallApiMethodWithAuth<BooleanModel>(
                new ApiMethod(ApiV1Constants.PmSendMessage, HttpMethod.Post, parameters, methodParameters,
                    postParameters)
                );
        }
Esempio n. 4
0
 public Task<RecivedId> Add(string body, ByteFile file)
 {
     throw new NotImplementedException();
 }
Esempio n. 5
0
 public BytePostParameter(string name, ByteFile file) : base(name)
 {
     Value    = file.Data;
     FileName = file.FileName;
     MimeType = file.MimeType;
 }
 public Task<BooleanModel> Send(string username, string body, ByteFile file)
 {
     throw new NotImplementedException();
 }
 public Task<RecivedId> Add(string body, ByteFile file, int linkId, int precedentCommentId = -1)
 {
     throw new NotImplementedException();
 }