updateLocales(map: Map<String, String>, lang) {
   let body = '{';
   if (map) {
     map.forEach((value: string, key: string) => {
       body += '"' + key + '":' + '"' + value + '",';
     });
   }
   body = body.slice(0, -1);
   body += '}';
   return this.http.put(httpApiHost + '/locales/' + lang, body, httpJsonOptions);
 }
 update<T extends Identifiable>(kind: ResourceType<T>, item: T): Observable<T> {
   const collectionPath = getCollectionPath(kind.typeId);
   const uri = `${API_BASE_URL}/${collectionPath}/${item.id}`;
   return this.http
     .put<T>(uri, item)
     .pipe(
       tap(entity => this.logger.log(`Updated ${kind.typeId}: ${JSON.stringify(entity)}.`)),
       retryAfter(2, 1000),
       catchError(this.handleError),
     );
 }
 updateVoucher(){
   var id = 1002;
   var url = "/api/vouchers/" + id;
   var vtu = { "ID": id, "Text": "Updated by Angular", "Date": "2016-04-22T16:59:32.086", "Amount": 99, "Paid": true, "Expense": false, "VATRate" : 20 };
   
   this.httpClient.put('http://localhost:5000/api/vouchers', vtu)
   .toPromise()
   .then((response)=>{
     console.log('voucher updated');
     this.result = response;})
 }
Esempio n. 4
0
 public updateApi(
   api: Api,
   namespace: string,
   token: string,
 ): Observable<Api> {
   const httpOptions = this.getHTTPOptions(token);
   const url = `${AppConfig.apisApiUrl}/namespaces/${namespace}/apis/${
     api.metadata.name
   }`;
   return this.http.put<Api>(url, api, httpOptions);
 }
    /**
     * Manage an existing user or create a new one.
     *
     * @param {User} user
     * @param operation whether we're creating a new user or updating an existing one
     */
    manageUser(user: User, operation: UserOperations = UserOperations.CREATE): Observable<any> {
        let url = '/api/users';

        if (operation === UserOperations.UPDATE) {
            url += `/${user.username}`;
        }

        return this.http
            .put(url, user)
            .pipe(map(r => plainToClass(ApiResponse, r)));
    }
Esempio n. 6
0
 save_changes_to_comic(comic: Comic, series: string, volume: string, issue_number: string): Observable<any> {
   const params = new HttpParams()
     .set('series', series)
     .set('volume', volume)
     .set('issue_number', issue_number);
   return this.http.put(`${COMIC_SERVICE_API_URL}/comics/${comic.id}`, params)
     .finally(() => {
       comic.series = series;
       comic.volume = volume;
       comic.issue_number = issue_number;
     });
 }
 update<T extends Identifiable>(kind: Type<T>, item: T): Observable<T> {
   const uri = `${BASE_API_URI}${API_ENDPOINTS[kind.name]}/${item.id}`;
   return this.http
     .put<CustomResponse<T>>(uri, item)
     .pipe(
       tap(entity => this.logger.log(`Response: ${JSON.stringify(entity)}.`)),
       map(productResponse => productResponse.data),
       tap(entity => this.logger.log(`Updated: ${JSON.stringify(entity)}.`)),
       retryAfter(3, 1000),
       catchError(this.handleError),
     );
 }
 /**
  *
  *
  * @param {any} params
  * @returns
  *
  * @memberof CheckoutService
  */
 updateOrder(params: any) {
   const url = `api/v1/checkouts/${
     this.orderNumber
     }.json?order_token=${this.getOrderToken()}`;
   return this.http
     .put<Order>(url, params)
     .pipe(
       map(order =>
         this.store.dispatch(this.actions.updateOrderSuccess(order))
       )
     );
 }
 /**
  *
  *
  * @returns
  *
  * @memberof CheckoutService
  */
 changeOrderState() {
   const url = `api/v1/checkouts/${
     this.orderNumber
     }/next.json?order_token=${this.getOrderToken()}`;
   return this.http
     .put<Order>(url, {})
     .pipe(
       map(order =>
         this.store.dispatch(this.actions.changeOrderStateSuccess(order))
       )
     );
 }
Esempio n. 10
0
	/**
	 * Responds to a message by calling a trigger endpoint for a given workflow's execution ID.
	 * @param workflow_execution_id Execution ID of workflow to trigger
	 * @param action Action to send to trigger endpoint
	 */
	respondToMessage(workflow_execution_id: string, action: string): Promise<string[]> {
		const arg = new Argument();
		arg.name = 'action';
		arg.value = action;
		const body: object = {
			execution_ids: [workflow_execution_id],
			data_in: action,
			arguments: [arg],
		};
		return this.http.put('/api/triggers/send_data', body)
			.toPromise()
			.catch(this.utils.handleResponseError);
	}