aboutsummaryrefslogtreecommitdiff
path: root/user/README.md
diff options
context:
space:
mode:
authorVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-20 19:50:18 +0530
committerVidhu Kant Sharma <vidhukant@protonmail.ch>2022-02-20 19:50:18 +0530
commit3f391a16dcc5ff87427058320ae4f29920e34f2a (patch)
tree5627718a9476333a1dfa5a44ed4d2eb2de210b95 /user/README.md
parented6b859a8c5df2decaf888111e2cead7aaf2a2eb (diff)
Fully documented user package
Diffstat (limited to 'user/README.md')
-rw-r--r--user/README.md48
1 files changed, 48 insertions, 0 deletions
diff --git a/user/README.md b/user/README.md
new file mode 100644
index 0000000..503f4da
--- /dev/null
+++ b/user/README.md
@@ -0,0 +1,48 @@
+# MAL2Go/user
+MAL2Go `user` package has functionality related to getting data about the authenticated user.
+
+## Usage
+Firstly, import this package and instanciate the client.
+``` go
+import (
+ "github.com/MikunoNaka/MAL2Go/user"
+)
+```
+
+Now instanciate with
+``` go
+myClient := user.Client {
+ AuthToken: "Bearer " + yourTokenHere,
+}
+```
+
+- ### Get authenticated user's info
+``` go
+userData := myClient.GetSelfUserInfo()
+
+fmt.Println(userData.Name, userData.Picture)
+```
+
+The `User` datatype has the following fields:
+- `Id` `int`
+- `Name` `string`
+- `Picture` `string`
+- `Gender` `string`
+- `Birthday` `string`
+- `Location` `string`
+- `JoinedAt` `string`
+- `TimeZone` `string`
+- `IsSupporter` `bool`
+
+## Structure
+- [user.go](user.go)
+Contains all the exported functions for pulling data from the API.
+
+- [user.structs.go](user.structs.go)
+Represents the user data returned by the API
+
+- [client.go](client.go)
+The Client for accessing the API with this package.
+
+- [request_handler.go](request_handler.go)
+Responsible for making HTTP requests