support urls
This commit is contained in:
12
ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj
Normal file
12
ModpackUpdater.GitLab/ModpackUpdater.GitLab.vbproj
Normal 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>
|
||||
33
ModpackUpdater.GitLab/UpdateConfigExt.vb
Normal file
33
ModpackUpdater.GitLab/UpdateConfigExt.vb
Normal 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
|
||||
Reference in New Issue
Block a user