/// <summary> /// Create new Source from local file /// </summary> /// <param name="path">path to local file</param> /// <param name="fileName">name to use</param> /// <param name="arguments">Additional parameters</param> public Task <Source> CreateSource(string path, string fileName = null, Source.Arguments arguments = null) { fileName = fileName ?? Path.GetFileName(path); var boundary = string.Format("--{0}", Guid.NewGuid()); var request = new MultipartFormDataContent(boundary); var customContentType = new MediaTypeHeaderValue("multipart/form-data"); customContentType.Parameters.Add(new NameValueHeaderValue("boundary", boundary)); request.Headers.ContentType = customContentType; request.Add(File.OpenRead(path), fileName); if (arguments != null) { request.Add(arguments.ToJson() as JsonObject); } return(Create <Source>(request)); }
/// <summary> /// Create a new Source /// </summary> /// <param name="arguments"></param> /// <returns></returns> public Task <Source> CreateSource(Source.Arguments arguments) { return(arguments.File != null ? CreateSource(arguments.File, arguments.Name) : Create <Source>(arguments)); }
public Task <Source> Create(Source.Arguments arguments) { return(CreateSource(arguments)); }
public Task <Source> Create(string path, string fileName = null, Source.Arguments arguments = null) { return(CreateSource(path, fileName, arguments)); }