-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.ts
43 lines (39 loc) · 963 Bytes
/
schema.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as identityEntitiesProto from "../../bridge/proto/identity_entities";
/**
* Represents a schema with its attributes.
*/
export class Schema {
cid: string;
cidJsonLd: string;
schemaType: string;
json: string;
/**
* Constructs a Schema object with the specified parameters.
* @param cid
* @param cidJsonLd
* @param schemaType
* @param json
*/
constructor(
cid: string,
cidJsonLd: string,
schemaType: string,
json: string
) {
this.cid = cid;
this.cidJsonLd = cidJsonLd;
this.schemaType = schemaType;
this.json = json;
}
public toProto(): identityEntitiesProto.Schema {
return identityEntitiesProto.Schema.fromPartial({
cid: this.cid,
cidJsonLd: this.cidJsonLd,
schemaType: this.schemaType,
json: this.json
});
}
static fromProto(r: identityEntitiesProto.Schema): Schema {
return new Schema(r.cid, r.cidJsonLd, r.schemaType, r.json);
}
}