There is an answer here which has this code in C#:
public class GoogleBatchInterceptor : IHttpExecuteInterceptor
{
public async Task InterceptAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
await Task.CompletedTask;
if (request.Content is not MultipartContent multipartContent)
{
return;
}
foreach (var content in multipartContent)
{
content.Headers.Add("Content-ID", Guid.NewGuid().ToString());
}
}
}
I am trying to port this to VB.Net and I tried to begin with:
Imports Google.Apis.Http.IHttpExecuteInterceptor
Public Class GoogleBatchInterceptor : IHttpExecuteInterceptor
End Class
It says:
Declaration expected.
How do I port this code over? It is so I can temporarily circumnavigate a Google Calendar API issue
Update
I have got this far now:
Imports System.Net.Http
Imports System.Threading
Imports Google.Apis.Http
Public Class GoogleBatchInterceptor
Implements IHttpExecuteInterceptor
Private Async Function IHttpExecuteInterceptor_InterceptAsync(request As HttpRequestMessage, cancellationToken As CancellationToken) As Task Implements IHttpExecuteInterceptor.InterceptAsync
Await Task.CompletedTask
'If request.Content Is Not MultipartContent multiplepartContent Then
' Return
'End If
'For Each (dim content)
End Function
End Class