package util import ( "net/url" "github.com/google/go-querystring/query" "github.com/guisea/directdnsonly/internal/responses" ) func DecodeParams(payload string) map[string]string { // Parse the query string from the payload values, err := url.ParseQuery(payload) if err != nil { // Handle error, e.g., log it or return an error value return nil } // Initialize a map to store the decoded parameters params := make(map[string]string) // Iterate through the parameters for key, val := range values { // Store the first value of each parameter in the map if len(val) > 0 { params[key] = val[0] } } // Return the decoded parameters as a map return params } func EncodeQueryString(payload responses.DAResponse) string { QueryStringResponse, _ := query.Values(payload) return QueryStringResponse.Encode() }