-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdoc.go
More file actions
74 lines (74 loc) · 2.65 KB
/
doc.go
File metadata and controls
74 lines (74 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Package verniy is unofficial Anilist GraphQL API library.
//
// Verniy will generate graphql query string according to your request,
// make request to Anilist, parse response body, and convert it
// to struct. The goal of this library is to make a flexible and easy to
// call Anilist API.
//
// // Init verniy.
// v := verniy.New()
//
// // Get anime One Piece data (with default fields).
// data, err := v.GetAnime(21)
//
// // Get anime One Piece data (with custom fields).
// data, err := v.GetAnime(21,
// verniy.MediaFieldID,
// verniy.MediaFieldTitle(
// verniy.MediaTitleFieldRomaji,
// verniy.MediaTitleFieldEnglish,
// verniy.MediaTitleFieldNative),
// verniy.MediaFieldType,
// verniy.MediaFieldFormat,
// verniy.MediaFieldStatusV2,
// verniy.MediaFieldDescription,
// verniy.MediaFieldStartDate,
// verniy.MediaFieldEndDate,
// verniy.MediaFieldSeason,
// verniy.MediaFieldSeasonYear)
//
// # Functions
//
// There are alot of functions in verniy package but
// most of the time, you just need functions in `Client` struct.
// And it's recommended to use them to make your life easier.
// If you want to make a custom request, you can use function
// `MakeRequest()` (go to the function for more details).
//
// # Parameters
//
// Yes, there are tons of custom types and functions but let
// your IDE auto-complete helps you choose the params for the
// functions. Not only constant value but also function (like
// `MediaFieldTitle` in the example) to fill the params.
// But, most of the functions have variadic parameters,
// so you don't need to actually fill it. There is already default
// value and you can read the code yourself to see the default
// value of the variadic parameters.
//
// If you want the complete list of available params,
// read the official docs (https://studio.apollographql.com/sandbox/explorer?endpoint=https%3A%2F%2Fgraphql.anilist.co).
//
// # Response
//
// Most of the functions in `Client` struct return a struct and error.
// Yes, most of the fields in the returned struct are pointers because,
// like any graphql, Anilist will not return fields that we didn't
// request. It is recommended to make your own pointer handler when
// using the field. For example.
//
// // Handle *string to string.
// func ptrToString(str *string) string {
// if str == nil {
// return ""
// }
// return *str
// }
//
// # Rate Limit
//
// Anilist has default rate limit 90 requests per minute. If you go over
// the rate limit you'll receive a 1-minute timeout. But, verniy has
// a built-in rate limiter to prevent the requests going over the limit.
// It will put your request on hold until the limit is available again.
package verniy