Skip to content

Commit

Permalink
modifications readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysolyne Gresille committed Feb 6, 2012
1 parent b3f50ee commit 54f42cd
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 82 deletions.
78 changes: 75 additions & 3 deletions JS/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,80 @@
Phraseanet API javascript SDK
=============================
#Javascript SDK

Library for interacting with Phraseanet API

Still in development.

Please, Do not use this library for the moment.
__Please, Do not use this library for the moment.__


* ##Register a phraseanet instance

```
PHRASEA.registerInstance(name, domain, apiKey);
```

* ##Get all registered instances from cookies

```
var instanceList = PHRASEA.getInstances();
var instance;
while (instance = instanceList.hasNext())
{
//the current instance
}
```

* ##Get a previously registered instance

```
var myInstance = PHRASEA.getInstance(name, function(instance){
if(instance)
{
return instance;
}
else
{
//handle errors
}
});
```
* ##Connect to the instance

```
myInstance.connect({options}, function(response){
if(response.errors)
{
//handle errors
}
else
{
//connected
}
});
```

* ##Request to the instance

```
myInstance.request("/path/", "METHOD", {params}, function(response){
if(response.metas.http_code === 403)
{
//handle errors
}
else
{
datas = response.datas;
}
});
```

* ##logout to the instance

```
myInstance.logout(function(response){
if(!response.error)
{
//user logout
}
});
```
80 changes: 1 addition & 79 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,80 +1,2 @@
Phraseanet Client Libraries
===========================

Phrasea
-

1. Register a phraseanet instance

```
PHRASEA.registerInstance(name, domain, apiKey);
```

2. Get all registered instances from cookies

```
var instanceList = PHRASEA.getInstances();
var instance;
while (instance = instanceList.hasNext())
{
//the current instance
}
```

3. Get a previously registered instance

```
var myInstance = PHRASEA.getInstance(name, function(instance){
if(instance)
{
return instance;
}
else
{
//handle errors
}
});
```
4. Connect to the instance

```
myInstance.connect({options}, function(response){
if(response.errors)
{
//handle errors
}
else
{
//connected
}
});
```

5. Request to the instance

```
myInstance.request("/path/", "METHOD", {params}, function(response){
if(response.metas.http_code === 403)
{
//handle errors
}
else
{
datas = response.datas;
}
});
```

6. logout to the instance

```
myInstance.logout(function(response){
if(!response.error)
{
//user logout
}
});
```
===========================

0 comments on commit 54f42cd

Please sign in to comment.