<?php

/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.10
 *
 * This file is not intended to be easily readable and contains a number of
 * coding conventions designed to improve portability and efficiency. Do not make
 * changes to this file unless you know what you are doing--modify the SWIG
 * interface file instead.
 * ----------------------------------------------------------------------------- */

// Try to load our extension if it's not already loaded.
if (!extension_loaded('mega')) {
  if (strtolower(substr(PHP_OS, 0, 3)) === 'win') {
    if (!dl('php_mega.dll')) return;
  } else {
    // PHP_SHLIB_SUFFIX gives 'dylib' on MacOS X but modules are 'so'.
    if (PHP_SHLIB_SUFFIX === 'dylib') {
      if (!dl('mega.so')) return;
    } else {
      if (!dl('mega.'.PHP_SHLIB_SUFFIX)) return;
    }
  }
}



abstract class mega {
	static function MEGA_DEBRIS_FOLDER_get() {
		return MEGA_DEBRIS_FOLDER_get();
	}

	static function INVALID_HANDLE_get() {
		return INVALID_HANDLE_get();
	}
}

/* PHP Proxy Classes */
class MegaGfxProcessor {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function readBitmap($path) {
		return MegaGfxProcessor_readBitmap($this->_cPtr,$path);
	}

	function getWidth() {
		return MegaGfxProcessor_getWidth($this->_cPtr);
	}

	function getHeight() {
		return MegaGfxProcessor_getHeight($this->_cPtr);
	}

	function getBitmapDataSize($width,$height,$px,$py,$rw,$rh) {
		return MegaGfxProcessor_getBitmapDataSize($this->_cPtr,$width,$height,$px,$py,$rw,$rh);
	}

	function getBitmapData($bitmapData,$size) {
		return MegaGfxProcessor_getBitmapData($this->_cPtr,$bitmapData,$size);
	}

	function freeBitmap() {
		MegaGfxProcessor_freeBitmap($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaGfxProcessor') {
			$this->_cPtr=$res;
			return;
		}
		if (get_class($this) === 'MegaGfxProcessor') {
			$_this = null;
		} else {
			$_this = $this;
		}
		$this->_cPtr=new_MegaGfxProcessor($_this);
	}
}

class MegaProxy {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const PROXY_NONE = 0;

	const PROXY_AUTO = 1;

	const PROXY_CUSTOM = 2;

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaProxy') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaProxy();
	}

	function setProxyType($proxyType) {
		MegaProxy_setProxyType($this->_cPtr,$proxyType);
	}

	function setProxyURL($proxyURL) {
		MegaProxy_setProxyURL($this->_cPtr,$proxyURL);
	}

	function setCredentials($username,$password) {
		MegaProxy_setCredentials($this->_cPtr,$username,$password);
	}

	function getProxyType() {
		return MegaProxy_getProxyType($this->_cPtr);
	}

	function getProxyURL() {
		return MegaProxy_getProxyURL($this->_cPtr);
	}

	function credentialsNeeded() {
		return MegaProxy_credentialsNeeded($this->_cPtr);
	}

	function getUsername() {
		return MegaProxy_getUsername($this->_cPtr);
	}

	function getPassword() {
		return MegaProxy_getPassword($this->_cPtr);
	}
}

class MegaLogger {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function log($time,$loglevel,$source,$message) {
		MegaLogger_log($this->_cPtr,$time,$loglevel,$source,$message);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaLogger') {
			$this->_cPtr=$res;
			return;
		}
		if (get_class($this) === 'MegaLogger') {
			$_this = null;
		} else {
			$_this = $this;
		}
		$this->_cPtr=new_MegaLogger($_this);
	}
}

class MegaNode {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const TYPE_UNKNOWN = -1;

	const TYPE_FILE = 0;

	const TYPE_FOLDER = MegaNode_TYPE_FOLDER;

	const TYPE_ROOT = MegaNode_TYPE_ROOT;

	const TYPE_INCOMING = MegaNode_TYPE_INCOMING;

	const TYPE_RUBBISH = MegaNode_TYPE_RUBBISH;

	const CHANGE_TYPE_REMOVED = MegaNode_CHANGE_TYPE_REMOVED;

	const CHANGE_TYPE_ATTRIBUTES = MegaNode_CHANGE_TYPE_ATTRIBUTES;

	const CHANGE_TYPE_OWNER = MegaNode_CHANGE_TYPE_OWNER;

	const CHANGE_TYPE_TIMESTAMP = MegaNode_CHANGE_TYPE_TIMESTAMP;

	const CHANGE_TYPE_FILE_ATTRIBUTES = MegaNode_CHANGE_TYPE_FILE_ATTRIBUTES;

	const CHANGE_TYPE_INSHARE = MegaNode_CHANGE_TYPE_INSHARE;

	const CHANGE_TYPE_OUTSHARE = MegaNode_CHANGE_TYPE_OUTSHARE;

	const CHANGE_TYPE_PARENT = MegaNode_CHANGE_TYPE_PARENT;

	const CHANGE_TYPE_PENDINGSHARE = MegaNode_CHANGE_TYPE_PENDINGSHARE;

	const CHANGE_TYPE_PUBLIC_LINK = MegaNode_CHANGE_TYPE_PUBLIC_LINK;

	const INVALID_DURATION = MegaNode_INVALID_DURATION;

	static function INVALID_COORDINATE() {
		return MegaNode_INVALID_COORDINATE_get();
	}

	function copy() {
		$r=MegaNode_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getType() {
		return MegaNode_getType($this->_cPtr);
	}

	function getName() {
		return MegaNode_getName($this->_cPtr);
	}

	function getFingerprint() {
		return MegaNode_getFingerprint($this->_cPtr);
	}

	function hasCustomAttrs() {
		return MegaNode_hasCustomAttrs($this->_cPtr);
	}

	function getCustomAttrNames() {
		$r=MegaNode_getCustomAttrNames($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaStringList($r);
		}
		return $r;
	}

	function getCustomAttr($attrName) {
		return MegaNode_getCustomAttr($this->_cPtr,$attrName);
	}

	function getDuration() {
		return MegaNode_getDuration($this->_cPtr);
	}

	function getLatitude() {
		return MegaNode_getLatitude($this->_cPtr);
	}

	function getLongitude() {
		return MegaNode_getLongitude($this->_cPtr);
	}

	function getBase64Handle() {
		return MegaNode_getBase64Handle($this->_cPtr);
	}

	function getSize() {
		return MegaNode_getSize($this->_cPtr);
	}

	function getCreationTime() {
		return MegaNode_getCreationTime($this->_cPtr);
	}

	function getModificationTime() {
		return MegaNode_getModificationTime($this->_cPtr);
	}

	function getHandle() {
		return MegaNode_getHandle($this->_cPtr);
	}

	function getParentHandle() {
		return MegaNode_getParentHandle($this->_cPtr);
	}

	function getBase64Key() {
		return MegaNode_getBase64Key($this->_cPtr);
	}

	function getTag() {
		return MegaNode_getTag($this->_cPtr);
	}

	function getExpirationTime() {
		return MegaNode_getExpirationTime($this->_cPtr);
	}

	function getPublicHandle() {
		return MegaNode_getPublicHandle($this->_cPtr);
	}

	function getPublicNode() {
		$r=MegaNode_getPublicNode($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getPublicLink() {
		return MegaNode_getPublicLink($this->_cPtr);
	}

	function isFile() {
		return MegaNode_isFile($this->_cPtr);
	}

	function isFolder() {
		return MegaNode_isFolder($this->_cPtr);
	}

	function isRemoved() {
		return MegaNode_isRemoved($this->_cPtr);
	}

	function hasChanged($changeType) {
		return MegaNode_hasChanged($this->_cPtr,$changeType);
	}

	function getChanges() {
		return MegaNode_getChanges($this->_cPtr);
	}

	function hasThumbnail() {
		return MegaNode_hasThumbnail($this->_cPtr);
	}

	function hasPreview() {
		return MegaNode_hasPreview($this->_cPtr);
	}

	function isPublic() {
		return MegaNode_isPublic($this->_cPtr);
	}

	function isShared() {
		return MegaNode_isShared($this->_cPtr);
	}

	function isOutShare() {
		return MegaNode_isOutShare($this->_cPtr);
	}

	function isInShare() {
		return MegaNode_isInShare($this->_cPtr);
	}

	function isExported() {
		return MegaNode_isExported($this->_cPtr);
	}

	function isExpired() {
		return MegaNode_isExpired($this->_cPtr);
	}

	function isTakenDown() {
		return MegaNode_isTakenDown($this->_cPtr);
	}

	function isForeign() {
		return MegaNode_isForeign($this->_cPtr);
	}

	function setPrivateAuth($privateAuth) {
		MegaNode_setPrivateAuth($this->_cPtr,$privateAuth);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaNode') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaNode();
	}
}

class MegaUser {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const VISIBILITY_UNKNOWN = -1;

	const VISIBILITY_HIDDEN = 0;

	const VISIBILITY_VISIBLE = 1;

	const VISIBILITY_INACTIVE = 2;

	const VISIBILITY_BLOCKED = 3;

	function copy() {
		$r=MegaUser_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaUser($r);
		}
		return $r;
	}

	function getEmail() {
		return MegaUser_getEmail($this->_cPtr);
	}

	function getHandle() {
		return MegaUser_getHandle($this->_cPtr);
	}

	function getVisibility() {
		return MegaUser_getVisibility($this->_cPtr);
	}

	function getTimestamp() {
		return MegaUser_getTimestamp($this->_cPtr);
	}

	const CHANGE_TYPE_AUTHRING = MegaUser_CHANGE_TYPE_AUTHRING;

	const CHANGE_TYPE_LSTINT = MegaUser_CHANGE_TYPE_LSTINT;

	const CHANGE_TYPE_AVATAR = MegaUser_CHANGE_TYPE_AVATAR;

	const CHANGE_TYPE_FIRSTNAME = MegaUser_CHANGE_TYPE_FIRSTNAME;

	const CHANGE_TYPE_LASTNAME = MegaUser_CHANGE_TYPE_LASTNAME;

	const CHANGE_TYPE_EMAIL = MegaUser_CHANGE_TYPE_EMAIL;

	const CHANGE_TYPE_KEYRING = MegaUser_CHANGE_TYPE_KEYRING;

	const CHANGE_TYPE_COUNTRY = MegaUser_CHANGE_TYPE_COUNTRY;

	const CHANGE_TYPE_BIRTHDAY = MegaUser_CHANGE_TYPE_BIRTHDAY;

	const CHANGE_TYPE_PUBKEY_CU255 = MegaUser_CHANGE_TYPE_PUBKEY_CU255;

	const CHANGE_TYPE_PUBKEY_ED255 = MegaUser_CHANGE_TYPE_PUBKEY_ED255;

	const CHANGE_TYPE_SIG_PUBKEY_RSA = MegaUser_CHANGE_TYPE_SIG_PUBKEY_RSA;

	const CHANGE_TYPE_SIG_PUBKEY_CU25 = MegaUser_CHANGE_TYPE_SIG_PUBKEY_CU25;

	function hasChanged($changeType) {
		return MegaUser_hasChanged($this->_cPtr,$changeType);
	}

	function getChanges() {
		return MegaUser_getChanges($this->_cPtr);
	}

	function isOwnChange() {
		return MegaUser_isOwnChange($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaUser') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaUser();
	}
}

class MegaShare {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const ACCESS_UNKNOWN = -1;

	const ACCESS_READ = 0;

	const ACCESS_READWRITE = MegaShare_ACCESS_READWRITE;

	const ACCESS_FULL = MegaShare_ACCESS_FULL;

	const ACCESS_OWNER = MegaShare_ACCESS_OWNER;

	function copy() {
		$r=MegaShare_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaShare($r);
		}
		return $r;
	}

	function getUser() {
		return MegaShare_getUser($this->_cPtr);
	}

	function getNodeHandle() {
		return MegaShare_getNodeHandle($this->_cPtr);
	}

	function getAccess() {
		return MegaShare_getAccess($this->_cPtr);
	}

	function getTimestamp() {
		return MegaShare_getTimestamp($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaShare') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaShare();
	}
}

class MegaStringMap {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function copy() {
		$r=MegaStringMap_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaStringMap($r);
		}
		return $r;
	}

	function get($key) {
		return MegaStringMap_get($this->_cPtr,$key);
	}

	function getKeys() {
		$r=MegaStringMap_getKeys($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaStringList($r);
		}
		return $r;
	}

	function set($key,$value) {
		MegaStringMap_set($this->_cPtr,$key,$value);
	}

	function size() {
		return MegaStringMap_size($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaStringMap') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaStringMap();
	}
}

class MegaStringList {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function copy() {
		$r=MegaStringList_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaStringList($r);
		}
		return $r;
	}

	function get($i) {
		return MegaStringList_get($this->_cPtr,$i);
	}

	function size() {
		return MegaStringList_size($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaStringList') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaStringList();
	}
}

class MegaNodeList {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function copy() {
		$r=MegaNodeList_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNodeList($r);
		}
		return $r;
	}

	function get($i) {
		$r=MegaNodeList_get($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function size() {
		return MegaNodeList_size($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaNodeList') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaNodeList();
	}
}

class MegaUserList {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function copy() {
		$r=MegaUserList_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaUserList($r);
		}
		return $r;
	}

	function get($i) {
		$r=MegaUserList_get($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaUser($r);
		}
		return $r;
	}

	function size() {
		return MegaUserList_size($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaUserList') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaUserList();
	}
}

class MegaShareList {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function get($i) {
		$r=MegaShareList_get($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaShare($r);
		}
		return $r;
	}

	function size() {
		return MegaShareList_size($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaShareList') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaShareList();
	}
}

class MegaTransferList {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function get($i) {
		$r=MegaTransferList_get($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaTransfer($r);
		}
		return $r;
	}

	function size() {
		return MegaTransferList_size($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaTransferList') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaTransferList();
	}
}

class MegaContactRequestList {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function copy() {
		$r=MegaContactRequestList_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaContactRequestList($r);
		}
		return $r;
	}

	function get($i) {
		$r=MegaContactRequestList_get($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaContactRequest($r);
		}
		return $r;
	}

	function size() {
		return MegaContactRequestList_size($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaContactRequestList') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaContactRequestList();
	}
}

class MegaRequest {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const TYPE_LOGIN = 0;

	const TYPE_CREATE_FOLDER = MegaRequest_TYPE_CREATE_FOLDER;

	const TYPE_MOVE = MegaRequest_TYPE_MOVE;

	const TYPE_COPY = MegaRequest_TYPE_COPY;

	const TYPE_RENAME = MegaRequest_TYPE_RENAME;

	const TYPE_REMOVE = MegaRequest_TYPE_REMOVE;

	const TYPE_SHARE = MegaRequest_TYPE_SHARE;

	const TYPE_IMPORT_LINK = MegaRequest_TYPE_IMPORT_LINK;

	const TYPE_EXPORT = MegaRequest_TYPE_EXPORT;

	const TYPE_FETCH_NODES = MegaRequest_TYPE_FETCH_NODES;

	const TYPE_ACCOUNT_DETAILS = MegaRequest_TYPE_ACCOUNT_DETAILS;

	const TYPE_CHANGE_PW = MegaRequest_TYPE_CHANGE_PW;

	const TYPE_UPLOAD = MegaRequest_TYPE_UPLOAD;

	const TYPE_LOGOUT = MegaRequest_TYPE_LOGOUT;

	const TYPE_GET_PUBLIC_NODE = MegaRequest_TYPE_GET_PUBLIC_NODE;

	const TYPE_GET_ATTR_FILE = MegaRequest_TYPE_GET_ATTR_FILE;

	const TYPE_SET_ATTR_FILE = MegaRequest_TYPE_SET_ATTR_FILE;

	const TYPE_GET_ATTR_USER = MegaRequest_TYPE_GET_ATTR_USER;

	const TYPE_SET_ATTR_USER = MegaRequest_TYPE_SET_ATTR_USER;

	const TYPE_RETRY_PENDING_CONNECTIONS = MegaRequest_TYPE_RETRY_PENDING_CONNECTIONS;

	const TYPE_REMOVE_CONTACT = MegaRequest_TYPE_REMOVE_CONTACT;

	const TYPE_CREATE_ACCOUNT = MegaRequest_TYPE_CREATE_ACCOUNT;

	const TYPE_CONFIRM_ACCOUNT = MegaRequest_TYPE_CONFIRM_ACCOUNT;

	const TYPE_QUERY_SIGNUP_LINK = MegaRequest_TYPE_QUERY_SIGNUP_LINK;

	const TYPE_ADD_SYNC = MegaRequest_TYPE_ADD_SYNC;

	const TYPE_REMOVE_SYNC = MegaRequest_TYPE_REMOVE_SYNC;

	const TYPE_REMOVE_SYNCS = MegaRequest_TYPE_REMOVE_SYNCS;

	const TYPE_PAUSE_TRANSFERS = MegaRequest_TYPE_PAUSE_TRANSFERS;

	const TYPE_CANCEL_TRANSFER = MegaRequest_TYPE_CANCEL_TRANSFER;

	const TYPE_CANCEL_TRANSFERS = MegaRequest_TYPE_CANCEL_TRANSFERS;

	const TYPE_DELETE = MegaRequest_TYPE_DELETE;

	const TYPE_REPORT_EVENT = MegaRequest_TYPE_REPORT_EVENT;

	const TYPE_CANCEL_ATTR_FILE = MegaRequest_TYPE_CANCEL_ATTR_FILE;

	const TYPE_GET_PRICING = MegaRequest_TYPE_GET_PRICING;

	const TYPE_GET_PAYMENT_ID = MegaRequest_TYPE_GET_PAYMENT_ID;

	const TYPE_GET_USER_DATA = MegaRequest_TYPE_GET_USER_DATA;

	const TYPE_LOAD_BALANCING = MegaRequest_TYPE_LOAD_BALANCING;

	const TYPE_KILL_SESSION = MegaRequest_TYPE_KILL_SESSION;

	const TYPE_SUBMIT_PURCHASE_RECEIPT = MegaRequest_TYPE_SUBMIT_PURCHASE_RECEIPT;

	const TYPE_CREDIT_CARD_STORE = MegaRequest_TYPE_CREDIT_CARD_STORE;

	const TYPE_UPGRADE_ACCOUNT = MegaRequest_TYPE_UPGRADE_ACCOUNT;

	const TYPE_CREDIT_CARD_QUERY_SUBSCRIPTIONS = MegaRequest_TYPE_CREDIT_CARD_QUERY_SUBSCRIPTIONS;

	const TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS = MegaRequest_TYPE_CREDIT_CARD_CANCEL_SUBSCRIPTIONS;

	const TYPE_GET_SESSION_TRANSFER_URL = MegaRequest_TYPE_GET_SESSION_TRANSFER_URL;

	const TYPE_GET_PAYMENT_METHODS = MegaRequest_TYPE_GET_PAYMENT_METHODS;

	const TYPE_INVITE_CONTACT = MegaRequest_TYPE_INVITE_CONTACT;

	const TYPE_REPLY_CONTACT_REQUEST = MegaRequest_TYPE_REPLY_CONTACT_REQUEST;

	const TYPE_SUBMIT_FEEDBACK = MegaRequest_TYPE_SUBMIT_FEEDBACK;

	const TYPE_SEND_EVENT = MegaRequest_TYPE_SEND_EVENT;

	const TYPE_CLEAN_RUBBISH_BIN = MegaRequest_TYPE_CLEAN_RUBBISH_BIN;

	const TYPE_SET_ATTR_NODE = MegaRequest_TYPE_SET_ATTR_NODE;

	const TYPE_CHAT_CREATE = MegaRequest_TYPE_CHAT_CREATE;

	const TYPE_CHAT_FETCH = MegaRequest_TYPE_CHAT_FETCH;

	const TYPE_CHAT_INVITE = MegaRequest_TYPE_CHAT_INVITE;

	const TYPE_CHAT_REMOVE = MegaRequest_TYPE_CHAT_REMOVE;

	const TYPE_CHAT_URL = MegaRequest_TYPE_CHAT_URL;

	const TYPE_CHAT_GRANT_ACCESS = MegaRequest_TYPE_CHAT_GRANT_ACCESS;

	const TYPE_CHAT_REMOVE_ACCESS = MegaRequest_TYPE_CHAT_REMOVE_ACCESS;

	const TYPE_USE_HTTPS_ONLY = MegaRequest_TYPE_USE_HTTPS_ONLY;

	const TYPE_SET_PROXY = MegaRequest_TYPE_SET_PROXY;

	const TYPE_GET_RECOVERY_LINK = MegaRequest_TYPE_GET_RECOVERY_LINK;

	const TYPE_QUERY_RECOVERY_LINK = MegaRequest_TYPE_QUERY_RECOVERY_LINK;

	const TYPE_CONFIRM_RECOVERY_LINK = MegaRequest_TYPE_CONFIRM_RECOVERY_LINK;

	const TYPE_GET_CANCEL_LINK = MegaRequest_TYPE_GET_CANCEL_LINK;

	const TYPE_CONFIRM_CANCEL_LINK = MegaRequest_TYPE_CONFIRM_CANCEL_LINK;

	const TYPE_GET_CHANGE_EMAIL_LINK = MegaRequest_TYPE_GET_CHANGE_EMAIL_LINK;

	const TYPE_CONFIRM_CHANGE_EMAIL_LINK = MegaRequest_TYPE_CONFIRM_CHANGE_EMAIL_LINK;

	const TYPE_CHAT_UPDATE_PERMISSIONS = MegaRequest_TYPE_CHAT_UPDATE_PERMISSIONS;

	const TYPE_CHAT_TRUNCATE = MegaRequest_TYPE_CHAT_TRUNCATE;

	function copy() {
		$r=MegaRequest_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaRequest($r);
		}
		return $r;
	}

	function getType() {
		return MegaRequest_getType($this->_cPtr);
	}

	function getRequestString() {
		return MegaRequest_getRequestString($this->_cPtr);
	}

	function toString() {
		return MegaRequest_toString($this->_cPtr);
	}

	function __str__() {
		return MegaRequest___str__($this->_cPtr);
	}

	function __toString() {
		return MegaRequest___toString($this->_cPtr);
	}

	function getNodeHandle() {
		return MegaRequest_getNodeHandle($this->_cPtr);
	}

	function getLink() {
		return MegaRequest_getLink($this->_cPtr);
	}

	function getParentHandle() {
		return MegaRequest_getParentHandle($this->_cPtr);
	}

	function getSessionKey() {
		return MegaRequest_getSessionKey($this->_cPtr);
	}

	function getName() {
		return MegaRequest_getName($this->_cPtr);
	}

	function getEmail() {
		return MegaRequest_getEmail($this->_cPtr);
	}

	function getPassword() {
		return MegaRequest_getPassword($this->_cPtr);
	}

	function getNewPassword() {
		return MegaRequest_getNewPassword($this->_cPtr);
	}

	function getPrivateKey() {
		return MegaRequest_getPrivateKey($this->_cPtr);
	}

	function getAccess() {
		return MegaRequest_getAccess($this->_cPtr);
	}

	function getFile() {
		return MegaRequest_getFile($this->_cPtr);
	}

	function getNumRetry() {
		return MegaRequest_getNumRetry($this->_cPtr);
	}

	function getPublicNode() {
		$r=MegaRequest_getPublicNode($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getPublicMegaNode() {
		$r=MegaRequest_getPublicMegaNode($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getParamType() {
		return MegaRequest_getParamType($this->_cPtr);
	}

	function getText() {
		return MegaRequest_getText($this->_cPtr);
	}

	function getNumber() {
		return MegaRequest_getNumber($this->_cPtr);
	}

	function getFlag() {
		return MegaRequest_getFlag($this->_cPtr);
	}

	function getTransferredBytes() {
		return MegaRequest_getTransferredBytes($this->_cPtr);
	}

	function getTotalBytes() {
		return MegaRequest_getTotalBytes($this->_cPtr);
	}

	function getMegaAccountDetails() {
		$r=MegaRequest_getMegaAccountDetails($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaAccountDetails($r);
		}
		return $r;
	}

	function getPricing() {
		$r=MegaRequest_getPricing($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaPricing($r);
		}
		return $r;
	}

	function getTransferTag() {
		return MegaRequest_getTransferTag($this->_cPtr);
	}

	function getNumDetails() {
		return MegaRequest_getNumDetails($this->_cPtr);
	}

	function getTag() {
		return MegaRequest_getTag($this->_cPtr);
	}

	function getMegaStringMap() {
		$r=MegaRequest_getMegaStringMap($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaStringMap($r);
		}
		return $r;
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaRequest') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaRequest();
	}
}

class MegaTransfer {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const TYPE_DOWNLOAD = 0;

	const TYPE_UPLOAD = MegaTransfer_TYPE_UPLOAD;

	const TYPE_LOCAL_HTTP_DOWNLOAD = MegaTransfer_TYPE_LOCAL_HTTP_DOWNLOAD;

	function copy() {
		$r=MegaTransfer_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaTransfer($r);
		}
		return $r;
	}

	function getType() {
		return MegaTransfer_getType($this->_cPtr);
	}

	function getTransferString() {
		return MegaTransfer_getTransferString($this->_cPtr);
	}

	function toString() {
		return MegaTransfer_toString($this->_cPtr);
	}

	function __str__() {
		return MegaTransfer___str__($this->_cPtr);
	}

	function __toString() {
		return MegaTransfer___toString($this->_cPtr);
	}

	function getStartTime() {
		return MegaTransfer_getStartTime($this->_cPtr);
	}

	function getTransferredBytes() {
		return MegaTransfer_getTransferredBytes($this->_cPtr);
	}

	function getTotalBytes() {
		return MegaTransfer_getTotalBytes($this->_cPtr);
	}

	function getPath() {
		return MegaTransfer_getPath($this->_cPtr);
	}

	function getParentPath() {
		return MegaTransfer_getParentPath($this->_cPtr);
	}

	function getNodeHandle() {
		return MegaTransfer_getNodeHandle($this->_cPtr);
	}

	function getParentHandle() {
		return MegaTransfer_getParentHandle($this->_cPtr);
	}

	function getStartPos() {
		return MegaTransfer_getStartPos($this->_cPtr);
	}

	function getEndPos() {
		return MegaTransfer_getEndPos($this->_cPtr);
	}

	function getFileName() {
		return MegaTransfer_getFileName($this->_cPtr);
	}

	function getNumRetry() {
		return MegaTransfer_getNumRetry($this->_cPtr);
	}

	function getMaxRetries() {
		return MegaTransfer_getMaxRetries($this->_cPtr);
	}

	function getTag() {
		return MegaTransfer_getTag($this->_cPtr);
	}

	function getSpeed() {
		return MegaTransfer_getSpeed($this->_cPtr);
	}

	function getDeltaSize() {
		return MegaTransfer_getDeltaSize($this->_cPtr);
	}

	function getUpdateTime() {
		return MegaTransfer_getUpdateTime($this->_cPtr);
	}

	function getPublicMegaNode() {
		$r=MegaTransfer_getPublicMegaNode($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function isSyncTransfer() {
		return MegaTransfer_isSyncTransfer($this->_cPtr);
	}

	function isStreamingTransfer() {
		return MegaTransfer_isStreamingTransfer($this->_cPtr);
	}

	function getLastBytes() {
		return MegaTransfer_getLastBytes($this->_cPtr);
	}

	function isFolderTransfer() {
		return MegaTransfer_isFolderTransfer($this->_cPtr);
	}

	function getFolderTransferTag() {
		return MegaTransfer_getFolderTransferTag($this->_cPtr);
	}

	function getAppData() {
		return MegaTransfer_getAppData($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaTransfer') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaTransfer();
	}
}

class MegaContactRequest {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const STATUS_UNRESOLVED = 0;

	const STATUS_ACCEPTED = MegaContactRequest_STATUS_ACCEPTED;

	const STATUS_DENIED = MegaContactRequest_STATUS_DENIED;

	const STATUS_IGNORED = MegaContactRequest_STATUS_IGNORED;

	const STATUS_DELETED = MegaContactRequest_STATUS_DELETED;

	const STATUS_REMINDED = MegaContactRequest_STATUS_REMINDED;

	const REPLY_ACTION_ACCEPT = 0;

	const REPLY_ACTION_DENY = MegaContactRequest_REPLY_ACTION_DENY;

	const REPLY_ACTION_IGNORE = MegaContactRequest_REPLY_ACTION_IGNORE;

	const INVITE_ACTION_ADD = 0;

	const INVITE_ACTION_DELETE = MegaContactRequest_INVITE_ACTION_DELETE;

	const INVITE_ACTION_REMIND = MegaContactRequest_INVITE_ACTION_REMIND;

	function copy() {
		$r=MegaContactRequest_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaContactRequest($r);
		}
		return $r;
	}

	function getHandle() {
		return MegaContactRequest_getHandle($this->_cPtr);
	}

	function getSourceEmail() {
		return MegaContactRequest_getSourceEmail($this->_cPtr);
	}

	function getSourceMessage() {
		return MegaContactRequest_getSourceMessage($this->_cPtr);
	}

	function getTargetEmail() {
		return MegaContactRequest_getTargetEmail($this->_cPtr);
	}

	function getCreationTime() {
		return MegaContactRequest_getCreationTime($this->_cPtr);
	}

	function getModificationTime() {
		return MegaContactRequest_getModificationTime($this->_cPtr);
	}

	function getStatus() {
		return MegaContactRequest_getStatus($this->_cPtr);
	}

	function isOutgoing() {
		return MegaContactRequest_isOutgoing($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaContactRequest') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaContactRequest();
	}
}

class MegaError {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const API_OK = 0;

	const API_EINTERNAL = -1;

	const API_EARGS = -2;

	const API_EAGAIN = -3;

	const API_ERATELIMIT = -4;

	const API_EFAILED = -5;

	const API_ETOOMANY = -6;

	const API_ERANGE = -7;

	const API_EEXPIRED = -8;

	const API_ENOENT = -9;

	const API_ECIRCULAR = -10;

	const API_EACCESS = -11;

	const API_EEXIST = -12;

	const API_EINCOMPLETE = -13;

	const API_EKEY = -14;

	const API_ESID = -15;

	const API_EBLOCKED = -16;

	const API_EOVERQUOTA = -17;

	const API_ETEMPUNAVAIL = -18;

	const API_ETOOMANYCONNECTIONS = -19;

	const API_EWRITE = -20;

	const API_EREAD = -21;

	const API_EAPPKEY = -22;

	const API_ESSL = -23;

	const PAYMENT_ECARD = -101;

	const PAYMENT_EBILLING = -102;

	const PAYMENT_EFRAUD = -103;

	const PAYMENT_ETOOMANY = -104;

	const PAYMENT_EBALANCE = -105;

	const PAYMENT_EGENERIC = -106;

	function __construct($errorCode_or_megaError=null,$value=null) {
		if (is_resource($errorCode_or_megaError) && get_resource_type($errorCode_or_megaError) === '_p_mega__MegaError') {
			$this->_cPtr=$errorCode_or_megaError;
			return;
		}
		switch (func_num_args()) {
		case 0: $this->_cPtr=new_MegaError(); break;
		case 1: $this->_cPtr=new_MegaError($errorCode_or_megaError); break;
		default: $this->_cPtr=new_MegaError($errorCode_or_megaError,$value);
		}
	}

	function copy() {
		$r=MegaError_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaError($r);
		}
		return $r;
	}

	function getErrorCode() {
		return MegaError_getErrorCode($this->_cPtr);
	}

	function getValue() {
		return MegaError_getValue($this->_cPtr);
	}

	function toString() {
		return MegaError_toString($this->_cPtr);
	}

	function __str__() {
		return MegaError___str__($this->_cPtr);
	}

	function __toString() {
		return MegaError___toString($this->_cPtr);
	}

	static function getErrorString($self_or_errorCode) {
		return MegaError_getErrorString($self_or_errorCode);
	}
}

class MegaTreeProcessor {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function processMegaNode($node) {
		return MegaTreeProcessor_processMegaNode($this->_cPtr,$node);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaTreeProcessor') {
			$this->_cPtr=$res;
			return;
		}
		if (get_class($this) === 'MegaTreeProcessor') {
			$_this = null;
		} else {
			$_this = $this;
		}
		$this->_cPtr=new_MegaTreeProcessor($_this);
	}
}

class MegaRequestListener {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function onRequestStart($api,$request) {
		MegaRequestListener_onRequestStart($this->_cPtr,$api,$request);
	}

	function onRequestFinish($api,$request,$e) {
		MegaRequestListener_onRequestFinish($this->_cPtr,$api,$request,$e);
	}

	function onRequestUpdate($api,$request) {
		MegaRequestListener_onRequestUpdate($this->_cPtr,$api,$request);
	}

	function onRequestTemporaryError($api,$request,$error) {
		MegaRequestListener_onRequestTemporaryError($this->_cPtr,$api,$request,$error);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaRequestListener') {
			$this->_cPtr=$res;
			return;
		}
		if (get_class($this) === 'MegaRequestListener') {
			$_this = null;
		} else {
			$_this = $this;
		}
		$this->_cPtr=new_MegaRequestListener($_this);
	}
}

class MegaTransferListener {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function onTransferStart($api,$transfer) {
		MegaTransferListener_onTransferStart($this->_cPtr,$api,$transfer);
	}

	function onTransferFinish($api,$transfer,$error) {
		MegaTransferListener_onTransferFinish($this->_cPtr,$api,$transfer,$error);
	}

	function onTransferUpdate($api,$transfer) {
		MegaTransferListener_onTransferUpdate($this->_cPtr,$api,$transfer);
	}

	function onTransferTemporaryError($api,$transfer,$error) {
		MegaTransferListener_onTransferTemporaryError($this->_cPtr,$api,$transfer,$error);
	}

	function onTransferData($api,$transfer,$buffer,$size) {
		return MegaTransferListener_onTransferData($this->_cPtr,$api,$transfer,$buffer,$size);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaTransferListener') {
			$this->_cPtr=$res;
			return;
		}
		if (get_class($this) === 'MegaTransferListener') {
			$_this = null;
		} else {
			$_this = $this;
		}
		$this->_cPtr=new_MegaTransferListener($_this);
	}
}

class MegaGlobalListener {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function onUsersUpdate($api,$users) {
		MegaGlobalListener_onUsersUpdate($this->_cPtr,$api,$users);
	}

	function onNodesUpdate($api,$nodes) {
		MegaGlobalListener_onNodesUpdate($this->_cPtr,$api,$nodes);
	}

	function onAccountUpdate($api) {
		MegaGlobalListener_onAccountUpdate($this->_cPtr,$api);
	}

	function onContactRequestsUpdate($api,$requests) {
		MegaGlobalListener_onContactRequestsUpdate($this->_cPtr,$api,$requests);
	}

	function onReloadNeeded($api) {
		MegaGlobalListener_onReloadNeeded($this->_cPtr,$api);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaGlobalListener') {
			$this->_cPtr=$res;
			return;
		}
		if (get_class($this) === 'MegaGlobalListener') {
			$_this = null;
		} else {
			$_this = $this;
		}
		$this->_cPtr=new_MegaGlobalListener($_this);
	}
}

class MegaListener {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function onRequestStart($api,$request) {
		MegaListener_onRequestStart($this->_cPtr,$api,$request);
	}

	function onRequestFinish($api,$request,$e) {
		MegaListener_onRequestFinish($this->_cPtr,$api,$request,$e);
	}

	function onRequestUpdate($api,$request) {
		MegaListener_onRequestUpdate($this->_cPtr,$api,$request);
	}

	function onRequestTemporaryError($api,$request,$error) {
		MegaListener_onRequestTemporaryError($this->_cPtr,$api,$request,$error);
	}

	function onTransferStart($api,$transfer) {
		MegaListener_onTransferStart($this->_cPtr,$api,$transfer);
	}

	function onTransferFinish($api,$transfer,$error) {
		MegaListener_onTransferFinish($this->_cPtr,$api,$transfer,$error);
	}

	function onTransferUpdate($api,$transfer) {
		MegaListener_onTransferUpdate($this->_cPtr,$api,$transfer);
	}

	function onTransferTemporaryError($api,$transfer,$error) {
		MegaListener_onTransferTemporaryError($this->_cPtr,$api,$transfer,$error);
	}

	function onUsersUpdate($api,$users) {
		MegaListener_onUsersUpdate($this->_cPtr,$api,$users);
	}

	function onNodesUpdate($api,$nodes) {
		MegaListener_onNodesUpdate($this->_cPtr,$api,$nodes);
	}

	function onAccountUpdate($api) {
		MegaListener_onAccountUpdate($this->_cPtr,$api);
	}

	function onContactRequestsUpdate($api,$requests) {
		MegaListener_onContactRequestsUpdate($this->_cPtr,$api,$requests);
	}

	function onReloadNeeded($api) {
		MegaListener_onReloadNeeded($this->_cPtr,$api);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaListener') {
			$this->_cPtr=$res;
			return;
		}
		if (get_class($this) === 'MegaListener') {
			$_this = null;
		} else {
			$_this = $this;
		}
		$this->_cPtr=new_MegaListener($_this);
	}
}

class MegaInputStream {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function getSize() {
		return MegaInputStream_getSize($this->_cPtr);
	}

	function read($buffer,$size) {
		return MegaInputStream_read($this->_cPtr,$buffer,$size);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaInputStream') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaInputStream();
	}
}

class MegaApi {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const STATE_NONE = 0;

	const STATE_SYNCED = MegaApi_STATE_SYNCED;

	const STATE_PENDING = MegaApi_STATE_PENDING;

	const STATE_SYNCING = MegaApi_STATE_SYNCING;

	const STATE_IGNORED = MegaApi_STATE_IGNORED;

	const LOG_LEVEL_FATAL = 0;

	const LOG_LEVEL_ERROR = MegaApi_LOG_LEVEL_ERROR;

	const LOG_LEVEL_WARNING = MegaApi_LOG_LEVEL_WARNING;

	const LOG_LEVEL_INFO = MegaApi_LOG_LEVEL_INFO;

	const LOG_LEVEL_DEBUG = MegaApi_LOG_LEVEL_DEBUG;

	const LOG_LEVEL_MAX = MegaApi_LOG_LEVEL_MAX;

	const ATTR_TYPE_THUMBNAIL = 0;

	const ATTR_TYPE_PREVIEW = 1;

	const USER_ATTR_AVATAR = 0;

	const USER_ATTR_FIRSTNAME = 1;

	const USER_ATTR_LASTNAME = 2;

	const USER_ATTR_AUTHRING = 3;

	const USER_ATTR_LAST_INTERACTION = 4;

	const USER_ATTR_ED25519_PUBLIC_KEY = 5;

	const USER_ATTR_CU25519_PUBLIC_KEY = 6;

	const USER_ATTR_KEYRING = 7;

	const USER_ATTR_SIG_RSA_PUBLIC_KEY = 8;

	const USER_ATTR_SIG_CU255_PUBLIC_KEY = 9;

	const NODE_ATTR_DURATION = 0;

	const NODE_ATTR_COORDINATES = 1;

	const PAYMENT_METHOD_BALANCE = 0;

	const PAYMENT_METHOD_PAYPAL = 1;

	const PAYMENT_METHOD_ITUNES = 2;

	const PAYMENT_METHOD_GOOGLE_WALLET = 3;

	const PAYMENT_METHOD_BITCOIN = 4;

	const PAYMENT_METHOD_UNIONPAY = 5;

	const PAYMENT_METHOD_FORTUMO = 6;

	const PAYMENT_METHOD_CREDIT_CARD = 8;

	const PAYMENT_METHOD_CENTILI = 9;

	const PAYMENT_METHOD_WINDOWS_STORE = 13;

	const TRANSFER_METHOD_NORMAL = 0;

	const TRANSFER_METHOD_ALTERNATIVE_PORT = 1;

	const TRANSFER_METHOD_AUTO = 2;

	const TRANSFER_METHOD_AUTO_NORMAL = 3;

	const TRANSFER_METHOD_AUTO_ALTERNATIVE = 4;

	function __construct($appKey,$basePath_or_processor=null,$userAgent_or_basePath=null,$userAgent=null) {
		if (is_resource($appKey) && get_resource_type($appKey) === '_p_mega__MegaApi') {
			$this->_cPtr=$appKey;
			return;
		}
		switch (func_num_args()) {
		case 1: $this->_cPtr=new_MegaApi($appKey); break;
		case 2: $this->_cPtr=new_MegaApi($appKey,$basePath_or_processor); break;
		case 3: $this->_cPtr=new_MegaApi($appKey,$basePath_or_processor,$userAgent_or_basePath); break;
		default: $this->_cPtr=new_MegaApi($appKey,$basePath_or_processor,$userAgent_or_basePath,$userAgent);
		}
	}

	function addListener($listener) {
		MegaApi_addListener($this->_cPtr,$listener);
	}

	function addRequestListener($listener) {
		MegaApi_addRequestListener($this->_cPtr,$listener);
	}

	function addTransferListener($listener) {
		MegaApi_addTransferListener($this->_cPtr,$listener);
	}

	function addGlobalListener($listener) {
		MegaApi_addGlobalListener($this->_cPtr,$listener);
	}

	function removeListener($listener) {
		MegaApi_removeListener($this->_cPtr,$listener);
	}

	function removeRequestListener($listener) {
		MegaApi_removeRequestListener($this->_cPtr,$listener);
	}

	function removeTransferListener($listener) {
		MegaApi_removeTransferListener($this->_cPtr,$listener);
	}

	function removeGlobalListener($listener) {
		MegaApi_removeGlobalListener($this->_cPtr,$listener);
	}

	function getCurrentRequest() {
		$r=MegaApi_getCurrentRequest($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaRequest($r);
		}
		return $r;
	}

	function getCurrentTransfer() {
		$r=MegaApi_getCurrentTransfer($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaTransfer($r);
		}
		return $r;
	}

	function getCurrentError() {
		$r=MegaApi_getCurrentError($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaError($r);
		}
		return $r;
	}

	function getCurrentNodes() {
		$r=MegaApi_getCurrentNodes($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNodeList($r);
		}
		return $r;
	}

	function getCurrentUsers() {
		$r=MegaApi_getCurrentUsers($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaUserList($r);
		}
		return $r;
	}

	function getBase64PwKey($password) {
		return MegaApi_getBase64PwKey($this->_cPtr,$password);
	}

	function getStringHash($base64pwkey,$email) {
		return MegaApi_getStringHash($this->_cPtr,$base64pwkey,$email);
	}

	function getSessionTransferURL($path,$listener=null) {
		MegaApi_getSessionTransferURL($this->_cPtr,$path,$listener);
	}

	static function base32ToHandle($base32Handle) {
		return MegaApi_base32ToHandle($base32Handle);
	}

	static function base64ToHandle($base64Handle) {
		return MegaApi_base64ToHandle($base64Handle);
	}

	static function handleToBase64($handle) {
		return MegaApi_handleToBase64($handle);
	}

	static function userHandleToBase64($handle) {
		return MegaApi_userHandleToBase64($handle);
	}

	static function addEntropy($data,$size) {
		MegaApi_addEntropy($data,$size);
	}

	function retryPendingConnections($disconnect=false,$includexfers=false,$listener=null) {
		MegaApi_retryPendingConnections($this->_cPtr,$disconnect,$includexfers,$listener);
	}

	function login($email,$password,$listener=null) {
		MegaApi_login($this->_cPtr,$email,$password,$listener);
	}

	function loginToFolder($megaFolderLink,$listener=null) {
		MegaApi_loginToFolder($this->_cPtr,$megaFolderLink,$listener);
	}

	function fastLogin($email_or_session,$stringHash_or_listener=null,$base64pwkey=null,$listener=null) {
		switch (func_num_args()) {
		case 1: case 2: MegaApi_fastLogin($this->_cPtr,$email_or_session,$stringHash_or_listener); break;
		default: MegaApi_fastLogin($this->_cPtr,$email_or_session,$stringHash_or_listener,$base64pwkey,$listener);
		}
	}

	function killSession($sessionHandle,$listener=null) {
		MegaApi_killSession($this->_cPtr,$sessionHandle,$listener);
	}

	function getUserData($listener_or_user=null,$listener=null) {
		switch (func_num_args()) {
		case 0: MegaApi_getUserData($this->_cPtr); break;
		case 1: MegaApi_getUserData($this->_cPtr,$listener_or_user); break;
		default: MegaApi_getUserData($this->_cPtr,$listener_or_user,$listener);
		}
	}

	function dumpSession() {
		return MegaApi_dumpSession($this->_cPtr);
	}

	function dumpXMPPSession() {
		return MegaApi_dumpXMPPSession($this->_cPtr);
	}

	function getAccountAuth() {
		return MegaApi_getAccountAuth($this->_cPtr);
	}

	function setAccountAuth($auth) {
		MegaApi_setAccountAuth($this->_cPtr,$auth);
	}

	function createAccount($email,$password,$name_or_firstname,$listener_or_lastname=null,$listener=null) {
		switch (func_num_args()) {
		case 3: MegaApi_createAccount($this->_cPtr,$email,$password,$name_or_firstname); break;
		case 4: MegaApi_createAccount($this->_cPtr,$email,$password,$name_or_firstname,$listener_or_lastname); break;
		default: MegaApi_createAccount($this->_cPtr,$email,$password,$name_or_firstname,$listener_or_lastname,$listener);
		}
	}

	function fastCreateAccount($email,$base64pwkey,$name,$listener=null) {
		MegaApi_fastCreateAccount($this->_cPtr,$email,$base64pwkey,$name,$listener);
	}

	function querySignupLink($link,$listener=null) {
		MegaApi_querySignupLink($this->_cPtr,$link,$listener);
	}

	function confirmAccount($link,$password,$listener=null) {
		MegaApi_confirmAccount($this->_cPtr,$link,$password,$listener);
	}

	function fastConfirmAccount($link,$base64pwkey,$listener=null) {
		MegaApi_fastConfirmAccount($this->_cPtr,$link,$base64pwkey,$listener);
	}

	function resetPassword($email,$hasMasterKey,$listener=null) {
		MegaApi_resetPassword($this->_cPtr,$email,$hasMasterKey,$listener);
	}

	function queryResetPasswordLink($link,$listener=null) {
		MegaApi_queryResetPasswordLink($this->_cPtr,$link,$listener);
	}

	function confirmResetPassword($link,$newPwd,$masterKey=null,$listener=null) {
		switch (func_num_args()) {
		case 2: MegaApi_confirmResetPassword($this->_cPtr,$link,$newPwd); break;
		default: MegaApi_confirmResetPassword($this->_cPtr,$link,$newPwd,$masterKey,$listener);
		}
	}

	function cancelAccount($listener=null) {
		MegaApi_cancelAccount($this->_cPtr,$listener);
	}

	function confirmCancelAccount($link,$pwd,$listener=null) {
		MegaApi_confirmCancelAccount($this->_cPtr,$link,$pwd,$listener);
	}

	function changeEmail($email,$listener=null) {
		MegaApi_changeEmail($this->_cPtr,$email,$listener);
	}

	function queryChangeEmailLink($link,$listener=null) {
		MegaApi_queryChangeEmailLink($this->_cPtr,$link,$listener);
	}

	function confirmChangeEmail($link,$pwd,$listener=null) {
		MegaApi_confirmChangeEmail($this->_cPtr,$link,$pwd,$listener);
	}

	function setProxySettings($proxySettings) {
		MegaApi_setProxySettings($this->_cPtr,$proxySettings);
	}

	function getAutoProxySettings() {
		$r=MegaApi_getAutoProxySettings($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaProxy($r);
		}
		return $r;
	}

	function isLoggedIn() {
		return MegaApi_isLoggedIn($this->_cPtr);
	}

	function getMyEmail() {
		return MegaApi_getMyEmail($this->_cPtr);
	}

	function getMyUserHandle() {
		return MegaApi_getMyUserHandle($this->_cPtr);
	}

	function getMyUser() {
		$r=MegaApi_getMyUser($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaUser($r);
		}
		return $r;
	}

	function getMyXMPPJid() {
		return MegaApi_getMyXMPPJid($this->_cPtr);
	}

	static function setLogLevel($logLevel) {
		MegaApi_setLogLevel($logLevel);
	}

	static function setLoggerObject($megaLogger) {
		MegaApi_setLoggerObject($megaLogger);
	}

	static function log($logLevel,$message,$filename="",$line=-1) {
		MegaApi_log($logLevel,$message,$filename,$line);
	}

	function createFolder($name,$parent,$listener=null) {
		MegaApi_createFolder($this->_cPtr,$name,$parent,$listener);
	}

	function moveNode($node,$newParent,$listener=null) {
		MegaApi_moveNode($this->_cPtr,$node,$newParent,$listener);
	}

	function copyNode($node,$newParent,$listener_or_newName=null,$listener=null) {
		switch (func_num_args()) {
		case 2: MegaApi_copyNode($this->_cPtr,$node,$newParent); break;
		case 3: MegaApi_copyNode($this->_cPtr,$node,$newParent,$listener_or_newName); break;
		default: MegaApi_copyNode($this->_cPtr,$node,$newParent,$listener_or_newName,$listener);
		}
	}

	function renameNode($node,$newName,$listener=null) {
		MegaApi_renameNode($this->_cPtr,$node,$newName,$listener);
	}

	function remove($node,$listener=null) {
		MegaApi_remove($this->_cPtr,$node,$listener);
	}

	function cleanRubbishBin($listener=null) {
		MegaApi_cleanRubbishBin($this->_cPtr,$listener);
	}

	function sendFileToUser($node,$user_or_email,$listener=null) {
		MegaApi_sendFileToUser($this->_cPtr,$node,$user_or_email,$listener);
	}

	function share($node,$user_or_email,$level,$listener=null) {
		MegaApi_share($this->_cPtr,$node,$user_or_email,$level,$listener);
	}

	function importFileLink($megaFileLink,$parent,$listener=null) {
		MegaApi_importFileLink($this->_cPtr,$megaFileLink,$parent,$listener);
	}

	function getPublicNode($megaFileLink,$listener=null) {
		MegaApi_getPublicNode($this->_cPtr,$megaFileLink,$listener);
	}

	function getThumbnail($node,$dstFilePath,$listener=null) {
		MegaApi_getThumbnail($this->_cPtr,$node,$dstFilePath,$listener);
	}

	function getPreview($node,$dstFilePath,$listener=null) {
		MegaApi_getPreview($this->_cPtr,$node,$dstFilePath,$listener);
	}

	function getUserAvatar($user_or_email_or_handle_or_dstFilePath,$dstFilePath_or_listener=null,$listener=null) {
		MegaApi_getUserAvatar($this->_cPtr,$user_or_email_or_handle_or_dstFilePath,$dstFilePath_or_listener,$listener);
	}

	function getUserAvatarColor($user_or_userhandle) {
		return MegaApi_getUserAvatarColor($this->_cPtr,$user_or_userhandle);
	}

	function getUserAttribute($user_or_email_or_handle_or_type,$type_or_listener=null,$listener=null) {
		MegaApi_getUserAttribute($this->_cPtr,$user_or_email_or_handle_or_type,$type_or_listener,$listener);
	}

	function cancelGetThumbnail($node,$listener=null) {
		MegaApi_cancelGetThumbnail($this->_cPtr,$node,$listener);
	}

	function cancelGetPreview($node,$listener=null) {
		MegaApi_cancelGetPreview($this->_cPtr,$node,$listener);
	}

	function setThumbnail($node,$srcFilePath,$listener=null) {
		MegaApi_setThumbnail($this->_cPtr,$node,$srcFilePath,$listener);
	}

	function setPreview($node,$srcFilePath,$listener=null) {
		MegaApi_setPreview($this->_cPtr,$node,$srcFilePath,$listener);
	}

	function setAvatar($srcFilePath,$listener=null) {
		MegaApi_setAvatar($this->_cPtr,$srcFilePath,$listener);
	}

	function setUserAttribute($type,$value,$listener=null) {
		MegaApi_setUserAttribute($this->_cPtr,$type,$value,$listener);
	}

	function setCustomNodeAttribute($node,$attrName,$value,$listener=null) {
		MegaApi_setCustomNodeAttribute($this->_cPtr,$node,$attrName,$value,$listener);
	}

	function setNodeDuration($node,$duration,$listener=null) {
		MegaApi_setNodeDuration($this->_cPtr,$node,$duration,$listener);
	}

	function setNodeCoordinates($node,$latitude,$longitude,$listener=null) {
		MegaApi_setNodeCoordinates($this->_cPtr,$node,$latitude,$longitude,$listener);
	}

	function exportNode($node,$listener_or_expireTime=null,$listener=null) {
		switch (func_num_args()) {
		case 1: MegaApi_exportNode($this->_cPtr,$node); break;
		case 2: MegaApi_exportNode($this->_cPtr,$node,$listener_or_expireTime); break;
		default: MegaApi_exportNode($this->_cPtr,$node,$listener_or_expireTime,$listener);
		}
	}

	function disableExport($node,$listener=null) {
		MegaApi_disableExport($this->_cPtr,$node,$listener);
	}

	function fetchNodes($listener=null) {
		MegaApi_fetchNodes($this->_cPtr,$listener);
	}

	function getAccountDetails($listener=null) {
		MegaApi_getAccountDetails($this->_cPtr,$listener);
	}

	function getExtendedAccountDetails($sessions=false,$purchases=false,$transactions=false,$listener=null) {
		MegaApi_getExtendedAccountDetails($this->_cPtr,$sessions,$purchases,$transactions,$listener);
	}

	function getPricing($listener=null) {
		MegaApi_getPricing($this->_cPtr,$listener);
	}

	function getPaymentId($productHandle,$listener=null) {
		MegaApi_getPaymentId($this->_cPtr,$productHandle,$listener);
	}

	function upgradeAccount($productHandle,$paymentMethod,$listener=null) {
		MegaApi_upgradeAccount($this->_cPtr,$productHandle,$paymentMethod,$listener);
	}

	function submitPurchaseReceipt($receipt_or_gateway,$listener_or_receipt=null,$listener=null) {
		switch (func_num_args()) {
		case 1: MegaApi_submitPurchaseReceipt($this->_cPtr,$receipt_or_gateway); break;
		case 2: MegaApi_submitPurchaseReceipt($this->_cPtr,$receipt_or_gateway,$listener_or_receipt); break;
		default: MegaApi_submitPurchaseReceipt($this->_cPtr,$receipt_or_gateway,$listener_or_receipt,$listener);
		}
	}

	function creditCardStore($address1,$address2,$city,$province,$country,$postalcode,$firstname,$lastname,$creditcard,$expire_month,$expire_year,$cv2,$listener=null) {
		MegaApi_creditCardStore($this->_cPtr,$address1,$address2,$city,$province,$country,$postalcode,$firstname,$lastname,$creditcard,$expire_month,$expire_year,$cv2,$listener);
	}

	function creditCardQuerySubscriptions($listener=null) {
		MegaApi_creditCardQuerySubscriptions($this->_cPtr,$listener);
	}

	function creditCardCancelSubscriptions($reason,$listener=null) {
		MegaApi_creditCardCancelSubscriptions($this->_cPtr,$reason,$listener);
	}

	function getPaymentMethods($listener=null) {
		MegaApi_getPaymentMethods($this->_cPtr,$listener);
	}

	function exportMasterKey() {
		return MegaApi_exportMasterKey($this->_cPtr);
	}

	function changePassword($oldPassword,$newPassword,$listener=null) {
		MegaApi_changePassword($this->_cPtr,$oldPassword,$newPassword,$listener);
	}

	function inviteContact($email,$message,$action,$listener=null) {
		MegaApi_inviteContact($this->_cPtr,$email,$message,$action,$listener);
	}

	function replyContactRequest($request,$action,$listener=null) {
		MegaApi_replyContactRequest($this->_cPtr,$request,$action,$listener);
	}

	function removeContact($user,$listener=null) {
		MegaApi_removeContact($this->_cPtr,$user,$listener);
	}

	function logout($listener=null) {
		MegaApi_logout($this->_cPtr,$listener);
	}

	function localLogout($listener=null) {
		MegaApi_localLogout($this->_cPtr,$listener);
	}

	function submitFeedback($rating,$comment,$listener=null) {
		MegaApi_submitFeedback($this->_cPtr,$rating,$comment,$listener);
	}

	function sendEvent($eventType,$message,$listener=null) {
		MegaApi_sendEvent($this->_cPtr,$eventType,$message,$listener);
	}

	function reportDebugEvent($text,$listener=null) {
		MegaApi_reportDebugEvent($this->_cPtr,$text,$listener);
	}

	function useHttpsOnly($httpsOnly) {
		MegaApi_useHttpsOnly($this->_cPtr,$httpsOnly);
	}

	function usingHttpsOnly() {
		return MegaApi_usingHttpsOnly($this->_cPtr);
	}

	function startUploadWithData($localPath,$parent,$appData,$listener_or_isSourceTemporary=null,$listener=null) {
		switch (func_num_args()) {
		case 3: MegaApi_startUploadWithData($this->_cPtr,$localPath,$parent,$appData); break;
		case 4: MegaApi_startUploadWithData($this->_cPtr,$localPath,$parent,$appData,$listener_or_isSourceTemporary); break;
		default: MegaApi_startUploadWithData($this->_cPtr,$localPath,$parent,$appData,$listener_or_isSourceTemporary,$listener);
		}
	}

	function startUpload($localPath,$parent,$listener_or_mtime=null,$isSourceTemporary=null,$listener=null) {
		switch (func_num_args()) {
		case 2: MegaApi_startUpload($this->_cPtr,$localPath,$parent); break;
		case 3: MegaApi_startUpload($this->_cPtr,$localPath,$parent,$listener_or_mtime); break;
		case 4: MegaApi_startUpload($this->_cPtr,$localPath,$parent,$listener_or_mtime,$isSourceTemporary); break;
		default: MegaApi_startUpload($this->_cPtr,$localPath,$parent,$listener_or_mtime,$isSourceTemporary,$listener);
		}
	}

	function startDownload($node,$localPath,$listener=null) {
		MegaApi_startDownload($this->_cPtr,$node,$localPath,$listener);
	}

	function startDownloadWithData($node,$localPath,$appData,$listener=null) {
		MegaApi_startDownloadWithData($this->_cPtr,$node,$localPath,$appData,$listener);
	}

	function startStreaming($node,$startPos,$size,$listener) {
		MegaApi_startStreaming($this->_cPtr,$node,$startPos,$size,$listener);
	}

	function cancelTransfer($transfer,$listener=null) {
		MegaApi_cancelTransfer($this->_cPtr,$transfer,$listener);
	}

	function cancelTransferByTag($transferTag,$listener=null) {
		MegaApi_cancelTransferByTag($this->_cPtr,$transferTag,$listener);
	}

	function cancelTransfers($type,$listener=null) {
		MegaApi_cancelTransfers($this->_cPtr,$type,$listener);
	}

	function pauseTransfers($pause,$listener_or_direction=null,$listener=null) {
		switch (func_num_args()) {
		case 1: MegaApi_pauseTransfers($this->_cPtr,$pause); break;
		case 2: MegaApi_pauseTransfers($this->_cPtr,$pause,$listener_or_direction); break;
		default: MegaApi_pauseTransfers($this->_cPtr,$pause,$listener_or_direction,$listener);
		}
	}

	function enableTransferResumption($loggedOutId=null) {
		switch (func_num_args()) {
		case 0: MegaApi_enableTransferResumption($this->_cPtr); break;
		default: MegaApi_enableTransferResumption($this->_cPtr,$loggedOutId);
		}
	}

	function disableTransferResumption($loggedOutId=null) {
		switch (func_num_args()) {
		case 0: MegaApi_disableTransferResumption($this->_cPtr); break;
		default: MegaApi_disableTransferResumption($this->_cPtr,$loggedOutId);
		}
	}

	function areTransfersPaused($direction) {
		return MegaApi_areTransfersPaused($this->_cPtr,$direction);
	}

	function setUploadLimit($bpslimit) {
		MegaApi_setUploadLimit($this->_cPtr,$bpslimit);
	}

	function setDownloadMethod($method) {
		MegaApi_setDownloadMethod($this->_cPtr,$method);
	}

	function setUploadMethod($method) {
		MegaApi_setUploadMethod($this->_cPtr,$method);
	}

	function getDownloadMethod() {
		return MegaApi_getDownloadMethod($this->_cPtr);
	}

	function getUploadMethod() {
		return MegaApi_getUploadMethod($this->_cPtr);
	}

	function getTransfersAll() {
		$r=MegaApi_getTransfersAll($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaTransferList($r);
		}
		return $r;
	}

	function getStreamingTransfers() {
		$r=MegaApi_getStreamingTransfers($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaTransferList($r);
		}
		return $r;
	}

	function getTransferByTag($transferTag) {
		$r=MegaApi_getTransferByTag($this->_cPtr,$transferTag);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaTransfer($r);
		}
		return $r;
	}

	function getTransfers($type) {
		$r=MegaApi_getTransfers($this->_cPtr,$type);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaTransferList($r);
		}
		return $r;
	}

	function getChildTransfers($transferTag) {
		$r=MegaApi_getChildTransfers($this->_cPtr,$transferTag);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaTransferList($r);
		}
		return $r;
	}

	function update() {
		MegaApi_update($this->_cPtr);
	}

	function isWaiting() {
		return MegaApi_isWaiting($this->_cPtr);
	}

	function getNumPendingUploads() {
		return MegaApi_getNumPendingUploads($this->_cPtr);
	}

	function getNumPendingDownloads() {
		return MegaApi_getNumPendingDownloads($this->_cPtr);
	}

	function getTotalUploads() {
		return MegaApi_getTotalUploads($this->_cPtr);
	}

	function getTotalDownloads() {
		return MegaApi_getTotalDownloads($this->_cPtr);
	}

	function resetTotalDownloads() {
		MegaApi_resetTotalDownloads($this->_cPtr);
	}

	function resetTotalUploads() {
		MegaApi_resetTotalUploads($this->_cPtr);
	}

	function getTotalDownloadedBytes() {
		return MegaApi_getTotalDownloadedBytes($this->_cPtr);
	}

	function getTotalUploadedBytes() {
		return MegaApi_getTotalUploadedBytes($this->_cPtr);
	}

	function updateStats() {
		MegaApi_updateStats($this->_cPtr);
	}

	function getNumNodes() {
		return MegaApi_getNumNodes($this->_cPtr);
	}

	const ORDER_NONE = 0;

	const ORDER_DEFAULT_ASC = MegaApi_ORDER_DEFAULT_ASC;

	const ORDER_DEFAULT_DESC = MegaApi_ORDER_DEFAULT_DESC;

	const ORDER_SIZE_ASC = MegaApi_ORDER_SIZE_ASC;

	const ORDER_SIZE_DESC = MegaApi_ORDER_SIZE_DESC;

	const ORDER_CREATION_ASC = MegaApi_ORDER_CREATION_ASC;

	const ORDER_CREATION_DESC = MegaApi_ORDER_CREATION_DESC;

	const ORDER_MODIFICATION_ASC = MegaApi_ORDER_MODIFICATION_ASC;

	const ORDER_MODIFICATION_DESC = MegaApi_ORDER_MODIFICATION_DESC;

	const ORDER_ALPHABETICAL_ASC = MegaApi_ORDER_ALPHABETICAL_ASC;

	const ORDER_ALPHABETICAL_DESC = MegaApi_ORDER_ALPHABETICAL_DESC;

	function getNumChildren($parent) {
		return MegaApi_getNumChildren($this->_cPtr,$parent);
	}

	function getNumChildFiles($parent) {
		return MegaApi_getNumChildFiles($this->_cPtr,$parent);
	}

	function getNumChildFolders($parent) {
		return MegaApi_getNumChildFolders($this->_cPtr,$parent);
	}

	function getChildren($parent,$order=1) {
		$r=MegaApi_getChildren($this->_cPtr,$parent,$order);
		if (!is_resource($r)) return $r;
		return new MegaNodeList($r);
	}

	function getIndex($node,$order=1) {
		return MegaApi_getIndex($this->_cPtr,$node,$order);
	}

	function getChildNode($parent,$name) {
		$r=MegaApi_getChildNode($this->_cPtr,$parent,$name);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getParentNode($node) {
		$r=MegaApi_getParentNode($this->_cPtr,$node);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getNodePath($node) {
		return MegaApi_getNodePath($this->_cPtr,$node);
	}

	function getNodeByPath($path,$n=null) {
		$r=MegaApi_getNodeByPath($this->_cPtr,$path,$n);
		if (!is_resource($r)) return $r;
		return new MegaNode($r);
	}

	function getNodeByHandle($h) {
		$r=MegaApi_getNodeByHandle($this->_cPtr,$h);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getContactRequestByHandle($handle) {
		$r=MegaApi_getContactRequestByHandle($this->_cPtr,$handle);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaContactRequest($r);
		}
		return $r;
	}

	function getContacts() {
		$r=MegaApi_getContacts($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaUserList($r);
		}
		return $r;
	}

	function getContact($email) {
		$r=MegaApi_getContact($this->_cPtr,$email);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaUser($r);
		}
		return $r;
	}

	function getInShares($user) {
		$r=MegaApi_getInShares($this->_cPtr,$user);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNodeList($r);
		}
		return $r;
	}

	function getInSharesAll() {
		$r=MegaApi_getInSharesAll($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNodeList($r);
		}
		return $r;
	}

	function getInSharesList() {
		$r=MegaApi_getInSharesList($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaShareList($r);
		}
		return $r;
	}

	function isShared($node) {
		return MegaApi_isShared($this->_cPtr,$node);
	}

	function isOutShare($node) {
		return MegaApi_isOutShare($this->_cPtr,$node);
	}

	function isInShare($node) {
		return MegaApi_isInShare($this->_cPtr,$node);
	}

	function isPendingShare($node) {
		return MegaApi_isPendingShare($this->_cPtr,$node);
	}

	function getOutSharesAll() {
		$r=MegaApi_getOutSharesAll($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaShareList($r);
		}
		return $r;
	}

	function getOutShares($node) {
		$r=MegaApi_getOutShares($this->_cPtr,$node);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaShareList($r);
		}
		return $r;
	}

	function getPendingOutShares($node=null) {
		if (!is_resource($r)) return $r;
		return new MegaShareList($r);
	}

	function getPublicLinks() {
		$r=MegaApi_getPublicLinks($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNodeList($r);
		}
		return $r;
	}

	function getIncomingContactRequests() {
		$r=MegaApi_getIncomingContactRequests($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaContactRequestList($r);
		}
		return $r;
	}

	function getOutgoingContactRequests() {
		$r=MegaApi_getOutgoingContactRequests($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaContactRequestList($r);
		}
		return $r;
	}

	function getAccess($node) {
		return MegaApi_getAccess($this->_cPtr,$node);
	}

	function getSize($node) {
		return MegaApi_getSize($this->_cPtr,$node);
	}

	function getFingerprint($filePath_or_node_or_inputStream,$mtime=null) {
		return $r;
	}

	function getNodeByFingerprint($fingerprint,$parent=null) {
		if (!is_resource($r)) return $r;
		return new MegaNode($r);
	}

	function getNodesByFingerprint($fingerprint) {
		$r=MegaApi_getNodesByFingerprint($this->_cPtr,$fingerprint);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNodeList($r);
		}
		return $r;
	}

	function getExportableNodeByFingerprint($fingerprint,$name=null) {
		if (!is_resource($r)) return $r;
		return new MegaNode($r);
	}

	function hasFingerprint($fingerprint) {
		return MegaApi_hasFingerprint($this->_cPtr,$fingerprint);
	}

	function getCRCFromFingerprint($fingerprint) {
		return MegaApi_getCRCFromFingerprint($this->_cPtr,$fingerprint);
	}

	function getCRC($filePath_or_node) {
		return MegaApi_getCRC($this->_cPtr,$filePath_or_node);
	}

	function getNodeByCRC($crc,$parent) {
		$r=MegaApi_getNodeByCRC($this->_cPtr,$crc,$parent);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function checkAccess($node,$level) {
		$r=MegaApi_checkAccess($this->_cPtr,$node,$level);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaError($r);
		}
		return $r;
	}

	function checkMove($node,$target) {
		$r=MegaApi_checkMove($this->_cPtr,$node,$target);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaError($r);
		}
		return $r;
	}

	function isFilesystemAvailable() {
		return MegaApi_isFilesystemAvailable($this->_cPtr);
	}

	function getRootNode() {
		$r=MegaApi_getRootNode($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getInboxNode() {
		$r=MegaApi_getInboxNode($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getRubbishNode() {
		$r=MegaApi_getRubbishNode($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function setDefaultFilePermissions($permissions) {
		MegaApi_setDefaultFilePermissions($this->_cPtr,$permissions);
	}

	function getDefaultFilePermissions() {
		return MegaApi_getDefaultFilePermissions($this->_cPtr);
	}

	function setDefaultFolderPermissions($permissions) {
		MegaApi_setDefaultFolderPermissions($this->_cPtr,$permissions);
	}

	function getDefaultFolderPermissions() {
		return MegaApi_getDefaultFolderPermissions($this->_cPtr);
	}

	function getBandwidthOverquotaDelay() {
		return MegaApi_getBandwidthOverquotaDelay($this->_cPtr);
	}

	function search($node_or_searchString,$searchString=null,$recursive=true) {
		if (!is_resource($r)) return $r;
		return new MegaNodeList($r);
	}

	function processMegaTree($node,$processor,$recursive=true) {
		return MegaApi_processMegaTree($this->_cPtr,$node,$processor,$recursive);
	}

	function authorizeNode($node) {
		$r=MegaApi_authorizeNode($this->_cPtr,$node);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaNode($r);
		}
		return $r;
	}

	function getVersion() {
		return MegaApi_getVersion($this->_cPtr);
	}

	function getUserAgent() {
		return MegaApi_getUserAgent($this->_cPtr);
	}

	function changeApiUrl($apiURL,$disablepkp=false) {
		MegaApi_changeApiUrl($this->_cPtr,$apiURL,$disablepkp);
	}

	function retrySSLerrors($enable) {
		MegaApi_retrySSLerrors($this->_cPtr,$enable);
	}

	function setPublicKeyPinning($enable) {
		MegaApi_setPublicKeyPinning($this->_cPtr,$enable);
	}

	function escapeFsIncompatible($filename) {
		return MegaApi_escapeFsIncompatible($this->_cPtr,$filename);
	}

	function unescapeFsIncompatible($name) {
		return MegaApi_unescapeFsIncompatible($this->_cPtr,$name);
	}

	function createThumbnail($imagePath,$dstPath) {
		return MegaApi_createThumbnail($this->_cPtr,$imagePath,$dstPath);
	}

	function createPreview($imagePath,$dstPath) {
		return MegaApi_createPreview($this->_cPtr,$imagePath,$dstPath);
	}

	static function base64ToBase32($base64) {
		return MegaApi_base64ToBase32($base64);
	}

	static function base32ToBase64($base32) {
		return MegaApi_base32ToBase64($base32);
	}

	static function strdup($buffer) {
		return MegaApi_strdup($buffer);
	}

	static function removeRecursively($path) {
		MegaApi_removeRecursively($path);
	}

	function isOnline() {
		return MegaApi_isOnline($this->_cPtr);
	}
}

class MegaAccountBalance {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function getAmount() {
		return MegaAccountBalance_getAmount($this->_cPtr);
	}

	function getCurrency() {
		return MegaAccountBalance_getCurrency($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountBalance') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaAccountBalance();
	}
}

class MegaAccountSession {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function getCreationTimestamp() {
		return MegaAccountSession_getCreationTimestamp($this->_cPtr);
	}

	function getMostRecentUsage() {
		return MegaAccountSession_getMostRecentUsage($this->_cPtr);
	}

	function getUserAgent() {
		return MegaAccountSession_getUserAgent($this->_cPtr);
	}

	function getIP() {
		return MegaAccountSession_getIP($this->_cPtr);
	}

	function getCountry() {
		return MegaAccountSession_getCountry($this->_cPtr);
	}

	function isCurrent() {
		return MegaAccountSession_isCurrent($this->_cPtr);
	}

	function isAlive() {
		return MegaAccountSession_isAlive($this->_cPtr);
	}

	function getHandle() {
		return MegaAccountSession_getHandle($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountSession') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaAccountSession();
	}
}

class MegaAccountPurchase {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function getTimestamp() {
		return MegaAccountPurchase_getTimestamp($this->_cPtr);
	}

	function getHandle() {
		return MegaAccountPurchase_getHandle($this->_cPtr);
	}

	function getCurrency() {
		return MegaAccountPurchase_getCurrency($this->_cPtr);
	}

	function getAmount() {
		return MegaAccountPurchase_getAmount($this->_cPtr);
	}

	function getMethod() {
		return MegaAccountPurchase_getMethod($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountPurchase') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaAccountPurchase();
	}
}

class MegaAccountTransaction {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function getTimestamp() {
		return MegaAccountTransaction_getTimestamp($this->_cPtr);
	}

	function getHandle() {
		return MegaAccountTransaction_getHandle($this->_cPtr);
	}

	function getCurrency() {
		return MegaAccountTransaction_getCurrency($this->_cPtr);
	}

	function getAmount() {
		return MegaAccountTransaction_getAmount($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountTransaction') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaAccountTransaction();
	}
}

class MegaAccountDetails {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	const ACCOUNT_TYPE_FREE = 0;

	const ACCOUNT_TYPE_PROI = 1;

	const ACCOUNT_TYPE_PROII = 2;

	const ACCOUNT_TYPE_PROIII = 3;

	const ACCOUNT_TYPE_LITE = 4;

	const SUBSCRIPTION_STATUS_NONE = 0;

	const SUBSCRIPTION_STATUS_VALID = 1;

	const SUBSCRIPTION_STATUS_INVALID = 2;

	function getProLevel() {
		return MegaAccountDetails_getProLevel($this->_cPtr);
	}

	function getProExpiration() {
		return MegaAccountDetails_getProExpiration($this->_cPtr);
	}

	function getSubscriptionStatus() {
		return MegaAccountDetails_getSubscriptionStatus($this->_cPtr);
	}

	function getSubscriptionRenewTime() {
		return MegaAccountDetails_getSubscriptionRenewTime($this->_cPtr);
	}

	function getSubscriptionMethod() {
		return MegaAccountDetails_getSubscriptionMethod($this->_cPtr);
	}

	function getSubscriptionCycle() {
		return MegaAccountDetails_getSubscriptionCycle($this->_cPtr);
	}

	function getStorageMax() {
		return MegaAccountDetails_getStorageMax($this->_cPtr);
	}

	function getTransferMax() {
		return MegaAccountDetails_getTransferMax($this->_cPtr);
	}

	function getTransferOwnUsed() {
		return MegaAccountDetails_getTransferOwnUsed($this->_cPtr);
	}

	function getNumUsageItems() {
		return MegaAccountDetails_getNumUsageItems($this->_cPtr);
	}

	function getStorageUsed($handle=null) {
		switch (func_num_args()) {
		case 0: $r=MegaAccountDetails_getStorageUsed($this->_cPtr); break;
		default: $r=MegaAccountDetails_getStorageUsed($this->_cPtr,$handle);
		}
		return $r;
	}

	function getNumFiles($handle) {
		return MegaAccountDetails_getNumFiles($this->_cPtr,$handle);
	}

	function getNumFolders($handle) {
		return MegaAccountDetails_getNumFolders($this->_cPtr,$handle);
	}

	function copy() {
		$r=MegaAccountDetails_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaAccountDetails($r);
		}
		return $r;
	}

	function getNumBalances() {
		return MegaAccountDetails_getNumBalances($this->_cPtr);
	}

	function getBalance($i) {
		$r=MegaAccountDetails_getBalance($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaAccountBalance($r);
		}
		return $r;
	}

	function getNumSessions() {
		return MegaAccountDetails_getNumSessions($this->_cPtr);
	}

	function getSession($i) {
		$r=MegaAccountDetails_getSession($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaAccountSession($r);
		}
		return $r;
	}

	function getNumPurchases() {
		return MegaAccountDetails_getNumPurchases($this->_cPtr);
	}

	function getPurchase($i) {
		$r=MegaAccountDetails_getPurchase($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaAccountPurchase($r);
		}
		return $r;
	}

	function getNumTransactions() {
		return MegaAccountDetails_getNumTransactions($this->_cPtr);
	}

	function getTransaction($i) {
		$r=MegaAccountDetails_getTransaction($this->_cPtr,$i);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaAccountTransaction($r);
		}
		return $r;
	}

	function getTemporalBandwidthInterval() {
		return MegaAccountDetails_getTemporalBandwidthInterval($this->_cPtr);
	}

	function getTemporalBandwidth() {
		return MegaAccountDetails_getTemporalBandwidth($this->_cPtr);
	}

	function isTemporalBandwidthValid() {
		return MegaAccountDetails_isTemporalBandwidthValid($this->_cPtr);
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaAccountDetails') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaAccountDetails();
	}
}

class MegaPricing {
	public $_cPtr=null;
	protected $_pData=array();

	function __set($var,$value) {
		if ($var === 'thisown') return swig_mega_alter_newobject($this->_cPtr,$value);
		$this->_pData[$var] = $value;
	}

	function __get($var) {
		if ($var === 'thisown') return swig_mega_get_newobject($this->_cPtr);
		return $this->_pData[$var];
	}

	function __isset($var) {
		if ($var === 'thisown') return true;
		return array_key_exists($var, $this->_pData);
	}

	function getNumProducts() {
		return MegaPricing_getNumProducts($this->_cPtr);
	}

	function getHandle($productIndex) {
		return MegaPricing_getHandle($this->_cPtr,$productIndex);
	}

	function getProLevel($productIndex) {
		return MegaPricing_getProLevel($this->_cPtr,$productIndex);
	}

	function getGBStorage($productIndex) {
		return MegaPricing_getGBStorage($this->_cPtr,$productIndex);
	}

	function getGBTransfer($productIndex) {
		return MegaPricing_getGBTransfer($this->_cPtr,$productIndex);
	}

	function getMonths($productIndex) {
		return MegaPricing_getMonths($this->_cPtr,$productIndex);
	}

	function getAmount($productIndex) {
		return MegaPricing_getAmount($this->_cPtr,$productIndex);
	}

	function getCurrency($productIndex) {
		return MegaPricing_getCurrency($this->_cPtr,$productIndex);
	}

	function getDescription($productIndex) {
		return MegaPricing_getDescription($this->_cPtr,$productIndex);
	}

	function getIosID($productIndex) {
		return MegaPricing_getIosID($this->_cPtr,$productIndex);
	}

	function getAndroidID($productIndex) {
		return MegaPricing_getAndroidID($this->_cPtr,$productIndex);
	}

	function copy() {
		$r=MegaPricing_copy($this->_cPtr);
		if (is_resource($r)) {
			$c=substr(get_resource_type($r), (strpos(get_resource_type($r), '__') ? strpos(get_resource_type($r), '__') + 2 : 3));
			if (class_exists($c)) return new $c($r);
			return new MegaPricing($r);
		}
		return $r;
	}

	function __construct($res=null) {
		if (is_resource($res) && get_resource_type($res) === '_p_mega__MegaPricing') {
			$this->_cPtr=$res;
			return;
		}
		$this->_cPtr=new_MegaPricing();
	}
}


?>
