Skip to content

Commit eed81b4

Browse files
Add validation for part number if provided should be between 1 to 1000
1 parent e48333f commit eed81b4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Src/Notion.Client/Api/FileUploads/Send/FileUploadsClient.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ public async Task<SendFileUploadResponse> SendAsync(
2020
throw new ArgumentNullException(nameof(sendFileUploadRequest.FileUploadId));
2121
}
2222

23+
if (sendFileUploadRequest.PartNumber != null)
24+
{
25+
if (!int.TryParse(sendFileUploadRequest.PartNumber, out int partNumberValue) || partNumberValue < 1 || partNumberValue > 1000)
26+
{
27+
throw new ArgumentOutOfRangeException(nameof(sendFileUploadRequest.PartNumber), "PartNumber must be between 1 and 1000.");
28+
}
29+
}
30+
2331
var path = ApiEndpoints.FileUploadsApiUrls.Send(sendFileUploadRequest.FileUploadId);
2432

2533
return await _restClient.PostAsync<SendFileUploadResponse>(

0 commit comments

Comments
 (0)