Add bot-settings for keywords and shares
This commit is contained in:
@@ -13,4 +13,100 @@ export class BotService {
|
||||
private http: HttpClient,
|
||||
private tokenStorage: TokenStorageService
|
||||
) {}
|
||||
|
||||
/**
|
||||
* @returns Observable
|
||||
*/
|
||||
public getKeywords(): Observable<any> {
|
||||
return this.http.get(API_URL + 'keywords', {
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
responseType: 'text',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} keyword
|
||||
* @returns Observable
|
||||
*/
|
||||
public createKeyword(keyword: string): Observable<any> {
|
||||
return this.http.post(
|
||||
API_URL + 'keyword',
|
||||
{
|
||||
keyword,
|
||||
},
|
||||
{
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} keyword
|
||||
* @returns Observable
|
||||
*/
|
||||
public deleteKeyword(keyword: string): Observable<any> {
|
||||
return this.http.delete(API_URL + 'keyword', {
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
body: {
|
||||
keyword,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns Observable
|
||||
*/
|
||||
public getSymbols(): Observable<any> {
|
||||
return this.http.get(API_URL + 'shares', {
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
responseType: 'text',
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} keyword
|
||||
* @returns Observable
|
||||
*/
|
||||
public createShare(symbol: string): Observable<any> {
|
||||
return this.http.post(
|
||||
API_URL + 'share',
|
||||
{
|
||||
symbol,
|
||||
},
|
||||
{
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} share
|
||||
* @returns Observable
|
||||
*/
|
||||
public deleteShare(share: string): Observable<any> {
|
||||
return this.http.delete(API_URL + 'share', {
|
||||
headers: new HttpHeaders({
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + this.tokenStorage.getToken(),
|
||||
}),
|
||||
body: {
|
||||
share,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user