Files
Umbraco-CMS/src/Umbraco.Core/Media/EmbedProviders/Twitter.cs
Sven Geusens e7eb14d310 V15/task/cleanup obsolete (#17433)
* Replace obsolete UserGroup Alias consts to key equivalent in tests

* Update use of usergroup alias consts to key equivalent in IsSystemgroup extension method

* Obsolete (internally) unused helper function which purpose doesn't even seem true

* Prepped EmbedProviders for proper removal of non async methods and unneeded proxy methods

* Remove obsoleted UmbracoPath and updated internal references

* Corrected  mistake and updated unittets

* Update usergroup tests that use aliases for "system" groups

* Replace more uses of globalsettings.UmbracoPath

* Remove GetDateType by key non async

* Cleanup some usages of hostingEnvironment.MapPathContentRoot

* More easy obsoletion cleanup

* Small Typeload cleanup

* More obsolete removal

* Deploy obsoletion cleanup

* Remove obsolete methods from OEmbedProviderBase.cs

---------

Co-authored-by: Zeegaan <skrivdetud@gmail.com>
2024-11-07 12:20:22 +01:00

38 lines
1.6 KiB
C#

using Umbraco.Cms.Core.Serialization;
namespace Umbraco.Cms.Core.Media.EmbedProviders;
/// <summary>
/// Embed Provider for Twitter the popular online service for microblogging and social networking.
/// </summary>
[Obsolete("Please use X instead, scheduled for removal in v16")]
public class Twitter : OEmbedProviderBase
{
public Twitter(IJsonSerializer jsonSerializer)
: base(jsonSerializer)
{
}
public override string ApiEndpoint => "http://publish.twitter.com/oembed";
public override string[] UrlSchemeRegex => new[] { @"twitter.com/.*/status/.*" };
public override Dictionary<string, string> RequestParams => new();
[Obsolete("Use GetMarkupAsync instead. This will be removed in Umbraco 15.")]
public override string? GetMarkup(string url, int maxWidth = 0, int maxHeight = 0)
=> GetMarkupAsync(url, maxWidth, maxHeight, CancellationToken.None).GetAwaiter().GetResult();
public override async Task<string?> GetMarkupAsync(string url, int? maxWidth, int? maxHeight, CancellationToken cancellationToken)
=> await GetJsonBasedMarkupAsync(url, maxWidth, maxHeight, cancellationToken);
[Obsolete("Use GetMarkupAsync instead. Planned for removal in v16")]
public override async Task<string?> GeOEmbedDataAsync(string url, int? maxWidth, int? maxHeight, CancellationToken cancellationToken)
{
var requestUrl = base.GetEmbedProviderUrl(url, maxWidth, maxHeight);
OEmbedResponse? oembed = await base.GetJsonResponseAsync<OEmbedResponse>(requestUrl, cancellationToken);
return oembed?.GetHtml();
}
}