All Downloads are FREE. Search and download functionalities are using the official Maven repository.

src.app.core.services.git-backup.service.ts Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { environment } from '@env/environment';
import { GitRemoteConfig } from '@model';

@Injectable({
    providedIn: 'root'
})
export class GitBackupService {

    private url = '/api/v1/backups/git/';

    constructor(private http: HttpClient) {
    }

    public loadConfig(): Observable> {
        return this.http.get>(environment.backend + this.url);
    }

    public add(remoteConfig: GitRemoteConfig): Observable {
        return this.http.post(environment.backend + this.url, remoteConfig);
    }

    public backupTo(remote: GitRemoteConfig): Observable {
        return this.http.get(environment.backend + this.url + remote.name + '/backup');
    }

    public importFrom(remote: GitRemoteConfig) {
        return this.http.get(environment.backend + this.url + remote.name + '/import');
    }

    public remove(remoteConfig: GitRemoteConfig): Observable {
        return this.http.delete(environment.backend + this.url + remoteConfig.name);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy