{"id":17803385,"url":"https://github.com/sethwebster/our-groceries-client","last_synced_at":"2025-03-17T11:31:16.691Z","repository":{"id":51837525,"uuid":"54940400","full_name":"sethwebster/our-groceries-client","owner":"sethwebster","description":null,"archived":false,"fork":false,"pushed_at":"2021-05-09T16:05:21.000Z","size":13,"stargazers_count":11,"open_issues_count":1,"forks_count":7,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-09T14:02:49.016Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sethwebster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-29T02:43:47.000Z","updated_at":"2024-03-12T19:19:42.000Z","dependencies_parsed_at":"2022-08-23T00:31:14.357Z","dependency_job_id":null,"html_url":"https://github.com/sethwebster/our-groceries-client","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethwebster%2Four-groceries-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethwebster%2Four-groceries-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethwebster%2Four-groceries-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sethwebster%2Four-groceries-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sethwebster","download_url":"https://codeload.github.com/sethwebster/our-groceries-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243862362,"owners_count":20360131,"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-10-27T12:46:38.833Z","updated_at":"2025-03-17T11:31:16.286Z","avatar_url":"https://github.com/sethwebster.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Our Groceries Client\n\nCurrent Features\n * Provides Authentication\n * Allows Retrieval of User's grocery lists\n * Allows addition of items to lists\n\n### Installation\n```\nnpm install our-groceries-client\n```\n\n### Usage\n\n```javascript\nvar OurGroceriesClient = require('our-groceries-client');\n// or import OurGroceriesClient from 'our-groceries-client' \n\nvar username = \"\u003cyour our groceries username\u003e\"\n  , password = \"\u003cyour our groceries password\u003e\"\n  , listName = \"\u003cyour list name\u003e\"\n  , itemName = \"Apples\"\n  , quantity = 1;\n\nvar client = new OurGroceriesClient();\n\nvar handlers = {   \n    // Called when authentication completes, either success or failure \n    authComplete: function(result) {\n        if (result.success) {\n            client.getLists(handlers.getListsComplete);\n        } else {\n            console.log(\"Authentication Failed: \"+result.error);\n        }\n    },\n    // Called when fetching the list of lists completes, either success or failure \n    getListsComplete: function(result) {\n        if (result.success) {\n            var list = client.findList(result.response.shoppingLists, listName);\n            if (list) {\n                client.getList(list.id, handlers.getListComplete);                \n            } else {\n                console.log(\"Unable to find list: \"+listName);\n            }\n        } else {\n            console.log(\"Unable to get lists: \"+result.error);\n        }\n    },\n    // Called when fetching a single list completes, either success or failure \n    getListComplete: function(result) {\n        var list = result.response.list;\n        client.addToList(list.id, itemName, quantity, handlers.addToListComplete);\n    },\n    // Called after adding the item completes\n    addToListComplete: function(result) {\n        if (result.success) {\n            console.log(\"Successfully added to list.\");\n        } else {\n            console.log(\"Unable to add to list: \"+result.error);\n        }\n    }\n}\n\n// Authenticate\nclient.authenticate(username, password, handlers.authComplete);\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethwebster%2Four-groceries-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsethwebster%2Four-groceries-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsethwebster%2Four-groceries-client/lists"}