{"action":"created","issue":{"url":"https://api.github.com/repos/driftyco/ionic-cloud/issues/48","repository_url":"https://api.github.com/repos/driftyco/ionic-cloud","labels_url":"https://api.github.com/repos/driftyco/ionic-cloud/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/driftyco/ionic-cloud/issues/48/comments","events_url":"https://api.github.com/repos/driftyco/ionic-cloud/issues/48/events","html_url":"https://github.com/driftyco/ionic-cloud/issues/48","id":177240161,"number":48,"title":"Push.register() has wrong return signature","user":{"login":"NoNameProvided","id":4706265,"avatar_url":"https://avatars.githubusercontent.com/u/4706265?v=3","gravatar_id":"","url":"https://api.github.com/users/NoNameProvided","html_url":"https://github.com/NoNameProvided","followers_url":"https://api.github.com/users/NoNameProvided/followers","following_url":"https://api.github.com/users/NoNameProvided/following{/other_user}","gists_url":"https://api.github.com/users/NoNameProvided/gists{/gist_id}","starred_url":"https://api.github.com/users/NoNameProvided/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoNameProvided/subscriptions","organizations_url":"https://api.github.com/users/NoNameProvided/orgs","repos_url":"https://api.github.com/users/NoNameProvided/repos","events_url":"https://api.github.com/users/NoNameProvided/events{/privacy}","received_events_url":"https://api.github.com/users/NoNameProvided/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-15T17:42:09Z","updated_at":"2016-09-15T19:23:47Z","closed_at":null,"body":"Both the documentation and TypeScript intellisense states that `Push.register()` returns a `Promise<PushToken>` but the actually returned data is (at least on ios): \r\n\r\n```\r\n{\r\n  token: string,\r\n  registered: boolean\r\n}\r\n```\r\n\r\nWhile the definition of`PushToken` is: \r\n\r\n```\r\n{\r\n      app_id: string,\r\n      invalidated: date-time,\r\n      token: string,\r\n      created: date-time,\r\n      valid: boolean,\r\n      id: string,\r\n      type: string\r\n}\r\n``` \r\n\r\nPush.saveToken() returns `Promise<PushToken>` as it's stated.\r\n\r\nThis is an easy fix, but I don't know if you want to introduce a new type for this, or just return with a explicit object signature like `Promise<{ token: string, registered: boolean }>`"},"comment":{"url":"https://api.github.com/repos/driftyco/ionic-cloud/issues/comments/247426387","html_url":"https://github.com/driftyco/ionic-cloud/issues/48#issuecomment-247426387","issue_url":"https://api.github.com/repos/driftyco/ionic-cloud/issues/48","id":247426387,"user":{"login":"NoNameProvided","id":4706265,"avatar_url":"https://avatars.githubusercontent.com/u/4706265?v=3","gravatar_id":"","url":"https://api.github.com/users/NoNameProvided","html_url":"https://github.com/NoNameProvided","followers_url":"https://api.github.com/users/NoNameProvided/followers","following_url":"https://api.github.com/users/NoNameProvided/following{/other_user}","gists_url":"https://api.github.com/users/NoNameProvided/gists{/gist_id}","starred_url":"https://api.github.com/users/NoNameProvided/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NoNameProvided/subscriptions","organizations_url":"https://api.github.com/users/NoNameProvided/orgs","repos_url":"https://api.github.com/users/NoNameProvided/repos","events_url":"https://api.github.com/users/NoNameProvided/events{/privacy}","received_events_url":"https://api.github.com/users/NoNameProvided/received_events","type":"User","site_admin":false},"created_at":"2016-09-15T19:23:47Z","updated_at":"2016-09-15T19:23:47Z","body":"Yeah I missed that `id` is optional. Anyway I find this kind of confusing, `id` something devs expect to be mandatory. I would suggest to have a different type for the \"bare\" token object. So devs can see the difference.\r\n\r\n> Honestly, `saveToken()` should be called for you when `register()` is called. I foresee this being a change I make.\r\n\r\nYes, this is a great idea! And it makes introducing a new type for the \"bare\" tokens unnecessary. \r\n\r\nI can do a PR for this tomorrow or on the weekend."}}
{"actor":{"display_login":"NoNameProvided"}}