Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add media v2 variants #1198

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/Tweetinvi.AspNet/Tweetinvi.AspNet.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<VersionPrefix>5.0.4</VersionPrefix>
Expand All @@ -7,7 +7,7 @@
<AssemblyOriginatorKeyFile>../tweetinvi.snk</AssemblyOriginatorKeyFile>
<AssemblyName>Tweetinvi.AspNet</AssemblyName>
<RootNamespace>Tweetinvi.AspNet</RootNamespace>
<TargetFrameworks>netstandard2.0;netcoreapp2.1;netcoreapp3.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netcoreapp2.1;netcoreapp3.1;net6.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
Expand Down Expand Up @@ -46,12 +46,13 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Tweetinvi.Core\Tweetinvi.Core.csproj" />
<ProjectReference Include="..\Tweetinvi\Tweetinvi.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
</ItemGroup>

<ItemGroup>

<ProjectReference Include="..\Tweetinvi\Tweetinvi.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Newtonsoft.Json;

using System.Diagnostics;

using Tweetinvi.Models.Entities.ExtendedEntities;

namespace Tweetinvi.Core.Models.TwitterEntities.ExtendedEntities;

[DebuggerDisplay("ContentType: {ContentType} Url: {URL}")]
public class MediaEntityVariantV2 : IVideoEntityVariant
{
[JsonProperty("bit_rate")]
public int Bitrate { get; set; }
[JsonProperty("content_type")]
public string ContentType { get; set; }
[JsonProperty("url")]
public string URL { get; set; }
}
10 changes: 10 additions & 0 deletions src/Tweetinvi.Core/Public/Models/V2/MediaV2.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
using Newtonsoft.Json;

using System.Diagnostics;

using Tweetinvi.Core.Models.TwitterEntities.ExtendedEntities;

namespace Tweetinvi.Models.V2
{
/// <summary>
/// A media, video, image, gif...
/// <para>Read more here : https://developer.twitter.com/en/docs/twitter-api/data-dictionary/object-model/media </para>
/// </summary>
[DebuggerDisplay("Type: {Type} MediaKey: {MediaKey}")]
public class MediaV2
{
/// <summary>
Expand Down Expand Up @@ -43,6 +48,11 @@ public class MediaV2
/// </summary>
[JsonProperty("width")] public int Width { get; set; }

/// <summary>
/// Each media object may have multiple display or playback variants, with different resolutions or formats
/// </summary>
[JsonProperty("variants")] public MediaEntityVariantV2[] Variants { get; set; }

/************* METRICS ************/

/// <summary>
Expand Down
6 changes: 3 additions & 3 deletions src/Tweetinvi.Core/Tweetinvi.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard1.4;netstandard2.0</TargetFrameworks>
<TargetFrameworks>netstandard1.4;netstandard2.0;net6.0</TargetFrameworks>
<VersionPrefix>5.0.4</VersionPrefix>
<Copyright>Tweetinvi 2020</Copyright>
<SignAssembly>false</SignAssembly>
Expand Down Expand Up @@ -30,9 +30,9 @@

<ItemGroup>
<PackageReference Include="Autofac" Version="4.9.4" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="System.Net.Requests" Version="4.3.0" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.5.1" />
<PackageReference Include="System.Reflection.TypeExtensions" Version="4.7.0" />
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/Tweetinvi/Tweetinvi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

<ItemGroup>
<ProjectReference Include="..\Tweetinvi.Controllers\Tweetinvi.Controllers.csproj" />
<ProjectReference Include="..\Tweetinvi.Core\Tweetinvi.Core.csproj" />
<ProjectReference Include="..\Tweetinvi.Credentials\Tweetinvi.Credentials.csproj" />
<ProjectReference Include="..\Tweetinvi.Streams\Tweetinvi.Streams.csproj" />
</ItemGroup>
Expand Down