-
Notifications
You must be signed in to change notification settings - Fork 256
/
Scripts.xml
1503 lines (1459 loc) · 122 KB
/
Scripts.xml
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
<Type Name="Scripts" FullName="Microsoft.Azure.Cosmos.Scripts.Scripts">
<TypeSignature Language="C#" Value="public abstract class Scripts" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract beforefieldinit Scripts extends System.Object" />
<TypeSignature Language="DocId" Value="T:Microsoft.Azure.Cosmos.Scripts.Scripts" />
<TypeSignature Language="VB.NET" Value="Public MustInherit Class Scripts" />
<TypeSignature Language="F#" Value="type Scripts = class" />
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.17.1.0</AssemblyVersion>
<AssemblyVersion>3.18.0.0</AssemblyVersion>
<AssemblyVersion>3.19.0.0</AssemblyVersion>
<AssemblyVersion>3.20.0.0</AssemblyVersion>
<AssemblyVersion>3.20.1.0</AssemblyVersion>
<AssemblyVersion>3.21.0.0</AssemblyVersion>
<AssemblyVersion>3.22.0.0</AssemblyVersion>
<AssemblyVersion>3.22.1.0</AssemblyVersion>
<AssemblyVersion>3.23.0.0</AssemblyVersion>
<AssemblyVersion>3.24.0.0</AssemblyVersion>
<AssemblyVersion>3.25.0.0</AssemblyVersion>
<AssemblyVersion>3.26.0.0</AssemblyVersion>
<AssemblyVersion>3.26.1.0</AssemblyVersion>
<AssemblyVersion>3.26.2.0</AssemblyVersion>
<AssemblyVersion>3.27.0.0</AssemblyVersion>
<AssemblyVersion>3.27.1.0</AssemblyVersion>
<AssemblyVersion>3.27.2.0</AssemblyVersion>
<AssemblyVersion>3.28.0.0</AssemblyVersion>
<AssemblyVersion>3.29.0.0</AssemblyVersion>
<AssemblyVersion>3.30.0.0</AssemblyVersion>
<AssemblyVersion>3.30.1.0</AssemblyVersion>
<AssemblyVersion>3.31.0.0</AssemblyVersion>
<AssemblyVersion>3.31.1.0</AssemblyVersion>
<AssemblyVersion>3.31.2.0</AssemblyVersion>
<AssemblyVersion>3.35.4.0</AssemblyVersion>
<AssemblyVersion>3.36.0.0</AssemblyVersion>
<AssemblyVersion>3.38.1.0</AssemblyVersion>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>
Represents script operations on an Azure Cosmos container.
</summary>
<remarks>To be added.</remarks>
<altmember cref="T:Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties" />
<altmember cref="T:Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties" />
<altmember cref="T:Microsoft.Azure.Cosmos.Scripts.TriggerProperties" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected Scripts ();" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.#ctor" />
<MemberSignature Language="VB.NET" Value="Protected Sub New ()" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CreateStoredProcedureAsync">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureResponse> CreateStoredProcedureAsync (Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties storedProcedureProperties, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.Scripts.StoredProcedureResponse> CreateStoredProcedureAsync(class Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties storedProcedureProperties, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.CreateStoredProcedureAsync(Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function CreateStoredProcedureAsync (storedProcedureProperties As StoredProcedureProperties, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of StoredProcedureResponse)" />
<MemberSignature Language="F#" Value="abstract member CreateStoredProcedureAsync : Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureResponse>" Usage="scripts.CreateStoredProcedureAsync (storedProcedureProperties, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="storedProcedureProperties" Type="Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="storedProcedureProperties">The Stored Procedure to create.</param>
<param name="requestOptions">(Optional) The options for the stored procedure request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Creates a stored procedure as an asynchronous operation in the Azure Cosmos DB service.
</summary>
<returns>The <see cref="T:Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties" /> that was created contained within a <see cref="T:System.Threading.Tasks.Task" /> object representing the service response for the asynchronous operation.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">If <paramref name="storedProcedureProperties" /> is not set.</exception>
<exception cref="T:System.AggregateException">Represents a consolidation of failures that occurred during async processing. Look within InnerExceptions to find the actual exception(s)</exception>
<exception cref="T:Microsoft.Azure.Cosmos.CosmosException">This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:
<list type="table"><listheader><term>StatusCode</term><description>Reason for exception</description></listheader><item><term>400</term><description>BadRequest - This means something was wrong with the request supplied. It is likely that an Id was not supplied for the stored procedure or the Body was malformed.</description></item><item><term>403</term><description>Forbidden - You have reached your quota of stored procedures for the collection supplied. Contact support to have this quota increased.</description></item><item><term>409</term><description>Conflict - This means a <see cref="T:Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties" /> with an id matching the id you supplied already existed.</description></item><item><term>413</term><description>RequestEntityTooLarge - This means the body of the <see cref="T:Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties" /> you tried to create was too large.</description></item></list></exception>
<example>
This creates and executes a stored procedure that appends a string to the first item returned from the query.
<code language="c#"><![CDATA[
string sprocBody = @"function simple(prefix)
{
var collection = getContext().getCollection();
// Query documents and take 1st item.
var isAccepted = collection.queryDocuments(
collection.getSelfLink(),
'SELECT * FROM root r',
function(err, feed, options) {
if (err)throw err;
// Check the feed and if it's empty, set the body to 'no docs found',
// Otherwise just take 1st element from the feed.
if (!feed || !feed.length) getContext().getResponse().setBody(""no docs found"");
else getContext().getResponse().setBody(prefix + JSON.stringify(feed[0]));
});
if (!isAccepted) throw new Error(""The query wasn't accepted by the server. Try again/use continuation token between API and script."");
}";
Scripts scripts = this.container.Scripts;
StoredProcedureProperties storedProcedure = new StoredProcedureProperties(id, sprocBody);
StoredProcedureResponse storedProcedureResponse = await scripts.CreateStoredProcedureAsync(storedProcedure);
// Execute the stored procedure
CosmosItemResponse<string> sprocResponse = await scripts.ExecuteStoredProcedureAsync<string, string>(
id,
"Item as a string: ",
new PartitionKey(testPartitionId));
Console.WriteLine("sprocResponse.Resource");
]]></code></example>
</Docs>
</Member>
<Member MemberName="CreateTriggerAsync">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.TriggerResponse> CreateTriggerAsync (Microsoft.Azure.Cosmos.Scripts.TriggerProperties triggerProperties, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.Scripts.TriggerResponse> CreateTriggerAsync(class Microsoft.Azure.Cosmos.Scripts.TriggerProperties triggerProperties, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.CreateTriggerAsync(Microsoft.Azure.Cosmos.Scripts.TriggerProperties,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function CreateTriggerAsync (triggerProperties As TriggerProperties, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TriggerResponse)" />
<MemberSignature Language="F#" Value="abstract member CreateTriggerAsync : Microsoft.Azure.Cosmos.Scripts.TriggerProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.TriggerResponse>" Usage="scripts.CreateTriggerAsync (triggerProperties, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.TriggerResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="triggerProperties" Type="Microsoft.Azure.Cosmos.Scripts.TriggerProperties" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="triggerProperties">The <see cref="T:Microsoft.Azure.Cosmos.Scripts.TriggerProperties" /> object.</param>
<param name="requestOptions">(Optional) The options for the stored procedure request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Creates a trigger as an asynchronous operation in the Azure Cosmos DB service.
</summary>
<returns>A task object representing the service response for the asynchronous operation.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">If <paramref name="triggerProperties" /> is not set.</exception>
<exception cref="T:System.AggregateException">Represents a consolidation of failures that occurred during async processing. Look within InnerExceptions to find the actual exception(s)</exception>
<exception cref="T:Microsoft.Azure.Cosmos.CosmosException">This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:
<list type="table"><listheader><term>StatusCode</term><description>Reason for exception</description></listheader><item><term>400</term><description>BadRequest - This means something was wrong with the request supplied. It is likely that an Id was not supplied for the new trigger or that the Body was malformed.</description></item><item><term>403</term><description>Forbidden - You have reached your quota of triggers for the collection supplied. Contact support to have this quota increased.</description></item><item><term>409</term><description>Conflict - This means a <see cref="T:Microsoft.Azure.Cosmos.Scripts.TriggerProperties" /> with an id matching the id you supplied already existed.</description></item><item><term>413</term><description>RequestEntityTooLarge - This means the body of the <see cref="T:Microsoft.Azure.Cosmos.Scripts.TriggerProperties" /> you tried to create was too large.</description></item></list></exception>
<example>
This creates a trigger then uses the trigger in a create item.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
TriggerResponse triggerResponse = await scripts.CreateTriggerAsync(
new TriggerProperties
{
Id = "addTax",
Body = @"function AddTax() {
var item = getContext().getRequest().getBody();
// calculate the tax.
item.tax = item.cost * .15;
// Update the request -- this is what is going to be inserted.
getContext().getRequest().setBody(item);
}",
TriggerOperation = TriggerOperation.All,
TriggerType = TriggerType.Pre
});
ItemRequestOptions options = new ItemRequestOptions()
{
PreTriggers = new List<string>() { triggerResponse.Id },
};
// Create a new item with trigger set in the request options
ItemResponse<dynamic> createdItem = await this.container.Items.CreateItemAsync<dynamic>(item.status, item, options);
double itemTax = createdItem.Resource.tax;
]]></code></example>
</Docs>
</Member>
<Member MemberName="CreateUserDefinedFunctionAsync">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse> CreateUserDefinedFunctionAsync (Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties userDefinedFunctionProperties, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse> CreateUserDefinedFunctionAsync(class Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties userDefinedFunctionProperties, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.CreateUserDefinedFunctionAsync(Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function CreateUserDefinedFunctionAsync (userDefinedFunctionProperties As UserDefinedFunctionProperties, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of UserDefinedFunctionResponse)" />
<MemberSignature Language="F#" Value="abstract member CreateUserDefinedFunctionAsync : Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse>" Usage="scripts.CreateUserDefinedFunctionAsync (userDefinedFunctionProperties, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="userDefinedFunctionProperties" Type="Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="userDefinedFunctionProperties">The <see cref="T:Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties" /> object.</param>
<param name="requestOptions">(Optional) The options for the user defined function request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Creates a user defined function as an asynchronous operation in the Azure Cosmos DB service.
</summary>
<returns>A task object representing the service response for the asynchronous operation.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">If <paramref name="userDefinedFunctionProperties" /> is not set.</exception>
<exception cref="T:System.AggregateException">Represents a consolidation of failures that occurred during async processing. Look within InnerExceptions to find the actual exception(s)</exception>
<exception cref="T:Microsoft.Azure.Cosmos.CosmosException">This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a user defined function are:
<list type="table"><listheader><term>StatusCode</term><description>Reason for exception</description></listheader><item><term>400</term><description>BadRequest - This means something was wrong with the request supplied. It is likely that an Id was not supplied for the new user defined function or that the Body was malformed.</description></item><item><term>403</term><description>Forbidden - You have reached your quota of user defined functions for the collection supplied. Contact support to have this quota increased.</description></item><item><term>409</term><description>Conflict - This means a <see cref="T:Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties" /> with an id matching the id you supplied already existed.</description></item><item><term>413</term><description>RequestEntityTooLarge - This means the body of the <see cref="T:Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties" /> you tried to create was too large.</description></item></list></exception>
<example>
This creates a user defined function then uses the function in an item query.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
await scripts.UserDefinedFunctions.CreateUserDefinedFunctionAsync(
new UserDefinedFunctionProperties
{
Id = "calculateTax",
Body = @"function(amt) { return amt * 0.05; }"
});
QueryDefinition sqlQuery = new QueryDefinition(
"SELECT VALUE udf.calculateTax(t.cost) FROM toDoActivity t where t.cost > @expensive and t.status = @status")
.WithParameter("@expensive", 9000)
.WithParameter("@status", "Done");
using (FeedIterator<double> setIterator = this.container.Items.GetItemsQueryIterator<double>(
sqlQueryDefinition: sqlQuery,
partitionKey: "Done")
{
while (setIterator.HasMoreResults)
{
foreach (var tax in await setIterator.ReadNextAsync())
{
Console.WriteLine(tax);
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="DeleteStoredProcedureAsync">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureResponse> DeleteStoredProcedureAsync (string id, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.Scripts.StoredProcedureResponse> DeleteStoredProcedureAsync(string id, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.DeleteStoredProcedureAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function DeleteStoredProcedureAsync (id As String, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of StoredProcedureResponse)" />
<MemberSignature Language="F#" Value="abstract member DeleteStoredProcedureAsync : string * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureResponse>" Usage="scripts.DeleteStoredProcedureAsync (id, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="id" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="id">The identifier of the Stored Procedure to delete.</param>
<param name="requestOptions">(Optional) The options for the stored procedure request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Delete a <see cref="T:Microsoft.Azure.Cosmos.Scripts.StoredProcedureProperties" /> from the Azure Cosmos DB service as an asynchronous operation.
</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> containing a <see cref="T:Microsoft.Azure.Cosmos.ResponseMessage" /> which will contain the response to the request issued.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">If <paramref name="id" /> are not set.</exception>
<exception cref="T:Microsoft.Azure.Cosmos.CosmosException">This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:
<list type="table"><listheader><term>StatusCode</term><description>Reason for exception</description></listheader><item><term>404</term><description>NotFound - This means the resource you tried to delete did not exist.</description></item></list></exception>
<example>
This examples gets a reference to an existing stored procedure and deletes it.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
StoredProcedureResponse response = await scripts.DeleteStoredProcedureAsync("taxUdfId");
]]></code></example>
</Docs>
</Member>
<Member MemberName="DeleteTriggerAsync">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.TriggerResponse> DeleteTriggerAsync (string id, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.Scripts.TriggerResponse> DeleteTriggerAsync(string id, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.DeleteTriggerAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function DeleteTriggerAsync (id As String, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of TriggerResponse)" />
<MemberSignature Language="F#" Value="abstract member DeleteTriggerAsync : string * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.TriggerResponse>" Usage="scripts.DeleteTriggerAsync (id, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.TriggerResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="id" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="id">The id of the trigger to delete.</param>
<param name="requestOptions">(Optional) The options for the trigger request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Delete a <see cref="T:Microsoft.Azure.Cosmos.Scripts.TriggerProperties" /> from the Azure Cosmos service as an asynchronous operation.
</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> containing a <see cref="T:Microsoft.Azure.Cosmos.Scripts.TriggerResponse" /> which wraps a <see cref="T:Microsoft.Azure.Cosmos.Scripts.TriggerProperties" /> which will contain information about the request issued.</returns>
<remarks>To be added.</remarks>
<example>
This examples gets a reference to an existing trigger and deletes it.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
TriggerResponse response = await scripts.DeleteTriggerAsync("existingId");
]]></code></example>
</Docs>
</Member>
<Member MemberName="DeleteUserDefinedFunctionAsync">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse> DeleteUserDefinedFunctionAsync (string id, Microsoft.Azure.Cosmos.RequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse> DeleteUserDefinedFunctionAsync(string id, class Microsoft.Azure.Cosmos.RequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.DeleteUserDefinedFunctionAsync(System.String,Microsoft.Azure.Cosmos.RequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function DeleteUserDefinedFunctionAsync (id As String, Optional requestOptions As RequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of UserDefinedFunctionResponse)" />
<MemberSignature Language="F#" Value="abstract member DeleteUserDefinedFunctionAsync : string * Microsoft.Azure.Cosmos.RequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse>" Usage="scripts.DeleteUserDefinedFunctionAsync (id, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="id" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.RequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="id">The id of the user defined function to delete.</param>
<param name="requestOptions">(Optional) The options for the user defined function request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Delete a <see cref="T:Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties" /> from the Azure Cosmos DB service as an asynchronous operation.
</summary>
<returns>A <see cref="T:System.Threading.Tasks.Task" /> containing a <see cref="T:Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionResponse" /> which wraps a <see cref="T:Microsoft.Azure.Cosmos.Scripts.UserDefinedFunctionProperties" /> which will contain information about the request issued.</returns>
<remarks>To be added.</remarks>
<example>
This examples gets a reference to an existing user defined function and deletes it.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
UserDefinedFunctionResponse response = await this.container.DeleteUserDefinedFunctionAsync("existingId");
]]></code></example>
</Docs>
</Member>
<Member MemberName="ExecuteStoredProcedureAsync<TOutput>">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureExecuteResponse<TOutput>> ExecuteStoredProcedureAsync<TOutput> (string storedProcedureId, Microsoft.Azure.Cosmos.PartitionKey partitionKey, object[] parameters, Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.Scripts.StoredProcedureExecuteResponse`1<!!TOutput>> ExecuteStoredProcedureAsync<TOutput>(string storedProcedureId, valuetype Microsoft.Azure.Cosmos.PartitionKey partitionKey, object[] parameters, class Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.ExecuteStoredProcedureAsync``1(System.String,Microsoft.Azure.Cosmos.PartitionKey,System.Object[],Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function ExecuteStoredProcedureAsync(Of TOutput) (storedProcedureId As String, partitionKey As PartitionKey, parameters As Object(), Optional requestOptions As StoredProcedureRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of StoredProcedureExecuteResponse(Of TOutput))" />
<MemberSignature Language="F#" Value="abstract member ExecuteStoredProcedureAsync : string * Microsoft.Azure.Cosmos.PartitionKey * obj[] * Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureExecuteResponse<'Output>>" Usage="scripts.ExecuteStoredProcedureAsync (storedProcedureId, partitionKey, parameters, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.Scripts.StoredProcedureExecuteResponse<TOutput>></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="TOutput" />
</TypeParameters>
<Parameters>
<Parameter Name="storedProcedureId" Type="System.String" />
<Parameter Name="partitionKey" Type="Microsoft.Azure.Cosmos.PartitionKey" />
<Parameter Name="parameters" Type="System.Object[]" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<typeparam name="TOutput">The return type that is JSON serializable.</typeparam>
<param name="storedProcedureId">The identifier of the Stored Procedure to execute.</param>
<param name="partitionKey">The partition key for the item.</param>
<param name="parameters">(Optional) An array of dynamic objects representing the parameters for the stored procedure.</param>
<param name="requestOptions">(Optional) The options for the stored procedure request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Executes a stored procedure against a container as an asynchronous operation in the Azure Cosmos service.
</summary>
<returns>The task object representing the service response for the asynchronous operation which would contain any response set in the stored procedure.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">If <paramref name="storedProcedureId" /> or <paramref name="partitionKey" /> are not set.</exception>
<example>
This creates and executes a stored procedure that appends a string to the first item returned from the query.
<code language="c#"><![CDATA[
string sprocBody = @"function simple(prefix, postfix)
{
var collection = getContext().getCollection();
// Query documents and take 1st item.
var isAccepted = collection.queryDocuments(
collection.getSelfLink(),
'SELECT * FROM root r',
function(err, feed, options) {
if (err)throw err;
// Check the feed and if it's empty, set the body to 'no docs found',
// Otherwise just take 1st element from the feed.
if (!feed || !feed.length) getContext().getResponse().setBody(""no docs found"");
else getContext().getResponse().setBody(prefix + JSON.stringify(feed[0]) + postfix);
});
if (!isAccepted) throw new Error(""The query wasn't accepted by the server. Try again/use continuation token between API and script."");
}";
Scripts scripts = this.container.Scripts;
string sprocId = "appendString";
StoredProcedureResponse storedProcedureResponse = await scripts.CreateStoredProcedureAsync(
sprocId,
sprocBody);
// Execute the stored procedure
StoredProcedureExecuteResponse<string> sprocResponse = await scripts.ExecuteStoredProcedureAsync<string>(
sprocId,
new PartitionKey(testPartitionId),
new dynamic[] {"myPrefixString", "myPostfixString"});
Console.WriteLine(sprocResponse.Resource);
/// ]]></code></example>
</Docs>
</Member>
<Member MemberName="ExecuteStoredProcedureStreamAsync">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage> ExecuteStoredProcedureStreamAsync (string storedProcedureId, Microsoft.Azure.Cosmos.PartitionKey partitionKey, object[] parameters, Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.ResponseMessage> ExecuteStoredProcedureStreamAsync(string storedProcedureId, valuetype Microsoft.Azure.Cosmos.PartitionKey partitionKey, object[] parameters, class Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.ExecuteStoredProcedureStreamAsync(System.String,Microsoft.Azure.Cosmos.PartitionKey,System.Object[],Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function ExecuteStoredProcedureStreamAsync (storedProcedureId As String, partitionKey As PartitionKey, parameters As Object(), Optional requestOptions As StoredProcedureRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResponseMessage)" />
<MemberSignature Language="F#" Value="abstract member ExecuteStoredProcedureStreamAsync : string * Microsoft.Azure.Cosmos.PartitionKey * obj[] * Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage>" Usage="scripts.ExecuteStoredProcedureStreamAsync (storedProcedureId, partitionKey, parameters, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="storedProcedureId" Type="System.String" />
<Parameter Name="partitionKey" Type="Microsoft.Azure.Cosmos.PartitionKey" />
<Parameter Name="parameters" Type="System.Object[]" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="storedProcedureId">The identifier of the Stored Procedure to execute.</param>
<param name="partitionKey">The partition key for the item.</param>
<param name="parameters">An array of dynamic objects representing the parameters for the stored procedure. This can be null if no parameters are required.</param>
<param name="requestOptions">(Optional) The options for the stored procedure request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Executes a stored procedure against a container as an asynchronous operation in the Azure Cosmos service and obtains a Stream as response.
</summary>
<returns>The task object representing the service response for the asynchronous operation which would contain any response set in the stored procedure.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">If <paramref name="storedProcedureId" /> or <paramref name="partitionKey" /> are not set.</exception>
<example>
This creates and executes a stored procedure that appends a string to the first item returned from the query.
<code language="c#"><![CDATA[
string sprocBody = @"function simple(prefix, postfix)
{
var collection = getContext().getCollection();
// Query documents and take 1st item.
var isAccepted = collection.queryDocuments(
collection.getSelfLink(),
'SELECT * FROM root r',
function(err, feed, options) {
if (err)throw err;
// Check the feed and if it's empty, set the body to 'no docs found',
// Otherwise just take 1st element from the feed.
if (!feed || !feed.length) getContext().getResponse().setBody(""no docs found"");
else getContext().getResponse().setBody(prefix + JSON.stringify(feed[0]) + postfix);
});
if (!isAccepted) throw new Error(""The query wasn't accepted by the server. Try again/use continuation token between API and script."");
}";
Scripts scripts = this.container.Scripts;
string sprocId = "appendString";
StoredProcedureResponse storedProcedureResponse = await scripts.CreateStoredProcedureAsync(
sprocId,
sprocBody);
// Execute the stored procedure
ResponseMessage sprocResponse = await scripts.ExecuteStoredProcedureStreamAsync(
sprocId,
new PartitionKey(testPartitionId),
new dynamic[] {"myPrefixString", "myPostfixString"});
using (StreamReader sr = new StreamReader(sprocResponse.Content))
{
string stringResponse = await sr.ReadToEndAsync();
Console.WriteLine(stringResponse);
}
/// ]]></code></example>
</Docs>
</Member>
<Member MemberName="ExecuteStoredProcedureStreamAsync">
<MemberSignature Language="C#" Value="public abstract System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage> ExecuteStoredProcedureStreamAsync (string storedProcedureId, System.IO.Stream streamPayload, Microsoft.Azure.Cosmos.PartitionKey partitionKey, Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions requestOptions = default, System.Threading.CancellationToken cancellationToken = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class Microsoft.Azure.Cosmos.ResponseMessage> ExecuteStoredProcedureStreamAsync(string storedProcedureId, class System.IO.Stream streamPayload, valuetype Microsoft.Azure.Cosmos.PartitionKey partitionKey, class Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions requestOptions, valuetype System.Threading.CancellationToken cancellationToken) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.ExecuteStoredProcedureStreamAsync(System.String,System.IO.Stream,Microsoft.Azure.Cosmos.PartitionKey,Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions,System.Threading.CancellationToken)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function ExecuteStoredProcedureStreamAsync (storedProcedureId As String, streamPayload As Stream, partitionKey As PartitionKey, Optional requestOptions As StoredProcedureRequestOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ResponseMessage)" />
<MemberSignature Language="F#" Value="abstract member ExecuteStoredProcedureStreamAsync : string * System.IO.Stream * Microsoft.Azure.Cosmos.PartitionKey * Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage>" Usage="scripts.ExecuteStoredProcedureStreamAsync (storedProcedureId, streamPayload, partitionKey, requestOptions, cancellationToken)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Threading.Tasks.Task<Microsoft.Azure.Cosmos.ResponseMessage></ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="storedProcedureId" Type="System.String" />
<Parameter Name="streamPayload" Type="System.IO.Stream" />
<Parameter Name="partitionKey" Type="Microsoft.Azure.Cosmos.PartitionKey" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.Scripts.StoredProcedureRequestOptions" />
<Parameter Name="cancellationToken" Type="System.Threading.CancellationToken" />
</Parameters>
<Docs>
<param name="storedProcedureId">The identifier of the Stored Procedure to execute.</param>
<param name="streamPayload">A <see cref="T:System.IO.Stream" /> containing the payload which should represent a JSON array or arraylike object of parameters. This is parsed using JSON.parse and Function.apply uses the result to call the stored procedure. This can be null if no parameters are required.</param>
<param name="partitionKey">The partition key for the item.</param>
<param name="requestOptions">(Optional) The options for the stored procedure request.</param>
<param name="cancellationToken">(Optional) <see cref="T:System.Threading.CancellationToken" /> representing request cancellation.</param>
<summary>
Executes a stored procedure against a container as an asynchronous operation in the Azure Cosmos service and obtains a Stream as response.
</summary>
<returns>The task object representing the service response for the asynchronous operation which would contain any response set in the stored procedure. The response will contain status code (400) BadRequest if streamPayload represents anything other than a JSON array, object or null.</returns>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">If <paramref name="storedProcedureId" /> or <paramref name="partitionKey" /> are not set.</exception>
<example>
This creates and executes a stored procedure that appends a string to the first item returned from the query.
<code language="c#"><![CDATA[
string sprocBody = @"function simple(prefix, postfix)
{
var collection = getContext().getCollection();
// Query documents and take 1st item.
var isAccepted = collection.queryDocuments(
collection.getSelfLink(),
'SELECT * FROM root r',
function(err, feed, options) {
if (err)throw err;
// Check the feed and if it's empty, set the body to 'no docs found',
// Otherwise just take 1st element from the feed.
if (!feed || !feed.length) getContext().getResponse().setBody(""no docs found"");
else getContext().getResponse().setBody(prefix + JSON.stringify(feed[0]) + postfix);
});
if (!isAccepted) throw new Error(""The query wasn't accepted by the server. Try again/use continuation token between API and script."");
}";
Scripts scripts = this.container.Scripts;
string sprocId = "appendString";
StoredProcedureResponse storedProcedureResponse = await scripts.CreateStoredProcedureAsync(
sprocId,
sprocBody);
// Serialize the parameters into a stream
string[] parameters = new string[] { "myPrefixString", "myPostfixString" };
byte[] serializedBytes = JsonSerializer.SerializeToUtf8Bytes(parameters);
MemoryStream streamPayload = new MemoryStream(serializedBytes);
// Execute the stored procedure
ResponseMessage sprocResponse = await scripts.ExecuteStoredProcedureStreamAsync(
sprocId,
streamPayload,
new PartitionKey(testPartitionId));
using (StreamReader sr = new StreamReader(sprocResponse.Content))
{
string stringResponse = await sr.ReadToEndAsync();
Console.WriteLine(stringResponse);
}
/// ]]></code></example>
</Docs>
</Member>
<Member MemberName="GetStoredProcedureQueryIterator<T>">
<MemberSignature Language="C#" Value="public abstract Microsoft.Azure.Cosmos.FeedIterator<T> GetStoredProcedureQueryIterator<T> (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator`1<!!T> GetStoredProcedureQueryIterator<T>(class Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.GetStoredProcedureQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetStoredProcedureQueryIterator(Of T) (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)" />
<MemberSignature Language="F#" Value="abstract member GetStoredProcedureQueryIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>" Usage="scripts.GetStoredProcedureQueryIterator (queryDefinition, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator<T></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Parameters>
<Parameter Name="queryDefinition" Type="Microsoft.Azure.Cosmos.QueryDefinition" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<typeparam name="T">To be added.</typeparam>
<param name="queryDefinition">The cosmos SQL query definition.</param>
<param name="continuationToken">(Optional) The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for stored procedures under a container using a SQL statement with parameterized values. It returns a FeedIterator.
For more information on preparing SQL statements with parameterized values, please see <see cref="T:Microsoft.Azure.Cosmos.QueryDefinition" /> overload.
</summary>
<returns>An iterator to read through the existing stored procedures.</returns>
<remarks>To be added.</remarks>
<example>
This create the type feed iterator for sproc with queryDefinition as input.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
string queryText = "SELECT * FROM s where s.id like @testId";
QueryDefinition queryDefinition = new QueryDefinition(queryText);
queryDefinition.WithParameter("@testId", "testSprocId");
using (FeedIterator<StoredProcedureProperties> feedIterator = scripts.GetStoredProcedureQueryIterator<StoredProcedureProperties>(queryDefinition))
{
while (feedIterator.HasMoreResults)
{
foreach (StoredProcedureProperties storedProcedure in await feedIterator.ReadNextAsync())
{
Console.WriteLine(storedProcedure.Id);
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetStoredProcedureQueryIterator<T>">
<MemberSignature Language="C#" Value="public abstract Microsoft.Azure.Cosmos.FeedIterator<T> GetStoredProcedureQueryIterator<T> (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator`1<!!T> GetStoredProcedureQueryIterator<T>(string queryText, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.GetStoredProcedureQueryIterator``1(System.String,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetStoredProcedureQueryIterator(Of T) (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)" />
<MemberSignature Language="F#" Value="abstract member GetStoredProcedureQueryIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>" Usage="scripts.GetStoredProcedureQueryIterator (queryText, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator<T></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Parameters>
<Parameter Name="queryText" Type="System.String" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<typeparam name="T">To be added.</typeparam>
<param name="queryText">The cosmos SQL query text.</param>
<param name="continuationToken">(Optional) The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for stored procedures under a container using a SQL statement. It returns a FeedIterator.
</summary>
<returns>An iterator to read through the existing stored procedures.</returns>
<remarks>To be added.</remarks>
<example>
This create the type feed iterator for sproc with queryText as input.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
using (FeedIterator<StoredProcedureProperties> feedIterator = this.scripts.GetStoredProcedureQueryIterator<StoredProcedureProperties>(
"SELECT * FROM u where u.id like '%testId%'"))
{
while (feedIterator.HasMoreResults)
{
foreach (StoredProcedureProperties properties in await feedIterator.ReadNextAsync())
{
Console.WriteLine(properties.Id);
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetStoredProcedureQueryStreamIterator">
<MemberSignature Language="C#" Value="public abstract Microsoft.Azure.Cosmos.FeedIterator GetStoredProcedureQueryStreamIterator (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator GetStoredProcedureQueryStreamIterator(class Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.GetStoredProcedureQueryStreamIterator(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetStoredProcedureQueryStreamIterator (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator" />
<MemberSignature Language="F#" Value="abstract member GetStoredProcedureQueryStreamIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator" Usage="scripts.GetStoredProcedureQueryStreamIterator (queryDefinition, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="queryDefinition" Type="Microsoft.Azure.Cosmos.QueryDefinition" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<param name="queryDefinition">The cosmos SQL query definition.</param>
<param name="continuationToken">(Optional) The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for stored procedures under a container using a SQL statement with parameterized values. It returns a FeedIterator.
For more information on preparing SQL statements with parameterized values, please see <see cref="T:Microsoft.Azure.Cosmos.QueryDefinition" /> overload.
</summary>
<returns>An iterator to read through the existing stored procedures.</returns>
<remarks>To be added.</remarks>
<example>
This create the stream feed iterator for sproc with queryDefinition as input.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
string queryText = "SELECT * FROM s where s.id like @testId";
QueryDefinition queryDefinition = new QueryDefinition(queryText);
queryDefinition.WithParameter("@testId", "testSprocId");
using (FeedIterator feedIterator = scripts.GetStoredProcedureQueryStreamIterator(queryDefinition))
{
while (feedIterator.HasMoreResults)
{
// Stream iterator returns a response with status for errors
using(ResponseMessage response = await feedIterator.ReadNextAsync())
{
// Handle failure scenario.
if(!response.IsSuccessStatusCode)
{
// Log the response.Diagnostics and handle the error
}
// Process the response.Content Stream
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetStoredProcedureQueryStreamIterator">
<MemberSignature Language="C#" Value="public abstract Microsoft.Azure.Cosmos.FeedIterator GetStoredProcedureQueryStreamIterator (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator GetStoredProcedureQueryStreamIterator(string queryText, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.GetStoredProcedureQueryStreamIterator(System.String,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetStoredProcedureQueryStreamIterator (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator" />
<MemberSignature Language="F#" Value="abstract member GetStoredProcedureQueryStreamIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator" Usage="scripts.GetStoredProcedureQueryStreamIterator (queryText, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="queryText" Type="System.String" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<param name="queryText">The cosmos SQL query text.</param>
<param name="continuationToken">(Optional) The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for stored procedures under a container using a SQL statement. It returns a FeedIterator.
</summary>
<returns>An iterator to read through the existing stored procedures.</returns>
<remarks>To be added.</remarks>
<example>
This create the stream feed iterator for sproc with queryText as input.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
string queryText = "SELECT * FROM s where s.id like '%testId%'";
using (FeedIterator feedIterator = this.scripts.GetStoredProcedureQueryStreamIterator(queryText)
{
while (feedIterator.HasMoreResults)
{
// Stream iterator returns a response with status for errors
using(ResponseMessage response = await feedIterator.ReadNextAsync())
{
// Handle failure scenario.
if(!response.IsSuccessStatusCode)
{
// Log the response.Diagnostics and handle the error
}
// Process the response.Content Stream
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetTriggerQueryIterator<T>">
<MemberSignature Language="C#" Value="public abstract Microsoft.Azure.Cosmos.FeedIterator<T> GetTriggerQueryIterator<T> (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator`1<!!T> GetTriggerQueryIterator<T>(class Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.GetTriggerQueryIterator``1(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetTriggerQueryIterator(Of T) (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)" />
<MemberSignature Language="F#" Value="abstract member GetTriggerQueryIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>" Usage="scripts.GetTriggerQueryIterator (queryDefinition, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator<T></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Parameters>
<Parameter Name="queryDefinition" Type="Microsoft.Azure.Cosmos.QueryDefinition" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<typeparam name="T">To be added.</typeparam>
<param name="queryDefinition">The cosmos SQL query definition.</param>
<param name="continuationToken">(Optional) The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for triggers under a container using a SQL statement with parameterized values. It returns a FeedIterator.
For more information on preparing SQL statements with parameterized values, please see <see cref="T:Microsoft.Azure.Cosmos.QueryDefinition" /> overload.
</summary>
<returns>An iterator to read through the existing stored procedures.</returns>
<remarks>To be added.</remarks>
<example>
This create the type feed iterator for Trigger with queryDefinition as input.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
QueryDefinition queryDefinition = new QueryDefinition("SELECT * FROM t where t.id like @testId")
.WithParameter("@testId", "testTriggerId");
using (FeedIterator<TriggerProperties> feedIterator = this.scripts.GetTriggerQueryIterator<TriggerProperties>(queryDefinition)
{
while (feedIterator.HasMoreResults)
{
foreach (var properties in await feedIterator.ReadNextAsync())
{
Console.WriteLine(properties.Id);
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetTriggerQueryIterator<T>">
<MemberSignature Language="C#" Value="public abstract Microsoft.Azure.Cosmos.FeedIterator<T> GetTriggerQueryIterator<T> (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator`1<!!T> GetTriggerQueryIterator<T>(string queryText, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.GetTriggerQueryIterator``1(System.String,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetTriggerQueryIterator(Of T) (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)" />
<MemberSignature Language="F#" Value="abstract member GetTriggerQueryIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>" Usage="scripts.GetTriggerQueryIterator (queryText, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator<T></ReturnType>
</ReturnValue>
<TypeParameters>
<TypeParameter Name="T" />
</TypeParameters>
<Parameters>
<Parameter Name="queryText" Type="System.String" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<typeparam name="T">To be added.</typeparam>
<param name="queryText">The cosmos SQL query text.</param>
<param name="continuationToken">(Optional) The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for triggers under a container using a SQL statement. It returns a FeedIterator.
</summary>
<returns>An iterator to read through the existing stored procedures.</returns>
<remarks>To be added.</remarks>
<example>
This create the type feed iterator for Trigger with queryText as input.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;
using (FeedIterator<TriggerProperties> feedIterator = this.scripts.GetTriggerQueryIterator<TriggerProperties>(
"SELECT * FROM t where t.id like '%testId%'")
{
while (feedIterator.HasMoreResults)
{
foreach (var properties in await feedIterator.ReadNextAsync())
{
Console.WriteLine(properties.Id);
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetTriggerQueryStreamIterator">
<MemberSignature Language="C#" Value="public abstract Microsoft.Azure.Cosmos.FeedIterator GetTriggerQueryStreamIterator (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator GetTriggerQueryStreamIterator(class Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.GetTriggerQueryStreamIterator(Microsoft.Azure.Cosmos.QueryDefinition,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetTriggerQueryStreamIterator (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator" />
<MemberSignature Language="F#" Value="abstract member GetTriggerQueryStreamIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator" Usage="scripts.GetTriggerQueryStreamIterator (queryDefinition, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="queryDefinition" Type="Microsoft.Azure.Cosmos.QueryDefinition" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<param name="queryDefinition">The cosmos SQL query definition.</param>
<param name="continuationToken">(Optional) The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>
<summary>
This method creates a query for triggers under a container using a SQL statement with parameterized values. It returns a FeedIterator.
For more information on preparing SQL statements with parameterized values, please see <see cref="T:Microsoft.Azure.Cosmos.QueryDefinition" /> overload.
</summary>
<returns>An iterator to read through the existing stored procedures.</returns>
<remarks>To be added.</remarks>
<example>
This create the stream feed iterator for Trigger with queryDefinition as input.
<code language="c#"><![CDATA[
Scripts scripts = this.container.Scripts;\
QueryDefinition queryDefinition = new QueryDefinition("SELECT * FROM t where t.id like @testId")
.WithParameter("@testId", "testTriggerId");
using (FeedIterator feedIterator = this.scripts.GetTriggerQueryStreamIterator(queryDefinition)
{
while (feedIterator.HasMoreResults)
{
// Stream iterator returns a response with status for errors
using(ResponseMessage response = await feedIterator.ReadNextAsync())
{
// Handle failure scenario.
if(!response.IsSuccessStatusCode)
{
// Log the response.Diagnostics and handle the error
}
// Process the response.Content Stream
}
}
}
]]></code></example>
</Docs>
</Member>
<Member MemberName="GetTriggerQueryStreamIterator">
<MemberSignature Language="C#" Value="public abstract Microsoft.Azure.Cosmos.FeedIterator GetTriggerQueryStreamIterator (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Microsoft.Azure.Cosmos.FeedIterator GetTriggerQueryStreamIterator(string queryText, string continuationToken, class Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Azure.Cosmos.Scripts.Scripts.GetTriggerQueryStreamIterator(System.String,System.String,Microsoft.Azure.Cosmos.QueryRequestOptions)" />
<MemberSignature Language="VB.NET" Value="Public MustOverride Function GetTriggerQueryStreamIterator (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator" />
<MemberSignature Language="F#" Value="abstract member GetTriggerQueryStreamIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator" Usage="scripts.GetTriggerQueryStreamIterator (queryText, continuationToken, requestOptions)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Azure.Cosmos.Client</AssemblyName>
<AssemblyVersion>3.39.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>Microsoft.Azure.Cosmos.FeedIterator</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="queryText" Type="System.String" />
<Parameter Name="continuationToken" Type="System.String" />
<Parameter Name="requestOptions" Type="Microsoft.Azure.Cosmos.QueryRequestOptions" />
</Parameters>
<Docs>
<param name="queryText">The cosmos SQL query text.</param>
<param name="continuationToken">(Optional) The continuation token in the Azure Cosmos DB service.</param>
<param name="requestOptions">(Optional) The options for the item query request.</param>