Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit e912a10

Browse files
author
RayhanADev
committed
Merge remote-tracking branch 'origin/main' into main
2 parents f49a0db + ebd78dc commit e912a10

File tree

1 file changed

+30
-16
lines changed

1 file changed

+30
-16
lines changed

README.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
> ⚠️ **IMPORTANT**: ReplAPI.it is now in version 2.x! Any projects transitioning to 2.x should read through [this](https://github.com/RayhanADev/ReplAPI.it/releases/tag/v2.0.6). ⚠️
2+
13
[![Contributors][contributors-shield]][contributors-url]
24
[![Forks][forks-shield]][forks-url]
35
[![Stargazers][stars-shield]][stars-url]
@@ -60,13 +62,13 @@
6062
<!-- ABOUT THE PROJECT -->
6163
## About The Project
6264

63-
[![Code Screenshot](images/screenshot.jpg)](https://replit.com/@RayhanADev/REPLAPIit-Replit-API-Package)
65+
[![Code Screenshot](images/screenshot.jpg)](https://replit.com/@RayhanADev/ReplAPIit)
6466

6567
The Replit GraphQL API is an extraordinary way to make projects unique and special, yet with the numerous packages available few such projects have been made. Why would that be? Most likely due to how complicated writing code can get and the limitations of their queries. My package, **ReplAPI.it**, changes that with a simple to use structure and many queries, some of which are:
6668

6769
* Queries for Data on Users (such as Profile, Posts, Comments)
6870
* Queries for Data on Posts (such as Upvoters, Content)
69-
* Queries for Data on Notifications (such as Reply Notifications, Achievement Notifications)
71+
* Queries for Data on Repls (such as Files, Comments)
7072
* Mutations for Commenting, Reporting, and Posting
7173
* Queries for Data on Leaderboard (with filters such as cycles since)
7274
* and lots more!
@@ -97,48 +99,60 @@ If you have not already download npm:
9799
```
98100
2. Require the package in your code
99101
```js
100-
const repl = require('replapi-it');
102+
import ReplAPI from 'replapi-it';
103+
```
104+
3. Initilize the package
105+
```js
106+
const replapi = ReplAPI({
107+
username: 'your-username-here'
108+
});
101109
```
102110

103111
## Usage
104112

105113
Using ReplAPI.it is very simple! Let's create a simple user and ask for their cycles:
106114
```js
107-
const repl = require('replapi-it');
108-
109-
const myUser = new repl.User("RayhanADev");
115+
import ReplAPI from 'replapi-it
116+
const replapi = ReplAPI({
117+
username: 'your-username-here'
118+
});
119+
120+
const myUser = new replapi.User("RayhanADev");
110121
111122
async function getCycles() {
112-
let info = await myUser.profileData();
113-
let cycles = info.karma; // Yep, it's karma!
114-
console.log(`User Cycles: ${cycles}`)
123+
let info = await myUser.userGraphQLDataFull();
124+
let cycles = info.karma; // Yep, it's karma!
125+
console.log(`User Cycles: ${cycles}`)
115126
}
116127

117128
getCycles()
118129
```
119130

120131
Output:
121-
```sh
132+
```
122133
User Cycles: 1008
123134
```
124135

125136

126137
That was fun! Now how about getting a specific post? Let's create a simple post and ask for it's title:
127138
```js
128-
const repl = require('replapi-it');
139+
import ReplAPI from 'replapi-it
140+
const replapi = ReplAPI({
141+
username: 'your-username-here'
142+
});
129143
130-
const myPost = new repl.Post(78043);
144+
const myPost = new replapi.Post(78043);
131145
132146
async function getTitle() {
133-
let info = await myPost.postData();
134-
let title = info.title;
135-
console.log(`Post Title: ${title}`)
147+
let info = await myPost.postDataFull();
148+
let title = info.title;
149+
console.log(`Post Title: ${title}`)
136150
}
137151
138152
getTitle()
139153
```
140154
Output:
141-
```sh
155+
```
142156
Post Title: Presenting... 🤔 RayhanADev 🤔? (GraphQL Success!)
143157
```
144158

0 commit comments

Comments
 (0)