-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToolingAPI.cls
1942 lines (1780 loc) · 71.4 KB
/
ToolingAPI.cls
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Copyright (c) 2013, Apex Tooling API
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of the Apex Tooling API, inc nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**/
public with sharing class ToolingAPI {
/**
* Complete list of all Tooling API objects (as per those in WSDL that extend tns:sObject)
**/
public enum SObjectType {
ApexClass,
ApexClassMember,
ApexCodeCoverage,
ApexCodeCoverageAggregate,
ApexComponent,
ApexComponentMember,
ApexExecutionOverlayAction,
ApexExecutionOverlayResult,
ApexLog,
ApexOrgWideCoverage,
ApexPage,
ApexPageMember,
ApexTestQueueItem,
ApexTestResult,
ApexTrigger,
ApexTriggerMember,
AsyncApexJob,
ContainerAsyncRequest,
CustomObject,
CustomField,
MetadataContainer,
MetadataContainerMember,
Name,
SecurityHealthCheck, // Added for Health Check Score
SecurityHealthCheckRisks, // Added for High Risk Health Check
StaticResource,
TraceFlag,
User,
UserPreference,
Workflow,
WorkflowRule,
WorkflowAction,
WorkflowAlert,
WorkflowFieldUpdate,
WorkflowOutboundMessage,
WorkflowTask
}
// The API version used relates to the types and structures defined here
private static final String TOOLING_API_URI = '/services/data/v37.0/tooling'; //Changed version for SecurityHealthCheck and SecurityHealthCheckRisks
// Session Id can be resovled automatically depending on consturctor used
private String sessionId;
// Interface used to implement customi serialization on SObject based types
private interface ISerialize {
void serialize(JSONGenerator generator);
}
/**
* Uses the current users Session Id, only compatible in a interactive context
* @throws ToolingAPIException if no Session Id can be resolved (e.g. in a batch context)
**/
public ToolingAPI() {
this.sessionId = UserInfo.getSessionId();
if(this.sessionId==null)
throw new ToolingAPIException('Unable to obtain Session Id');
}
/**
* Uses the given Session Id, useful when using the API in a batch context
**/
public ToolingAPI(String sessionId) {
this.sessionId = sessionId;
}
/**
* Using this query as an example for calling the private static helper method.
* query
* @description Uses the queryString to issue a query via the Tooling API
* @param The query string to use
* @return a ToolingAPI Query Result
* @throws ToolingAPIException if an an exception was encountered.
*/
public QueryResult query(String queryString) {
HttpResponse response = submitRestCall('/query/?q=' + EncodingUtil.urlEncode(queryString, 'UTF-8'));
return parseQueryResult(response.getBody());
}
/**
* Describes all the sobjects via the tooling api. This is the equivalent of
* calling //instance/api/tooling/sobjects via the Tooling REST API.
* @return a ToolingAPI DescribeGlobalResult
* @throws ToolingAPIException if an an exception was encountered.
*/
public DescribeGlobalResult describeGlobal(){
return (DescribeGlobalResult)submitRestCallAndDeserialize('/sobjects',DescribeGlobalResult.class);
}
/**
* Describes a particular sobject via the tooling api.
* This is the equivalent of calling //instance/api/tooling/sobjects/{sobjectname}/describe
* @param The api name of the sobject to describe
* @return a ToolingAPI DescribeSObjectResult
* @throws ToolingAPIException if an exception was encountered
*/
public DescribeSObjectResult describeSObject(String apiName){
return
(DescribeSObjectResult)
submitRestCallAndDeserialize(
'/sobjects/'+apiName+'/describe'
,DescribeSObjectResult.class);
}
/**
* Execute code anonymously via the tooling api
* This is the equivalent of calling /executeAnonymous/?anonymousBody=body
* @param an already encoded body for executing anonymous code.
* @return a Tooling API ExecuteAnonymousResult record
* @throws ToolingAPIException if an exception was encountered
*/
public ExecuteAnonymousResult executeAnonymousEncoded(String body){
return (ExecuteAnonymousResult)
submitRestCallAndDeserialize(
'/executeAnonymous/?anonymousBody='+body
,ExecuteAnonymousResult.class);
}
/**
* Execute code anonymously via the tooling api
* This is the equivalent of calling /executeAnonymous/?anonymousBody=body
* This particular method encodes the body with UTF-8 by default.
* @param a String for executing anonymous code that WILL BE URL encoded with UTF-8
* @return a Tooling API ExecuteAnonymousResult record
* @throws ToolingAPIException if an exception was encountered
*/
public ExecuteAnonymousResult executeAnonymousUnencoded(String body){
if(body != null){
body = EncodingUtil.urlEncode(body, 'UTF-8');
}
return executeAnonymousEncoded(body);
}
/**
* Retrieve an Apex Log by its Id via the tooling api
* This is the equivalent of calling //instance/api/tooling/sobjects/ApexLog/{apexLogId}/Body/
* This method actually submits two REST callouts.. 1 to grab the ApexLog body and 1 to grab
* the rest of the ApexLog information.
* @param Id of the apex log to retrieve
* @return a ToolingAPI ApexLog
* @throws ToolingAPIException if an exception was encountered
*/
public ApexLog retrieveApexLog(Id apexLogId){
String body = submitRestCall('/sobjects/ApexLog/'+apexLogId+'/Body/').getBody();
ApexLog log = (ToolingAPI.ApexLog)retrieveSObject(SObjectType.ApexLog,apexLogId);
//Append the body from the first REST call to the ApexLog record.
log.body = body;
return log;
}
/**
* Generic method for retrieving an sobject of type by Id
* Assumes the class name in the ToolingAPI matches the REST api
* @param sobjType name of one of the valid Tooling API SObject's
* @param sobjectId Id of the applicable record to retrieve
*/
public SObject_x retrieveSObject(SObjectType sobjType,Id sobjectId){
//Have to prefix the sobjType with outter class name before type casting
return (SObject_x) submitRestCallAndDeserialize(
'/sobjects/'+sobjType.name()+'/'+sobjectId
,Type.forName('ToolingAPI.'+sobjType.name())
);
}
/**
* Generic method for deleting an sobject record
* @param sobjType name of one of the valid Tooling API SObject's
* @param sobjectId Id of the applicable record to delete
**/
public ToolingAPI.SaveResult deleteSObject(SObjectType sobjType, Id sobjectId){
return (ToolingAPI.SaveResult) submitRestCallAndDeserialize(
'/sobjects/'+sobjType.name()+'/'+sobjectId
,ToolingAPI.SaveResult.class
,'DELETE'
);
}
/**
* Generic method for deleting an sobject record
* @param sobjectRecord The sobject record to delete with id and type specified.
**/
public ToolingAPI.SaveResult deleteSObject(SObject_x sobjectRecord){
return (ToolingAPI.SaveResult) submitRestCallAndDeserialize(
'/sobjects/'+sobjectRecord.type_x+'/'+sobjectRecord.Id
,ToolingAPI.SaveResult.class
,'DELETE'
);
}
/**
* Generic methods for creating an sobject record
* @param sobjectRecord The sobject record to create.
**/
public ToolingAPI.SaveResult createSObject(SObject_x sobjectRecord)
{
return (ToolingAPI.SaveResult) submitRestCallAndDeserialize(
'/sobjects/'+sobjectRecord.type_x
,ToolingAPI.SaveResult.class
,'POST'
,sobjectRecord
);
}
/**
* Generic methods for updating an sobject record
* @param sobjectRecord The sobject record to update.
**/
/* - Commented out per issue https://github.com/afawcett/apex-toolingapi/issues/12
public ToolingAPI.SaveResult updateSObject(SObject_x sobjectRecord)
{
//ToolingAPI doesn't like having the Id in the body of the sobject upon update.. so null it out
//But first, set it to temp variable for handling the request path.
Id recordId = sobjectRecord.Id;
sobjectRecord.Id = null;
//Updates need to be "PATCH" methods, however, most clients balk at the PATCH method
//Fix for this is to specify the _HttpMethod parameter.
//For more info, see: http://salesforce.stackexchange.com/questions/13294/patch-request-using-apex-httprequest
return (SaveResult) submitRestCallAndDeserialize(
'/sobjects/'+sobjectRecord.type_x+'/'+recordId+'?_HttpMethod=PATCH'
,SaveResult.class
,'POST'
,sobjectRecord
);
}*/
//Public Inner Classes for Handling Tooling API Requests
public class AggregateExpressionResultColumnMetadata {
public String displayName;
}
public class AllowedWorkitemAction {
public boolean commentsRequired;
public String label;
public String name;
public boolean nextOwnerRequired;
public boolean versionRequired;
}
public class ApexClass extends SObject_x implements ISerialize {
public Double apiVersion;
public String body;
public Double bodyCrc;
public String fullName;
public boolean isValid;
public Integer lengthWithoutComments;
public ApexClassMetadata metadata;
public String name;
public String namespacePrefix;
public String status;
public SymbolTable symbolTable;
public ApexClass() {
super(SObjectType.ApexClass);
}
public override void serialize(JSONGenerator jsonGen) {
super.serialize(jsonGen);
if(apiVersion!=null)
jsonGen.writeNumberField('apiVersion', apiVersion);
if(body!=null)
jsonGen.writeStringField('body', body);
if(name!=null)
jsonGen.writeStringField('name', name);
if(status!=null)
jsonGen.writeStringField('status', status);
if(fullName!=null)
jsonGen.writeStringField('fullName', fullName);
if(metadata!=null)
jsonGen.writeObjectField('metadata', metadata);
}
}
public class ApexClassMetadata {
public Double apiVersion;
public PackageVersion[] packageVersions;
public String status;
}
public class ApexCodeCoverage extends SObject_x{
public SObject_x apexClassOrTrigger;
public Id apexClassOrTriggerId;
public ApexClass apexTestClass;
public Id apexTestClassId;
public Coverage coverage;
public Boolean isDeleted;
public Integer numLinesCovered;
public Integer numLinesUncovered;
public String testMethodName;
public ApexCodeCoverage() {
super(SObjectType.ApexCodeCoverage);
}
}
public class ApexCodeCoverageAggregate extends SObject_x{
public SObject_x apexClassOrTrigger;
public String apexClassOrTriggerId;
public Coverage coverage;
public DateTime coverageLastModifiedDate;
public boolean isDeleted;
public Integer numLinesCovered;
public Integer numLinesUncovered;
public ApexCodeCoverageAggregate() {
super(SObjectType.ApexCodeCoverageAggregate);
}
}
public class ApexComponent extends SObject_x{
public Double apiVersion;
public String controllerKey;
public String controllerType;
public String description;
public String markup;
public String masterLabel;
public String name;
public String namespacePrefix;
public ApexComponent() {
super(SObjectType.ApexComponent);
}
}
public class ApexExecutionOverlayAction extends SObject_x{
public String actionScript;
public String actionScriptType;
public DateTime createdDate;
public SObject_x executableEntity;
public Id executableEntityId;
public DateTime expirationDate;
public boolean isDeleted;
public boolean isDumpingHeap;
public Integer iteration;
public Integer line;
public User_x scope;
public String scopeId;
public ApexExecutionOverlayAction() {
super(SObjectType.ApexExecutionOverlayAction);
}
}
public class ApexLog extends SObject_x{
public String application;
public Integer durationMilliseconds;
public String location;
public Integer logLength;
public SObject_x logUser;
public Id logUserId;
public String operation;
public String request;
public DateTime startTime;
public String status;
public String body;
public ApexLog() {
super(SObjectType.ApexLog);
}
}
public class ApexOrgWideCoverage extends SObject_x{
public Integer percentCovered;
public ApexOrgWideCoverage() {
super(SObjectType.ApexOrgWideCoverage);
}
}
public class ApexResult {
public String apexError;
public ExecuteAnonymousResult apexExecutionResult;
}
public class ApexTestResult {
public ApexClass apexClass;
public String apexClassId;
public ApexLog apexLog;
public Id apexLogId;
public AsyncApexJob asyncApexJob;
public Id asyncApexJobId;
public String message;
public String methodName;
public String outcome;
public ApexTestQueueItem queueItem;
public Id queueItemId;
public String stackTrace;
public DateTime systemModstamp;
public DateTime testTimestamp;
}
public class ApexTestQueueItem {
public ApexClass apexClass;
public Id apexClassId;
public String extendedStatus;
public Id parentJobId;
public String status;
}
public class ApexPage extends SObject_x{
public Double apiVersion;
public String controllerKey;
public String controllerType;
public DateTime createdDate;
public String description;
public boolean isAvailableInTouch;
public boolean isConfirmationTokenRequired;
public String markup;
public String masterLabel;
public String name;
public String namespacePrefix;
public ApexPage() {
super(SObjectType.ApexPage);
}
}
public class ApexClassMember extends SObject_x implements ISerialize {
public String body;
public String content;
public ApexClass contentEntity;
public String contentEntityId;
public Datetime lastSyncDate;
public ApexClassMetadata metadata;
public MetadataContainer metadataContainer;
public Id metadataContainerId;
public SymbolTable symbolTable;
public ApexClassMember() {
super(SObjectType.ApexClassMember);
}
public override void serialize(JSONGenerator jsonGen) {
super.serialize(jsonGen);
if(body!=null)
jsonGen.writeStringField('body', body);
if(content!=null)
jsonGen.writeStringField('content', content);
if(contentEntity!=null)
jsonGen.writeObjectField('contentEntity', contentEntity);
if(contentEntityId!=null)
jsonGen.writeStringField('contentEntityId', contentEntityId);
if(lastSyncDate!=null)
jsonGen.writeDateTimeField('lastSyncDate', lastSyncDate);
if(metadata!=null)
jsonGen.writeObjectField('metadata', metadata);
if(metadataContainer!=null)
jsonGen.writeObjectField('metadataContainer', metadataContainer);
if(metadataContainerId!=null)
jsonGen.writeStringField('metadataContainerId', metadataContainerId);
if(symbolTable!=null)
jsonGen.writeObjectField('symbolTable', symbolTable);
}
}
public class ApexTriggerMember extends SObject_x implements ISerialize {
public String body;
public String content;
public ApexTrigger contentEntity;
public Id contentEntityId;
public DateTime lastSyncDate;
public Metadata metadata;
public MetadataContainer metadataContainer;
public Id metadataContainerId;
public SymbolTable symbolTable;
public ApexTriggerMember() {
super(SObjectType.ApexTriggerMember);
}
public override void serialize(JSONGenerator jsonGen) {
super.serialize(jsonGen);
if(body!=null)
jsonGen.writeStringField('body', body);
if(content!=null)
jsonGen.writeStringField('content', content);
if(contentEntity!=null)
jsonGen.writeObjectField('contentEntity', contentEntity);
if(contentEntityId!=null)
jsonGen.writeIdField('contentEntityId', contentEntityId);
if(lastSyncDate!=null)
jsonGen.writeDateTimeField('lastSyncDate', lastSyncDate);
if(metadata!=null)
jsonGen.writeObjectField('metadata', metadata);
if(metadataContainerId!=null)
jsonGen.writeIdField('metadataContainerId', metadataContainerId);
if(symbolTable!=null)
jsonGen.writeObjectField('symbolTable', symbolTable);
}
}
public class ApexComponentMember extends SObject_x{
public String body;
public String content;
public ApexComponent contentEntity;
public Id contentEntityId;
public DateTime lastSyncDate;
public Metadata metadata;
public MetadataContainer metadataContainer;
public Id metadataContainerId;
public ApexComponentMember() {
super(SObjectType.ApexComponentMember);
}
}
public class ApexExecutionOverlayResult extends SObject_x{
public String actionScript;
public String actionScriptType;
public ApexResult apexResult;
public String className;
public DateTime expirationDate;
public HeapDump heapDump;
public boolean isDeleted;
public boolean isDumpingHeap;
public Integer iteration;
public Integer line;
public String namespace;
public Integer overlayResultLength;
public User_x requestedBy;
public Id requestedById;
public SOQLResult sOQLResult;
public User_x user;
public Id userId;
public ApexExecutionOverlayResult() {
super(SObjectType.ApexExecutionOverlayResult);
}
}
public class ApexPageMember extends SObject_x{
public String body;
public String content;
public ApexPage contentEntity;
public String contentEntityId;
public DateTime lastSyncDate;
public Metadata metadata;
public MetadataContainer metadataContainer;
public Id metadataContainerId;
public ApexPageMember() {
super(SObjectType.ApexPageMember);
}
}
public class ApexTrigger extends SObject_x implements ISerialize {
public Double apiVersion;
public String body;
public Double bodyCrc;
public boolean isValid;
public Integer lengthWithoutComments;
public String name;
public String namespacePrefix;
public String status;
public Id tableEnumOrId;
public boolean usageAfterDelete;
public boolean usageAfterInsert;
public boolean usageAfterUndelete;
public boolean usageAfterUpdate;
public boolean usageBeforeDelete;
public boolean usageBeforeInsert;
public boolean usageBeforeUpdate;
public boolean usageIsBulk;
public ApexTrigger() {
super(SObjectType.ApexTrigger);
}
public override void serialize(JSONGenerator jsonGen) {
super.serialize(jsonGen);
if(apiVersion!=null)
jsonGen.writeNumberField('apiVersion', apiVersion);
if(body!=null)
jsonGen.writeStringField('body', body);
if(bodyCrc!=null)
jsonGen.writeNumberField('bodyCrc', bodyCrc);
if(isValid!=null)
jsonGen.writeBooleanField('isValid', isValid);
if(lengthWithoutComments!=null)
jsonGen.writeNumberField('lengthWithoutComments', lengthWithoutComments);
if(name!=null)
jsonGen.writeStringField('name', name);
if(namespacePrefix!=null)
jsonGen.writeStringField('namespacePrefix', namespacePrefix);
if(status!=null)
jsonGen.writeStringField('status', status);
if(tableEnumOrId!=null)
jsonGen.writeIdField('tableEnumOrId', tableEnumOrId);
if(usageAfterDelete!=null)
jsonGen.writeBooleanField('usageAfterDelete', usageAfterDelete);
if(usageAfterInsert!=null)
jsonGen.writeBooleanField('usageAfterInsert', usageAfterInsert);
if(usageAfterUndelete!=null)
jsonGen.writeBooleanField('usageAfterUndelete', usageAfterUndelete);
if(usageAfterUpdate!=null)
jsonGen.writeBooleanField('usageAfterUpdate', usageAfterUpdate);
if(usageBeforeDelete!=null)
jsonGen.writeBooleanField('usageBeforeDelete', usageBeforeDelete);
if(usageBeforeInsert!=null)
jsonGen.writeBooleanField('usageBeforeInsert', usageBeforeInsert);
if(usageBeforeUpdate!=null)
jsonGen.writeBooleanField('usageBeforeUpdate', usageBeforeUpdate);
if(usageIsBulk!=null)
jsonGen.writeBooleanField('usageIsBulk', usageIsBulk);
}
}
public class ApiFault {
public String exceptionCode;
public String exceptionMessage;
public String upgradeURL;
public String upgradeMessage;
}
public class ApiQueryFault {
public Integer row;
public Integer column;
}
public class Attribute {
public String type;
public String url;
}
public class AttributeDefinition {
public String name;
public String type_x;
}
public class AsyncApexJob extends SObject_x implements ISerialize {
public ApexClass apexClass;
public Id apexClassId;
public DateTime completedDate;
public String extendedStatus;
public Integer jobItemsProcessed;
public String jobType;
public String lastProcessed;
public Integer lastProcessedOffset;
public String methodName;
public Integer numberOfErrors;
public Id parentJobId;
public String status;
public Integer totalJobItems;
public AsyncApexJob() {
super(SObjectType.AsyncApexJob);
}
public override void serialize(JSONGenerator jsonGen) {
super.serialize(jsonGen);
if(apexClass!=null)
jsonGen.writeObjectField('apexClass', apexClass);
if(apexClassId!=null)
jsonGen.writeIdField('apexClassId', apexClassId);
if(completedDate!=null)
jsonGen.writeDateTimeField('completedDate', completedDate);
if(extendedStatus!=null)
jsonGen.writeStringField('extendedStatus', extendedStatus);
if(jobItemsProcessed!=null)
jsonGen.writeNumberField('jobItemsProcessed', jobItemsProcessed);
if(jobType!=null)
jsonGen.writeStringField('jobType', jobType);
if(lastProcessed!=null)
jsonGen.writeStringField('lastProcessed', lastProcessed);
if(lastProcessedOffset!=null)
jsonGen.writeNumberField('lastProcessedOffset', lastProcessedOffset);
if(methodName!=null)
jsonGen.writeStringField('methodName', methodName);
if(numberOfErrors!=null)
jsonGen.writeNumberField('numberOfErrors', numberOfErrors);
if(parentJobId!=null)
jsonGen.writeIdField('parentJobId', parentJobId);
if(status!=null)
jsonGen.writeStringField('status', status);
if(totalJobItems!=null)
jsonGen.writeNumberField('totalJobItems', totalJobItems);
}
}
public class BooleanValue {
public Boolean value;
}
public class ChildRelationship {
public boolean cascadeDelete;
public String childSObject;
public boolean deprecatedAndHidden;
public String field;
public String relationshipName;
public Boolean restrictedDelete;
}
public class ComplexQueryResultColumnMetadata {
public QueryResultColumnMetadata[] joinColumns;
}
public class ContainerAsyncRequest extends SObject_x implements ISerialize {
public String compilerErrors;
public String errorMsg;
public boolean isCheckOnly;
public Boolean isDeleted;
public Boolean isRunTests;
public MetadataContainer metadataContainer;
public Id metadataContainerId;
public MetadataContainerMember metadataContainerMember;
public Id metadataContainerMemberId;
public String state;
public ContainerAsyncRequest() {
super(SObjectType.ContainerAsyncRequest);
}
public override void serialize(JSONGenerator jsonGen) {
super.serialize(jsonGen);
if(compilerErrors!=null)
jsonGen.writeStringField('compilerErrors', compilerErrors);
if(errorMsg!=null)
jsonGen.writeStringField('errorMsg', errorMsg);
if(isCheckOnly!=null)
jsonGen.writeBooleanField('isCheckOnly', isCheckOnly);
if(isDeleted!=null)
jsonGen.writeBooleanField('isDeleted', isDeleted);
if(isRunTests!=null)
jsonGen.writeBooleanField('isRunTests', isRunTests);
if(metadataContainer!=null)
jsonGen.writeObjectField('metadataContainer', metadataContainer);
if(metadataContainerId!=null)
jsonGen.writeStringField('metadataContainerId', metadataContainerId);
if(metadataContainerMember!=null)
jsonGen.writeObjectField('metadataContainerMember', metadataContainerMember);
if(metadataContainerMemberId!=null)
jsonGen.writeStringField('metadataContainerMemberId', metadataContainerMemberId);
if(state!=null)
jsonGen.writeStringField('state', state);
}
}
public class Coverage {
public Integer[] coveredLines;
public Integer[] uncoveredLines;
}
public class CustomField extends SObject_x implements ISerialize {
public String fullName;
public String developerName;
public CustomFieldMetadata metadata;
public String namespacePrefix;
public String tableEnumOrId;
public CustomField() {
super(SObjectType.CustomField);
}
public override void serialize(JSONGenerator jsonGen) {
super.serialize(jsonGen);
if(fullName!=null)
jsonGen.writeStringField('fullName', fullName);
if(developerName!=null)
jsonGen.writeStringField('developerName', developerName);
if(metadata!=null)
jsonGen.writeObjectField('metadata', metadata);
if(namespacePrefix!=null)
jsonGen.writeStringField('namespacePrefix', namespacePrefix);
if(tableEnumOrId!=null)
jsonGen.writeStringField('tableEnumOrId', tableEnumOrId);
}
}
public class CustomFieldMetadata {
public boolean caseSensitive;
public String customDataType;
public String defaultValue;
public String deleteConstraint;
public boolean deprecated;
public String description;
public String displayFormat;
public boolean escapeMarkup;
public String externalDeveloperName;
public boolean externalId;
public String formula;
public String formulaTreatBlanksAs;
public String inlineHelpText;
public boolean isFilteringDisabled;
public boolean isNameField;
public boolean isSortingDisabled;
public String label;
public Integer length;
public String maskChar;
public String maskType;
public Picklist picklist;
public boolean populateExistingRows;
public Integer precision;
public String referenceTo;
public String relationshipLabel;
public String relationshipName;
public Integer relationshipOrder;
public boolean reparentableMasterDetail;
public boolean required;
public boolean restrictedAdminField;
public Integer scale;
public Integer startingNumber;
public boolean stripMarkup;
public String summarizedField;
public FilterItem[] summaryFilterItems;
public String summaryForeignKey;
public String summaryOperation;
public boolean trackFeedHistory;
public boolean trackHistory;
public boolean trackTrending;
public String type_x;
public boolean unique;
public Integer visibleLines;
public boolean writeRequiresMasterRead;
}
public class CustomObject extends SObject_x implements ISerialize {
public String developerName;
public String externalDataSourceId;
public String namespacePrefix;
public CustomObject() {
super(SObjectType.CustomObject);
}
public override void serialize(JSONGenerator jsonGen) {
super.serialize(jsonGen);
if(developerName!=null)
jsonGen.writeStringField('developerName', developerName);
if(externalDataSourceId!=null)
jsonGen.writeStringField('externalDataSourceId', externalDataSourceId);
if(namespacePrefix!=null)
jsonGen.writeStringField('namespacePrefix', namespacePrefix);
}
}
public class DescribeColorResult {
public String color;
public String context;
public String theme;
}
public class DescribeColumn {
public String field;
public String format;
public String label;
public String name;
}
public class DescribeGlobalResult {
public String encoding;
public Integer maxBatchSize;
public DescribeGlobalSObjectResult[] sobjects;
}
public class DescribeGlobalSObjectResult {
public boolean activateable;
public boolean createable;
public boolean custom;
public boolean customSetting;
public boolean deletable;
public boolean deprecatedAndHidden;
public boolean feedEnabled;
public String keyPrefix;
public String label;
public String labelPlural;
public boolean layoutable;
public boolean mergeable;
public String name;
public boolean queryable;
public boolean replicateable;
public boolean retrieveable;
public boolean searchable;
public boolean triggerable;
public boolean undeletable;
public boolean updateable;
}
public class DescribeIconResult {
public String contentType;
public Integer height;
public String theme;
public String url;
public Integer width;
}
public class DescribeLayoutButton {
public boolean custom;
public DescribeIconResult[] icons;
public String label;
public String name;
}
public class DescribeLayoutItem {
public boolean editable;
public String label;
public DescribeLayoutComponent[] layoutComponents;
public boolean placeholder;
public boolean required;
}
public class DescribeLayoutComponent {
public Integer displayLines;
public Integer tabOrder;
public String type_x;
public String value;
}
public class DescribeLayoutRow {
public DescribeLayoutItem[] layoutItems;
public Integer numItems;
}
public class DescribeLayoutSection {
public Integer columns;
public String heading;
public DescribeLayoutRow[] layoutRows;
public Integer rows;
public boolean useCollapsibleSection;
public boolean useHeading;
}
public class DescribeSObjectResult {
public boolean activateable;
public ChildRelationship[] childRelationships;
public boolean createable;
public boolean custom;
public boolean customSetting;
public boolean deletable;
public boolean deprecatedAndHidden;
public boolean feedEnabled;
public Field[] fields;
public String keyPrefix;
public String label;
public String labelPlural;
public boolean layoutable;
public boolean listviewable;
public boolean lookupLayoutable;
public boolean mergeable;
public String name;
public boolean queryable;
public RecordTypeInfo[] recordTypeInfos;
public boolean replicateable;
public boolean retrieveable;
public boolean searchLayoutable;
public boolean searchable;
public boolean triggerable;
public boolean undeletable;
public boolean updateable;
}
public class DescribeWorkitemActionResult {
public AllowedWorkitemAction[] actions;
public Error[] errors;
public boolean success;
public Id targetObjectId;
public String workitemId;
}
public class Error {
public String[] fields;
public String message;
public String statusCode;
}
public class ErrorResponse{
public List<String> fields;
public String errorCode;
public String message;
}
public class ExecuteAnonymousResult {
public Integer column;
public String compileProblem;
public Boolean compiled;
public String exceptionMessage;
public String exceptionStackTrace;
public Integer line;
public Boolean success;
}
public virtual class ExternalConstructor extends ExternalSymbol {
public Parameter[] parameters;
}
public class ExternalMethod extends ExternalConstructor {
public String[] argTypes;
public String returnType;
}
public class ExternalReference {