{"id":23065822,"url":"https://github.com/tidepool-org/user-api-client","last_synced_at":"2025-08-15T11:32:16.116Z","repository":{"id":13592768,"uuid":"16285590","full_name":"tidepool-org/user-api-client","owner":"tidepool-org","description":"An npm package for making it easy to use the Tidepool user-api.","archived":false,"fork":false,"pushed_at":"2024-10-19T10:23:17.000Z","size":413,"stargazers_count":1,"open_issues_count":3,"forks_count":2,"subscribers_count":34,"default_branch":"master","last_synced_at":"2024-12-08T19:52:05.872Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tidepool-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-01-27T16:56:23.000Z","updated_at":"2024-08-20T19:30:46.000Z","dependencies_parsed_at":"2023-12-11T06:53:08.096Z","dependency_job_id":"e1bf403c-9147-4271-bedc-c03a870de4ba","html_url":"https://github.com/tidepool-org/user-api-client","commit_stats":{"total_commits":96,"total_committers":7,"mean_commits":"13.714285714285714","dds":0.5520833333333333,"last_synced_commit":"4a1e78ec6749c5f2e77d5492d131598cc9e520b7"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidepool-org%2Fuser-api-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidepool-org%2Fuser-api-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidepool-org%2Fuser-api-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tidepool-org%2Fuser-api-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tidepool-org","download_url":"https://codeload.github.com/tidepool-org/user-api-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229911005,"owners_count":18143229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-16T05:10:10.653Z","updated_at":"2024-12-16T05:10:11.296Z","avatar_url":"https://github.com/tidepool-org.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"user-api-client\n===============\n\n# Docs\nThis is a library that makes it easier for servers that are talking to the\nTidepool User API.\n\n\n## Setup\n```require('user-api-client')(config, hostGetter, request);```\n\n  * ```config``` -- an object containing configuration parameters\n  * ```hostGetter``` -- an object with a get() method.  The get() method should return an array of objects that can be\n passed into url.format() to produce a valid url to talk to.\n  * ```httpClient``` -- (optional) -- the result of require('./httpClient.js')(config). This is primarily exposed to allow\n for mocking in tests.  If not supplied a new \"correct\" one will be created.\n  * ```members``` -- client and middleware.\n\n## Client\n\n\n### login\n* ```login (username, password, cb)```\n*Frontend to the API call to log in a user*\n    * ```username``` -- string\n    * ```password``` -- password\n    * ```cb (err, response)```\n        * ```err``` -- null if no error, else an error object\n        * ```response``` -- result from the /user/login api call\n\n### getAnonymousPair\n* ```getAnonymousPair (userid, cb)```\n*Frontend to the API call to retrieve a pair from the user object without storing it*\n    * ```userid``` -- Tidepool-assigned userid\n    * ```cb (err, response)```\n        * ```err``` -- null if no error, else an error object\n        * ```response``` -- result from the /user/private api call\n\n### checkToken\n* ```checkToken (token, cb)```\n*Frontend to the API call to check the validity of a server or user token*\n    * ```token``` -- the server token to be checked\n    * ```cb (err, response)```\n        * ```err``` -- null if no error, else an object\n        * ```response``` -- result from the /user/token api call\n\n### createUser\n* ```createUser (userObj, cb)```\n*Frontend to the API call to create a user*\n    * ```userObj``` -- object containing username, emails and password fields at minimum\n    * ```cb (err, response)```\n        * ```err``` -- null if no error, else an error object\n        * ```response``` -- result from the /user/user api call\n\n### withServerToken\n* ```withServerToken (cb)```\n*Calls CB with a valid server token, iff one can be retrieved*\n    * ```cb (err, token)```\n        * ```err``` -- always null if callback is called at all\n        * ```token``` -- a valid server token\n\n\n## Middleware\n\n\n### expressify\n* ```expressify (middlewareFn)```\n*Converts restify middleware into express middleware.*\n    * ```middlewareFn``` -- the restify middleware\nReturns: middleware that works with express\n\n### checkToken\n* ```checkToken (client)```\n*Middleware to process the session token -- expects a token in a request header, processes it, and*\n*returns information about the token in the _tokendata variable on the request.*\n    * ```client``` -- client to use when talking to the user-api\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidepool-org%2Fuser-api-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftidepool-org%2Fuser-api-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftidepool-org%2Fuser-api-client/lists"}