@@ -12,23 +12,23 @@ import (
1212 "time"
1313)
1414
15- // APIRequest makes an API request to the specified URL using the specified HTTP method and authentication header.
16- // It returns a models.ResponseBody struct containing the API response body and an error (if any).
17- func APIRequest (url , method string , auth string , request models.ReadCsv ) (models.ResponseBody , error ) {
15+ // APIRequestLawsuit makes an API request to the specified URL using the specified HTTP method and authentication header.
16+ // It returns a models.ResponseBodyLawsuit struct containing the API response body and an error (if any).
17+ func APIRequestLawsuit (url , method string , auth string , request models.ReadCsvLaawsuit ) (models.ResponseBodyLawsuit , error ) {
1818 cnj , err := modifyCNJ (request .CNJNumber )
1919 if err != nil {
20- return models.ResponseBody {}, errors .New (err .Error () + " " + request .CNJNumber )
20+ return models.ResponseBodyLawsuit {}, errors .New (err .Error () + " " + request .CNJNumber )
2121 }
2222
23- // Create a new BodyRequest struct with the document ID and pagination settings for the initial API call.
24- req := models.BodyRequest {
25- Query : models.Query {Match : models.Match {CNJNumber : cnj }},
23+ // Create a new BodyRequestLawsuit struct with the document ID and pagination settings for the initial API call.
24+ req := models.BodyRequestLawsuit {
25+ Query : models.QueryLawsuit {Match : models.MatchLawsuit {CNJNumber : cnj }},
2626 }
2727
28- // Serialize the BodyRequest struct to JSON.
28+ // Serialize the BodyRequestLawsuit struct to JSON.
2929 jsonReq , err := json .Marshal (req )
3030 if err != nil {
31- return models.ResponseBody {}, errors .New (err .Error () + " " + req .Query .Match .CNJNumber )
31+ return models.ResponseBodyLawsuit {}, errors .New (err .Error () + " " + req .Query .Match .CNJNumber )
3232 }
3333
3434 // Create a new buffer with the JSON-encoded request body.
@@ -37,23 +37,23 @@ func APIRequest(url, method string, auth string, request models.ReadCsv) (models
3737 // Make the API call and get the response.
3838 res , err := call (url , method , auth , reqBody )
3939 if err != nil {
40- return models.ResponseBody {}, errors .New (err .Error () + " " + req .Query .Match .CNJNumber )
40+ return models.ResponseBodyLawsuit {}, errors .New (err .Error () + " " + req .Query .Match .CNJNumber )
4141 }
4242
4343 // Read the response body.
4444 body , err := ioutil .ReadAll (res .Body )
4545 if err != nil {
46- return models.ResponseBody {}, errors .New (err .Error () + " " + req .Query .Match .CNJNumber )
46+ return models.ResponseBodyLawsuit {}, errors .New (err .Error () + " " + req .Query .Match .CNJNumber )
4747 }
4848
49- // Unmarshal the response body into a ResponseBody struct.
50- var response models.ResponseBody
49+ // Unmarshal the response body into a ResponseBodyLawsuit struct.
50+ var response models.ResponseBodyLawsuit
5151 err = json .Unmarshal (body , & response )
5252 if err != nil {
53- return models.ResponseBody {}, errors .New (err .Error () + " " + req .Query .Match .CNJNumber )
53+ return models.ResponseBodyLawsuit {}, errors .New (err .Error () + " " + req .Query .Match .CNJNumber )
5454 }
5555
56- return models.ResponseBody {
56+ return models.ResponseBodyLawsuit {
5757 Took : response .Took ,
5858 TimedOut : response .TimedOut ,
5959 Shards : response .Shards ,
0 commit comments