diff options
author | Chocobozzz <me@florianbigard.com> | 2020-06-10 15:18:15 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-06-10 15:18:15 +0200 |
commit | ad031145a9385871870a40419bbfda9aed1d5b6b (patch) | |
tree | 5d2ea9a59e365f40ab855d050c5bb8dea2e9b7c2 /support/doc/api | |
parent | 3521ab8fc01da85fa804439ca6e297e6fb364c58 (diff) | |
download | PeerTube-ad031145a9385871870a40419bbfda9aed1d5b6b.tar.gz PeerTube-ad031145a9385871870a40419bbfda9aed1d5b6b.tar.zst PeerTube-ad031145a9385871870a40419bbfda9aed1d5b6b.zip |
Add rest api doc for index search
Diffstat (limited to 'support/doc/api')
-rw-r--r-- | support/doc/api/openapi.yaml | 99 |
1 files changed, 97 insertions, 2 deletions
diff --git a/support/doc/api/openapi.yaml b/support/doc/api/openapi.yaml index 4ba950a9d..501187d8f 100644 --- a/support/doc/api/openapi.yaml +++ b/support/doc/api/openapi.yaml | |||
@@ -71,10 +71,13 @@ tags: | |||
71 | Operations dealing with listing, uploading, fetching or modifying videos. | 71 | Operations dealing with listing, uploading, fetching or modifying videos. |
72 | - name: Search | 72 | - name: Search |
73 | description: | | 73 | description: | |
74 | The search helps to find _videos_ from within the instance and beyond. | 74 | The search helps to find _videos_ or _channels_ from within the instance and beyond. |
75 | Videos from other instances federated by the instance (that is, instances | 75 | Videos from other instances federated by the instance (that is, instances |
76 | followed by the instance) can be found via keywords and other criteria of | 76 | followed by the instance) can be found via keywords and other criteria of |
77 | the advanced search. | 77 | the advanced search. |
78 | |||
79 | Administrators can also enable the use of a remote search system, indexing | ||
80 | videos and channels not could be not federated by the instance. | ||
78 | - name: Video Comments | 81 | - name: Video Comments |
79 | description: > | 82 | description: > |
80 | Operations dealing with comments to a video. Comments are organized in | 83 | Operations dealing with comments to a video. Comments are organized in |
@@ -1973,13 +1976,57 @@ paths: | |||
1973 | - $ref: '#/components/parameters/skipCount' | 1976 | - $ref: '#/components/parameters/skipCount' |
1974 | - $ref: '#/components/parameters/start' | 1977 | - $ref: '#/components/parameters/start' |
1975 | - $ref: '#/components/parameters/count' | 1978 | - $ref: '#/components/parameters/count' |
1979 | - $ref: '#/components/parameters/searchTarget' | ||
1976 | - $ref: '#/components/parameters/videosSearchSort' | 1980 | - $ref: '#/components/parameters/videosSearchSort' |
1977 | - name: search | 1981 | - name: search |
1978 | in: query | 1982 | in: query |
1979 | required: true | 1983 | required: true |
1980 | description: String to search | 1984 | description: > |
1985 | String to search. If the user can make a remote URI search, and the string is an URI then the | ||
1986 | PeerTube instance will fetch the remote object and add it to its database. Then, | ||
1987 | you can use the REST API to fetch the complete video information and interact with it. | ||
1988 | schema: | ||
1989 | type: string | ||
1990 | - name: startDate | ||
1991 | in: query | ||
1992 | required: true | ||
1993 | description: Get videos that are published after this date | ||
1994 | schema: | ||
1995 | type: string | ||
1996 | format: date-time | ||
1997 | - name: endDate | ||
1998 | in: query | ||
1999 | required: true | ||
2000 | description: Get videos that are published before this date | ||
1981 | schema: | 2001 | schema: |
1982 | type: string | 2002 | type: string |
2003 | format: date-time | ||
2004 | - name: originallyPublishedStartDate | ||
2005 | in: query | ||
2006 | required: true | ||
2007 | description: Get videos that are originally published after this date | ||
2008 | schema: | ||
2009 | type: string | ||
2010 | format: date-time | ||
2011 | - name: originallyPublishedEndDate | ||
2012 | in: query | ||
2013 | required: true | ||
2014 | description: Get videos that are originally published before this date | ||
2015 | schema: | ||
2016 | type: string | ||
2017 | format: date-time | ||
2018 | - name: durationMin | ||
2019 | in: query | ||
2020 | required: true | ||
2021 | description: Get videos that have this minimum duration | ||
2022 | schema: | ||
2023 | type: number | ||
2024 | - name: durationMax | ||
2025 | in: query | ||
2026 | required: true | ||
2027 | description: Get videos that have this maximum duration | ||
2028 | schema: | ||
2029 | type: number | ||
1983 | responses: | 2030 | responses: |
1984 | '200': | 2031 | '200': |
1985 | description: successful operation | 2032 | description: successful operation |
@@ -1987,6 +2034,34 @@ paths: | |||
1987 | application/json: | 2034 | application/json: |
1988 | schema: | 2035 | schema: |
1989 | $ref: '#/components/schemas/VideoListResponse' | 2036 | $ref: '#/components/schemas/VideoListResponse' |
2037 | /search/video-channels: | ||
2038 | get: | ||
2039 | tags: | ||
2040 | - Search | ||
2041 | summary: Search channels | ||
2042 | parameters: | ||
2043 | - $ref: '#/components/parameters/start' | ||
2044 | - $ref: '#/components/parameters/count' | ||
2045 | - $ref: '#/components/parameters/searchTarget' | ||
2046 | - $ref: '#/components/parameters/sort' | ||
2047 | - name: search | ||
2048 | in: query | ||
2049 | required: true | ||
2050 | description: > | ||
2051 | String to search. If the user can make a remote URI search, and the string is an URI then the | ||
2052 | PeerTube instance will fetch the remote object and add it to its database. Then, | ||
2053 | you can use the REST API to fetch the complete channel information and interact with it. | ||
2054 | schema: | ||
2055 | type: string | ||
2056 | responses: | ||
2057 | '200': | ||
2058 | description: successful operation | ||
2059 | content: | ||
2060 | application/json: | ||
2061 | schema: | ||
2062 | type: array | ||
2063 | items: | ||
2064 | $ref: '#/components/schemas/VideoChannel' | ||
1990 | servers: | 2065 | servers: |
1991 | - url: 'https://peertube.cpy.re/api/v1' | 2066 | - url: 'https://peertube.cpy.re/api/v1' |
1992 | description: Live Test Server (live data - stable version) | 2067 | description: Live Test Server (live data - stable version) |
@@ -2017,6 +2092,26 @@ components: | |||
2017 | description: Sort column (-createdAt for example) | 2092 | description: Sort column (-createdAt for example) |
2018 | schema: | 2093 | schema: |
2019 | type: string | 2094 | type: string |
2095 | searchTarget: | ||
2096 | name: searchTarget | ||
2097 | in: query | ||
2098 | required: false | ||
2099 | description: > | ||
2100 | If the administrator enabled search index support, you can override the default search target. | ||
2101 | |||
2102 | |||
2103 | **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. | ||
2104 | It means the instance may not know the objects you fetched. If you want to load video/channel information: | ||
2105 | * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), | ||
2106 | then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. | ||
2107 | After that, you can use the classic REST API endpoints to fetch the complete object or interact with it | ||
2108 | * If the current user has not the ability to make a remote URI search, then redirect the user on the origin instance or fetch | ||
2109 | the data from the origin instance API | ||
2110 | schema: | ||
2111 | type: string | ||
2112 | enum: | ||
2113 | - 'local' | ||
2114 | - 'search-index' | ||
2020 | videosSort: | 2115 | videosSort: |
2021 | name: sort | 2116 | name: sort |
2022 | in: query | 2117 | in: query |