Skip to content

Commit

Permalink
added some missing classes for vk example
Browse files Browse the repository at this point in the history
  • Loading branch information
eresid committed Mar 11, 2017
1 parent 7c119e1 commit 5be4cdd
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 30 deletions.
8 changes: 4 additions & 4 deletions examples/vk-dlang-sdk/source/vksdk/httpclient/VibeClient.d
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module vksdk.httpclient.RequestsTransportClient;
module vksdk.httpclient.VibeClient;

import std.datetime;
import std.experimental.logger.filelogger;
Expand All @@ -8,13 +8,13 @@ import vksdk.client.ClientResponse;
import vksdk.client.TransportClient;
import requests;

class RequestsTransportClient : BaseTransportClient {
class VibeClient : BaseTransportClient {

private static RequestsTransportClient instance;
private static VibeClient instance;

static TransportClient getInstance() {
if (instance is null) {
instance = new RequestsTransportClient;
instance = new VibeClient;
}

return instance;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module vksdk.objects.audio.AudioFull;

import vksdk.objects.audio.Audio;
import vksdk.objects.base.BoolInt;

import vibe.data.json;
Expand Down
30 changes: 30 additions & 0 deletions examples/vk-dlang-sdk/source/vksdk/objects/users/CropPhoto.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module vksdk.objects.users.CropPhoto;

import vibe.data.json;

/**
* CropPhoto object
*/
class CropPhoto {

@name("photo")
private Photo photo;

@name("crop")
private Json crop;

@name("rect")
private Json rect;

Photo getPhoto() {
return photo;
}

Json getCrop() {
return crop;
}

Json getRect() {
return rect;
}
}
28 changes: 28 additions & 0 deletions examples/vk-dlang-sdk/source/vksdk/objects/users/LastSeen.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module vksdk.objects.users.LastSeen;

import vibe.data.json;

/**
* LastSeen object
*/
class LastSeen {
/**
* Last visit date (in Unix time)
*/
@name("time")
private int time;

/**
* Type of the platform that used for the last authorization
*/
@name("platform")
private int platform;

int getTime() {
return time;
}

int getPlatform() {
return platform;
}
}
36 changes: 36 additions & 0 deletions examples/vk-dlang-sdk/source/vksdk/objects/users/Occupation.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module vksdk.objects.users.Occupation;

/**
* Occupation object
*/
class Occupation {
/**
* Type of occupation
*/
@name("type")
private string type;

/**
* ID of school, university, company group
*/
@name("id")
private int id;

/**
* Name of occupation
*/
@name("name")
private string name;

string getType() {
return type;
}

int getId() {
return id;
}

string getName() {
return name;
}
}
1 change: 1 addition & 0 deletions examples/vk-dlang-sdk/source/vksdk/objects/users/User.d
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module vksdk.objects.users.User;

import vksdk.objects.base.BoolInt;
import vksdk.objects.base.Sex;
import vksdk.objects.users.UserMin;

import vibe.data.json;

Expand Down
55 changes: 29 additions & 26 deletions examples/vk-dlang-sdk/source/vksdk/objects/users/UserFull.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import vksdk.objects.audio.AudioFull;
import vksdk.objects.base.BaseObject;
import vksdk.objects.base.BoolInt;
import vksdk.objects.base.Country;
import vksdk.objects.users.CropPhoto;
import vksdk.objects.users.LastSeen;
import vksdk.objects.users.Occupation;
import vksdk.objects.users.User;

import vibe.data.json;
Expand Down Expand Up @@ -89,19 +92,19 @@ class UserFull : User {
* Information whether the user has main photo
*/
@name("has_photo")
private BoolInt hasPhoto;
private BoolInt _hasPhoto;

/**
* Information whether the user specified his phone number
*/
@name("has_mobile")
private BoolInt hasMobile;
private BoolInt _hasMobile;

/**
* Information whether the user is a friend of current user
*/
@name("is_friend")
private BoolInt isFriend;
private BoolInt _isFriend;

/**
* Friend status for current user
Expand All @@ -119,31 +122,31 @@ class UserFull : User {
* Information whether current user can post on the user's wall
*/
@name("can_post")
private BoolInt canPost;
private BoolInt _canPost;

/**
* Information whether current user can see other users' audio on the wall
*/
@name("can_see_all_posts")
private BoolInt canSeeAllPosts;
private BoolInt _canSeeAllPosts;

/**
* Information whether current user can see the user's audio
*/
@name("can_see_audio")
private BoolInt canSeeAudio;
private BoolInt _canSeeAudio;

/**
* Information whether current user can write private message
*/
@name("can_write_private_message")
private BoolInt canWritePrivateMessage;
private BoolInt _canWritePrivateMessage;

/**
* Information whether current user can send a friend request
*/
@name("can_send_friend_request")
private BoolInt canSendFriendRequest;
private BoolInt _canSendFriendRequest;

/**
* Information whether current user can see
Expand Down Expand Up @@ -218,7 +221,7 @@ class UserFull : User {
private LastSeen lastSeen;

@name("exports")
private Exports exports;
private Json exports;

@name("crop_photo")
private CropPhoto cropPhoto;
Expand Down Expand Up @@ -251,13 +254,13 @@ class UserFull : User {
* Information whether the requested user is in faves of current user
*/
@name("is_favorite")
private BoolInt isFavorite;
private BoolInt _isFavorite;

/**
* Information whether the requested user is hidden from current user's newsfeed
*/
@name("is_hidden_from_feed")
private BoolInt isHiddenFromFeed;
private BoolInt _isHiddenFromFeed;

/**
* Number of common friends with current user
Expand Down Expand Up @@ -450,15 +453,15 @@ class UserFull : User {
}

bool hasPhoto() {
return hasPhoto == BoolInt.YES;
return _hasPhoto == BoolInt.YES;
}

bool isHasMobile() {
return hasMobile == BoolInt.YES;
bool hasMobile() {
return _hasMobile == BoolInt.YES;
}

bool isIsFriend() {
return isFriend == BoolInt.YES;
bool isFriend() {
return _isFriend == BoolInt.YES;
}

int getFriendStatus() {
Expand All @@ -470,23 +473,23 @@ class UserFull : User {
}

bool canPost() {
return canPost == BoolInt.YES;
return _canPost == BoolInt.YES;
}

bool canSeeAllPosts() {
return canSeeAllPosts == BoolInt.YES;
return _canSeeAllPosts == BoolInt.YES;
}

bool canSeeAudio() {
return canSeeAudio == BoolInt.YES;
return _canSeeAudio == BoolInt.YES;
}

bool canWritePrivateMessage() {
return canWritePrivateMessage == BoolInt.YES;
return _canWritePrivateMessage == BoolInt.YES;
}

bool canSendFriendRequest() {
return canSendFriendRequest == BoolInt.YES;
return _canSendFriendRequest == BoolInt.YES;
}

string getMobilePhone() {
Expand Down Expand Up @@ -541,7 +544,7 @@ class UserFull : User {
return lastSeen;
}

Exports getExports() {
Json getExports() {
return exports;
}

Expand All @@ -565,12 +568,12 @@ class UserFull : User {
return blacklistedByMe == BoolInt.YES;
}

bool isIsFavorite() {
return isFavorite == BoolInt.YES;
bool isFavorite() {
return _isFavorite == BoolInt.YES;
}

bool isIsHiddenFromFeed() {
return isHiddenFromFeed == BoolInt.YES;
bool isHiddenFromFeed() {
return _isHiddenFromFeed == BoolInt.YES;
}

int getCommonCount() {
Expand Down
58 changes: 58 additions & 0 deletions examples/vk-dlang-sdk/source/vksdk/objects/users/UserMin.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
module vksdk.objects.users.UserMin;

import vibe.data.json;

/**
* UserMin object
*/
class UserMin {
/**
* User ID
*/
@name("id")
private int id;

/**
* User first name
*/
@name("first_name")
private string firstName;

/**
* User last name
*/
@name("last_name")
private string lastName;

/**
* Returns if a profile is deleted or blocked
*/
@name("deactivated")
private string deactivated;

/**
* Returns if a profile is hidden.
*/
@name("hidden")
private int hidden;

int getId() {
return id;
}

string getFirstName() {
return firstName;
}

string getLastName() {
return lastName;
}

string getDeactivated() {
return deactivated;
}

int getHidden() {
return hidden;
}
}

0 comments on commit 5be4cdd

Please sign in to comment.