@@ -42,6 +42,11 @@ public interface IArtifacts
42
42
Task < Models . Operations . GetRevisionsResponse > GetRevisionsAsync ( GetRevisionsRequest request ) ;
43
43
Task < Models . Operations . GetTagsResponse > GetTagsAsync ( GetTagsRequest request ) ;
44
44
45
+ /// <summary>
46
+ /// Add tags to an existing revision
47
+ /// </summary>
48
+ Task < PostTagsResponse > PostTagsAsync ( PostTagsRequest request ) ;
49
+
45
50
/// <summary>
46
51
/// Get access token for communicating with OCI distribution endpoints
47
52
/// </summary>
@@ -52,10 +57,10 @@ public class Artifacts: IArtifacts
52
57
{
53
58
public SDKConfig SDKConfiguration { get ; private set ; }
54
59
private const string _language = "csharp" ;
55
- private const string _sdkVersion = "5.5.0 " ;
56
- private const string _sdkGenVersion = "2.317.0 " ;
60
+ private const string _sdkVersion = "5.5.1 " ;
61
+ private const string _sdkGenVersion = "2.319.10 " ;
57
62
private const string _openapiDocVersion = "0.4.0 ." ;
58
- private const string _userAgent = "speakeasy-sdk/csharp 5.5.0 2.317.0 0.4.0 . SpeakeasySDK" ;
63
+ private const string _userAgent = "speakeasy-sdk/csharp 5.5.1 2.319.10 0.4.0 . SpeakeasySDK" ;
59
64
private string _serverUrl = "" ;
60
65
private ISpeakeasyHttpClient _defaultClient ;
61
66
private Func < Security > ? _securitySource ;
@@ -529,6 +534,94 @@ public async Task<GetManifestResponse> GetManifestAsync(GetManifestRequest reque
529
534
}
530
535
}
531
536
537
+ public async Task < PostTagsResponse > PostTagsAsync ( PostTagsRequest request )
538
+ {
539
+ string baseUrl = this . SDKConfiguration . GetTemplatedServerUrl ( ) ;
540
+ var urlString = URLBuilder . Build ( baseUrl , "/v1/artifacts/namespaces/{namespace_name}/tags" , request ) ;
541
+
542
+ var httpRequest = new HttpRequestMessage ( HttpMethod . Post , urlString ) ;
543
+ httpRequest . Headers . Add ( "user-agent" , _userAgent ) ;
544
+
545
+ var serializedBody = RequestBodySerializer . Serialize ( request , "AddTags" , "json" , false , true ) ;
546
+ if ( serializedBody != null )
547
+ {
548
+ httpRequest . Content = serializedBody ;
549
+ }
550
+
551
+ if ( _securitySource != null )
552
+ {
553
+ httpRequest = new SecurityMetadata ( _securitySource ) . Apply ( httpRequest ) ;
554
+ }
555
+
556
+ var hookCtx = new HookContext ( "postTags" , null , _securitySource ) ;
557
+
558
+ httpRequest = await this . SDKConfiguration . hooks . BeforeRequestAsync ( new BeforeRequestContext ( hookCtx ) , httpRequest ) ;
559
+ HttpResponseMessage httpResponse ;
560
+ try
561
+ {
562
+ httpResponse = await _defaultClient . SendAsync ( httpRequest ) ;
563
+ int _statusCode = ( int ) httpResponse . StatusCode ;
564
+
565
+ if ( _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600 )
566
+ {
567
+ var _httpResponse = await this . SDKConfiguration . hooks . AfterErrorAsync ( new AfterErrorContext ( hookCtx ) , httpResponse , null ) ;
568
+ if ( _httpResponse != null )
569
+ {
570
+ httpResponse = _httpResponse ;
571
+ }
572
+ }
573
+ }
574
+ catch ( Exception error )
575
+ {
576
+ var _httpResponse = await this . SDKConfiguration . hooks . AfterErrorAsync ( new AfterErrorContext ( hookCtx ) , null , error ) ;
577
+ if ( _httpResponse != null )
578
+ {
579
+ httpResponse = _httpResponse ;
580
+ }
581
+ else
582
+ {
583
+ throw ;
584
+ }
585
+ }
586
+
587
+ httpResponse = await this . SDKConfiguration . hooks . AfterSuccessAsync ( new AfterSuccessContext ( hookCtx ) , httpResponse ) ;
588
+
589
+ var contentType = httpResponse . Content . Headers . ContentType ? . MediaType ;
590
+ int responseStatusCode = ( int ) httpResponse . StatusCode ;
591
+ if ( responseStatusCode == 200 )
592
+ {
593
+ return new PostTagsResponse ( )
594
+ {
595
+ StatusCode = responseStatusCode ,
596
+ ContentType = contentType ,
597
+ RawResponse = httpResponse
598
+ } ; ;
599
+ }
600
+ else if ( responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600 )
601
+ {
602
+ throw new SDKException ( "API error occurred" , responseStatusCode , await httpResponse . Content . ReadAsStringAsync ( ) , httpResponse ) ;
603
+ }
604
+ else
605
+ {
606
+ if ( Utilities . IsContentTypeMatch ( "application/json" , contentType ) )
607
+ {
608
+ var obj = ResponseBodyDeserializer . Deserialize < Error > ( await httpResponse . Content . ReadAsStringAsync ( ) , NullValueHandling . Ignore ) ;
609
+ var response = new PostTagsResponse ( )
610
+ {
611
+ StatusCode = responseStatusCode ,
612
+ ContentType = contentType ,
613
+ RawResponse = httpResponse
614
+ } ;
615
+ response . Error = obj ;
616
+ return response ;
617
+ }
618
+ else
619
+ {
620
+ throw new SDKException ( "Unknown content type received" , responseStatusCode , await httpResponse . Content . ReadAsStringAsync ( ) , httpResponse ) ;
621
+ }
622
+ }
623
+ }
624
+
532
625
public async Task < PreflightResponse > PreflightAsync ( PreflightRequest ? request = null )
533
626
{
534
627
string baseUrl = this . SDKConfiguration . GetTemplatedServerUrl ( ) ;
0 commit comments