Skip to content

Commit 2a3f4ed

Browse files
committed
cleanup
1 parent 7fadf96 commit 2a3f4ed

File tree

40 files changed

+11424
-11244
lines changed

40 files changed

+11424
-11244
lines changed

codegen/generator/src/Visitors/PaginationVisitor.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ public class PaginationVisitor : ScmLibraryVisitor
8686
"GetMessagesAsync",
8787
("ThreadMessage", "MessageCollectionOptions", _paginationParamsToReplace)
8888
},
89+
{
90+
"GetRuns",
91+
("ThreadRun", "RunCollectionOptions", _paginationParamsToReplace)
92+
},
93+
{
94+
"GetRunsAsync",
95+
("ThreadRun", "RunCollectionOptions", _paginationParamsToReplace)
96+
},
97+
{
98+
"GetRunSteps",
99+
("RunStep", "RunStepCollectionOptions", _paginationParamsToReplace)
100+
},
101+
{
102+
"GetRunStepsAsync",
103+
("RunStep", "RunStepCollectionOptions", _paginationParamsToReplace)
104+
}
89105
};
90106

91107
protected override MethodProvider? VisitMethod(MethodProvider method)

specification/base/typespec/runs/models.tsp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,19 @@ model ListRunsResponse {
224224
// Tool customization: add a clear enum enforcement of constrained 'object' label
225225
object: "list";
226226

227-
data: RunObject[];
227+
@pageItems data: RunObject[];
228228
first_id: string;
229-
last_id: string;
229+
@continuationToken last_id: string;
230230
has_more: boolean;
231231
}
232232

233233
model ListRunStepsResponse {
234234
// Tool customization: add a clear enum enforcement of constrained 'object' label
235235
object: "list";
236236

237-
data: RunStepObject[];
237+
@pageItems data: RunStepObject[];
238238
first_id: string;
239-
last_id: string;
239+
@continuationToken last_id: string;
240240
has_more: boolean;
241241
}
242242

specification/base/typespec/runs/operations.tsp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ interface Runs {
4343
@operationId("listRuns")
4444
@tag("Assistants")
4545
@summary("Returns a list of runs belonging to a thread.")
46+
@list
4647
listRuns(
4748
...AcceptJsonHeader,
4849
...AssistantsBetaHeader,
@@ -130,6 +131,7 @@ interface Runs {
130131
@operationId("listRunSteps")
131132
@tag("Assistants")
132133
@summary("Returns a list of run steps belonging to a run.")
134+
@list
133135
listRunSteps(
134136
...AcceptJsonHeader,
135137
...AssistantsBetaHeader,

specification/client/models/assistants.models.tsp

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ model AssistantCollectionOptions {
2929
...AssistantCollectionOrderQueryParameter,
3030
}
3131

32-
33-
3432
alias MessageCollectionOrderQueryParameter = {
3533
/**
3634
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
@@ -52,4 +50,50 @@ model MessageCollectionOptions {
5250
...CollectionBeforeQueryParameter,
5351
...CollectionLimitQueryParameter,
5452
...MessageCollectionOrderQueryParameter,
53+
}
54+
55+
@access(Access.public)
56+
@usage(Usage.input)
57+
model RunCollectionOptions {
58+
...CollectionAfterQueryParameter,
59+
...CollectionBeforeQueryParameter,
60+
...CollectionLimitQueryParameter,
61+
...RunCollectionOrderQueryParameter,
62+
}
63+
64+
alias RunCollectionOrderQueryParameter = {
65+
/**
66+
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
67+
* for descending order.
68+
*/
69+
@query order?: RunCollectionOrder;
70+
};
71+
72+
union RunCollectionOrder {
73+
string,
74+
Ascending: "asc",
75+
Descending: "desc",
76+
}
77+
78+
@access(Access.public)
79+
@usage(Usage.input)
80+
model RunStepCollectionOptions {
81+
...CollectionAfterQueryParameter,
82+
...CollectionBeforeQueryParameter,
83+
...CollectionLimitQueryParameter,
84+
...RunStepCollectionOrderQueryParameter,
85+
}
86+
87+
alias RunStepCollectionOrderQueryParameter = {
88+
/**
89+
* Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
90+
* for descending order.
91+
*/
92+
@query order?: RunStepCollectionOrder;
93+
};
94+
95+
union RunStepCollectionOrder {
96+
string,
97+
Ascending: "asc",
98+
Descending: "desc",
5599
}

src/Custom/Assistants/AssistantClient.Protocol.cs

Lines changed: 0 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -116,82 +116,6 @@ public virtual Task<ClientResult> CreateRunAsync(string threadId, BinaryContent
116116
public virtual ClientResult CreateRun(string threadId, BinaryContent content, RequestOptions options = null)
117117
=> _runSubClient.CreateRun(threadId, content, options);
118118

119-
/// <summary>
120-
/// [Protocol Method] Returns a paginated collection of runs belonging to a thread.
121-
/// </summary>
122-
/// <param name="threadId"> The ID of the thread the run belongs to. </param>
123-
/// <param name="limit">
124-
/// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
125-
/// default is 20.
126-
/// </param>
127-
/// <param name="order">
128-
/// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
129-
/// for descending order. Allowed values: "asc" | "desc"
130-
/// </param>
131-
/// <param name="after">
132-
/// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
133-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
134-
/// subsequent call can include after=obj_foo in order to fetch the next page of the list.
135-
/// </param>
136-
/// <param name="before">
137-
/// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
138-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
139-
/// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
140-
/// </param>
141-
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
142-
/// <exception cref="ArgumentNullException"> <paramref name="threadId"/> is null. </exception>
143-
/// <exception cref="ArgumentException"> <paramref name="threadId"/> is an empty string, and was expected to be non-empty. </exception>
144-
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
145-
/// <returns> A collection of service responses, each holding a page of values. </returns>
146-
public virtual AsyncCollectionResult GetRunsAsync(string threadId, int? limit, string order, string after, string before, RequestOptions options)
147-
{
148-
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
149-
150-
return new AsyncRunCollectionResult(_runSubClient, options, threadId, limit, order, after, before);
151-
}
152-
153-
/// <summary>
154-
/// [Protocol Method] Returns a paginated collection of runs belonging to a thread.
155-
/// </summary>
156-
/// <param name="threadId"> The ID of the thread the run belongs to. </param>
157-
/// <param name="limit">
158-
/// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
159-
/// default is 20.
160-
/// </param>
161-
/// <param name="order">
162-
/// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
163-
/// for descending order. Allowed values: "asc" | "desc"
164-
/// </param>
165-
/// <param name="after">
166-
/// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
167-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
168-
/// subsequent call can include after=obj_foo in order to fetch the next page of the list.
169-
/// </param>
170-
/// <param name="before">
171-
/// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
172-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
173-
/// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
174-
/// </param>
175-
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
176-
/// <exception cref="ArgumentNullException"> <paramref name="threadId"/> is null. </exception>
177-
/// <exception cref="ArgumentException"> <paramref name="threadId"/> is an empty string, and was expected to be non-empty. </exception>
178-
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
179-
/// <returns> A collection of service responses, each holding a page of values. </returns>
180-
public virtual CollectionResult GetRuns(string threadId, int? limit, string order, string after, string before, RequestOptions options)
181-
{
182-
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
183-
184-
return new RunCollectionResult(_runSubClient, options, threadId, limit, order, after, before);
185-
}
186-
187-
/// <inheritdoc cref="InternalAssistantRunClient.GetRunAsync"/>
188-
public virtual Task<ClientResult> GetRunAsync(string threadId, string runId, RequestOptions options)
189-
=> _runSubClient.GetRunAsync(threadId, runId, options);
190-
191-
/// <inheritdoc cref="InternalAssistantRunClient.GetRun"/>
192-
public virtual ClientResult GetRun(string threadId, string runId, RequestOptions options)
193-
=> _runSubClient.GetRun(threadId, runId, options);
194-
195119
/// <inheritdoc cref="InternalAssistantRunClient.ModifyRunAsync"/>
196120
public virtual Task<ClientResult> ModifyRunAsync(string threadId, string runId, BinaryContent content, RequestOptions options = null)
197121
=> _runSubClient.ModifyRunAsync(threadId, runId, content, options);
@@ -216,86 +140,6 @@ public virtual Task<ClientResult> SubmitToolOutputsToRunAsync(string threadId, s
216140
public virtual ClientResult SubmitToolOutputsToRun(string threadId, string runId, BinaryContent content, RequestOptions options = null)
217141
=> _runSubClient.SubmitToolOutputsToRun(threadId, runId, content, options);
218142

219-
/// <summary>
220-
/// [Protocol Method] Returns a paginated collection of run steps belonging to a run.
221-
/// </summary>
222-
/// <param name="threadId"> The ID of the thread the run and run steps belong to. </param>
223-
/// <param name="runId"> The ID of the run the run steps belong to. </param>
224-
/// <param name="limit">
225-
/// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
226-
/// default is 20.
227-
/// </param>
228-
/// <param name="order">
229-
/// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
230-
/// for descending order. Allowed values: "asc" | "desc"
231-
/// </param>
232-
/// <param name="after">
233-
/// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
234-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
235-
/// subsequent call can include after=obj_foo in order to fetch the next page of the list.
236-
/// </param>
237-
/// <param name="before">
238-
/// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
239-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
240-
/// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
241-
/// </param>
242-
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
243-
/// <exception cref="ArgumentNullException"> <paramref name="threadId"/> or <paramref name="runId"/> is null. </exception>
244-
/// <exception cref="ArgumentException"> <paramref name="threadId"/> or <paramref name="runId"/> is an empty string, and was expected to be non-empty. </exception>
245-
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
246-
/// <returns> A collection of service responses, each holding a page of values. </returns>
247-
public virtual AsyncCollectionResult GetRunStepsAsync(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
248-
{
249-
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
250-
Argument.AssertNotNullOrEmpty(runId, nameof(runId));
251-
252-
return new AsyncRunStepCollectionResult(_runSubClient, options, threadId, runId, limit, order, after, before);
253-
}
254-
255-
/// <summary>
256-
/// [Protocol Method] Returns a paginated collection of run steps belonging to a run.
257-
/// </summary>
258-
/// <param name="threadId"> The ID of the thread the run and run steps belong to. </param>
259-
/// <param name="runId"> The ID of the run the run steps belong to. </param>
260-
/// <param name="limit">
261-
/// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
262-
/// default is 20.
263-
/// </param>
264-
/// <param name="order">
265-
/// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
266-
/// for descending order. Allowed values: "asc" | "desc"
267-
/// </param>
268-
/// <param name="after">
269-
/// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
270-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
271-
/// subsequent call can include after=obj_foo in order to fetch the next page of the list.
272-
/// </param>
273-
/// <param name="before">
274-
/// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
275-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
276-
/// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
277-
/// </param>
278-
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
279-
/// <exception cref="ArgumentNullException"> <paramref name="threadId"/> or <paramref name="runId"/> is null. </exception>
280-
/// <exception cref="ArgumentException"> <paramref name="threadId"/> or <paramref name="runId"/> is an empty string, and was expected to be non-empty. </exception>
281-
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
282-
/// <returns> A collection of service responses, each holding a page of values. </returns>
283-
public virtual CollectionResult GetRunSteps(string threadId, string runId, int? limit, string order, string after, string before, RequestOptions options)
284-
{
285-
Argument.AssertNotNullOrEmpty(threadId, nameof(threadId));
286-
Argument.AssertNotNullOrEmpty(runId, nameof(runId));
287-
288-
return new RunStepCollectionResult(_runSubClient, options, threadId, runId, limit, order, after, before);
289-
}
290-
291-
/// <inheritdoc cref="InternalAssistantRunClient.GetRunStepAsync"/>
292-
public virtual Task<ClientResult> GetRunStepAsync(string threadId, string runId, string stepId, RequestOptions options)
293-
=> _runSubClient.GetRunStepAsync(threadId, runId, stepId, options);
294-
295-
/// <inheritdoc cref="InternalAssistantRunClient.GetRunStep"/>
296-
public virtual ClientResult GetRunStep(string threadId, string runId, string stepId, RequestOptions options)
297-
=> _runSubClient.GetRunStep(threadId, runId, stepId, options);
298-
299143
/// <inheritdoc cref="InternalAssistantThreadClient.CreateThreadAsync"/>
300144
public virtual Task<ClientResult> CreateThreadAsync(BinaryContent content, RequestOptions options = null)
301145
=> _threadSubClient.CreateThreadAsync(content, options);

0 commit comments

Comments
 (0)