1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 16:53:34 +00:00

get templates

This commit is contained in:
Kyle Spearrin
2018-05-14 16:25:14 -04:00
parent a1238ff685
commit 85770b7cbb
14 changed files with 222 additions and 6 deletions

View File

@@ -0,0 +1,19 @@
export class CardRequest {
static template(): CardRequest {
var req = new CardRequest();
req.cardholderName = 'John Doe';
req.brand = 'visa';
req.number = '4242424242424242';
req.expMonth = '04';
req.expYear = '2023';
req.code = '123';
return req;
}
cardholderName: string;
brand: string;
number: string;
expMonth: string;
expYear: string;
code: string;
}

View File

@@ -0,0 +1,36 @@
import { CipherType } from 'jslib/enums/cipherType';
import { LoginRequest } from './loginRequest';
import { SecureNoteRequest } from './secureNoteRequest';
import { CardRequest } from './cardRequest';
import { IdentityRequest } from './identityRequest';
import { FieldRequest } from './fieldRequest';
export class CipherRequest {
static template(): CipherRequest {
var req = new CipherRequest();
req.type = CipherType.Login;
req.folderId = null;
req.organizationId = null;
req.name = 'Item name';
req.notes = 'Some notes about this item.';
req.favorite = false;
req.fields = [];
req.login = null;
req.secureNote = null;
req.card = null;
req.identity = null;
return req;
}
type: CipherType;
folderId: string;
organizationId: string;
name: string;
notes: string;
favorite: boolean;
fields: FieldRequest[];
login: LoginRequest;
secureNote: SecureNoteRequest;
card: CardRequest;
identity: IdentityRequest;
}

View File

@@ -0,0 +1,3 @@
export class CollectionRequest {
name: string;
}

View File

@@ -0,0 +1,15 @@
import { FieldType } from 'jslib/enums/fieldType';
export class FieldRequest {
static template(): FieldRequest {
var req = new FieldRequest();
req.name = 'Field name';
req.value = 'Some value';
req.type = FieldType.Text;
return req;
}
name: string;
value: string;
type: FieldType;
}

View File

@@ -0,0 +1,3 @@
export class FolderRequest {
name: string;
}

View File

@@ -0,0 +1,43 @@
export class IdentityRequest {
static template(): IdentityRequest {
var req = new IdentityRequest();
req.title = 'Mr';
req.firstName = 'John';
req.middleName = 'William';
req.lastName = 'Doe';
req.address1 = '123 Any St';
req.address2 = 'Apt #123';
req.address3 = null;
req.city = 'New York';
req.state = 'NY';
req.postalCode = '10001';
req.country = 'US';
req.company = 'Acme Inc.';
req.email = 'john@company.com';
req.phone = '5555551234';
req.ssn = '000-123-4567';
req.username = 'jdoe';
req.passportNumber = 'US-123456789';
req.licenseNumber = 'D123-12-123-12333';
return req;
}
title: string;
firstName: string;
middleName: string;
lastName: string;
address1: string;
address2: string;
address3: string;
city: string;
state: string;
postalCode: string;
country: string;
company: string;
email: string;
phone: string;
ssn: string;
username: string;
passportNumber: string;
licenseNumber: string;
}

View File

@@ -0,0 +1,17 @@
import { LoginUriRequest } from './loginUriRequest';
export class LoginRequest {
static template(): LoginRequest {
var req = new LoginRequest();
req.uris = [];
req.username = 'jdoe';
req.password = 'myp@ssword123';
req.totp = 'JBSWY3DPEHPK3PXP';
return req;
}
uris: LoginUriRequest[];
username: string;
password: string;
totp: string;
}

View File

@@ -0,0 +1,13 @@
import { UriMatchType } from 'jslib/enums/uriMatchType';
export class LoginUriRequest {
static template(): LoginUriRequest {
var req = new LoginUriRequest();
req.uri = 'https://google.com';
req.match = null;
return req;
}
uri: string;
match: UriMatchType = null;
}

View File

@@ -0,0 +1,11 @@
import { SecureNoteType } from 'jslib/enums/secureNoteType';
export class SecureNoteRequest {
static template(): SecureNoteRequest {
var req = new SecureNoteRequest();
req.type = SecureNoteType.Generic;
return req;
}
type: SecureNoteType;
}

View File

@@ -0,0 +1,10 @@
import { BaseResponse } from './baseResponse';
export class TemplateResponse extends BaseResponse {
template: any;
constructor(template: any) {
super('template');
this.template = template;
}
}