icloud-api = function () { var self = this; //autobinding takes place here if(proto.Binds) proto.Binds.forEach(function(f){ var original = self[f]; if(original) self[f] = mixIn(self[f].bind(self), original); }); //clone non function/static properties to current instance for(var key in out.prototype) { var v = out.prototype[key], t = kindOf(v); if(key.match(verbs) || t === "Function" || t == "GeneratorFunction") continue; if(t == "Object") self[key] = merge({}, self[key]); //create(null, self[key]); else if(t == "Array") self[key] = v.slice(); //clone ?? else self[key] = v; } if(proto.Implements) proto.Implements.forEach(function(Mixin){ Mixin.call(self); }); constructor.apply(this, arguments); }
n/a
account = function () { var self = this; //autobinding takes place here if(proto.Binds) proto.Binds.forEach(function(f){ var original = self[f]; if(original) self[f] = mixIn(self[f].bind(self), original); }); //clone non function/static properties to current instance for(var key in out.prototype) { var v = out.prototype[key], t = kindOf(v); if(key.match(verbs) || t === "Function" || t == "GeneratorFunction") continue; if(t == "Object") self[key] = merge({}, self[key]); //create(null, self[key]); else if(t == "Array") self[key] = v.slice(); //clone ?? else self[key] = v; } if(proto.Implements) proto.Implements.forEach(function(Mixin){ Mixin.call(self); }); constructor.apply(this, arguments); }
n/a
file = function () { var self = this; //autobinding takes place here if(proto.Binds) proto.Binds.forEach(function(f){ var original = self[f]; if(original) self[f] = mixIn(self[f].bind(self), original); }); //clone non function/static properties to current instance for(var key in out.prototype) { var v = out.prototype[key], t = kindOf(v); if(key.match(verbs) || t === "Function" || t == "GeneratorFunction") continue; if(t == "Object") self[key] = merge({}, self[key]); //create(null, self[key]); else if(t == "Array") self[key] = v.slice(); //clone ?? else self[key] = v; } if(proto.Implements) proto.Implements.forEach(function(Mixin){ Mixin.call(self); }); constructor.apply(this, arguments); }
n/a
index = function () { var self = this; //autobinding takes place here if(proto.Binds) proto.Binds.forEach(function(f){ var original = self[f]; if(original) self[f] = mixIn(self[f].bind(self), original); }); //clone non function/static properties to current instance for(var key in out.prototype) { var v = out.prototype[key], t = kindOf(v); if(key.match(verbs) || t === "Function" || t == "GeneratorFunction") continue; if(t == "Object") self[key] = merge({}, self[key]); //create(null, self[key]); else if(t == "Array") self[key] = v.slice(); //clone ?? else self[key] = v; } if(proto.Implements) proto.Implements.forEach(function(Mixin){ Mixin.call(self); }); constructor.apply(this, arguments); }
n/a
account = function () { var self = this; //autobinding takes place here if(proto.Binds) proto.Binds.forEach(function(f){ var original = self[f]; if(original) self[f] = mixIn(self[f].bind(self), original); }); //clone non function/static properties to current instance for(var key in out.prototype) { var v = out.prototype[key], t = kindOf(v); if(key.match(verbs) || t === "Function" || t == "GeneratorFunction") continue; if(t == "Object") self[key] = merge({}, self[key]); //create(null, self[key]); else if(t == "Array") self[key] = v.slice(); //clone ?? else self[key] = v; } if(proto.Implements) proto.Implements.forEach(function(Mixin){ Mixin.call(self); }); constructor.apply(this, arguments); }
n/a
initialize = function (icloud, chain){ var self = this; this.icloud = icloud; var service_root = icloud.session.webservices['account']['url']; var base_url = util.format("%s/setup/ws/1/storageUsageInfo", service_root); var query = url.parse(base_url); this.icloud.request(query, null, function(err, body){ if(err) return chain(err); console.log("GOT RESPONSE", err, body); chain(); }); }
n/a
file = function () { var self = this; //autobinding takes place here if(proto.Binds) proto.Binds.forEach(function(f){ var original = self[f]; if(original) self[f] = mixIn(self[f].bind(self), original); }); //clone non function/static properties to current instance for(var key in out.prototype) { var v = out.prototype[key], t = kindOf(v); if(key.match(verbs) || t === "Function" || t == "GeneratorFunction") continue; if(t == "Object") self[key] = merge({}, self[key]); //create(null, self[key]); else if(t == "Array") self[key] = v.slice(); //clone ?? else self[key] = v; } if(proto.Implements) proto.Implements.forEach(function(Mixin){ Mixin.call(self); }); constructor.apply(this, arguments); }
n/a
dir = function (folderId, chain){ var base_url = util.format("%s/retrieveItemDetailsInFolders", this.service_root); var query = url.parse(base_url); var params = [{ "drivewsid":folderId, "partialData":false }]; this.icloud.request(query, params, chain); }
...
this.service_root = icloud.session.webservices['drivews']['url'];
chain();
},
fetchDirectories : function(chain){
this.dir("FOLDER::com.apple.CloudDocs::root", chain);
},
fetchDirectoryTree : function(chain, folderId, tree){
if(!folderId)
folderId = "FOLDER::com.apple.CloudDocs::root";
if(!tree)
tree = {};
...
fetchDirectories = function (chain){ this.dir("FOLDER::com.apple.CloudDocs::root", chain); }
n/a
fetchDirectoryTree = function (chain, folderId, tree){ if(!folderId) folderId = "FOLDER::com.apple.CloudDocs::root"; if(!tree) tree = {}; this.dir(folderId, function(err, directories){ directories = reindex(directories, "drivewsid"); if(!directories[folderId]) return chain(); var children = []; directories[folderId].items.forEach(function(v){ if(v.type == "FOLDER") children.push(v['drivewsid']); }); async.series(children, function(v, chain) { self.fetchDirectoryTree(chain, v, tree); }, function(){ }); }); }
...
var children = [];
directories[folderId].items.forEach(function(v){
if(v.type == "FOLDER")
children.push(v['drivewsid']);
});
async.series(children, function(v, chain) {
self.fetchDirectoryTree(chain, v, tree);
}, function(){
});
});
},
...
initialize = function (icloud, chain){ var self = this; this.icloud = icloud; this.service_root = icloud.session.webservices['drivews']['url']; chain(); }
n/a
index = function () { var self = this; //autobinding takes place here if(proto.Binds) proto.Binds.forEach(function(f){ var original = self[f]; if(original) self[f] = mixIn(self[f].bind(self), original); }); //clone non function/static properties to current instance for(var key in out.prototype) { var v = out.prototype[key], t = kindOf(v); if(key.match(verbs) || t === "Function" || t == "GeneratorFunction") continue; if(t == "Object") self[key] = merge({}, self[key]); //create(null, self[key]); else if(t == "Array") self[key] = v.slice(); //clone ?? else self[key] = v; } if(proto.Implements) proto.Implements.forEach(function(Mixin){ Mixin.call(self); }); constructor.apply(this, arguments); }
n/a
fetchAll = function (chain){ var contact_url = this.icloud.session.webservices.contacts.url; contact_url = util.format("%s/co/startup", contact_url); //params = merge(params, {'dsid': session['dsInfo']['dsid']}); var params = merge({}, { // clientVersion : "2.1", locale : "en_US", order : "last,first", }); var query = merge(url.parse(contact_url), { qs : params, }); this.icloud.request(query, null, function(err, body){ console.log(res.statusCode, body); }); }
...
});
```
## API : contacts
```
// Fetch iCloud contacts
client.contact.fetchAll(function(err, contacts){
//tada
});
```
## API : photo (&videos)
```
...
initialize = function (icloud, chain) { this.icloud = icloud; //this.session = icloud.session; chain(); }
n/a