{"id":23752536,"url":"https://github.com/ilanfrumer/restify","last_synced_at":"2025-09-05T01:32:09.829Z","repository":{"id":12248235,"uuid":"14862760","full_name":"IlanFrumer/Restify","owner":"IlanFrumer","description":"Restful factory for AngularJS.","archived":false,"fork":false,"pushed_at":"2014-03-28T09:50:52.000Z","size":510,"stargazers_count":25,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-20T08:18:57.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/IlanFrumer.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-MIT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-02T13:18:33.000Z","updated_at":"2020-07-02T22:03:58.000Z","dependencies_parsed_at":"2022-08-29T05:31:16.072Z","dependency_job_id":null,"html_url":"https://github.com/IlanFrumer/Restify","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/IlanFrumer/Restify","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IlanFrumer%2FRestify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IlanFrumer%2FRestify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IlanFrumer%2FRestify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IlanFrumer%2FRestify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IlanFrumer","download_url":"https://codeload.github.com/IlanFrumer/Restify/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IlanFrumer%2FRestify/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273699521,"owners_count":25152278,"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","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-31T17:53:22.895Z","updated_at":"2025-09-05T01:32:04.807Z","avatar_url":"https://github.com/IlanFrumer.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Restify](https://github.com/IlanFrumer/Restify)\nRestful factory for AngularJS.\n\n[![Build Status](https://travis-ci.org/IlanFrumer/Restify.png?branch=master)](https://travis-ci.org/IlanFrumer/Restify)\n\n### Install\n\n- `bower install restify`\n- `\u003cscript src=\"bower_components/restify/dist/restify.min.js\"\u003e`\n\n### Dependencies\n\n- [Angular.js](https://github.com/angular/angular.js)\n- [Lodash](https://github.com/lodash/lodash)\n\n### Example\n\n```coffee\n# declare restify as a dependency of your application module\napp = angular.module('yourModule',['restify'])\n\n# create a service by injecting restify and using its factory function\n# note: you should probably create one service for the whole api\n#       and then pass it all over the place\n\napp.factory 'API', ['restify',(restify)-\u003e\n  \n  # restify \n  # gets a base url and a configuration block\n  # returns a Restified Object\n\n  restify '/api' , (config)-\u003e\n\n    # add your endpoints\n    config.add('/users/:id/images')\n    config.add('/stores/:name/branches/:id')\n    config.add('/stores/:name/products/:id')\n    config.add('/stores/:name/images')\n]\n\n\n# inject your service and start playing\n\napp.controller 'MyCtrl',['$scope', 'API', ($scope, API)-\u003e\n\n  # GET /api/users\n  API.users.$get().then (users)-\u003e\n    $scope.users = users\n\n  $scope.userImages = (user)-\u003e\n    # provided that user.id == 123\n    # GET /api/users/123/images\n    user.images.$uget().then (images)-\u003e\n      user.images = images\n\n  $scope.create = (user)-\u003e\n    # PUT /api/users\n    $scope.users.$post(user)\n\n  $scope.save = (user)-\u003e\n    # provided that user.id == 123\n    # PUT /api/users/123\n    user.$put()\n\n  $scope.changePassword = (user, password)-\u003e\n    # provided that user.id == 123\n    # PATCH /api/users/123\n    user.$patch({password: password})\n\n  $scope.remove (user)-\u003e    \n    user.$delete().then ()-\u003e\n      $scope.users = _.without($scope.users,user)\n]\n\n```\n##### View:\n```html\n  \u003cul\u003e\n    \u003cli ng-repeat=\"user in users\"\u003e\n      \u003cinput type=\"text\" ng-model=\"user.name\"\u003e\n      \u003cinput type=\"text\" ng-model=\"user.email\"\u003e\n      \u003cbutton ng-click=\"save(user)\"\u003eSave\u003c/button\u003e\n      \u003cbutton ng-click=\"remove(user)\"\u003eRemove\u003c/button\u003e      \n      \u003cbutton ng-click=\"getImages(user)\"\u003eSee Images\u003c/button\u003e\n      \u003cul\u003e\n        \u003cli ng-repeat=\"image in user.images\"\u003e\n            \u003cimg src=\"{{image.src}}\" alt=\"{{image.alt}}\"\u003e\n        \u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n  \u003c/ul\u003e  \n````\n\n### Restify Class\n\n#### Own properties (_All own properties are prefixed with $$_)\n\nOwned properties are ment to be used internally, don't mess with them!\n\n* **$$url**\n* **$$route**\n* **$$parent**\n* **$$headers**\n* **$$requestInterceptor**\n* **$$responseInterceptor**\n\n\n#### Methods (_All inherited methods are prefixed with $_)\n\n* **$get()**: getting the response and restifying it\n* **$uget()**: getting the response without restifying it\n* **$delete()**: \n* **$post([data])**: If data is not provided then this object is sent stripped from functions or Restified objects.\n* **$patch([data])**: If data is not provided then this object is sent stripped from functions or Restified objects.\n* **$put([data])**: If data is not provided then this object is sent stripped from functions or Restified objects.\n\nConfiguration methods(_see below_)\n\n* **$setHeaders(headers)**\n* **$setResponseInterceptor(callback)**\n* **$setRequestInterceptor(callback)**\n\n### Configartion\n\nAll restified object inherits configuration from its parent chain and may override it\n\n````coffee\n# parent chain: api \u003e users \u003e user\n\nusers = api.users\nuser = users.$id(123)\n\napi.$setHeaders({'X-AUTH-TOKEN': 123})\nuser.$get() # sends X-AUTH-TOKEN: 123\n\nusers.$setHeaders({'X-AUTH-TOKEN': 456})\nuser.$get() # sends X-AUTH-TOKEN: 456\n\napi.$get() # still sends X-AUTH-TOKEN: 123\n\n# note: $id creates a new restified object\nsameUser = users.$id(123)\nuser !== sameUser # true\n\n# note: every request data creates a new restified object\nuser.$get.then(sameUser)-\u003e\n  user !== sameUser # true\n\n````\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filanfrumer%2Frestify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filanfrumer%2Frestify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filanfrumer%2Frestify/lists"}