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 @@ -6,7 +6,7 @@ namespace Descript.CLI.Commands;

internal sealed record ExportTranscriptRequestOptionSet(
Option<global::System.Guid> ProjectId,
Option<global::System.Guid?> CompositionId,
Option<string?> CompositionId,
Option<global::Descript.ExportTranscriptRequestFormat> Format,
Option<global::Descript.ExportTranscriptRequestIncludeSpeakerLabels?> IncludeSpeakerLabels,
Option<bool?> IncludeMarkers)
Expand All @@ -22,9 +22,15 @@ public static ExportTranscriptRequestOptionSet Create(string? prefix = null)
Description = @"The ID of the project to export from.",
Required = true,
},
CompositionId: new Option<global::System.Guid?>($"--{normalizedPrefix}composition-id")
CompositionId: new Option<string?>($"--{normalizedPrefix}composition-id")
{
Description = @"The ID of the composition to export. Defaults to the first composition.",
Description = @"Composition to export. If omitted, the first composition in the project is used.

Accepts any of the following formats:
- A full composition UUID (e.g. `39677a40-1c43-4c36-8449-46cfbc4de2b5`)
- A 5-character short ID from a Descript URL (e.g. `39677`)
- A full Descript project URL (e.g. `https://web.descript.com/{project_id}/39677`)
",
},
Format: new Option<global::Descript.ExportTranscriptRequestFormat>($"--{normalizedPrefix}format")
{
Expand Down
6 changes: 3 additions & 3 deletions src/cli/Descript.CLI/Descript.CLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MinVer" Version="8.0.0">
<PackageReference Include="MinVer" Version="7.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.CommandLine" Version="2.0.11" />
<PackageReference Include="System.CommandLine" Version="2.0.7" />
<ProjectReference Include="../../libs/Descript/Descript.csproj" />
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,11 @@ partial void ProcessExportTranscriptResponseContent(
/// Example: 9f36ee32-5a2c-47e7-b1a3-94991d3e3ddb
/// </param>
/// <param name="compositionId">
/// The ID of the composition to export. Defaults to the first composition.<br/>
/// Composition to export. If omitted, the first composition in the project is used.<br/>
/// Accepts any of the following formats:<br/>
/// - A full composition UUID (e.g. `39677a40-1c43-4c36-8449-46cfbc4de2b5`)<br/>
/// - A 5-character short ID from a Descript URL (e.g. `39677`)<br/>
/// - A full Descript project URL (e.g. `https://web.descript.com/{project_id}/39677`)<br/>
/// Example: 39677a40-1c43-4c36-8449-46cfbc4de2b5
/// </param>
/// <param name="format">
Expand Down Expand Up @@ -634,7 +638,7 @@ partial void ProcessExportTranscriptResponseContent(
public async global::System.Threading.Tasks.Task<string> ExportTranscriptAsync(
global::System.Guid projectId,
global::Descript.ExportTranscriptRequestFormat format,
global::System.Guid? compositionId = default,
string? compositionId = default,
global::Descript.ExportTranscriptRequestIncludeSpeakerLabels? includeSpeakerLabels = default,
bool? includeMarkers = default,
global::Descript.ExportTranscriptRequestTimecodes? timecodes = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,11 @@ partial void ProcessExportTranscriptAsBytesResponseContent(
/// Example: 9f36ee32-5a2c-47e7-b1a3-94991d3e3ddb
/// </param>
/// <param name="compositionId">
/// The ID of the composition to export. Defaults to the first composition.<br/>
/// Composition to export. If omitted, the first composition in the project is used.<br/>
/// Accepts any of the following formats:<br/>
/// - A full composition UUID (e.g. `39677a40-1c43-4c36-8449-46cfbc4de2b5`)<br/>
/// - A 5-character short ID from a Descript URL (e.g. `39677`)<br/>
/// - A full Descript project URL (e.g. `https://web.descript.com/{project_id}/39677`)<br/>
/// Example: 39677a40-1c43-4c36-8449-46cfbc4de2b5
/// </param>
/// <param name="format">
Expand Down Expand Up @@ -1111,7 +1115,7 @@ partial void ProcessExportTranscriptAsBytesResponseContent(
public async global::System.Threading.Tasks.Task<byte[]> ExportTranscriptAsBytesAsync(
global::System.Guid projectId,
global::Descript.ExportTranscriptRequestFormat format,
global::System.Guid? compositionId = default,
string? compositionId = default,
global::Descript.ExportTranscriptRequestIncludeSpeakerLabels? includeSpeakerLabels = default,
bool? includeMarkers = default,
global::Descript.ExportTranscriptRequestTimecodes? timecodes = default,
Expand Down
107 changes: 107 additions & 0 deletions src/libs/Descript/Generated/Descript.AutoSDKHttpResponse.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,111 @@ public AutoSDKHttpResponse(
/// </summary>
public T Body { get; }
}

/// <summary>
/// Represents the result of a conditional HTTP request. A not-modified response has no body
/// and preserves the response entity tag so callers can keep their cached representation.
/// </summary>
public sealed class AutoSDKConditionalResponse<T>
{
internal AutoSDKConditionalResponse(
bool notModified,
string? entityTag,
global::Descript.AutoSDKHttpResponse<T>? response)
{
NotModified = notModified;
EntityTag = entityTag;
Response = response;
}

/// <summary>Gets whether the server returned HTTP 304 Not Modified.</summary>
public bool NotModified { get; }

/// <summary>Gets the response ETag, when one was supplied.</summary>
public string? EntityTag { get; }

/// <summary>Gets the successful response, or null when <see cref="NotModified"/> is true.</summary>
public global::Descript.AutoSDKHttpResponse<T>? Response { get; }
}

/// <summary>
/// Helpers for standards-based ETag conditional requests. Generated clients already expose
/// request headers through <see cref="AutoSDKRequestOptions"/> and successful response
/// headers through <see cref="AutoSDKHttpResponse"/>; this helper also turns an OpenAPI
/// <c>304</c> error response into a typed not-modified result.
/// </summary>
public static class AutoSDKConditionalRequests
{
/// <summary>
/// Executes a generated <c>AsResponseAsync</c> method with an optional If-None-Match header.
/// </summary>
public static async global::System.Threading.Tasks.Task<global::Descript.AutoSDKConditionalResponse<T>> SendAsync<T>(
global::System.Func<global::Descript.AutoSDKRequestOptions, global::System.Threading.CancellationToken, global::System.Threading.Tasks.Task<global::Descript.AutoSDKHttpResponse<T>>> send,
string? entityTag = null,
global::Descript.AutoSDKRequestOptions? requestOptions = null,
global::System.Threading.CancellationToken cancellationToken = default)
{
send = send ?? throw new global::System.ArgumentNullException(nameof(send));
requestOptions = CloneRequestOptions(requestOptions);
if (!string.IsNullOrWhiteSpace(entityTag))
{
requestOptions.Headers["If-None-Match"] = entityTag!;
}

try
{
var response = await send(requestOptions, cancellationToken).ConfigureAwait(false);
return new global::Descript.AutoSDKConditionalResponse<T>(
notModified: false,
entityTag: GetEntityTag(response.Headers),
response: response);
}
catch (global::Descript.ApiException exception)
when (exception.StatusCode == global::System.Net.HttpStatusCode.NotModified)
{
return new global::Descript.AutoSDKConditionalResponse<T>(
notModified: true,
entityTag: GetEntityTag(exception.ResponseHeaders) ?? entityTag,
response: null);
}
}

private static global::Descript.AutoSDKRequestOptions CloneRequestOptions(
global::Descript.AutoSDKRequestOptions? source)
{
var clone = new global::Descript.AutoSDKRequestOptions();
if (source == null)
{
return clone;
}

foreach (var header in source.Headers)
{
clone.Headers[header.Key] = header.Value;
}

foreach (var parameter in source.QueryParameters)
{
clone.QueryParameters[parameter.Key] = parameter.Value;
}

clone.Timeout = source.Timeout;
clone.Retry = source.Retry;
clone.ReadResponseAsString = source.ReadResponseAsString;
clone.Authorizations = source.Authorizations;
return clone;
}

/// <summary>Gets the first ETag header value from a generated response header map.</summary>
public static string? GetEntityTag(
global::System.Collections.Generic.Dictionary<string, global::System.Collections.Generic.IEnumerable<string>>? headers)
{
if (headers == null || !headers.TryGetValue("ETag", out var values))
{
return null;
}

return global::System.Linq.Enumerable.FirstOrDefault(values);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public partial interface IApiEndpointsClient
/// Example: 9f36ee32-5a2c-47e7-b1a3-94991d3e3ddb
/// </param>
/// <param name="compositionId">
/// The ID of the composition to export. Defaults to the first composition.<br/>
/// Composition to export. If omitted, the first composition in the project is used.<br/>
/// Accepts any of the following formats:<br/>
/// - A full composition UUID (e.g. `39677a40-1c43-4c36-8449-46cfbc4de2b5`)<br/>
/// - A 5-character short ID from a Descript URL (e.g. `39677`)<br/>
/// - A full Descript project URL (e.g. `https://web.descript.com/{project_id}/39677`)<br/>
/// Example: 39677a40-1c43-4c36-8449-46cfbc4de2b5
/// </param>
/// <param name="format">
Expand Down Expand Up @@ -83,7 +87,7 @@ public partial interface IApiEndpointsClient
global::System.Threading.Tasks.Task<string> ExportTranscriptAsync(
global::System.Guid projectId,
global::Descript.ExportTranscriptRequestFormat format,
global::System.Guid? compositionId = default,
string? compositionId = default,
global::Descript.ExportTranscriptRequestIncludeSpeakerLabels? includeSpeakerLabels = default,
bool? includeMarkers = default,
global::Descript.ExportTranscriptRequestTimecodes? timecodes = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ public partial interface IApiEndpointsClient
/// Example: 9f36ee32-5a2c-47e7-b1a3-94991d3e3ddb
/// </param>
/// <param name="compositionId">
/// The ID of the composition to export. Defaults to the first composition.<br/>
/// Composition to export. If omitted, the first composition in the project is used.<br/>
/// Accepts any of the following formats:<br/>
/// - A full composition UUID (e.g. `39677a40-1c43-4c36-8449-46cfbc4de2b5`)<br/>
/// - A 5-character short ID from a Descript URL (e.g. `39677`)<br/>
/// - A full Descript project URL (e.g. `https://web.descript.com/{project_id}/39677`)<br/>
/// Example: 39677a40-1c43-4c36-8449-46cfbc4de2b5
/// </param>
/// <param name="format">
Expand Down Expand Up @@ -101,7 +105,7 @@ public partial interface IApiEndpointsClient
global::System.Threading.Tasks.Task<byte[]> ExportTranscriptAsBytesAsync(
global::System.Guid projectId,
global::Descript.ExportTranscriptRequestFormat format,
global::System.Guid? compositionId = default,
string? compositionId = default,
global::Descript.ExportTranscriptRequestIncludeSpeakerLabels? includeSpeakerLabels = default,
bool? includeMarkers = default,
global::Descript.ExportTranscriptRequestTimecodes? timecodes = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ public sealed partial class ExportTranscriptRequest
public required global::System.Guid ProjectId { get; set; }

/// <summary>
/// The ID of the composition to export. Defaults to the first composition.<br/>
/// Composition to export. If omitted, the first composition in the project is used.<br/>
/// Accepts any of the following formats:<br/>
/// - A full composition UUID (e.g. `39677a40-1c43-4c36-8449-46cfbc4de2b5`)<br/>
/// - A 5-character short ID from a Descript URL (e.g. `39677`)<br/>
/// - A full Descript project URL (e.g. `https://web.descript.com/{project_id}/39677`)<br/>
/// Example: 39677a40-1c43-4c36-8449-46cfbc4de2b5
/// </summary>
/// <example>39677a40-1c43-4c36-8449-46cfbc4de2b5</example>
[global::System.Text.Json.Serialization.JsonPropertyName("composition_id")]
public global::System.Guid? CompositionId { get; set; }
public string? CompositionId { get; set; }

/// <summary>
/// Transcript file format. The response body is the raw transcript file<br/>
Expand Down Expand Up @@ -79,7 +83,11 @@ public sealed partial class ExportTranscriptRequest
/// The `srt` format exports a SubRip subtitle file with timed captions.
/// </param>
/// <param name="compositionId">
/// The ID of the composition to export. Defaults to the first composition.<br/>
/// Composition to export. If omitted, the first composition in the project is used.<br/>
/// Accepts any of the following formats:<br/>
/// - A full composition UUID (e.g. `39677a40-1c43-4c36-8449-46cfbc4de2b5`)<br/>
/// - A 5-character short ID from a Descript URL (e.g. `39677`)<br/>
/// - A full Descript project URL (e.g. `https://web.descript.com/{project_id}/39677`)<br/>
/// Example: 39677a40-1c43-4c36-8449-46cfbc4de2b5
/// </param>
/// <param name="includeSpeakerLabels">
Expand All @@ -103,7 +111,7 @@ public sealed partial class ExportTranscriptRequest
public ExportTranscriptRequest(
global::System.Guid projectId,
global::Descript.ExportTranscriptRequestFormat format,
global::System.Guid? compositionId,
string? compositionId,
global::Descript.ExportTranscriptRequestIncludeSpeakerLabels? includeSpeakerLabels,
bool? includeMarkers,
global::Descript.ExportTranscriptRequestTimecodes? timecodes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ public sealed partial class ImportProjectMediaRequestAddCompositionClip
[global::System.Text.Json.Serialization.JsonRequired]
public required string Media { get; set; }

/// <summary>
/// Mute the track this clip plays on. For a sequence clip, mutes the sequence's own tracks.<br/>
/// For any other clip, mutes the composition's script layer, which silences every<br/>
/// clip on it — including clips already in the composition. Defaults to false.<br/>
/// Default Value: false<br/>
/// Example: true
/// </summary>
/// <example>true</example>
[global::System.Text.Json.Serialization.JsonPropertyName("mute")]
public bool? Mute { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
Expand All @@ -30,13 +41,22 @@ public sealed partial class ImportProjectMediaRequestAddCompositionClip
/// Media reference ID (display name) of the media to add as a clip<br/>
/// Example: Misc/intro.mp4
/// </param>
/// <param name="mute">
/// Mute the track this clip plays on. For a sequence clip, mutes the sequence's own tracks.<br/>
/// For any other clip, mutes the composition's script layer, which silences every<br/>
/// clip on it — including clips already in the composition. Defaults to false.<br/>
/// Default Value: false<br/>
/// Example: true
/// </param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
public ImportProjectMediaRequestAddCompositionClip(
string media)
string media,
bool? mute)
{
this.Media = media ?? throw new global::System.ArgumentNullException(nameof(media));
this.Mute = mute;
}

/// <summary>
Expand Down
9 changes: 6 additions & 3 deletions src/libs/Descript/Generated/Descript.OptionsSupport.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -903,11 +903,14 @@ private static void ApplyHeadersCore(
foreach (var header in headers)
{
request.Headers.Remove(header.Key);
request.Content?.Headers.Remove(header.Key);
if (request.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty))
{
continue;
}

if (!request.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty) &&
request.Content != null)
if (request.Content != null)
{
request.Content.Headers.Remove(header.Key);
request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty);
}
}
Expand Down
17 changes: 15 additions & 2 deletions src/libs/Descript/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,14 @@ paths:
type: string
description: Media reference ID (display name) of the media to add as a clip
example: Misc/intro.mp4
mute:
type: boolean
description: |
Mute the track this clip plays on. For a sequence clip, mutes the sequence's own tracks.
For any other clip, mutes the composition's script layer, which silences every
clip on it — including clips already in the composition. Defaults to false.
default: false
example: true
additionalProperties: false
required:
- clips
Expand Down Expand Up @@ -1386,8 +1394,13 @@ paths:
example: 9f36ee32-5a2c-47e7-b1a3-94991d3e3ddb
composition_id:
type: string
format: uuid
description: The ID of the composition to export. Defaults to the first composition.
description: |
Composition to export. If omitted, the first composition in the project is used.

Accepts any of the following formats:
- A full composition UUID (e.g. `39677a40-1c43-4c36-8449-46cfbc4de2b5`)
- A 5-character short ID from a Descript URL (e.g. `39677`)
- A full Descript project URL (e.g. `https://web.descript.com/{project_id}/39677`)
example: 39677a40-1c43-4c36-8449-46cfbc4de2b5
format:
type: string
Expand Down