$.uaYT = function() { this.createChannel = function(pData, pCbkFunc) { gapi.client.youtube.channels.insert({ part: 'snippet', resource: { 'snippet': { 'title': 'UnfoldingArt' } } }). then(function(response) { pCbkFunc({ bError: false, idChannel: response.result.id }); }). catch(function(pResp) { pCbkFunc({ bError: true }); }); }; return this; };