An open API service indexing awesome lists of open source software.

https://github.com/progzone122/aur-wrapper

A simple wrapper for RPC API and RSS for AUR (Arch User Repository)
https://github.com/progzone122/aur-wrapper

api arch aur javascript packages rpc rss typescript wrapper

Last synced: about 2 months ago
JSON representation

A simple wrapper for RPC API and RSS for AUR (Arch User Repository)

Awesome Lists containing this project

README

          

# AUR TypeScript Wrapper
A simple wrapper for RPC API and RSS for AUR (Arch User Repository)
## Install
```shell
npm install aur-wrapper
```
## Example using
```ts
import AurWebWrapper from "aur-wrapper";

let wrapper: AurWebWrapper = new AurWebWrapper({
proxy: true
});

wrapper.rpc.getPackageInfo("warp-gui").then((info) => {
if (info.success) {
console.log(info);
} else {
console.error(info)
}
})

wrapper.rss.getLatestPackages().then((packages) => {
if (packages.success) {
console.log(packages.data);
} else {
console.error(packages.error);
}
})

wrapper.rpc.getPackagesInfo(["warp-gui", "mixerdialog"]).then((info) => {
if (info.success) {
console.log(info);
} else {
console.error(info)
}
})

wrapper.rpc.search("warp").then(result => {
if (result.success) {
console.log(result.data.results.slice(0, 2));
}
});
```

## Configuration
Configure the wrapper instance before using it.

| Argument | Description | Type | Default |
|----------|--------------------------------------------------------------------------------|---------|---------------------------|
| baseUrl | Domain for all requests to AUR | string | https://aur.archlinux.org |
| proxy | Proxies all requests through the [corsproxy.io](https://corsproxy.io) service | boolean | false |

### Server-side
If you are using the library on the server side, no configuration is required.
```ts
let wrapper: AurWebWrapper = new AurWebWrapper({});
```

### Client-side
If you want to send requests on the client side and bypass CORS. Configure the use of proxy.
```ts
let wrapper: AurWebWrapper = new AurWebWrapper({
proxy: true
});
```