(base: string, params: AgiloftSearchRecordsParams)
| 66 | } |
| 67 | |
| 68 | export function buildSearchRecordsUrl(base: string, params: AgiloftSearchRecordsParams): string { |
| 69 | const query = encodeURIComponent(params.query) |
| 70 | let url = `${base}/ewws/EWSearch/.json?${buildEwBaseQuery(params)}&query=${query}` |
| 71 | |
| 72 | if (params.fields) { |
| 73 | const fieldList = params.fields |
| 74 | .split(',') |
| 75 | .map((f) => f.trim()) |
| 76 | .filter(Boolean) |
| 77 | for (const field of fieldList) { |
| 78 | url += `&field=${encodeURIComponent(field)}` |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | if (params.page) { |
| 83 | url += `&page=${encodeURIComponent(params.page)}` |
| 84 | } |
| 85 | if (params.limit) { |
| 86 | url += `&limit=${encodeURIComponent(params.limit)}` |
| 87 | } |
| 88 | |
| 89 | return url |
| 90 | } |
| 91 | |
| 92 | export function buildSelectRecordsUrl(base: string, params: AgiloftSelectRecordsParams): string { |
| 93 | const where = encodeURIComponent(params.where) |
no test coverage detected