Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
Breeze
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DeStream-public
Breeze
Commits
45f0ffdf
Commit
45f0ffdf
authored
Apr 02, 2017
by
dev0tion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add API documentation
parent
3361c94d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
8 deletions
+24
-8
api.service.ts
Breeze.UI/src/app/shared/api/api.service.ts
+24
-8
No files found.
Breeze.UI/src/app/shared/api/api.service.ts
View file @
45f0ffdf
...
...
@@ -7,6 +7,10 @@ import 'rxjs/add/operator/catch';
import
{
SafeCreation
}
from
'../safe-creation'
;
import
{
Mnemonic
}
from
'../mnemonic'
;
/**
* For information on the API specification have a look at our Github:
* https://github.com/stratisproject/Breeze/blob/master/Breeze.Documentation/ApiSpecification.md
*/
@
Injectable
()
export
class
ApiService
{
constructor
(
private
http
:
Http
)
{};
...
...
@@ -14,13 +18,9 @@ export class ApiService {
private
webApiUrl
=
'http://localhost:3000/api/v1'
;
private
headers
=
new
Headers
({
'Content-Type'
:
'application/json'
});
isConnected
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/safe/connected'
)
.
map
((
response
:
Response
)
=>
response
.
json
())
.
catch
(
this
.
handleError
);
}
/**
* Get wallet status info from the API.
*/
getWalletStatus
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/status'
)
...
...
@@ -28,6 +28,9 @@ export class ApiService {
.
catch
(
this
.
handleError
);
}
/**
* Get wallet balance info from the API.
*/
getWalletBalance
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/balance'
)
...
...
@@ -35,6 +38,9 @@ export class ApiService {
.
catch
(
this
.
handleError
);
}
/**
* Get a wallets transaction history info from the API.
*/
getWalletHistory
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/history'
)
...
...
@@ -42,6 +48,9 @@ export class ApiService {
.
catch
(
this
.
handleError
);
}
/**
* Get unused receive addresses for a certain wallet from the API.
*/
getUnusedReceiveAddresses
():
Observable
<
any
>
{
return
this
.
http
.
get
(
this
.
webApiUrl
+
'/wallet/receive'
)
...
...
@@ -49,6 +58,9 @@ export class ApiService {
.
catch
(
this
.
handleError
);
}
/**
* Create a new wallet.
*/
createWallet
(
data
:
SafeCreation
):
Observable
<
any
>
{
console
.
log
(
JSON
.
stringify
(
data
));
return
this
.
http
...
...
@@ -56,6 +68,10 @@ export class ApiService {
.
map
(
response
=>
response
.
json
());
}
/**
* Handle errors from the API.
* @param error
*/
private
handleError
(
error
:
Response
|
any
)
{
let
errMsg
:
string
;
if
(
error
instanceof
Response
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment