/// <summary> /// Creates a Gfy using a remote url and returns the Gfy status /// </summary> /// <param name="remoteUrl"></param> /// <param name="parameters"></param> /// <param name="options">The options for this request</param> /// <returns></returns> public async Task <GfyStatus> CreateGfyAsync(string remoteUrl, GfyCreationParameters parameters = null, RequestOptions options = null) { UploadKey key = await ApiClient.CreateGfyFromFetchUrlAsync(remoteUrl, parameters ?? new GfyCreationParameters(), options).ConfigureAwait(false); await Task.Delay(500).ConfigureAwait(false); return(await GetGfyUploadStatusAsync(key.Gfycat, options).ConfigureAwait(false)); }
/// <summary> /// Creates a Gfycat using the specified stream and upload parameters /// </summary> /// <param name="data"></param> /// <param name="parameters"></param> /// <param name="options">The options for this request</param> /// <returns></returns> public async Task <GfyStatus> CreateGfyAsync(Stream data, GfyCreationParameters parameters = null, RequestOptions options = null) { UploadKey uploadKey = await ApiClient.GetUploadKeyAsync(parameters.CreateModel(), options).ConfigureAwait(false); await ApiClient.PostGfyStreamAsync(uploadKey, data, options).ConfigureAwait(false); await Task.Delay(500).ConfigureAwait(false); return(await GetGfyUploadStatusAsync(uploadKey.Gfycat, options).ConfigureAwait(false)); }
/// <summary> /// Compares the specified node. N.B. for our purposes /// the segments are equal if the upload key is equal. /// </summary> /// <param name="node">The node.</param> /// <returns></returns> protected override int Compare(CompositeBase node) { if (string.IsNullOrEmpty(UploadKey)) { return(base.Compare(node)); } var source = node as AhsSegment; return(source != null?UploadKey.CompareTo(source.UploadKey) : 1); }
internal async Task PostGfyStreamAsync(UploadKey key, Stream stream, RequestOptions options) { options = options ?? RequestOptions.CreateFromDefaults(Config); options.UseAccessToken = false; RestResponse response = await SendStreamAsync("POST", "https://filedrop.gfycat.com/", stream, key.Gfycat, options).ConfigureAwait(false); // uploads as multipart }