(query string, page codersdk.Pagination)
| 450 | } |
| 451 | |
| 452 | func AIBridgeModels(query string, page codersdk.Pagination) (database.ListAIBridgeModelsParams, []codersdk.ValidationError) { |
| 453 | // nolint:exhaustruct // Empty values just means "don't filter by that field". |
| 454 | filter := database.ListAIBridgeModelsParams{ |
| 455 | // #nosec G115 - Safe conversion for pagination offset which is expected to be within int32 range |
| 456 | Offset: int32(page.Offset), |
| 457 | // #nosec G115 - Safe conversion for pagination limit which is expected to be within int32 range |
| 458 | Limit: int32(page.Limit), |
| 459 | } |
| 460 | |
| 461 | if query == "" { |
| 462 | return filter, nil |
| 463 | } |
| 464 | |
| 465 | values, errors := searchTerms(query, func(term string, values url.Values) error { |
| 466 | // Defaults to the `model` if no `key:value` pair is provided. |
| 467 | values.Add("model", term) |
| 468 | return nil |
| 469 | }) |
| 470 | if len(errors) > 0 { |
| 471 | return filter, errors |
| 472 | } |
| 473 | |
| 474 | parser := httpapi.NewQueryParamParser() |
| 475 | filter.Model = parser.String(values, "", "model") |
| 476 | |
| 477 | parser.ErrorExcessParams(values) |
| 478 | return filter, parser.Errors |
| 479 | } |
| 480 | |
| 481 | func AIBridgeClients(query string, page codersdk.Pagination) (database.ListAIBridgeClientsParams, []codersdk.ValidationError) { |
| 482 | // nolint:exhaustruct // Empty values just means "don't filter by that field". |
no test coverage detected