Files
discoursejs/docs/sdks/search/README.md

26 KiB
Raw Blame History

Search

(search)

Available Operations

search

Search for a term

Example Usage

import { SDK } from "@lukehagar/discoursejs";
import { SearchRequest } from "@lukehagar/discoursejs/dist/sdk/models/operations";

async function run() {
  const sdk = new SDK();
const page: number = 307631;
const q: string = "string";

  const res = await sdk.search.search(page, q);

  if (res.statusCode == 200) {
    // handle response
  }
}

run();

Parameters

Parameter Type Required Description
page number N/A
q string The query string needs to be url encoded and is made up of the following options:
- Search term. This is just a string. Usually it would be the first item in the query.
- @<username>: Use the @ followed by the username to specify posts by this user.
- #<category>: Use the # followed by the category slug to search within this category.
- tags:: api,solved or for posts that have all the specified tags api+solved.
- before:: yyyy-mm-dd
- after:: yyyy-mm-dd
- order:: latest, likes, views, latest_topic
- assigned:: username (without @)
- in:: title, likes, personal, messages, seen, unseen, posted, created, watching, tracking, bookmarks, assigned, unassigned, first, pinned, wiki
- with:: images
- status:: open, closed, public, archived, noreplies, single_user, solved, unsolved
- group:: group_name or group_id
- group_messages:: group_name or group_id
- min_posts:: 1
- max_posts:: 10
- min_views:: 1
- max_views:: 10

If you are using cURL you can use the -G and the --data-urlencode flags to encode the query:

<br/>curl -i -sS -X GET -G "http://localhost:4200/search.json" \<br/>--data-urlencode 'q=wordpress @scossar #fun after:2020-01-01'<br/>
config AxiosRequestConfig Available config options for making requests.

Response

Promise<operations.SearchResponse>

Errors

Error Object Status Code Content Type
errors.SDKError 4xx-5xx /