Skip to content

Commit 4c26417

Browse files
authored
Update README.md
1 parent 75f0451 commit 4c26417

File tree

1 file changed

+72
-3
lines changed

1 file changed

+72
-3
lines changed

README.md

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ This project aims to create a Twitter clone API using GraphQL in PHP8. The API w
1616
Clone the repository:
1717

1818
```bash
19-
git clone https://github.com/your-username/twitter-clone-api.git
20-
cd twitter-clone-api
19+
git clone https://github.com/BaseMax/TwitterGraphQLPHP.git
20+
cd TwitterGraphQLPHP
2121
```
2222

2323
Install dependencies:
@@ -91,9 +91,78 @@ The API comes with a suite of unit tests and integration tests. To run the tests
9191
phpunit
9292
```
9393

94+
## cURL Testing
95+
96+
### Query: user(username: String!): User
97+
98+
```bash
99+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"{ user(username: \"example_user\") { id username name } }"}' YOUR_API_URL
100+
```
101+
102+
### Query: tweet(id: ID!): Tweet
103+
104+
```bash
105+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"{ tweet(id: \"example_tweet_id\") { id text author { id username } } }"}' YOUR_API_URL
106+
```
107+
108+
### Query: timeline(userId: ID!): [Tweet!]!
109+
110+
```bash
111+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"{ timeline(userId: \"example_user_id\") { id text author { id username } } }"}' YOUR_API_URL
112+
```
113+
114+
### Mutation: createUser(input: CreateUserInput!): User
115+
116+
```bash
117+
curl -X POST -H "Content-Type: application/json" -d '{"query":"mutation { createUser(input: { username: \"new_user\", password: \"password123\", name: \"New User\" }) { id username name } }"}' YOUR_API_URL
118+
```
119+
120+
### Mutation: createTweet(input: CreateTweetInput!): Tweet
121+
122+
```bash
123+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"mutation { createTweet(input: { text: \"This is a new tweet!\" }) { id text author { id username } } }"}' YOUR_API_URL
124+
```
125+
126+
### Mutation: followUser(userId: ID!): User
127+
128+
```bash
129+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"mutation { followUser(userId: \"user_to_follow_id\") { id username } }"}' YOUR_API_URL
130+
```
131+
132+
### Mutation: unfollowUser(userId: ID!): User
133+
134+
```bash
135+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"mutation { unfollowUser(userId: \"user_to_unfollow_id\") { id username } }"}' YOUR_API_URL
136+
```
137+
138+
### Mutation: likeTweet(tweetId: ID!): Tweet
139+
140+
```bash
141+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"mutation { likeTweet(tweetId: \"tweet_to_like_id\") { id text author { id username } } }"}' YOUR_API_URL
142+
```
143+
144+
### Mutation: unlikeTweet(tweetId: ID!): Tweet
145+
146+
```bash
147+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"mutation { unlikeTweet(tweetId: \"tweet_to_unlike_id\") { id text author { id username } } }"}' YOUR_API_URL
148+
```
149+
150+
### Mutation: retweet(tweetId: ID!): Tweet
151+
```bash
152+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"mutation { retweet(tweetId: \"tweet_to_retweet_id\") { id text author { id username } } }"}' YOUR_API_URL
153+
```
154+
155+
### Mutation: deleteTweet(tweetId: ID!): Boolean
156+
157+
```bash
158+
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_AUTH_TOKEN" -d '{"query":"mutation { deleteTweet(tweetId: \"tweet_to_delete_id\") }"}' YOUR_API_URL
159+
```
160+
161+
Make sure to replace YOUR_API_URL with the actual URL of your GraphQL API endpoint and YOUR_AUTH_TOKEN with a valid authentication token obtained from the login mutation, if required.
162+
94163
## Documentation
95164

96-
For more information on the API's schema, queries, and mutations, you can access the GraphQL documentation tool at http://localhost:8000/graphql-playground after starting the development server.
165+
For more information on the API's schema, queries, and mutations, you can access the GraphQL documentation tool at `http://localhost:8000/graphql-playground` after starting the development server.
97166

98167
## Contribution
99168

0 commit comments

Comments
 (0)