' Main module
Sub Process_Globals
Public Const API_URL As String = "https://api.quantumnumbers.anu.edu.au"
Public Const API_KEY As String = "your_secret_api_key"
End Sub
Sub AppStart (Form1 As Form, Args() As String)
' Initialize the form
MainForm = Form1
MainForm.Show
' Example parameters
Dim arrayLength As Int = 10
Dim dataType As String = "hex16"
Dim blockSize As Int = 1
' Call the function to fetch data
FetchQuantumNumbers(arrayLength, dataType, blockSize)
End Sub
Sub FetchQuantumNumbers(arrayLength As Int, dataType As String, blockSize As Int)
Dim url As String = $"${API_URL}?length=${arrayLength}&type=${dataType}&size=${blockSize}"$
Dim Job As HttpJob
Job.Initialize("QuantumNumbersJob", Me)
Job.GetRequest.SetHeader("x-api-key", API_KEY)
Job.Download(url)
' Wait for the job to complete
Wait For (Job) JobDone(Job As HttpJob)
If Job.Success Then
Dim response As String = Job.GetString
Log("Response: " & response)
' Process the response here
Else
Log("Error: " & Job.ErrorMessage)
End If
Job.Release
End Sub