Skip to content

Commit b51a39f

Browse files
Normalize collection_uuid and environment_uuid parameters to collectionUuid and environmentUuid
1 parent 1cdadf1 commit b51a39f

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pkg/sources/postman/postman_client.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -330,42 +330,42 @@ func (c *Client) GetWorkspace(ctx context.Context, workspaceUUID string) (Worksp
330330
}
331331

332332
// GetEnvironmentVariables returns the environment variables for a given environment
333-
func (c *Client) GetEnvironmentVariables(ctx context.Context, environment_uuid string) (VariableData, error) {
333+
func (c *Client) GetEnvironmentVariables(ctx context.Context, environmentUid string) (VariableData, error) {
334334
obj := struct {
335335
VariableData VariableData `json:"environment"`
336336
}{}
337337

338-
url := fmt.Sprintf(ENVIRONMENTS_URL, environment_uuid)
338+
url := fmt.Sprintf(ENVIRONMENTS_URL, environmentUid)
339339
if err := c.GeneralRateLimiter.Wait(ctx); err != nil {
340340
return VariableData{}, fmt.Errorf("could not wait for rate limiter during environment variable getting: %w", err)
341341
}
342342
body, err := c.getPostmanResponseBodyBytes(ctx, url, nil)
343343
if err != nil {
344-
return VariableData{}, fmt.Errorf("could not get postman environment (%s) response bytes: %w", environment_uuid, err)
344+
return VariableData{}, fmt.Errorf("could not get postman environment (%s) response bytes: %w", environmentUid, err)
345345
}
346346
if err := json.Unmarshal([]byte(body), &obj); err != nil {
347-
return VariableData{}, fmt.Errorf("could not unmarshal env variables JSON for environment (%s): %w", environment_uuid, err)
347+
return VariableData{}, fmt.Errorf("could not unmarshal env variables JSON for environment (%s): %w", environmentUid, err)
348348
}
349349

350350
return obj.VariableData, nil
351351
}
352352

353353
// GetCollection returns the collection for a given collection
354-
func (c *Client) GetCollection(ctx context.Context, collection_uuid string) (Collection, error) {
354+
func (c *Client) GetCollection(ctx context.Context, collectionId string) (Collection, error) {
355355
obj := struct {
356356
Collection Collection `json:"collection"`
357357
}{}
358358

359-
url := fmt.Sprintf(COLLECTIONS_URL, collection_uuid)
359+
url := fmt.Sprintf(COLLECTIONS_URL, collectionId)
360360
if err := c.WorkspaceAndCollectionRateLimiter.Wait(ctx); err != nil {
361361
return Collection{}, fmt.Errorf("could not wait for rate limiter during collection getting: %w", err)
362362
}
363363
body, err := c.getPostmanResponseBodyBytes(ctx, url, nil)
364364
if err != nil {
365-
return Collection{}, fmt.Errorf("could not get postman collection (%s) response bytes: %w", collection_uuid, err)
365+
return Collection{}, fmt.Errorf("could not get postman collection (%s) response bytes: %w", collectionId, err)
366366
}
367367
if err := json.Unmarshal([]byte(body), &obj); err != nil {
368-
return Collection{}, fmt.Errorf("could not unmarshal JSON for collection (%s): %w", collection_uuid, err)
368+
return Collection{}, fmt.Errorf("could not unmarshal JSON for collection (%s): %w", collectionId, err)
369369
}
370370

371371
// Loop used to deal with seeing whether a request/response header is a string or a key value pair
@@ -374,21 +374,21 @@ func (c *Client) GetCollection(ctx context.Context, collection_uuid string) (Col
374374
if err := json.Unmarshal(obj.Collection.Items[i].Request.HeaderRaw, &obj.Collection.Items[i].Request.HeaderKeyValue); err == nil {
375375
} else if err := json.Unmarshal(obj.Collection.Items[i].Request.HeaderRaw, &obj.Collection.Items[i].Request.HeaderString); err == nil {
376376
} else {
377-
return Collection{}, fmt.Errorf("could not unmarshal request header JSON for collection (%s): %w", collection_uuid, err)
377+
return Collection{}, fmt.Errorf("could not unmarshal request header JSON for collection (%s): %w", collectionId, err)
378378
}
379379
}
380380

381381
for j := range obj.Collection.Items[i].Response {
382382
if err := json.Unmarshal(obj.Collection.Items[i].Response[j].OriginalRequest.HeaderRaw, &obj.Collection.Items[i].Response[j].OriginalRequest.HeaderKeyValue); err == nil {
383383
} else if err := json.Unmarshal(obj.Collection.Items[i].Response[j].OriginalRequest.HeaderRaw, &obj.Collection.Items[i].Response[j].OriginalRequest.HeaderString); err == nil {
384384
} else {
385-
return Collection{}, fmt.Errorf("could not unmarshal original request header in response JSON for collection (%s): %w", collection_uuid, err)
385+
return Collection{}, fmt.Errorf("could not unmarshal original request header in response JSON for collection (%s): %w", collectionId, err)
386386
}
387387

388388
if err := json.Unmarshal(obj.Collection.Items[i].Response[j].HeaderRaw, &obj.Collection.Items[i].Response[j].HeaderKeyValue); err == nil {
389389
} else if err := json.Unmarshal(obj.Collection.Items[i].Response[j].HeaderRaw, &obj.Collection.Items[i].Response[j].HeaderString); err == nil {
390390
} else {
391-
return Collection{}, fmt.Errorf("could not unmarshal response header JSON for collection (%s): %w", collection_uuid, err)
391+
return Collection{}, fmt.Errorf("could not unmarshal response header JSON for collection (%s): %w", collectionId, err)
392392
}
393393
}
394394
}

0 commit comments

Comments
 (0)