Last active
September 13, 2022 06:05
-
-
Save moson-mo/c268abcf800151e7ffeb4a244a310fda to your computer and use it in GitHub Desktop.
OpenAPI v3 spec proposal for AUR /api (v6)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WIP: Proposal for the v6 REST-API or aurweb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openapi: 3.0.1 | |
info: | |
title: AUR /api | |
description: AUR Metadata API - !Proposal! | |
version: '6.0' | |
servers: | |
- url: https://server.moson.rocks | |
paths: | |
/api/v6/search/{term}: | |
get: | |
tags: | |
- Searching | |
description: >- | |
Search for packages with a single term returning basic package | |
information | |
summary: Single-term search | |
parameters: | |
- name: term | |
in: path | |
schema: | |
type: string | |
required: true | |
- name: by | |
in: query | |
schema: | |
$ref: '#/components/schemas/SearchBy' | |
responses: | |
'200': | |
description: Search result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/SearchResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
/api/v6/search: | |
get: | |
tags: | |
- Searching | |
description: >- | |
Search for packages with multiple terms returning basic package | |
information | |
summary: Multi-term search | |
parameters: | |
- name: terms | |
required: true | |
in: query | |
schema: | |
type: array | |
items: | |
type: string | |
- name: by | |
in: query | |
schema: | |
$ref: '#/components/schemas/SearchBy' | |
responses: | |
'200': | |
description: Search result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/SearchResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
post: | |
tags: | |
- Searching | |
description: >- | |
Search for packages with multiple terms returning basic package | |
information | |
summary: Multi-term search | |
requestBody: | |
content: | |
application/x-www-form-urlencoded: | |
schema: | |
type: object | |
properties: | |
terms: | |
type: array | |
items: | |
type: string | |
required: | |
- terms | |
encoding: | |
terms: | |
style: form | |
explode: true | |
parameters: | |
- name: by | |
in: query | |
schema: | |
$ref: '#/components/schemas/SearchBy' | |
responses: | |
'200': | |
description: Search result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/SearchResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
/api/v6/search-info/{term}: | |
get: | |
tags: | |
- Searching | |
description: >- | |
Search for packages with a single term returning extended package | |
information | |
summary: Single-term search with extended info | |
parameters: | |
- name: term | |
in: path | |
schema: | |
type: string | |
required: true | |
- name: by | |
in: query | |
schema: | |
$ref: '#/components/schemas/SearchBy' | |
responses: | |
'200': | |
description: Search result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/SearchInfoResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
/api/v6/search-info: | |
get: | |
tags: | |
- Searching | |
description: >- | |
Search for packages with multiple terms returning basic package | |
information | |
summary: Multi-term search with extended info | |
parameters: | |
- name: terms | |
required: true | |
in: query | |
schema: | |
type: array | |
items: | |
type: string | |
- name: by | |
in: query | |
schema: | |
$ref: '#/components/schemas/SearchBy' | |
responses: | |
'200': | |
description: Search result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/SearchInfoResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
post: | |
tags: | |
- Searching | |
description: >- | |
Search for packages with multiple terms returning basic package | |
information | |
summary: Multi-term search with extended info | |
requestBody: | |
content: | |
application/x-www-form-urlencoded: | |
schema: | |
type: object | |
properties: | |
terms: | |
type: array | |
items: | |
type: string | |
required: | |
- terms | |
encoding: | |
terms: | |
style: form | |
explode: true | |
parameters: | |
- name: by | |
in: query | |
schema: | |
$ref: '#/components/schemas/SearchBy' | |
responses: | |
'200': | |
description: Search result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/SearchInfoResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
/api/v6/info/{pkgname}: | |
get: | |
tags: | |
- Package data | |
description: Get extended package information for a single package | |
summary: Single package lookup | |
parameters: | |
- name: pkgname | |
in: path | |
schema: | |
type: string | |
required: true | |
responses: | |
'200': | |
description: Info result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/InfoResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
/api/v6/info: | |
get: | |
tags: | |
- Package data | |
description: Get extended package information for multiple packages | |
summary: Multiple package lookup | |
parameters: | |
- name: packages | |
in: query | |
schema: | |
type: array | |
items: | |
type: string | |
required: true | |
responses: | |
'200': | |
description: Info result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/InfoResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
post: | |
tags: | |
- Package data | |
description: Get extended package information for multiple packages | |
summary: Multiple package lookup | |
requestBody: | |
content: | |
application/x-www-form-urlencoded: | |
schema: | |
type: object | |
properties: | |
packages: | |
type: array | |
items: | |
type: string | |
required: | |
- packages | |
encoding: | |
packages: | |
style: form | |
explode: true | |
responses: | |
'200': | |
description: Info result | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/InfoResult' | |
default: | |
description: Error response | |
content: | |
application/json: | |
schema: | |
$ref: '#/components/schemas/ErrorResult' | |
/api/v6/suggest/{term}: | |
get: | |
tags: | |
- Searching | |
description: Get list of package-names starting with {term} | |
summary: Package name search (starts-with) | |
parameters: | |
- name: term | |
in: path | |
schema: | |
type: string | |
required: true | |
responses: | |
'200': | |
description: Suggest results | |
content: | |
text/plain: | |
schema: | |
type: string | |
/api/v6/suggest: | |
get: | |
tags: | |
- Searching | |
description: Get list of package-names starting with {term} | |
summary: Package name search (starts-with) | |
parameters: | |
- name: term | |
in: query | |
schema: | |
type: string | |
required: true | |
responses: | |
'200': | |
description: Suggest results | |
content: | |
text/plain: | |
schema: | |
type: string | |
components: | |
schemas: | |
SearchResult: | |
description: >- | |
SearchResult contains a list of basic information for packages matching | |
the search-term(s) | |
type: object | |
allOf: | |
- $ref: '#/components/schemas/BaseResult' | |
- properties: | |
results: | |
type: array | |
items: | |
allOf: | |
- $ref: '#/components/schemas/PackageBasic' | |
- type: object | |
properties: | |
term: | |
type: string | |
SearchInfoResult: | |
description: >- | |
SearchInfoResult contains a list of extended information for packages | |
matching the search-term(s) | |
type: object | |
allOf: | |
- $ref: '#/components/schemas/BaseResult' | |
- properties: | |
results: | |
type: array | |
items: | |
allOf: | |
- $ref: '#/components/schemas/PackageExtended' | |
- type: object | |
properties: | |
term: | |
type: string | |
SearchBy: | |
description: >- | |
List of package properties that can be used for searching. Note that for | |
"name" and "name-desc" it will perform a "contains" search. Other | |
options require the exact package-name or keyword | |
type: string | |
enum: | |
- name | |
- name-desc | |
- depends | |
- checkdepends | |
- optdepends | |
- makedepends | |
- maintainer | |
- provides | |
- conflicts | |
- keywords | |
- groups | |
InfoResult: | |
description: >- | |
InfoResult contains a list of extended package information for packages | |
matching any of the provided "pkgname" values | |
type: object | |
allOf: | |
- $ref: '#/components/schemas/BaseResult' | |
- properties: | |
results: | |
type: array | |
items: | |
$ref: '#/components/schemas/PackageExtended' | |
PackageExtended: | |
description: Detailed package information | |
type: object | |
allOf: | |
- $ref: '#/components/schemas/PackageBasic' | |
- properties: | |
License: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `license` | |
Depends: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `depends` | |
MakeDepends: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `makedepends` | |
OptDepends: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `optdepends` | |
CheckDepends: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `checkdepends` | |
Provides: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `provides` | |
Conflicts: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `conflicts` | |
Replaces: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `replaces` | |
Groups: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `groups` | |
Keywords: | |
type: array | |
items: | |
type: string | |
description: From PKGBUILD `keywords` | |
PackageBasic: | |
description: Basic package information | |
type: object | |
properties: | |
Name: | |
type: string | |
description: From PKGBUILD `pkgname` | |
Description: | |
type: string | |
description: From PKGBUILD `pkgdesc` | |
PackageBaseID: | |
type: integer | |
PackageBase: | |
type: string | |
Maintainer: | |
type: string | |
NumVotes: | |
type: integer | |
Popularity: | |
type: number | |
FirstSubmitted: | |
type: integer | |
description: UNIX timestamp | |
LastModified: | |
type: integer | |
description: UNIX timestamp | |
OutOfDate: | |
type: string | |
description: UNIX timestamp, or null if not flagged | |
Version: | |
type: string | |
description: From PKGBUILD `pkgver`-`pkgrel` | |
URLPath: | |
type: string | |
description: Path to gzipped snapshot | |
URL: | |
type: string | |
description: From PKGBUILD `url` | |
ErrorResult: | |
type: object | |
allOf: | |
- $ref: '#/components/schemas/BaseResult' | |
- properties: | |
error: | |
type: string | |
description: Error message | |
results: | |
type: array | |
items: | |
type: object | |
BaseResult: | |
properties: | |
resultcount: | |
type: integer | |
description: Number of search results | |
type: | |
type: string | |
description: Type of API call | |
version: | |
type: integer | |
description: API Version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment