0.1.12 • Published 10 years ago

swagger-angular-client v0.1.12

Weekly downloads
4
License
-
Repository
github
Last release
10 years ago

swagger-angular-client

AngularJS service for communicating with endpoints described by swagger.

Usage

To use, include one of these files in your application:

You may also bower install swagger-angular-client to install using bower. Once you've included the script, you can include the swagger-client module as a dependency to your existing application and use the swaggerClient service to generate api clients.

Schemas can be generated using fetch-swagger-schema.

Example

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Example</title>
  <script src="angular.js"></script>
</head>
<body ng-app="myApp" ng-cloak>
    Pet: {{ pet.name || 'Loading...' }}

  <script src="swagger-client.js"></script>

  <!-- `petStoreSchema.js` exposes the JSON object generated by [fetch-swagger-schema] when run against http://petstore.swagger.wordnik.com/api/api-docs to the window as `PetStoreSchema` (see `examples/petStoreSchema.js`). -->
  <script src="petStoreSchema.js"></script>

  <script>
  angular.module('myApp', ['swagger-client'])
    .run(function($rootScope, swaggerClient){
      var api = swaggerClient(PetStoreSchema);
      
      api.auth('secret-key');
      api.pet.addPet({id: 1, name: 'Bob'}).then(function(){
        return api.pet.getPetById(1);
      }).then(function(pet){
        $rootScope.pet = pet;
      });
    }); 
  </script>
</body>
</html>
0.1.12

10 years ago

0.1.11

10 years ago

0.1.10

11 years ago

0.1.9

11 years ago

0.1.7

11 years ago

0.1.5

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.0

11 years ago