@@ -24,7 +24,7 @@ Set-StrictMode -Version 3
2424. (Join-Path $PSScriptRoot Helpers ApiView- Helpers.ps1)
2525
2626# Submit API review request and return status whether current revision is approved or pending or failed to create review
27- function Upload-SourceArtifact ($filePath , $apiLabel , $releaseStatus , $packageVersion )
27+ function Upload-SourceArtifact ($filePath , $apiLabel , $releaseStatus , $packageVersion , $packageType )
2828{
2929 Write-Host " File path: $filePath "
3030 $fileName = Split-Path - Leaf $filePath
@@ -61,6 +61,13 @@ function Upload-SourceArtifact($filePath, $apiLabel, $releaseStatus, $packageVer
6161 $multipartContent.Add ($releaseTagParamContent )
6262 Write-Host " Request param, setReleaseTag: $MarkPackageAsShipped "
6363
64+ $packageTypeParam = [System.Net.Http.Headers.ContentDispositionHeaderValue ]::new(" form-data" )
65+ $packageTypeParam.Name = " packageType"
66+ $packageTypeParamContent = [System.Net.Http.StringContent ]::new($packageType )
67+ $packageTypeParamContent.Headers.ContentDisposition = $packageTypeParam
68+ $multipartContent.Add ($packageTypeParamContent )
69+ Write-Host " Request param, packageType: $packageType "
70+
6471 if ($releaseStatus -and ($releaseStatus -ne " Unreleased" ))
6572 {
6673 $compareAllParam = [System.Net.Http.Headers.ContentDispositionHeaderValue ]::new(" form-data" )
@@ -92,14 +99,14 @@ function Upload-SourceArtifact($filePath, $apiLabel, $releaseStatus, $packageVer
9299 return $StatusCode
93100}
94101
95- function Upload-ReviewTokenFile ($packageName , $apiLabel , $releaseStatus , $reviewFileName , $packageVersion , $filePath )
102+ function Upload-ReviewTokenFile ($packageName , $apiLabel , $releaseStatus , $reviewFileName , $packageVersion , $filePath , $packageType )
96103{
97104 Write-Host " Original File path: $filePath "
98105 $fileName = Split-Path - Leaf $filePath
99106 Write-Host " OriginalFile name: $fileName "
100107
101108 $params = " buildId=${BuildId} &artifactName=${ArtifactName} &originalFilePath=${fileName} &reviewFilePath=${reviewFileName} "
102- $params += " &label=${apiLabel} &repoName=${RepoName} &packageName=${packageName} &project=internal&packageVersion=${packageVersion} "
109+ $params += " &label=${apiLabel} &repoName=${RepoName} &packageName=${packageName} &project=internal&packageVersion=${packageVersion} &packageType= ${packageType }"
103110 if ($MarkPackageAsShipped ) {
104111 $params += " &setReleaseTag=true"
105112 }
@@ -146,17 +153,18 @@ function Get-APITokenFileName($packageName)
146153function Submit-APIReview ($packageInfo , $packagePath )
147154{
148155 $apiLabel = " Source Branch:${SourceBranch} "
156+ $packageType = $packageInfo.SdkType
149157
150158 # Get generated review token file if present
151159 # APIView processes request using different API if token file is already generated
152160 $reviewTokenFileName = Get-APITokenFileName $packageInfo.ArtifactName
153161 if ($reviewTokenFileName ) {
154162 Write-Host " Uploading review token file $reviewTokenFileName to APIView."
155- return Upload- ReviewTokenFile $packageInfo.ArtifactName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version $packagePath
163+ return Upload- ReviewTokenFile $packageInfo.ArtifactName $apiLabel $packageInfo.ReleaseStatus $reviewTokenFileName $packageInfo.Version $packagePath $packageType
156164 }
157165 else {
158166 Write-Host " Uploading $packagePath to APIView."
159- return Upload- SourceArtifact $packagePath $apiLabel $packageInfo.ReleaseStatus $packageInfo.Version
167+ return Upload- SourceArtifact $packagePath $apiLabel $packageInfo.ReleaseStatus $packageInfo.Version $packageType
160168 }
161169}
162170
0 commit comments