mirror of
https://github.com/sissbruecker/linkding
synced 2024-11-13 23:27:16 +00:00
c61e8ee2cd
* Implement archive function (#46) * Implement archive view (#46) * Filter tags for archived/unarchived (#46) * Implement archived bookmarks endpoint (#46) * Implement archive mode for search component (#46) * Move bookmarklet to settings (#46) * Update modified timestamp on archive/unarchive (#46) * Fix bookmarklet (#46)
23 lines
No EOL
807 B
JavaScript
23 lines
No EOL
807 B
JavaScript
export class ApiClient {
|
|
constructor(baseUrl) {
|
|
this.baseUrl = baseUrl
|
|
}
|
|
|
|
getBookmarks(query, options = {limit: 100, offset: 0}) {
|
|
const encodedQuery = encodeURIComponent(query)
|
|
const url = `${this.baseUrl}bookmarks?q=${encodedQuery}&limit=${options.limit}&offset=${options.offset}`
|
|
|
|
return fetch(url)
|
|
.then(response => response.json())
|
|
.then(data => data.results)
|
|
}
|
|
|
|
getArchivedBookmarks(query, options = {limit: 100, offset: 0}) {
|
|
const encodedQuery = encodeURIComponent(query)
|
|
const url = `${this.baseUrl}bookmarks/archived?q=${encodedQuery}&limit=${options.limit}&offset=${options.offset}`
|
|
|
|
return fetch(url)
|
|
.then(response => response.json())
|
|
.then(data => data.results)
|
|
}
|
|
} |