Add bot-settings for keywords and shares

This commit is contained in:
kevinpauer
2022-04-06 13:42:15 +02:00
parent de586a7e17
commit b2be8745a6
8 changed files with 306 additions and 8 deletions

View File

@@ -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,
},
});
}
}