modifyContactTag(contactId: number, params): Observable<any> {
     const url = `${Constants.apiContacts}/${contactId}`;
     
     return this.http
         .patch(url, params)
         .pipe(catchError(this.handleError('modifyContactTag', null)));
 }
Ejemplo n.º 2
0
  public updateNote(note: Note): Observable<Note> {
    const updateNoteUrl = `https://whiteraven.azurewebsites.net/api/notes/${note.id}`;

    return this.http.patch<Response<Note>>(updateNoteUrl, { title: note.title, content: note.content })
      .pipe(
        tap(r => {
          const indexInAll = this.dataStore.allNotes.findIndex(x => x.id === r.data.id);

          this.dataStore.allNotes[indexInAll] = r.data;
          this._allNotes.next([...this.dataStore.allNotes]);

          const indexInMy = this.dataStore.myNotes.findIndex(x => x.id === r.data.id);
          if (indexInMy >= 0) {
            this.dataStore.myNotes[indexInMy] = r.data;
            this._myNotes.next([...this.dataStore.myNotes]);
            return;
          }

          const indexInEditable = this.dataStore.editableNotes.findIndex(x => x.id === r.data.id);
          if (indexInEditable >= 0) {
            this.dataStore.editableNotes[indexInEditable] = r.data;
            this._editableNotes.next([...this.dataStore.editableNotes]);
            return;
          }

          throw new Error('Note was not found in the editable collections');
        }),
        map(r => r.data));
  }
Ejemplo n.º 3
0
 updateAclString(rootDn:string, aclStrVal:string){
     let headers = this.authService.getAuthHeader();
     let body  = this.constructSDJsonBody(aclStrVal);
     let url = 'https://' + this.domain + ':' + this.configService.API_PORT + '/v1/vmdir/ldap';
     url += '?dn=' + encodeURIComponent(rootDn);
     console.log(url);
     return this.httpClient.patch(url, body, {headers})
            .share()
            .map((res: Response) => res)
            .catch(this.handleError)
 }
Ejemplo n.º 4
0
 updateAttributes(rootDn:string, originalValMap:Map<string,any>, attribsArr:string[], modifiedAttributesMap:Map<string,any>, schemaMap:Map<string,any>): Observable<string[]> {
     let headers = this.authService.getAuthHeader();
     let body = this.constructJsonBody(originalValMap, attribsArr, modifiedAttributesMap, schemaMap);
     this.getUrl = 'https://' + this.domain + ':' + this.configService.API_PORT + '/v1/vmdir/ldap';
     let updateUrl = this.getUrl + '?dn='+rootDn;
     console.log(updateUrl);
     return this.httpClient.patch(updateUrl, body, {headers})
            .share()
            .map((res: Response) => res)
            .catch(this.handleError)
 }
Ejemplo n.º 5
0
 switchMap(user => {
   return this.http.patch('/_api/v1/user/changepassword', {
       old_password: oldPassword,
       new_password: newPassword,
       retype_password: newPassword,
     },
     {
       headers: { 'X-Authorization': 'Bearer ' + user.token }
     }
   );
 })
 patch<T>(url: string, body: string): Observable<T> {
     return this.http.patch<T>(url, body);
 }
 patch<TResponseBody>(url: string, data?: any): Observable<HttpResponse<TResponseBody>> {
     return this.httpClient.patch<TResponseBody>(url, JSON.stringify(data), { observe: 'response' });
 }
Ejemplo n.º 8
0
 updateUser(id: any, user: any) {
   return this.http.patch(`${environment.url}/users/${id}`, user);
 }
Ejemplo n.º 9
0
	changeScheduledTaskStatus(scheduledTaskId: number, actionName: string): Promise<void> {
		return this.http.patch('/api/scheduledtasks', { id: scheduledTaskId, action: actionName })
			.toPromise()
			.then(() => null)
			.catch(this.utils.handleResponseError);
	}
Ejemplo n.º 10
0
	/**
	 * Renames an existing playbook.
	 * @param playbookId Current playbook ID to change
	 * @param newName New name for the updated playbook
	 */
	renamePlaybook(playbookId: string, newName: string): Promise<Playbook> {
		return this.http.patch('/api/playbooks', { id: playbookId, name: newName })
			.toPromise()
			.then((data: object) => plainToClass(Playbook, data))
			.catch(this.utils.handleResponseError);
	}
Ejemplo n.º 11
0
	/**
	 * Asynchronously sends a device to be updated within the DB and returns the edited device.
	 * @param device Device to edit
	 */
	editDevice(device: Device): Promise<Device> {
		return this.http.patch('/api/devices', device)
			.toPromise()
			.then((data) => plainToClass(Device, data))
			.catch(this.utils.handleResponseError);
	}
Ejemplo n.º 12
0
	/**
	 * For a given executing workflow, asyncronously perform some action to change its status.
	 * Only returns success
	 * @param workflowId Workflow ID to act upon
	 * @param action Action to take (e.g. abort, resume, pause)
	 */
	performWorkflowStatusAction(workflowId: string, action: string): Promise<void> {
		return this.http.patch('api/workflowqueue', { execution_id: workflowId, status: action })
			.toPromise()
			.then(() => null)
			.catch(this.utils.handleResponseError);
	}