Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Let ChatGPT generate LA code
#1
The code replied by ChatGPT is always generic C# code. Sometimes, I want to convert this generic code into LA-specific code,
but I don't know how to express this in ChatGPT.
Are there any tips for expressing this? (Equivalent LA code, without using third-party JSON components, and the expression will be very concise, which is exactly what I need.)
For example, the code below.
 
Code:
Copy      Help
using System;
using System.Net.Http;
using System.Threading.Tasks;
using System.Net;
using Newtonsoft.Json.Linq;

static async Task<string> UpdateSubDomainIP(string subDomain, string recordId)
{
    using HttpClient client = new HttpClient();
    var values = new Dictionary<string, string>
        {
            { "login_token", "201201,fe9ddec" },
            { "format", "json" },
            { "domain", "test.com" },
            { "record_id", recordId },
            { "record_line_id", "0" },
            { "sub_domain", subDomain }
        };
    
    var content = new FormUrlEncodedContent(values);
    var response = await client.PostAsync("https://dnsapi.cn/Record.Ddns", content);
    var responseString = await response.Content.ReadAsStringAsync();
    var json = JObject.Parse(responseString);
    
    return json["record"]["value"].ToString();
}


Messages In This Thread
Let ChatGPT generate LA code - by Davider - 06-11-2024, 10:43 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)