Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,43 @@ partial void ProcessAgentEditJobResponseContent(
/// <exception cref="global::Descript.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Descript.AgentEditJobResponse> AgentEditJobAsync(

global::Descript.AgentEditJobRequest request,
global::Descript.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __response = await AgentEditJobAsResponseAsync(

request: request,
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);

return __response.Body;
}
/// <summary>
/// Agent edit<br/>
/// Use a background agent to create and edit projects using a natural language prompt.<br/>
/// - **Edit existing project**: Provide a `project_id` to edit an existing project<br/>
/// - **Target a specific composition**: Provide both `project_id` and `composition_id` to direct the agent to a specific composition within the project<br/>
/// - **Create new project**: Provide a `project_name` instead of `project_id` to create a new project<br/>
/// ### Common use cases<br/>
/// - Create new content: "create a 30-second video about cooking tips"<br/>
/// - Apply audio effects: "add studio sound to every clip"<br/>
/// - Remove filler words: "remove all filler words from the transcript"<br/>
/// - Create highlights: "create a 30-second highlight reel"<br/>
/// - Content editing: "remove the section from 1:30 to 2:15"<br/>
/// ### Async Operations<br/>
/// Agent edits run in the background and return a `job_id`. Monitor progress via the [GET /jobs/{job_id}](#operation/getJob) endpoint.<br/>
/// ### Dynamic webhook<br/>
/// If `callback_url` is provided, Descript will POST the job status to that URL when the job completes or fails.<br/>
/// The payload will match the format returned by [GET /jobs/{job_id}](#operation/getJob).
/// </summary>
/// <param name="request"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Descript.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Descript.AutoSDKHttpResponse<global::Descript.AgentEditJobResponse>> AgentEditJobAsResponseAsync(

global::Descript.AgentEditJobRequest request,
global::Descript.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
Expand Down Expand Up @@ -99,6 +136,7 @@ partial void ProcessAgentEditJobResponseContent(

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::Descript.PathBuilder(
path: "/jobs/agent",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -178,6 +216,8 @@ partial void ProcessAgentEditJobResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -188,6 +228,11 @@ partial void ProcessAgentEditJobResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::Descript.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Descript.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -205,6 +250,8 @@ partial void ProcessAgentEditJobResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -214,8 +261,7 @@ partial void ProcessAgentEditJobResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::Descript.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -224,6 +270,11 @@ partial void ProcessAgentEditJobResponseContent(
__attempt < __maxAttempts &&
global::Descript.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::Descript.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::Descript.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Descript.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -240,14 +291,15 @@ partial void ProcessAgentEditJobResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::Descript.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -287,6 +339,8 @@ partial void ProcessAgentEditJobResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -307,6 +361,8 @@ partial void ProcessAgentEditJobResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
// Invalid input: - Malformed request body - Invalid project_id or composition_id - Empty or invalid prompt
Expand Down Expand Up @@ -521,9 +577,13 @@ partial void ProcessAgentEditJobResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::Descript.AgentEditJobResponse.FromJson(__content, JsonSerializerContext) ??
var __value = global::Descript.AgentEditJobResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return new global::Descript.AutoSDKHttpResponse<global::Descript.AgentEditJobResponse>(
statusCode: __response.StatusCode,
headers: global::Descript.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down Expand Up @@ -551,9 +611,13 @@ partial void ProcessAgentEditJobResponseContent(
#endif
).ConfigureAwait(false);

return
await global::Descript.AgentEditJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
var __value = await global::Descript.AgentEditJobResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return new global::Descript.AutoSDKHttpResponse<global::Descript.AgentEditJobResponse>(
statusCode: __response.StatusCode,
headers: global::Descript.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,25 @@ partial void ProcessCancelJobResponse(
global::System.Guid jobId,
global::Descript.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
await CancelJobAsResponseAsync(
jobId: jobId,
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);
}
/// <summary>
/// Cancel job<br/>
/// Cancel a running job.
/// </summary>
/// <param name="jobId"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Descript.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Descript.AutoSDKHttpResponse> CancelJobAsResponseAsync(
global::System.Guid jobId,
global::Descript.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
Expand Down Expand Up @@ -77,6 +96,7 @@ partial void ProcessCancelJobResponse(

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::Descript.PathBuilder(
path: $"/jobs/{jobId}",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -150,6 +170,8 @@ partial void ProcessCancelJobResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -160,6 +182,11 @@ partial void ProcessCancelJobResponse(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::Descript.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::Descript.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -177,6 +204,8 @@ partial void ProcessCancelJobResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -186,8 +215,7 @@ partial void ProcessCancelJobResponse(
__httpRequest.Dispose();
__httpRequest = null;
await global::Descript.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -196,6 +224,11 @@ partial void ProcessCancelJobResponse(
__attempt < __maxAttempts &&
global::Descript.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::Descript.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::Descript.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::Descript.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -212,14 +245,15 @@ partial void ProcessCancelJobResponse(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::Descript.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -259,6 +293,8 @@ partial void ProcessCancelJobResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -279,6 +315,8 @@ partial void ProcessCancelJobResponse(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
// Unauthorized - invalid or missing authentication token
Expand Down Expand Up @@ -451,6 +489,10 @@ partial void ProcessCancelJobResponse(
{
__response.EnsureSuccessStatusCode();

return new global::Descript.AutoSDKHttpResponse(
statusCode: __response.StatusCode,
headers: global::Descript.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri);
}
catch (global::System.Exception __ex)
{
Expand All @@ -472,6 +514,10 @@ partial void ProcessCancelJobResponse(
try
{
__response.EnsureSuccessStatusCode();
return new global::Descript.AutoSDKHttpResponse(
statusCode: __response.StatusCode,
headers: global::Descript.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri);
}
catch (global::System.Exception __ex)
{
Expand Down
Loading