(ctx context.Context, headers http.Header, query url.Values)
| 533 | } |
| 534 | |
| 535 | func (c *Client) GetModels(ctx context.Context, headers http.Header, query url.Values) ([]byte, error) { |
| 536 | cmd, errClient := c.commandClient() |
| 537 | if errClient != nil { |
| 538 | return nil, errClient |
| 539 | } |
| 540 | req := modelsRequest{ |
| 541 | Type: "models", |
| 542 | Headers: headersToLowerMap(headers), |
| 543 | Query: queryToLowerMap(query), |
| 544 | } |
| 545 | keyBytes, err := json.Marshal(&req) |
| 546 | if err != nil { |
| 547 | return nil, err |
| 548 | } |
| 549 | raw, err := cmd.Get(ctx, string(keyBytes)).Bytes() |
| 550 | if errors.Is(err, redis.Nil) { |
| 551 | return nil, ErrModelsNotFound |
| 552 | } |
| 553 | if err != nil { |
| 554 | return nil, err |
| 555 | } |
| 556 | if len(raw) == 0 { |
| 557 | return nil, ErrEmptyResponse |
| 558 | } |
| 559 | return raw, nil |
| 560 | } |
| 561 | |
| 562 | func buildKVSetArgs(key string, value []byte, opts KVSetOptions) ([]any, error) { |
| 563 | key = strings.TrimSpace(key) |
no test coverage detected