@@ -118,14 +118,8 @@ public virtual AsyncPageCollection<Assistant> GetAssistantsAsync(
118118 AssistantCollectionOptions options = default ,
119119 CancellationToken cancellationToken = default )
120120 {
121- AssistantsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
122- options ? . PageSize ,
123- options ? . Order ? . ToString ( ) ,
124- options ? . AfterId ,
125- options ? . BeforeId ,
126- cancellationToken . ToRequestOptions ( ) ) ;
127-
128- return PageCollectionHelpers . CreateAsync ( enumerator ) ;
121+ return GetAssistantsAsync ( options ? . PageSize , options ? . Order ? . ToString ( ) , options ? . AfterId , options ? . BeforeId , cancellationToken . ToRequestOptions ( ) )
122+ as AsyncPageCollection < Assistant > ;
129123 }
130124
131125 /// <summary>
@@ -144,14 +138,8 @@ public virtual AsyncPageCollection<Assistant> GetAssistantsAsync(
144138 Argument . AssertNotNull ( firstPageToken , nameof ( firstPageToken ) ) ;
145139
146140 AssistantsPageToken pageToken = AssistantsPageToken . FromToken ( firstPageToken ) ;
147- AssistantsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
148- pageToken . Limit ,
149- pageToken . Order ,
150- pageToken . After ,
151- pageToken . Before ,
152- cancellationToken . ToRequestOptions ( ) ) ;
153-
154- return PageCollectionHelpers . CreateAsync ( enumerator ) ;
141+ return GetAssistantsAsync ( pageToken ? . Limit , pageToken ? . Order , pageToken ? . After , pageToken . Before , cancellationToken . ToRequestOptions ( ) )
142+ as AsyncPageCollection < Assistant > ;
155143 }
156144
157145 /// <summary>
@@ -167,14 +155,8 @@ public virtual PageCollection<Assistant> GetAssistants(
167155 AssistantCollectionOptions options = default ,
168156 CancellationToken cancellationToken = default )
169157 {
170- AssistantsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
171- options ? . PageSize ,
172- options ? . Order ? . ToString ( ) ,
173- options ? . AfterId ,
174- options ? . BeforeId ,
175- cancellationToken . ToRequestOptions ( ) ) ;
176-
177- return PageCollectionHelpers . Create ( enumerator ) ;
158+ return GetAssistants ( options ? . PageSize , options ? . Order ? . ToString ( ) , options ? . AfterId , options ? . BeforeId , cancellationToken . ToRequestOptions ( ) )
159+ as PageCollection < Assistant > ;
178160 }
179161
180162 /// <summary>
@@ -193,14 +175,8 @@ public virtual PageCollection<Assistant> GetAssistants(
193175 Argument . AssertNotNull ( firstPageToken , nameof ( firstPageToken ) ) ;
194176
195177 AssistantsPageToken pageToken = AssistantsPageToken . FromToken ( firstPageToken ) ;
196- AssistantsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
197- pageToken . Limit ,
198- pageToken . Order ,
199- pageToken . After ,
200- pageToken . Before ,
201- cancellationToken . ToRequestOptions ( ) ) ;
202-
203- return PageCollectionHelpers . Create ( enumerator ) ;
178+ return GetAssistants ( pageToken ? . Limit , pageToken ? . Order , pageToken ? . After , pageToken . Before , cancellationToken . ToRequestOptions ( ) )
179+ as PageCollection < Assistant > ;
204180 }
205181
206182 /// <summary>
@@ -486,15 +462,8 @@ public virtual AsyncPageCollection<ThreadMessage> GetMessagesAsync(
486462 {
487463 Argument . AssertNotNullOrEmpty ( threadId , nameof ( threadId ) ) ;
488464
489- MessagesPageEnumerator enumerator = new ( _pipeline , _endpoint ,
490- threadId ,
491- options ? . PageSize ,
492- options ? . Order ? . ToString ( ) ,
493- options ? . AfterId ,
494- options ? . BeforeId ,
495- cancellationToken . ToRequestOptions ( ) ) ;
496-
497- return PageCollectionHelpers . CreateAsync ( enumerator ) ;
465+ return GetMessagesAsync ( threadId , options ? . PageSize , options ? . Order ? . ToString ( ) , options ? . AfterId , options ? . BeforeId , cancellationToken . ToRequestOptions ( ) )
466+ as AsyncPageCollection < ThreadMessage > ;
498467 }
499468
500469 /// <summary>
@@ -513,15 +482,8 @@ public virtual AsyncPageCollection<ThreadMessage> GetMessagesAsync(
513482 Argument . AssertNotNull ( firstPageToken , nameof ( firstPageToken ) ) ;
514483
515484 MessagesPageToken pageToken = MessagesPageToken . FromToken ( firstPageToken ) ;
516- MessagesPageEnumerator enumerator = new ( _pipeline , _endpoint ,
517- pageToken . ThreadId ,
518- pageToken . Limit ,
519- pageToken . Order ,
520- pageToken . After ,
521- pageToken . Before ,
522- cancellationToken . ToRequestOptions ( ) ) ;
523-
524- return PageCollectionHelpers . CreateAsync ( enumerator ) ;
485+ return GetMessagesAsync ( pageToken ? . ThreadId , pageToken ? . Limit , pageToken ? . Order , pageToken ? . After , pageToken ? . Before , cancellationToken . ToRequestOptions ( ) )
486+ as AsyncPageCollection < ThreadMessage > ;
525487 }
526488
527489 /// <summary>
@@ -541,15 +503,8 @@ public virtual PageCollection<ThreadMessage> GetMessages(
541503 {
542504 Argument . AssertNotNullOrEmpty ( threadId , nameof ( threadId ) ) ;
543505
544- MessagesPageEnumerator enumerator = new ( _pipeline , _endpoint ,
545- threadId ,
546- options ? . PageSize ,
547- options ? . Order ? . ToString ( ) ,
548- options ? . AfterId ,
549- options ? . BeforeId ,
550- cancellationToken . ToRequestOptions ( ) ) ;
551-
552- return PageCollectionHelpers . Create ( enumerator ) ;
506+ return GetMessages ( threadId , options ? . PageSize , options ? . Order ? . ToString ( ) , options ? . AfterId , options ? . BeforeId , cancellationToken . ToRequestOptions ( ) )
507+ as PageCollection < ThreadMessage > ;
553508 }
554509
555510 /// <summary>
@@ -568,15 +523,9 @@ public virtual PageCollection<ThreadMessage> GetMessages(
568523 Argument . AssertNotNull ( firstPageToken , nameof ( firstPageToken ) ) ;
569524
570525 MessagesPageToken pageToken = MessagesPageToken . FromToken ( firstPageToken ) ;
571- MessagesPageEnumerator enumerator = new ( _pipeline , _endpoint ,
572- pageToken . ThreadId ,
573- pageToken . Limit ,
574- pageToken . Order ,
575- pageToken . After ,
576- pageToken . Before ,
577- cancellationToken . ToRequestOptions ( ) ) ;
578-
579- return PageCollectionHelpers . Create ( enumerator ) ;
526+ return GetMessages ( pageToken ? . ThreadId , pageToken ? . Limit , pageToken ? . Order , pageToken ? . After , pageToken ? . Before , cancellationToken . ToRequestOptions ( ) )
527+ as PageCollection < ThreadMessage > ;
528+
580529 }
581530
582531 /// <summary>
@@ -888,15 +837,8 @@ public virtual AsyncPageCollection<ThreadRun> GetRunsAsync(
888837 {
889838 Argument . AssertNotNullOrEmpty ( threadId , nameof ( threadId ) ) ;
890839
891- RunsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
892- threadId ,
893- options ? . PageSize ,
894- options ? . Order ? . ToString ( ) ,
895- options ? . AfterId ,
896- options ? . BeforeId ,
897- cancellationToken . ToRequestOptions ( ) ) ;
898-
899- return PageCollectionHelpers . CreateAsync ( enumerator ) ;
840+ return GetRunsAsync ( threadId , options ? . PageSize , options ? . Order ? . ToString ( ) , options ? . AfterId , options ? . BeforeId , cancellationToken . ToRequestOptions ( ) )
841+ as AsyncPageCollection < ThreadRun > ;
900842 }
901843
902844 /// <summary>
@@ -915,15 +857,8 @@ public virtual AsyncPageCollection<ThreadRun> GetRunsAsync(
915857 Argument . AssertNotNull ( firstPageToken , nameof ( firstPageToken ) ) ;
916858
917859 RunsPageToken pageToken = RunsPageToken . FromToken ( firstPageToken ) ;
918- RunsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
919- pageToken . ThreadId ,
920- pageToken . Limit ,
921- pageToken . Order ,
922- pageToken . After ,
923- pageToken . Before ,
924- cancellationToken . ToRequestOptions ( ) ) ;
925-
926- return PageCollectionHelpers . CreateAsync ( enumerator ) ;
860+ return GetRunsAsync ( pageToken ? . ThreadId , pageToken ? . Limit , pageToken ? . Order , pageToken ? . After , pageToken ? . Before , cancellationToken . ToRequestOptions ( ) )
861+ as AsyncPageCollection < ThreadRun > ;
927862 }
928863
929864 /// <summary>
@@ -943,15 +878,8 @@ public virtual PageCollection<ThreadRun> GetRuns(
943878 {
944879 Argument . AssertNotNullOrEmpty ( threadId , nameof ( threadId ) ) ;
945880
946- RunsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
947- threadId ,
948- options ? . PageSize ,
949- options ? . Order ? . ToString ( ) ,
950- options ? . AfterId ,
951- options ? . BeforeId ,
952- cancellationToken . ToRequestOptions ( ) ) ;
953-
954- return PageCollectionHelpers . Create ( enumerator ) ;
881+ return GetRuns ( threadId , options ? . PageSize , options ? . Order ? . ToString ( ) , options ? . AfterId , options ? . BeforeId , cancellationToken . ToRequestOptions ( ) )
882+ as PageCollection < ThreadRun > ;
955883 }
956884
957885 /// <summary>
@@ -970,15 +898,8 @@ public virtual PageCollection<ThreadRun> GetRuns(
970898 Argument . AssertNotNull ( firstPageToken , nameof ( firstPageToken ) ) ;
971899
972900 RunsPageToken pageToken = RunsPageToken . FromToken ( firstPageToken ) ;
973- RunsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
974- pageToken . ThreadId ,
975- pageToken . Limit ,
976- pageToken . Order ,
977- pageToken . After ,
978- pageToken . Before ,
979- cancellationToken . ToRequestOptions ( ) ) ;
980-
981- return PageCollectionHelpers . Create ( enumerator ) ;
901+ return GetRuns ( pageToken ? . ThreadId , pageToken ? . Limit , pageToken ? . Order , pageToken ? . After , pageToken ? . Before , cancellationToken . ToRequestOptions ( ) )
902+ as PageCollection < ThreadRun > ;
982903 }
983904
984905 /// <summary>
@@ -1168,16 +1089,8 @@ public virtual AsyncPageCollection<RunStep> GetRunStepsAsync(
11681089 Argument . AssertNotNullOrEmpty ( threadId , nameof ( threadId ) ) ;
11691090 Argument . AssertNotNullOrEmpty ( runId , nameof ( runId ) ) ;
11701091
1171- RunStepsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
1172- threadId ,
1173- runId ,
1174- options ? . PageSize ,
1175- options ? . Order ? . ToString ( ) ,
1176- options ? . AfterId ,
1177- options ? . BeforeId ,
1178- cancellationToken . ToRequestOptions ( ) ) ;
1179-
1180- return PageCollectionHelpers . CreateAsync ( enumerator ) ;
1092+ return GetRunStepsAsync ( threadId , runId , options ? . PageSize , options ? . Order ? . ToString ( ) , options ? . AfterId , options ? . BeforeId , cancellationToken . ToRequestOptions ( ) )
1093+ as AsyncPageCollection < RunStep > ;
11811094 }
11821095
11831096 /// <summary>
@@ -1196,16 +1109,8 @@ public virtual AsyncPageCollection<RunStep> GetRunStepsAsync(
11961109 Argument . AssertNotNull ( firstPageToken , nameof ( firstPageToken ) ) ;
11971110
11981111 RunStepsPageToken pageToken = RunStepsPageToken . FromToken ( firstPageToken ) ;
1199- RunStepsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
1200- pageToken . ThreadId ,
1201- pageToken . RunId ,
1202- pageToken . Limit ,
1203- pageToken . Order ,
1204- pageToken . After ,
1205- pageToken . Before ,
1206- cancellationToken . ToRequestOptions ( ) ) ;
1207-
1208- return PageCollectionHelpers . CreateAsync ( enumerator ) ;
1112+ return GetRunStepsAsync ( pageToken ? . ThreadId , pageToken ? . RunId , pageToken ? . Limit , pageToken ? . Order , pageToken ? . After , pageToken ? . Before , cancellationToken . ToRequestOptions ( ) )
1113+ as AsyncPageCollection < RunStep > ;
12091114 }
12101115
12111116 /// <summary>
@@ -1228,16 +1133,8 @@ public virtual PageCollection<RunStep> GetRunSteps(
12281133 Argument . AssertNotNullOrEmpty ( threadId , nameof ( threadId ) ) ;
12291134 Argument . AssertNotNullOrEmpty ( runId , nameof ( runId ) ) ;
12301135
1231- RunStepsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
1232- threadId ,
1233- runId ,
1234- options ? . PageSize ,
1235- options ? . Order ? . ToString ( ) ,
1236- options ? . AfterId ,
1237- options ? . BeforeId ,
1238- cancellationToken . ToRequestOptions ( ) ) ;
1239-
1240- return PageCollectionHelpers . Create ( enumerator ) ;
1136+ return GetRunSteps ( threadId , runId , options ? . PageSize , options ? . Order ? . ToString ( ) , options ? . AfterId , options ? . BeforeId , cancellationToken . ToRequestOptions ( ) )
1137+ as PageCollection < RunStep > ;
12411138 }
12421139
12431140 /// <summary>
@@ -1256,16 +1153,8 @@ public virtual PageCollection<RunStep> GetRunSteps(
12561153 Argument . AssertNotNull ( firstPageToken , nameof ( firstPageToken ) ) ;
12571154
12581155 RunStepsPageToken pageToken = RunStepsPageToken . FromToken ( firstPageToken ) ;
1259- RunStepsPageEnumerator enumerator = new ( _pipeline , _endpoint ,
1260- pageToken . ThreadId ,
1261- pageToken . RunId ,
1262- pageToken . Limit ,
1263- pageToken . Order ,
1264- pageToken . After ,
1265- pageToken . Before ,
1266- cancellationToken . ToRequestOptions ( ) ) ;
1267-
1268- return PageCollectionHelpers . Create ( enumerator ) ;
1156+ return GetRunSteps ( pageToken ? . ThreadId , pageToken ? . RunId , pageToken ? . Limit , pageToken ? . Order , pageToken ? . After , pageToken ? . Before , cancellationToken . ToRequestOptions ( ) )
1157+ as PageCollection < RunStep > ;
12691158 }
12701159
12711160 /// <summary>
0 commit comments