Методы API Вконтакте

Discussion in 'Социальные сети' started by SoulReaver, 12 Aug 2009.

  1. SoulReaver

    SoulReaver Banned

    Joined:
    30 Jul 2009
    Messages:
    0
    Likes Received:
    10
    Reputations:
    5
    Кому нужен пример в формате *swf пишите в приват.

    Code:
    				
    		[COLOR=DarkRed]User methods[/COLOR]
    	
    		
    		public function isAppUser (uid: Number = -1): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'isAppUser', secret, test_mode, format, version, server_url);
    			if (uid != -1)
    				api.addParameter('uid', uid.toString());
    			return api.getQuery();
    		}
    
    		public function getProfiles (uids: Array, fields: Array = null): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getProfiles', secret, test_mode, format, version, server_url);
    			api.addParameter('uids', uids.join(','));
    			if (fields)
    				api.addParameter('fields', fields.join(','));
    			return api.getQuery();
    		}
    
    		public function getFriends (): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getFriends', secret, test_mode, format, version, server_url);
    			return api.getQuery();
    		}
    
    		public function getAppFriends (): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getAppFriends', secret, test_mode, format, version, server_url);
    			return api.getQuery();
    		}
    
    		public function getUserBalance (): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getUserBalance', secret, test_mode, format, version, server_url);
    			return api.getQuery();
    		}
    
    
    		
    			[COLOR=DarkRed]Photo methods[/COLOR]	
    		 
    
    		public function getPhotoAlbums (): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getPhotoAlbums', secret, test_mode, format, version, server_url);
    			return api.getQuery();
    		}
    
    		public function getPhotos (uid: Number, aid: Number, pids: Array = null): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getPhotos', secret, test_mode, format, version, server_url);
    			api.addParameter('uid', uid.toString());
    			api.addParameter('aid', aid.toString());
    			if (pids)
    				api.addParameter('pids', pids.join(','));
    			return api.getQuery();
    		}
    
    		public function createPhotoAlbum (title: String, privacy: Number = -1, description: String = ''): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'createPhotoAlbum', secret, test_mode, format, version, server_url);
    			api.addParameter('title', title);
    			if (privacy != -1)
    				api.addParameter('privacy', privacy.toString());
    			if (description != '')
    				api.addParameter('description', description);
    			return api.getQuery();
    		}
    
    		public function getPhotosUploadServer (aid: Number = -1): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getPhotosUploadServer', secret, test_mode, format, version, server_url);
    			if (aid != -1)
    				api.addParameter('aid', aid.toString());
    			return api.getQuery();
    		}
    
    		public function savePhotos (aid: Number, server: String, photos_list: String, hash: String): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'savePhotos', secret, test_mode, format, version, server_url);
    			api.addParameter('aid', aid.toString());
    			api.addParameter('server', server);
    			api.addParameter('photos_list', photos_list);
    			api.addParameter('hash', hash);
    			return api.getQuery();
    		}
    
    
    		
    			[COLOR=DarkRed]Audio methods[/COLOR]
    		
    
    		public function getAudios (uid: Number = -1, aids: Array = null): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getAudios', secret, test_mode, format, version, server_url);
    			if (uid != -1)	
    				api.addParameter('uid', uid.toString());
    			if (aids)
    				api.addParameter('aids', aids.join(','));
    			return api.getQuery();
    		}
    		
    		public function getAudioUploadServer (): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getAudioUploadServer', secret, test_mode, format, version, server_url);
    			return api.getQuery();
    		}
    		
    		public function saveAudio (server: String, audio: String, hash: String, artist: String = '', title: String = ''): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'saveAudio', secret, test_mode, format, version, server_url);
    			api.addParameter('server', server);
    			api.addParameter('audio', audio);
    			api.addParameter('hash', hash);
    			if (artist != '')
    				api.addParameter('artist', artist);
    			if (title != '')
    				api.addParameter('title', title);
    			return api.getQuery();
    		}
    
    
    		
    			[COLOR=DarkRed]Geo methods[/COLOR]		
    		
    
    		public function getCountries (cids: Array): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getCountries', secret, test_mode, format, version, server_url);
    			api.addParameter('cids', cids.join(','));
    			return api.getQuery();
    		}
    		
    		public function getCities (cids: Array): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getCities', secret, test_mode, format, version, server_url);
    			api.addParameter('cids', cids.join(','));
    			return api.getQuery();
    		}
    		
    
    		
    			[COLOR=DarkRed]Other methods[/COLOR]	
    		
    
    		public function getVariable (key: Number): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getVariable', secret, test_mode, format, version, server_url);
    			api.addParameter('key', key.toString());
    			return api.getQuery();
    		}
    
    		public function getVariables (key: Number, count: Number): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getVariables', secret, test_mode, format, version, server_url);
    			api.addParameter('key', key.toString());
    			api.addParameter('count', count.toString());
    			return api.getQuery();
    		}
    
    		public function putVariable (key: Number, value: String): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'putVariable', secret, test_mode, format, version, server_url);
    			api.addParameter('key', key.toString());
    			api.addParameter('value', value);
    			return api.getQuery();
    		}
    
    		public function getHighScores (): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getHighScores', secret, test_mode, format, version, server_url);
    			return api.getQuery();
    		}
    
    		public function setUserScore (score: String): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'setUserScore', secret, test_mode, format, version, server_url);
    			api.addParameter('score', score);
    			return api.getQuery();
    		}
    
    		public function getMessages (): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getMessages', secret, test_mode, format, version, server_url);
    			return api.getQuery();
    		}
    
    		public function sendMessage (message: String): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'sendMessage', secret, test_mode, format, version, server_url);
    			api.addParameter('message', message);
    			return api.getQuery();
    		}
    
    		public function getServerTime (): String
    		{
    			var api: VkApi = new VkApi(viewer_id, api_id, 'getServerTime', secret, test_mode, format, version, server_url);
    			return api.getQuery();
    		}
    
    Небольшое допояснение :
    Code:
    public var viewer_id: Number;
    		public var api_id: Number;
    		public var secret: String;
    		public var test_mode: Boolean; 
    		public var format: String;
    		public var version: String;
    		public var server_url: String;
    
    		public function VkApiNode (viewer_id: Number, api_id: Number, secret: String, 
    								test_mode: Boolean = false, format: String = 'XML',
    								version: String = '2.0', server_url: String = 'http://api.vkontakte.ru/api.php?')
    		{
    			this.viewer_id = viewer_id;
    			this.api_id = api_id;
    			this.secret = secret;
    			this.test_mode = test_mode;
    			this.format = format;
    			this.version = version;
    			this.server_url = server_url;
    		}
     
    #1 SoulReaver, 12 Aug 2009
    Last edited: 12 Aug 2009