diff --git a/Sources/VKSharp/Api/Generated/ImplementedMethods.txt b/Sources/VKSharp/Api/Generated/ImplementedMethods.txt index 7449c24..1f972f4 100644 --- a/Sources/VKSharp/Api/Generated/ImplementedMethods.txt +++ b/Sources/VKSharp/Api/Generated/ImplementedMethods.txt @@ -1,5 +1,5 @@  -Implemented 145 methods +Implemented 146 methods * Account * account.banUser * account.getAppPermissions @@ -85,6 +85,7 @@ Implemented 145 methods * messages.addChatUser * messages.delete * messages.deleteDialog + * messages.getLastActivity * messages.markAsImportant * messages.markAsRead * messages.removeChatUser diff --git a/Sources/VKSharp/Api/Generated/RawApi.cs b/Sources/VKSharp/Api/Generated/RawApi.cs index 1254e1d..fb729d1 100644 --- a/Sources/VKSharp/Api/Generated/RawApi.cs +++ b/Sources/VKSharp/Api/Generated/RawApi.cs @@ -418,6 +418,10 @@ public async Task RestoreAsync( int messageId ){ return await _parent.Executor.ExecRawAsync( _parent._reqapi.MessagesRestore( messageId ) ); } + public async Task GetLastActivityAsync( int userId ){ + return await _parent.Executor.ExecRawAsync( _parent._reqapi.MessagesGetLastActivity( userId ) ); + } + public async Task DeleteDialogAsync( uint userId , uint offset = 0, uint count = 100 ){ return await _parent.Executor.ExecRawAsync( _parent._reqapi.MessagesDeleteDialog( userId,offset,count ) ); } diff --git a/Sources/VKSharp/Api/Generated/RequestApi1.cs b/Sources/VKSharp/Api/Generated/RequestApi1.cs index ac6eca5..6b0c525 100644 --- a/Sources/VKSharp/Api/Generated/RequestApi1.cs +++ b/Sources/VKSharp/Api/Generated/RequestApi1.cs @@ -1173,6 +1173,19 @@ int messageId return req; } + public VKRequest MessagesGetLastActivity( + int userId +){ + var req = new VKRequest{ + MethodName = "messages.getLastActivity", + Parameters = new Dictionary { + { "user_id", userId.ToNCString() } + } + }; + req.Token = CurrentToken; + + return req; + } public VKRequest MessagesDeleteDialog( uint userId , uint offset = 0, uint count = 100 ){ diff --git a/Sources/VKSharp/Api/Generated/VKSharpFuncs.xml b/Sources/VKSharp/Api/Generated/VKSharpFuncs.xml index 4dca544..d5b0752 100644 --- a/Sources/VKSharp/Api/Generated/VKSharpFuncs.xml +++ b/Sources/VKSharp/Api/Generated/VKSharpFuncs.xml @@ -129,7 +129,7 @@ - + @@ -656,6 +656,13 @@ + + + + + + + diff --git a/Sources/VKSharp/Api/Generated/VkApi.cs b/Sources/VKSharp/Api/Generated/VkApi.cs index bfcbd97..4034665 100644 --- a/Sources/VKSharp/Api/Generated/VkApi.cs +++ b/Sources/VKSharp/Api/Generated/VkApi.cs @@ -799,6 +799,14 @@ await _parent.Executor.ExecAsync( ) ) ; + } + public async Task GetLastActivityAsync( int userId ){ + await _parent.Executor.ExecAsync( + _parent._reqapi.MessagesGetLastActivity( + userId + ) + ) + ; } public async Task DeleteDialogAsync( uint userId , uint offset = 0, uint count = 100 ){ await _parent.Executor.ExecAsync( diff --git a/Sources/VKSharp/Core/Entities/BanInfo.cs b/Sources/VKSharp/Core/Entities/BanInfo.cs index 2dc7cd9..8904371 100644 --- a/Sources/VKSharp/Core/Entities/BanInfo.cs +++ b/Sources/VKSharp/Core/Entities/BanInfo.cs @@ -3,11 +3,10 @@ namespace VKSharp.Core.Entities { public class BanInfo : IVKEntity { public uint AdminId{ get; set; } - public uint AddDate { get; set; } + public uint Date { get; set; } public uint EndDate { get; set; } public string Reason { get; set; } public string Comment { get; set; } - - + public bool CommentVisible { get; set; } } } diff --git a/Sources/VKSharp/Core/Entities/Chat.cs b/Sources/VKSharp/Core/Entities/Chat.cs new file mode 100644 index 0000000..edb4329 --- /dev/null +++ b/Sources/VKSharp/Core/Entities/Chat.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VKSharp.Core.Entities { + public class Chat { + public long Id { get; set; } + public string Type { get; set; } + public string Title { get; set; } + public long? AdminId { get; set; } + public int[] Users { get; set; } + } +} diff --git a/Sources/VKSharp/Core/Entities/City.cs b/Sources/VKSharp/Core/Entities/City.cs index b7a5b65..7c7b573 100644 --- a/Sources/VKSharp/Core/Entities/City.cs +++ b/Sources/VKSharp/Core/Entities/City.cs @@ -2,6 +2,8 @@ namespace VKSharp.Core.Entities { public class DatabaseCity : DatabaseEntry, IVKEntity { + public string Area { get; set; } + public string Region { get; set; } public bool Important { get; set; } } } diff --git a/Sources/VKSharp/Core/Entities/Comment.cs b/Sources/VKSharp/Core/Entities/Comment.cs index bc3229d..291f5ba 100644 --- a/Sources/VKSharp/Core/Entities/Comment.cs +++ b/Sources/VKSharp/Core/Entities/Comment.cs @@ -1,18 +1,15 @@ -using VKSharp.Core.Interfaces; +using VKSharp.Core.EntityFragments; +using VKSharp.Core.Interfaces; namespace VKSharp.Core.Entities { public class Comment : IVKEntity { - - public Attachment[] Attachments { get; set; } - public CommentLikes Likes { get; set; } + public long Id{ get; set; } public int FromId{ get; set; } - public int ReplyToId{ get; set; } - public int UserId{ get; set; } - public string Text { get; set; } public uint Date { get; set; } - public uint Id{ get; set; } - public uint ReplyToCId{ get; set; } - - + public string Text { get; set; } + public int ReplyToUser{ get; set; } + public long ReplyToComment { get; set; } + public Attachment[] Attachments { get; set; } + public CommentLikes Likes { get; set; } } } diff --git a/Sources/VKSharp/Core/Entities/Counter.cs b/Sources/VKSharp/Core/Entities/Counter.cs index 747cca6..836865d 100644 --- a/Sources/VKSharp/Core/Entities/Counter.cs +++ b/Sources/VKSharp/Core/Entities/Counter.cs @@ -2,7 +2,6 @@ namespace VKSharp.Core.Entities { public class Counter : IVKEntity { - public uint Count { get; set; } } } diff --git a/Sources/VKSharp/Core/Entities/DatabaseEntry.cs b/Sources/VKSharp/Core/Entities/DatabaseEntry.cs index 178ce97..318beb6 100644 --- a/Sources/VKSharp/Core/Entities/DatabaseEntry.cs +++ b/Sources/VKSharp/Core/Entities/DatabaseEntry.cs @@ -2,10 +2,7 @@ namespace VKSharp.Core.Entities { public class DatabaseEntry : IVKEntity { - - public string Title { get; set; } - public int Id { get; set; } } } diff --git a/Sources/VKSharp/Core/Entities/Geo.cs b/Sources/VKSharp/Core/Entities/Geo.cs index c10b83e..9e18870 100644 --- a/Sources/VKSharp/Core/Entities/Geo.cs +++ b/Sources/VKSharp/Core/Entities/Geo.cs @@ -1,15 +1,16 @@ using VKSharp.Core.Interfaces; namespace VKSharp.Core.Entities { - public class Geo:IVKEntity { - + //todo:check geo + public class Geo : IVKEntity { + public string Address { get; set; } public string Title { get; set; } public string Type { get; set; } - public uint CityId{ get; set; } - public uint CountryId{ get; set; } - public uint PlaceId{ get; set; } + public uint CityId { get; set; } + public uint CountryId { get; set; } + public uint PlaceId { get; set; } + - } } diff --git a/Sources/VKSharp/Core/Entities/Group.cs b/Sources/VKSharp/Core/Entities/Group.cs index 66426fd..06ac8ba 100644 --- a/Sources/VKSharp/Core/Entities/Group.cs +++ b/Sources/VKSharp/Core/Entities/Group.cs @@ -7,9 +7,13 @@ public class Group:IVKEntity { public bool IsAdmin { get; set; } public bool IsClosed { get; set; } + public Deleted? Deactivated { get; set; } + public string Activity { get; set; } public bool IsMember { get; set; } public bool? CanCreateTopic { get; set; } public bool? CanPost { get; set; } + public bool? CanUploadDoc { get; set; } + public bool? CanUploadVideo { get; set; } public bool? CanSeeAllPosts { get; set; } public bool? Verified { get; set; } public GroupAdminLevel AdminLevel { get; set; } @@ -17,11 +21,12 @@ public class Group:IVKEntity { public PageType PageType { get; set; } public Place Place { get; set; } public ProfilePhotos Photos { get; set; } + //todo: photos mapping(50,100,200) public string Contacts { get; set; } public string Description { get; set; } public string Links { get; set; } public string Name { get; set; } - public string ScreeName { get; set; } + public string ScreenName { get; set; } public string Site { get; set; } public string Status { get; set; } public string WikiPage { get; set; } @@ -32,7 +37,10 @@ public class Group:IVKEntity { public uint? MembersCount { get; set; } public uint? PostId { get; set; } public uint? StartDate { get; set; } + public uint? FinishDate { get; set; } + public uint? FixedPost { get; set; } + public long? MainAlbumId { get; set; } + - } } diff --git a/Sources/VKSharp/Core/Entities/Place.cs b/Sources/VKSharp/Core/Entities/Place.cs index 46ec7ae..af1b95d 100644 --- a/Sources/VKSharp/Core/Entities/Place.cs +++ b/Sources/VKSharp/Core/Entities/Place.cs @@ -2,7 +2,7 @@ namespace VKSharp.Core.Entities { public class Place:IVKEntity { - public uint Id { get; set; } + public uint Id { get; set; } public uint Title { get; set; } public uint Latitude { get; set; } public uint Longitude { get; set; } @@ -10,7 +10,5 @@ public class Place:IVKEntity { public string Type { get; set; } public uint City { get; set; } public string Address { get; set; } - - } } diff --git a/Sources/VKSharp/Core/Entities/Post.cs b/Sources/VKSharp/Core/Entities/Post.cs index 6260d06..b3fb224 100644 --- a/Sources/VKSharp/Core/Entities/Post.cs +++ b/Sources/VKSharp/Core/Entities/Post.cs @@ -1,4 +1,5 @@ -using VKSharp.Core.Enums; +using VKSharp.Core.EntityFragments; +using VKSharp.Core.Enums; using VKSharp.Core.Interfaces; namespace VKSharp.Core.Entities { diff --git a/Sources/VKSharp/Core/Entities/University.cs b/Sources/VKSharp/Core/Entities/University.cs index b6210b0..62f2a15 100644 --- a/Sources/VKSharp/Core/Entities/University.cs +++ b/Sources/VKSharp/Core/Entities/University.cs @@ -14,6 +14,5 @@ public class University: IVKEntity { public uint? Faculty { get; set; } public ushort? Graduation { get; set; } - } } diff --git a/Sources/VKSharp/Core/Entities/User.cs b/Sources/VKSharp/Core/Entities/User.cs index 8796f49..0db020b 100644 --- a/Sources/VKSharp/Core/Entities/User.cs +++ b/Sources/VKSharp/Core/Entities/User.cs @@ -56,7 +56,6 @@ public class User : IVKEntity, IEquatable { public string Activities { get; set; } public string Books { get; set; } public string Domain { get; set; } - public string FacultyName { get; set; } public string FirstName { get; set; } public string Games { get; set; } public string HomePhone { get; set; } @@ -73,19 +72,24 @@ public class User : IVKEntity, IEquatable { public string Site { get; set; } public string Status { get; set; } public string Tv { get; set; } - public string UniversityName { get; set; } public StandInLife Personal { get; set;} public uint? CommonCount { get; set; } public uint Id { get; set; } public GeoEntry City { get; set; } public GeoEntry Country { get; set; } + + + //todo: move to education + public string UniversityName { get; set; } + public string FacultyName { get; set; } public uint? Faculty { get; set; } + public uint? University { get; set; } + public ushort? Graduation { get; set; } + public uint? FollowersCount { get; set; } public uint? OnlineApp { get; set; } - public uint? University { get; set; } public uint[] Lists { get; set; } public University[] Universities { get; set; } - public ushort? Graduation { get; set; } public bool Equals( User other ) => !ReferenceEquals( other, null ) && Id == other.Id; diff --git a/Sources/VKSharp/Core/Entities/VideoAlbum.cs b/Sources/VKSharp/Core/Entities/VideoAlbum.cs new file mode 100644 index 0000000..4b239e7 --- /dev/null +++ b/Sources/VKSharp/Core/Entities/VideoAlbum.cs @@ -0,0 +1,10 @@ +using VKSharp.Core.Interfaces; + +namespace VKSharp.Core.Entities { + public class VideoAlbum : OwnedEntity { + public string Title { get; set; } + public long? Count { get; set; } + public string Photo160 { get; set; } + public string Photo320 { get; set; } + } +} diff --git a/Sources/VKSharp/Core/Entities/CommentLikes.cs b/Sources/VKSharp/Core/EntityFragments/CommentLikes.cs similarity index 72% rename from Sources/VKSharp/Core/Entities/CommentLikes.cs rename to Sources/VKSharp/Core/EntityFragments/CommentLikes.cs index c609b11..aaa759d 100644 --- a/Sources/VKSharp/Core/Entities/CommentLikes.cs +++ b/Sources/VKSharp/Core/EntityFragments/CommentLikes.cs @@ -1,11 +1,10 @@ using VKSharp.Core.Interfaces; -namespace VKSharp.Core.Entities { +namespace VKSharp.Core.EntityFragments { public class CommentLikes:IVKEntity { public uint Count { get; set; } public bool? UserLikes { get; set; } public bool? CanLike { get; set; } - - + public bool? CanPublish { get; set; } } } diff --git a/Sources/VKSharp/Core/Entities/PostComments.cs b/Sources/VKSharp/Core/EntityFragments/PostComments.cs similarity index 80% rename from Sources/VKSharp/Core/Entities/PostComments.cs rename to Sources/VKSharp/Core/EntityFragments/PostComments.cs index f0c9fab..cda263e 100644 --- a/Sources/VKSharp/Core/Entities/PostComments.cs +++ b/Sources/VKSharp/Core/EntityFragments/PostComments.cs @@ -1,10 +1,8 @@ using VKSharp.Core.Interfaces; -namespace VKSharp.Core.Entities { +namespace VKSharp.Core.EntityFragments { public class PostComments:IVKEntity { public uint Count { get; set; } public bool? CanPost { get; set; } - - } } diff --git a/Sources/VKSharp/Core/Enums/ChangeNameStatus.cs b/Sources/VKSharp/Core/Enums/ChangeNameStatus.cs new file mode 100644 index 0000000..7f7f450 --- /dev/null +++ b/Sources/VKSharp/Core/Enums/ChangeNameStatus.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace VKSharp.Core.Enums { + public enum ChangeNameStatus { + Processing, + Declined, + Success, + WasAccepted, + WasDeclined + } +} diff --git a/Sources/VKSharp/Core/ResponseEntities/ChangeNameRequest.cs b/Sources/VKSharp/Core/ResponseEntities/ChangeNameRequest.cs new file mode 100644 index 0000000..9367dd4 --- /dev/null +++ b/Sources/VKSharp/Core/ResponseEntities/ChangeNameRequest.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using VKSharp.Core.Enums; + +namespace VKSharp.Core.ResponseEntities { + public class ChangeNameRequest { + public int? Id { get; set; } + public ChangeNameStatus? Status { get; set; } + public string RepeatDate { get; set; } + public string FirstName { get; set; } + public string LastName { get; set; } + } +} diff --git a/Sources/VKSharp/Core/ResponseEntities/LastActivity.cs b/Sources/VKSharp/Core/ResponseEntities/LastActivity.cs new file mode 100644 index 0000000..253e975 --- /dev/null +++ b/Sources/VKSharp/Core/ResponseEntities/LastActivity.cs @@ -0,0 +1,7 @@ +using System; +namespace VKSharp.Core.ResponseEntities { + public class LastActivity { + public bool? IsOnline { get; set; } + public long? Time { get; set; } + } +} diff --git a/Sources/VKSharp/Data/Executors/JsonExecutor.cs b/Sources/VKSharp/Data/Executors/JsonExecutor.cs index b8adf45..f72545d 100644 --- a/Sources/VKSharp/Data/Executors/JsonExecutor.cs +++ b/Sources/VKSharp/Data/Executors/JsonExecutor.cs @@ -18,11 +18,17 @@ namespace VKSharp.Data.Executors { public class JsonExecutor : IExecutor { static JsonExecutor() { + //required for parallel IO + //default conn limit is 2 ServicePointManager.DefaultConnectionLimit = Math.Max( 25, ServicePointManager.DefaultConnectionLimit ); + + //client w compresssion var httpClientHandler = new HttpClientHandler(); if ( httpClientHandler.SupportsAutomaticDecompression ) httpClientHandler.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip; Client = new HttpClient( httpClientHandler ); + + //snake case parsing var snakeCaseContractResolver = new SnakeCaseContractResolver(); snakeCaseContractResolver.DefaultMembersSearchFlags |= BindingFlags.NonPublic; Jsonser = new JsonSerializer { ContractResolver = snakeCaseContractResolver }; @@ -63,7 +69,6 @@ public override bool CanConvert( Type objectType ) { return btype.IsEnum; } public override object ReadJson( JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer ) { - //base var isNullable = ReflectionUtils.IsNullableType( objectType ); var t = isNullable ? Nullable.GetUnderlyingType( objectType ) : objectType; if ( reader.TokenType == JsonToken.Null ) { @@ -74,7 +79,8 @@ public override object ReadJson( JsonReader reader, Type objectType, object exis try { switch ( reader.TokenType ) { case JsonToken.String: - var enumText = reader.Value.ToString().ToMeth(); + var enumText = reader.Value.ToString() + .ToMeth();//the only changed line return EnumUtils.ParseEnumName( enumText, isNullable, t ); case JsonToken.Integer: if ( !AllowIntegerValues ) diff --git a/Sources/VKSharp/VKSharp.csproj b/Sources/VKSharp/VKSharp.csproj index bbf39ee..6175aa9 100644 --- a/Sources/VKSharp/VKSharp.csproj +++ b/Sources/VKSharp/VKSharp.csproj @@ -69,10 +69,15 @@ + + + + + @@ -119,7 +124,7 @@ - + @@ -127,7 +132,7 @@ - +