|
1 | 1 | package types
|
2 | 2 |
|
3 |
| -type ApiResponse[T any] struct { |
4 |
| - Code string `json:"code"` |
5 |
| - Message *string `json:"message,omitempty"` |
6 |
| - Data T `json:"data,omitempty"` |
| 3 | +type IResponse interface { |
| 4 | + ToLLMStyle() string |
7 | 5 | }
|
8 | 6 |
|
9 |
| -type SearchTextPayload struct { |
10 |
| - // Keywords to search (required) |
11 |
| - Keyword string `json:"keyword" form:"keyword" validate:"required"` |
12 |
| - // Region to search (optional) (default "en-US") |
13 |
| - Region string `json:"region" form:"region"` |
14 |
| - // Time limit to search (optional) ( "" default all , "d" past day, "w" past week, "m" past month, "y" past year) |
15 |
| - TimeLimit string `json:"timeLimit" form:"timeLimit"` |
16 |
| - // Max count of search results (optional) (default 20) |
17 |
| - MaxCount int `json:"maxCount" form:"maxCount"` |
18 |
| - // Proxy url to use (optional) |
19 |
| - ViaProxyUrl string `json:"viaProxyUrl" form:"viaProxyUrl"` |
| 7 | +type ApiResponse struct { |
| 8 | + Code string `json:"code"` |
| 9 | + Message *string `json:"message,omitempty"` |
| 10 | + Data IResponse `json:"data,omitempty"` |
20 | 11 | }
|
21 | 12 |
|
22 |
| -type SearchTextResponse struct { |
23 |
| - Results []SearchTextResultItem `json:"results"` |
24 |
| -} |
25 |
| - |
26 |
| -type SearchTextResultItem struct { |
27 |
| - Order int `json:"order"` // order of the result |
28 |
| - Title string `json:"title"` // title of the result |
29 |
| - Url string `json:"url"` // url of the result |
30 |
| - Description string `json:"description"` // description of the result |
31 |
| -} |
32 |
| - |
33 |
| -type LanguageType struct { |
34 |
| - Code string `json:"code"` |
35 |
| - Name string `json:"name"` |
36 |
| -} |
37 |
| - |
38 |
| -type ListLanguagePayload struct { |
39 |
| - // Proxy url to use (optional) |
40 |
| - ViaProxyUrl string `json:"viaProxyUrl" form:"viaProxyUrl"` |
41 |
| -} |
| 13 | +type EmptyResponse struct{} |
42 | 14 |
|
43 |
| -type ListLanguageResponse struct { |
44 |
| - Languages []LanguageType `json:"languages"` |
| 15 | +func (e EmptyResponse) ToLLMStyle() string { |
| 16 | + return "success" |
45 | 17 | }
|
0 commit comments