Files
minecraft-modpack-updater/ModpackUpdater.GitLab/UpdateConfigExt.vb
2024-06-17 16:55:31 +02:00

34 lines
1.1 KiB
VB.net

Imports System.Net.Http
Imports ModpackUpdater.Model
Imports Newtonsoft.Json
Public Class UpdateConfigExt
'<Extension>
'Public Sub SaveToSnippet(config As UpdateConfig, gitlabUrl As String, gitlabToken As String, projectId As Integer, snippetId As Integer, snippetFilePath As String)
' Dim client As New GitLabClient(gitlabUrl, gitlabToken)
' Dim update As New SnippetProjectUpdate With {
' .Visibility = VisibilityLevel.Public,
' .ProjectId = projectId,
' .SnippetId = snippetId,
' .Files = {
' New SnippetUpdateFile With {
' .Action = SnippetUpdateFileAction.Update.Create,
' .FilePath = snippetFilePath,
' .Content = JsonConvert.SerializeObject(config)
' }
' }
' }
' client.Snippets.Update(update)
'End Sub
Public Shared Function LoadFromSnippet(url As String) As UpdateConfig
Dim client As New HttpClient
Dim result = client.GetStringAsync(url).Result
Return JsonConvert.DeserializeObject(Of UpdateConfig)(result)
End Function
End Class