Skip to content

Commit

Permalink
Add options for start_cursor, filter_properties
Browse files Browse the repository at this point in the history
  • Loading branch information
psarin committed Dec 15, 2023
1 parent 5516866 commit 64f95b5
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions lib/src/DatabaseApi.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,36 @@ component DatabaseAPI {
method: 'GET',
url: '/databases'
});
}
}

public function retrieve(String database_id) {
return this.httpService(argumentCollection = {
message: 'getting the database',
method: 'GET',
url: '/databases/#arguments.database_id#'
});
}
}

public function query(String database_id, numeric page_size = 10, String start_cursor, Array sorts = [], Struct filter, Array filter_properties = []) {

var _body = {
"page_size": arguments?.page_size,
"filter": arguments?.filter,
"start_cursor": arguments?.start_cursor
}

public function query(String database_id, numeric page_size = 10, String start_cursor, Array sorts = [], Struct filter) {
for (var key in _body) {
if (isNull(arguments[key])) {
structDelete(_body, key);
}
}

return this.httpService(argumentCollection = {
message: 'querying the database',
method: 'POST',
url: '/databases/#arguments.database_id#/query',
body: {
page_size: arguments.page_size
}
filter_properties: arguments.filter_properties,
body: _body
});
}
}

0 comments on commit 64f95b5

Please sign in to comment.