-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3b4cf30
commit a0acf0e
Showing
37 changed files
with
615 additions
and
1,362 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<p align="center"> <img src="https://alpha-coders.js.org/svg/Alpha%20Coders.svg" alt="Cover" height="200px" width="600px"> </p> | ||
|
||
# About | ||
A complete package used to interact with the [Wallpaper Abyss / The Alpha Coders API](https://api.alphacoders.com/api/instructions) to get wallpapers, wallpaper count, collections, and much more ! | ||
A complete package used to interact with the [Wallpaper Abyss / The Alpha Coders API](https://api.alphacoders.com/api/instructions) to get wallpapers, wallpaper count, and much more ! | ||
|
||
You will need an API key which can obtained from [The Alpha Coders API](https://api.alphacoders.com/api/instructions) to use this package. | ||
|
||
|
@@ -10,11 +10,6 @@ You will need an API key which can obtained from [The Alpha Coders API](https:// | |
npm i alpha-coders | ||
``` | ||
|
||
<!-- ### NOTE: | ||
If you would like to use the v2 of the Alpha Coders API, kindly install the package using `npm i [email protected]` | ||
The default installation of the package uses the v3 of the Alpha Coders API. --> | ||
|
||
# Features | ||
- Made with JavaScript. | ||
- Easy to use. | ||
|
@@ -33,32 +28,17 @@ The default installation of the package uses the v3 of the Alpha Coders API. --> | |
**M** - Method | ||
|
||
- [Alpha](https://biologyscience.gitbook.io/alpha-coders/reference/classes/alpha) **C** | ||
- [getWallpapers](https://biologyscience.gitbook.io/alpha-coders/reference/properties/getwallpapers) **P** | ||
- [getSpecificWallpapers](https://biologyscience.gitbook.io/alpha-coders/reference/properties/getspecificwallpapers) **P** | ||
- [bySort](https://biologyscience.gitbook.io/alpha-coders/reference/methods/bysort) **M** | ||
- [fromCategory](https://biologyscience.gitbook.io/alpha-coders/reference/methods/fromcategory) **M** | ||
- [fromCollection](https://biologyscience.gitbook.io/alpha-coders/reference/methods/fromcollection) **M** | ||
- [fromGroup](https://biologyscience.gitbook.io/alpha-coders/reference/methods/fromgroup) **M** | ||
- [fromSubCategory](https://biologyscience.gitbook.io/alpha-coders/reference/methods/fromsubcategory) **M** | ||
- [fromFeatured](https://biologyscience.gitbook.io/alpha-coders/reference/methods/fromfeatured) **M** | ||
- [fromPopular](https://biologyscience.gitbook.io/alpha-coders/reference/methods/frompopular) **M** | ||
- [fromTag](https://biologyscience.gitbook.io/alpha-coders/reference/methods/fromtag) **M** | ||
- [fromUser](https://biologyscience.gitbook.io/alpha-coders/reference/methods/fromuser) **M** | ||
- [getWallpaperCount](https://biologyscience.gitbook.io/alpha-coders/reference/properties/getwallpapercount) **P** | ||
- [inEntireDB](https://biologyscience.gitbook.io/alpha-coders/reference/methods/inentiredb) **M** | ||
- [inCategory](https://biologyscience.gitbook.io/alpha-coders/reference/methods/incategory) **M** | ||
- [inCollection](https://biologyscience.gitbook.io/alpha-coders/reference/methods/incollection) **M** | ||
- [inGroup](https://biologyscience.gitbook.io/alpha-coders/reference/methods/ingroup) **M** | ||
- [inSubCategory](https://biologyscience.gitbook.io/alpha-coders/reference/methods/insubcategory) **M** | ||
- [inTag](https://biologyscience.gitbook.io/alpha-coders/reference/methods/intag) **M** | ||
- [inUser](https://biologyscience.gitbook.io/alpha-coders/reference/methods/inuser) **M** | ||
- [getList](https://biologyscience.gitbook.io/alpha-coders/reference/properties/getlist) **P** | ||
- [ofCategory](https://biologyscience.gitbook.io/alpha-coders/reference/methods/ofcategory) **M** | ||
- [ofCollection](https://biologyscience.gitbook.io/alpha-coders/reference/methods/ofcollection) **M** | ||
- [ofGroup](https://biologyscience.gitbook.io/alpha-coders/reference/methods/ofgroup) **M** | ||
- [ofSubCategory](https://biologyscience.gitbook.io/alpha-coders/reference/methods/ofsubcategory) **M** | ||
- [search](https://biologyscience.gitbook.io/alpha-coders/reference/methods/search) **M** | ||
- [getWallpaperInfo](https://biologyscience.gitbook.io/alpha-coders/reference/methods/getwallpaperinfo) **M** | ||
- [getRandomWallpaper](https://biologyscience.gitbook.io/alpha-coders/reference/methods/getrandomwallpaper) **M** | ||
- [getWallpaper](https://biologyscience.gitbook.io/alpha-coders/reference/methods/getwallpaper) **M** | ||
- [getRandomWallpapers](https://biologyscience.gitbook.io/alpha-coders/reference/methods/getrandomwallpapers) **M** | ||
- [queryCount](https://biologyscience.gitbook.io/alpha-coders/reference/methods/querycount) **M** | ||
|
||
<br> | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,25 @@ | ||
const Others = require('./methods/others'); | ||
|
||
class Alpha | ||
{ | ||
baseURL = new URL('https://wall.alphacoders.com/api2.0/get.php'); | ||
baseURL = new URL('https://api.alphacoders.com/3.0'); | ||
|
||
constructor(apiToken) | ||
{ | ||
this.apiToken = apiToken; | ||
this.baseURL.searchParams.set('auth', this.apiToken); | ||
} | ||
if (apiToken === undefined) throw new Error('API Key is not provided !'); | ||
|
||
getWallpapers = | ||
{ | ||
baseURL: this.baseURL, | ||
bySort: require('./methods/getWallpapers/bySort'), | ||
fromCategory: require('./methods/getWallpapers/fromCategory'), | ||
fromCollection: require('./methods/getWallpapers/fromCollection'), | ||
fromGroup: require('./methods/getWallpapers/fromGroup'), | ||
fromSubCategory: require('./methods/getWallpapers/fromSubCategory'), | ||
fromFeatured: require('./methods/getWallpapers/fromFeatured'), | ||
fromPopular: require('./methods/getWallpapers/fromPopular'), | ||
fromTag: require('./methods/getWallpapers/fromTag'), | ||
fromUser: require('./methods/getWallpapers/fromUser') | ||
} | ||
this.baseURL.searchParams.set('auth', apiToken); | ||
|
||
getWallpaperCount = | ||
{ | ||
baseURL: this.baseURL, | ||
inEntireDB: require('./methods/getWallpaperCount/inEntireDB'), | ||
inCategory: require('./methods/getWallpaperCount/inCategory'), | ||
inCollection: require('./methods/getWallpaperCount/inCollection'), | ||
inGroup: require('./methods/getWallpaperCount/inGroup'), | ||
inSubCategory: require('./methods/getWallpaperCount/inSubCategory'), | ||
inFeatured: require('./methods/getWallpaperCount/inFeatured'), | ||
inPopular: require('./methods/getWallpaperCount/inPopular'), | ||
inTag: require('./methods/getWallpaperCount/inTag'), | ||
inUser: require('./methods/getWallpaperCount/inUser') | ||
} | ||
require('./utils').setBaseURL(this.baseURL); | ||
}; | ||
|
||
getList = | ||
{ | ||
baseURL: this.baseURL, | ||
ofCategory: require('./methods/getList/ofCategory'), | ||
ofCollection: require('./methods/getList/ofCollection'), | ||
ofGroup: require('./methods/getList/ofGroup'), | ||
ofSubCategory: require('./methods/getList/ofSubCategory') | ||
} | ||
getSpecificWallpapers = require('./methods/getSpecificWallpapers'); | ||
getList = require('./methods/getList'); | ||
|
||
search = require('./methods/search'); | ||
getWallpaperInfo = require('./methods/getWallpaperInfo'); | ||
getRandomWallpaper = require('./methods/getRandomWallpaper'); | ||
queryCount = require('./methods/queryCount'); | ||
} | ||
search = Others.search; | ||
getWallpaper = Others.getWallpaper; | ||
getRandomWallpapers = Others.getRandomWallpaper; | ||
queryCount = Others.queryCount; | ||
}; | ||
|
||
module.exports = Alpha; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const process = require('../utils'); | ||
|
||
function ofCategory() | ||
{ | ||
const url = process.getBaseURL(); | ||
|
||
url.searchParams.set('method', 'category_list'); | ||
|
||
return new Promise((resolve) => | ||
{ | ||
fetch(url).then(x => x.json()).then((response) => | ||
{ | ||
if (process.response(response) === null) return resolve(null); | ||
|
||
const send = process.data(response.categories, 'LIST'); | ||
|
||
resolve(send); | ||
}); | ||
}); | ||
}; | ||
|
||
function ofSubCategory(id, page) | ||
{ | ||
const url = process.getBaseURL(); | ||
|
||
if (id === undefined) throw new Error('Category ID not provided !'); | ||
|
||
url.searchParams.set('method', 'sub_category_list'); | ||
url.searchParams.set('id', id); | ||
|
||
page !== undefined ? url.searchParams.set('page', page) : null; | ||
|
||
return new Promise((resolve) => | ||
{ | ||
fetch(url).then(x => x.json()).then((response) => | ||
{ | ||
if (process.response(response) === null) return resolve(null); | ||
|
||
const send = process.data(response.sub_categories, 'LIST'); | ||
|
||
resolve(send); | ||
}); | ||
}); | ||
}; | ||
|
||
module.exports = { ofCategory, ofSubCategory }; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.