-
Notifications
You must be signed in to change notification settings - Fork 0
/
OperationResult.class.st
61 lines (47 loc) · 1.34 KB
/
OperationResult.class.st
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
"
An OperationResult encapsulates the result from the GraphQL operation. You can use it directly OR, if you have complex object traversal needs, you can subclass it for your particular needs (either object traversal needs OR display needs)
"
Class {
#name : #OperationResult,
#superclass : #Object,
#instVars : [
'wasSuccess',
'result'
],
#category : #GraphQLSupport
}
{ #category : #'instance creation' }
OperationResult class >> newFromOperationResult: oldResult [
"Construct a new instance of (this class) from another OperationResult subclass.
Meant to allow OperationResults to be up-casted into specific OperationResult subclasses"
"scope: class-variables & class-instance-variables"
|o|
o := self new.
o result: (oldResult result).
o wasSuccess: (oldResult wasSuccess).
^ o.
]
{ #category : #accessing }
OperationResult >> data [
^ wasSuccess ifTrue: [ result ] ifFalse: [ nil ].
]
{ #category : #accessing }
OperationResult >> errors [
^ wasSuccess ifFalse: [ result ] ifTrue: [ nil ].
]
{ #category : #accessing }
OperationResult >> result [
^ result
]
{ #category : #accessing }
OperationResult >> result: anObject [
result := anObject
]
{ #category : #accessing }
OperationResult >> wasSuccess [
^ wasSuccess
]
{ #category : #accessing }
OperationResult >> wasSuccess: anObject [
wasSuccess := anObject
]