forked from Qortal/qortal
Added new search features to the SEARCH_QDN_RESOURCES action.
Existing action renamed to LIST_QDN_RESOURCES, which is an alternative for listing QDN resources without using a search query.
This commit is contained in:
parent
5656100197
commit
469c1af0ef
28
Q-Apps.md
28
Q-Apps.md
@ -138,6 +138,7 @@ Here is a list of currently supported actions:
|
|||||||
- GET_ACCOUNT_DATA
|
- GET_ACCOUNT_DATA
|
||||||
- GET_ACCOUNT_NAMES
|
- GET_ACCOUNT_NAMES
|
||||||
- GET_NAME_DATA
|
- GET_NAME_DATA
|
||||||
|
- LIST_QDN_RESOURCES
|
||||||
- SEARCH_QDN_RESOURCES
|
- SEARCH_QDN_RESOURCES
|
||||||
- GET_QDN_RESOURCE_STATUS
|
- GET_QDN_RESOURCE_STATUS
|
||||||
- FETCH_QDN_RESOURCE
|
- FETCH_QDN_RESOURCE
|
||||||
@ -209,16 +210,33 @@ let res = await qortalRequest({
|
|||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### List QDN resources
|
||||||
|
```
|
||||||
|
let res = await qortalRequest({
|
||||||
|
action: "LIST_QDN_RESOURCES",
|
||||||
|
service: "THUMBNAIL",
|
||||||
|
identifier: "qortal_avatar", // Optional
|
||||||
|
default: true, // Optional
|
||||||
|
includeStatus: false, // Optional - will take time to respond, so only request if necessary
|
||||||
|
includeMetadata: false, // Optional - will take time to respond, so only request if necessary
|
||||||
|
limit: 100,
|
||||||
|
offset: 0,
|
||||||
|
reverse: true
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
### Search QDN resources
|
### Search QDN resources
|
||||||
```
|
```
|
||||||
let res = await qortalRequest({
|
let res = await qortalRequest({
|
||||||
action: "SEARCH_QDN_RESOURCES",
|
action: "SEARCH_QDN_RESOURCES",
|
||||||
service: "THUMBNAIL",
|
service: "THUMBNAIL",
|
||||||
identifier: "qortal_avatar", // Optional
|
query: "search query goes here", // Optional - searches both "identifier" and "name" fields
|
||||||
default: true, // Optional
|
identifier: "search query goes here", // Optional - searches only the "identifier" field
|
||||||
nameListFilter: "FollowedNames", // Optional
|
name: "search query goes here", // Optional - searches only the "name" field
|
||||||
includeStatus: false,
|
prefix: false, // Optional - if true, only the beginning of fields are matched in all of the above filters
|
||||||
includeMetadata: false,
|
default: false, // Optional - if true, only resources without identifiers are returned
|
||||||
|
includeStatus: false, // Optional - will take time to respond, so only request if necessary
|
||||||
|
includeMetadata: false, // Optional - will take time to respond, so only request if necessary
|
||||||
limit: 100,
|
limit: 100,
|
||||||
offset: 0,
|
offset: 0,
|
||||||
reverse: true
|
reverse: true
|
||||||
|
@ -155,12 +155,27 @@ window.addEventListener("message", (event) => {
|
|||||||
window.location = buildResourceUrl(data.service, data.name, data.identifier, data.path);
|
window.location = buildResourceUrl(data.service, data.name, data.identifier, data.path);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "SEARCH_QDN_RESOURCES":
|
case "LIST_QDN_RESOURCES":
|
||||||
url = "/arbitrary/resources?";
|
url = "/arbitrary/resources?";
|
||||||
if (data.service != null) url = url.concat("&service=" + data.service);
|
if (data.service != null) url = url.concat("&service=" + data.service);
|
||||||
if (data.identifier != null) url = url.concat("&identifier=" + data.identifier);
|
if (data.identifier != null) url = url.concat("&identifier=" + data.identifier);
|
||||||
if (data.default != null) url = url.concat("&default=" + data.default);
|
if (data.default != null) url = url.concat("&default=" + new Boolean(data.default).toString());
|
||||||
if (data.nameListFilter != null) url = url.concat("&namefilter=" + data.nameListFilter);
|
if (data.includeStatus != null) url = url.concat("&includestatus=" + new Boolean(data.includeStatus).toString());
|
||||||
|
if (data.includeMetadata != null) url = url.concat("&includemetadata=" + new Boolean(data.includeMetadata).toString());
|
||||||
|
if (data.limit != null) url = url.concat("&limit=" + data.limit);
|
||||||
|
if (data.offset != null) url = url.concat("&offset=" + data.offset);
|
||||||
|
if (data.reverse != null) url = url.concat("&reverse=" + new Boolean(data.reverse).toString());
|
||||||
|
response = httpGet(url);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "SEARCH_QDN_RESOURCES":
|
||||||
|
url = "/arbitrary/resources/search?";
|
||||||
|
if (data.service != null) url = url.concat("&service=" + data.service);
|
||||||
|
if (data.query != null) url = url.concat("&query=" + data.query);
|
||||||
|
if (data.identifier != null) url = url.concat("&identifier=" + data.identifier);
|
||||||
|
if (data.name != null) url = url.concat("&name=" + data.name);
|
||||||
|
if (data.prefix != null) url = url.concat("&prefix=" + new Boolean(data.prefix).toString());
|
||||||
|
if (data.default != null) url = url.concat("&default=" + new Boolean(data.default).toString());
|
||||||
if (data.includeStatus != null) url = url.concat("&includestatus=" + new Boolean(data.includeStatus).toString());
|
if (data.includeStatus != null) url = url.concat("&includestatus=" + new Boolean(data.includeStatus).toString());
|
||||||
if (data.includeMetadata != null) url = url.concat("&includemetadata=" + new Boolean(data.includeMetadata).toString());
|
if (data.includeMetadata != null) url = url.concat("&includemetadata=" + new Boolean(data.includeMetadata).toString());
|
||||||
if (data.limit != null) url = url.concat("&limit=" + data.limit);
|
if (data.limit != null) url = url.concat("&limit=" + data.limit);
|
||||||
|
Loading…
Reference in New Issue
Block a user