support urls

This commit is contained in:
2024-06-17 16:55:31 +02:00
parent 97b38ed90c
commit bbac69b79e
8 changed files with 363 additions and 215 deletions

View File

@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<RootNamespace>ModpackUpdater.GitLab</RootNamespace>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\ModpackUpdater.Model\ModpackUpdater.Model.vbproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,33 @@
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