Reference / Modules / client / DraftRequest
Class: DraftRequest
client.DraftRequest
A State instance is a state in the "state machine" sense. It comes with some behavior and state transition methods. A state transition method returns an instance of the next state given the executed operation, which discards current object.
This class should be extended by client class. It provides method enabling the client class to query if it was already discarded or not as well as methods actually discarding the state.
Hierarchy
-
↳
DraftRequest
Table of contents
Constructors
Properties
Accessors
Methods
- _withLocs
- addFile
- addLink
- addMetadata
- cancel
- checkHash
- data
- deleteFile
- deleteLink
- deleteMetadata
- discard
- discardOnSuccess
- ensureCurrent
- finalizeOnSuccess
- getCurrentState
- getCurrentStateOrThrow
- getFile
- isIDenfySessionInProgress
- isLogionData
- isLogionIdentity
- isOwner
- isRequester
- isVerifiedIssuer
- locsState
- refresh
- requestFileReview
- requestLinkReview
- requestMetadataReview
- startNewIDenfySession
- submit
- supersededLoc
- syncDiscardOnSuccess
- veryNew
- withLocs
- buildLocData
- checkHash
- createFromLoc
- createFromRequest
- toCollectionParams
Constructors
constructor
• new DraftRequest(locSharedState
, request
, legalOfficerCase
, locIssuers
, invitedContributors
): DraftRequest
Parameters
Name | Type |
---|---|
locSharedState | LocSharedState |
request | LocRequest |
legalOfficerCase | undefined | LegalOfficerCase |
locIssuers | LocVerifiedIssuers |
invitedContributors | ValidAccountId [] |
Returns
Inherited from
Defined in
packages/client/src/Loc.ts:766
Properties
invitedContributors
• Protected
Readonly
invitedContributors: ValidAccountId
[]
Inherited from
EditableRequest.invitedContributors
Defined in
packages/client/src/Loc.ts:763
legalOfficerCase
• Protected
Optional
Readonly
legalOfficerCase: LegalOfficerCase
Inherited from
EditableRequest.legalOfficerCase
Defined in
packages/client/src/Loc.ts:761
locIssuers
• Protected
Readonly
locIssuers: LocVerifiedIssuers
Inherited from
Defined in
packages/client/src/Loc.ts:762
locSharedState
• Protected
Readonly
locSharedState: LocSharedState
Inherited from
EditableRequest.locSharedState
Defined in
packages/client/src/Loc.ts:759
owner
• Readonly
owner: LegalOfficerClass
Inherited from
Defined in
packages/client/src/Loc.ts:764
request
• Protected
Readonly
request: LocRequest
Inherited from
Defined in
packages/client/src/Loc.ts:760
Accessors
discarded
• get
discarded(): boolean
Returns
boolean
Description
True if this state was discarded
Inherited from
EditableRequest.discarded
Defined in
packages/client/src/State.ts:24
iDenfySessionUrl
• get
iDenfySessionUrl(): string
Returns
string
Defined in
packages/client/src/Loc.ts:1345
locId
• get
locId(): UUID
Returns
UUID
Inherited from
EditableRequest.locId
Defined in
packages/client/src/Loc.ts:781
Methods
_withLocs
▸ _withLocs<T
>(locsState
, constructor
): T
Type parameters
Name | Type |
---|---|
T | extends LocRequestState |
Parameters
Name | Type |
---|---|
locsState | LocsState |
constructor | (locSharedState : LocSharedState , request : LocRequest , legalOfficerCase : undefined | LegalOfficerCase , locIssuers : LocVerifiedIssuers , invitedContributors : ValidAccountId []) => T |
Returns
T
Inherited from
Defined in
packages/client/src/Loc.ts:1096
addFile
▸ addFile(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | AddFileParams |
Returns
Promise
<EditableRequest
>
Inherited from
Defined in
packages/client/src/Loc.ts:1189
addLink
▸ addLink(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | AddLinkParams |
Returns
Promise
<EditableRequest
>
Inherited from
Defined in
packages/client/src/Loc.ts:1199
addMetadata
▸ addMetadata(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | AddMetadataParams |
Returns
Promise
<EditableRequest
>
Inherited from
Defined in
packages/client/src/Loc.ts:1180
cancel
▸ cancel(): Promise
<LocsState
>
Returns
Promise
<LocsState
>
Defined in
packages/client/src/Loc.ts:1325
checkHash
▸ checkHash(hash
): Promise
<CheckHashResult
>
Parameters
Name | Type |
---|---|
hash | Hash |
Returns
Promise
<CheckHashResult
>
Inherited from
Defined in
packages/client/src/Loc.ts:869
data
▸ data(): LocData
Returns
Inherited from
Defined in
packages/client/src/Loc.ts:839
deleteFile
▸ deleteFile(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | RefFileParams |
Returns
Promise
<EditableRequest
>
Inherited from
Defined in
packages/client/src/Loc.ts:1217
deleteLink
▸ deleteLink(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | RefLinkParams |
Returns
Promise
<EditableRequest
>
Inherited from
Defined in
packages/client/src/Loc.ts:1226
deleteMetadata
▸ deleteMetadata(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | RefMetadataParams |
Returns
Promise
<EditableRequest
>
Inherited from
EditableRequest.deleteMetadata
Defined in
packages/client/src/Loc.ts:1208
discard
▸ discard(next
): void
Parameters
Name | Type |
---|---|
next | undefined | State |
Returns
void
Description
Discards current state. One must discard the state only
if the state transition was successfully executed. It may be safer to
use discardOnSuccess
.
Inherited from
Defined in
packages/client/src/State.ts:43
discardOnSuccess
▸ discardOnSuccess<T
, U
>(action
): Promise
<U
>
Type parameters
Name | Type |
---|---|
T | extends State |
U | extends State = T |
Parameters
Name | Type | Description |
---|---|---|
action | (current : T ) => Promise <U > | The state transition logic producing next state |
Returns
Promise
<U
>
Next state if state transition logic execution did not throw
Descripiton
Discards current state only if given state transition logic executed successfully (i.e. without throwing an error).
Inherited from
EditableRequest.discardOnSuccess
Defined in
packages/client/src/State.ts:55
ensureCurrent
▸ ensureCurrent(): void
Returns
void
Description
Throws an error if this state was discarded. This should be called by all public methods of client class.
Inherited from
Defined in
packages/client/src/State.ts:32
finalizeOnSuccess
▸ finalizeOnSuccess<T
>(action
): Promise
<void
>
Type parameters
Name | Type |
---|---|
T | extends State |
Parameters
Name | Type | Description |
---|---|---|
action | (current : T ) => Promise <void > | The state transition logic producing next state |
Returns
Promise
<void
>
Next state if state transition logic execution did not throw
Descripiton
Finalizes (i.e. replaces with no new state) current state only if given state transition logic executed successfully (i.e. without throwing an error).
Inherited from
EditableRequest.finalizeOnSuccess
Defined in
packages/client/src/State.ts:117
getCurrentState
▸ getCurrentState(): undefined
| State
Returns
undefined
| State
This state if not discareded or the current state or undefined when there is no current state.
Description
If the state has been discarded, provides the replacing current state if any.
Inherited from
EditableRequest.getCurrentState
Defined in
packages/client/src/State.ts:90
getCurrentStateOrThrow
▸ getCurrentStateOrThrow(): State
Returns
Inherited from
EditableRequest.getCurrentStateOrThrow
Defined in
packages/client/src/State.ts:102
getFile
▸ getFile(hash
): Promise
<TypedFile
>
Parameters
Name | Type |
---|---|
hash | Hash |
Returns
Promise
<TypedFile
>
Inherited from
Defined in
packages/client/src/Loc.ts:1103
isIDenfySessionInProgress
▸ isIDenfySessionInProgress(): boolean
Returns
boolean
Defined in
packages/client/src/Loc.ts:1331
isLogionData
▸ isLogionData(): boolean
Returns
boolean
Inherited from
Defined in
packages/client/src/Loc.ts:864
isLogionIdentity
▸ isLogionIdentity(): boolean
Returns
boolean
Inherited from
EditableRequest.isLogionIdentity
Defined in
packages/client/src/Loc.ts:859
isOwner
▸ isOwner(account?
): boolean
Parameters
Name | Type |
---|---|
account? | ValidAccountId |
Returns
boolean
Inherited from
Defined in
packages/client/src/Loc.ts:1112
isRequester
▸ isRequester(account?
): boolean
Parameters
Name | Type |
---|---|
account? | ValidAccountId |
Returns
boolean
Inherited from
Defined in
packages/client/src/Loc.ts:1107
isVerifiedIssuer
▸ isVerifiedIssuer(account?
): boolean
Parameters
Name | Type |
---|---|
account? | ValidAccountId |
Returns
boolean
Inherited from
EditableRequest.isVerifiedIssuer
Defined in
packages/client/src/Loc.ts:1117
locsState
▸ locsState(): LocsState
Returns
Inherited from
Defined in
packages/client/src/Loc.ts:835
refresh
▸ refresh(): Promise
<DraftRequest
>
Returns
Promise
<DraftRequest
>
Overrides
Defined in
packages/client/src/Loc.ts:1316
requestFileReview
▸ requestFileReview(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | RefFileParams |
Returns
Promise
<EditableRequest
>
Inherited from
EditableRequest.requestFileReview
Defined in
packages/client/src/Loc.ts:1235
requestLinkReview
▸ requestLinkReview(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | RefLinkParams |
Returns
Promise
<EditableRequest
>
Inherited from
EditableRequest.requestLinkReview
Defined in
packages/client/src/Loc.ts:1253
requestMetadataReview
▸ requestMetadataReview(params
): Promise
<EditableRequest
>
Parameters
Name | Type |
---|---|
params | RefMetadataParams |
Returns
Promise
<EditableRequest
>
Inherited from
EditableRequest.requestMetadataReview
Defined in
packages/client/src/Loc.ts:1244
startNewIDenfySession
▸ startNewIDenfySession(request
): Promise
<DraftRequest
>
Parameters
Name | Type |
---|---|
request | IdenfyVerificationCreation |
Returns
Promise
<DraftRequest
>
Defined in
packages/client/src/Loc.ts:1335
submit
▸ submit(): Promise
<PendingRequest
>
Returns
Promise
<PendingRequest
>
Defined in
packages/client/src/Loc.ts:1320
supersededLoc
▸ supersededLoc(): Promise
<undefined
| VoidedLoc
>
Returns
Promise
<undefined
| VoidedLoc
>
Inherited from
Defined in
packages/client/src/Loc.ts:851
syncDiscardOnSuccess
▸ syncDiscardOnSuccess<T
, U
>(action
): U
Type parameters
Name | Type |
---|---|
T | extends State |
U | extends State = T |
Parameters
Name | Type | Description |
---|---|---|
action | (current : T ) => U | The state transition logic producing next state |
Returns
U
Next state if state transition logic execution did not throw
Descripiton
Same as discardOnSuccess
but with a synchronous action.
Inherited from
EditableRequest.syncDiscardOnSuccess
Defined in
packages/client/src/State.ts:73
veryNew
▸ veryNew(): DraftRequest
Returns
Defined in
packages/client/src/Loc.ts:1311
withLocs
▸ withLocs(locsState
): DraftRequest
Parameters
Name | Type |
---|---|
locsState | LocsState |
Returns
Overrides
Defined in
packages/client/src/Loc.ts:1353
buildLocData
▸ buildLocData(api
, legalOfficerCase
, request
, locIssuers
, invitedContributors
): LocData
Parameters
Name | Type |
---|---|
api | LogionNodeApiClass |
legalOfficerCase | undefined | LegalOfficerCase |
request | LocRequest |
locIssuers | LocVerifiedIssuers |
invitedContributors | ValidAccountId [] |
Returns
Inherited from
Defined in
packages/client/src/Loc.ts:843
checkHash
▸ checkHash(loc
, hash
): CheckHashResult
Parameters
Name | Type |
---|---|
loc | LocData |
hash | Hash |
Returns
Inherited from
Defined in
packages/client/src/Loc.ts:873
createFromLoc
▸ createFromLoc(locSharedState
, request
, legalOfficerCase
, locIssuers
, invitedContributors
): Promise
<OnchainLocState
>
Parameters
Name | Type |
---|---|
locSharedState | LocSharedState |
request | LocRequest |
legalOfficerCase | LegalOfficerCase |
locIssuers | LocVerifiedIssuers |
invitedContributors | ValidAccountId [] |
Returns
Promise
<OnchainLocState
>
Inherited from
Defined in
packages/client/src/Loc.ts:800
createFromRequest
▸ createFromRequest(locSharedState
, request
, locIssuers
, invitedContributors
, legalOfficerCase?
): Promise
<AnyLocState
>
Parameters
Name | Type |
---|---|
locSharedState | LocSharedState |
request | LocRequest |
locIssuers | LocVerifiedIssuers |
invitedContributors | ValidAccountId [] |
legalOfficerCase? | LegalOfficerCase |
Returns
Promise
<AnyLocState
>
Inherited from
EditableRequest.createFromRequest
Defined in
packages/client/src/Loc.ts:785
toCollectionParams
▸ toCollectionParams(collectionParams
): undefined
| CollectionParams
Parameters
Name | Type |
---|---|
collectionParams | undefined | BackendCollectionParams |
Returns
undefined
| CollectionParams
Inherited from
EditableRequest.toCollectionParams