abstract api service

This commit is contained in:
Kyle Spearrin 2018-01-31 14:27:11 -05:00
parent 4694793785
commit 5845291aaf
2 changed files with 20 additions and 19 deletions

View File

@ -12,26 +12,27 @@ import { FolderResponse } from '../models/response/folderResponse';
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
import { SyncResponse } from '../models/response/syncResponse';
export interface ApiService {
export abstract class ApiService {
urlsSet: boolean;
baseUrl: string;
identityBaseUrl: string;
deviceType: string;
logoutCallback: Function;
setUrls(urls: EnvironmentUrls): void;
postIdentityToken(request: TokenRequest): Promise<IdentityTokenResponse | any>;
refreshIdentityToken(): Promise<any>;
postTwoFactorEmail(request: TwoFactorEmailRequest): Promise<any>;
getAccountRevisionDate(): Promise<number>;
postPasswordHint(request: PasswordHintRequest): Promise<any>;
postRegister(request: RegisterRequest): Promise<any>;
postFolder(request: FolderRequest): Promise<FolderResponse>;
putFolder(id: string, request: FolderRequest): Promise<FolderResponse>;
deleteFolder(id: string): Promise<any>;
postCipher(request: CipherRequest): Promise<CipherResponse>;
putCipher(id: string, request: CipherRequest): Promise<CipherResponse>;
deleteCipher(id: string): Promise<any>;
postCipherAttachment(id: string, data: FormData): Promise<CipherResponse>;
deleteCipherAttachment(id: string, attachmentId: string): Promise<any>;
getSync(): Promise<SyncResponse>;
setUrls: (urls: EnvironmentUrls) => void;
postIdentityToken: (request: TokenRequest) => Promise<IdentityTokenResponse | any>;
refreshIdentityToken: () => Promise<any>;
postTwoFactorEmail: (request: TwoFactorEmailRequest) => Promise<any>;
getAccountRevisionDate: () => Promise<number>;
postPasswordHint: (request: PasswordHintRequest) => Promise<any>;
postRegister: (request: RegisterRequest) => Promise<any>;
postFolder: (request: FolderRequest) => Promise<FolderResponse>;
putFolder: (id: string, request: FolderRequest) => Promise<FolderResponse>;
deleteFolder: (id: string) => Promise<any>;
postCipher: (request: CipherRequest) => Promise<CipherResponse>;
putCipher: (id: string, request: CipherRequest) => Promise<CipherResponse>;
deleteCipher: (id: string) => Promise<any>;
postCipherAttachment: (id: string, data: FormData) => Promise<CipherResponse>;
deleteCipherAttachment: (id: string, attachmentId: string) => Promise<any>;
getSync: () => Promise<SyncResponse>;
}

View File

@ -1,6 +1,6 @@
import { ConstantsService } from './constants.service';
import { ApiService as ApiServiceInterface } from '../abstractions/api.service';
import { ApiService as ApiServiceAbstraction } from '../abstractions/api.service';
import { PlatformUtilsService } from '../abstractions/platformUtils.service';
import { TokenService } from '../abstractions/token.service';
@ -19,7 +19,7 @@ import { FolderResponse } from '../models/response/folderResponse';
import { IdentityTokenResponse } from '../models/response/identityTokenResponse';
import { SyncResponse } from '../models/response/syncResponse';
export class ApiService implements ApiServiceInterface {
export class ApiService implements ApiServiceAbstraction {
urlsSet: boolean = false;
baseUrl: string;
identityBaseUrl: string;