ensure LogDate has String() method for converting to string with zero padded y, m, d add/update READMEmaster
parent
5418bc6479
commit
4b5a75477a
4 changed files with 198 additions and 1 deletions
@ -0,0 +1,37 @@ |
||||
# jschan-api-go |
||||
|
||||
API client for jschan imageboard software written in go. |
||||
|
||||
jschan repo: [fatchan/jschan](https://gitgud.io/fatchan/jschan/) |
||||
|
||||
API docs repo: [fatchan/jschan-docs](https://gitgud.io/fatchan/jschan-docs/) ([gitgud pages](http://fatchan.gitgud.site/jschan-docs/#introduction)) |
||||
|
||||
## License |
||||
|
||||
GNU LGPLv3, see [LICENSE](LICENSE). |
||||
|
||||
## Example |
||||
|
||||
```go |
||||
getThreadOptions := &jschan.GetThreadOptions{ |
||||
Board: "t", |
||||
ThreadId: 1392, |
||||
} |
||||
res3, err3 := jschanClient.GetThread(ctx, getThreadOptions) |
||||
if err3 != nil { |
||||
fmt.Println(err3) |
||||
return |
||||
} |
||||
fmt.Printf("Fetched /%s/ thread %d with %d replies\n", getThreadOptions.Board, getThreadOptions.ThreadId, len(res3.Replies)) |
||||
``` |
||||
|
||||
## For generous people |
||||
|
||||
Bitcoin (BTC): |
||||
[`bc1q4elrlz5puak4m9xy3hfvmpempnpqpu95v8s9m6`](bitcoin:bc1q4elrlz5puak4m9xy3hfvmpempnpqpu95v8s9m6) |
||||
|
||||
Monero (XMR): |
||||
[`89J9DXPLUBr5HjNDNZTEo4WYMFTouSsGjUjBnUCCUxJGUirthnii4naZ8JafdnmhPe4NP1nkWsgcK82Uga7X515nNR1isuh`](monero:89J9DXPLUBr5HjNDNZTEo4WYMFTouSsGjUjBnUCCUxJGUirthnii4naZ8JafdnmhPe4NP1nkWsgcK82Uga7X515nNR1isuh) |
||||
|
||||
Oxen (OXEN): |
||||
`LBjExqjDKCFT6Tj198CfK8auAzBERJX1ogtcsjuKZ6AYWTFxwEADLgf2zZ8NHvWCa1UW7vrtY8DJmPYFpj3MEE69CryCvN6` |
@ -0,0 +1,37 @@ |
||||
package models |
||||
|
||||
import ( |
||||
"fmt" |
||||
) |
||||
|
||||
type LogList struct { |
||||
Date LogDate `json:"date"` |
||||
Count int `json:"count"` |
||||
} |
||||
|
||||
type Log struct { |
||||
ID string `json:"_id"` |
||||
ShowLinks bool `json:"showLinks"` |
||||
PostLinks []LogPostLinks `json:"postLinks"` |
||||
Actions []string `json:"actions"` |
||||
Date ScuffedTime `json:"date"` |
||||
ShowUser bool `json:"showUser"` |
||||
Message string `json:"message"` |
||||
User string `json:"user"` |
||||
Board string `json:"board"` |
||||
} |
||||
|
||||
type LogPostLinks struct { |
||||
PostID int `json:"postId"` |
||||
Thread interface{} `json:"thread"` |
||||
} |
||||
|
||||
type LogDate struct { |
||||
Year int `json:"year"` |
||||
Month int `json:"month"` |
||||
Day int `json:"day"` |
||||
} |
||||
|
||||
func (m *LogDate) String() string { |
||||
return fmt.Sprintf("%02d-%02d-%02d", m.Month, m.Day, m.Year) |
||||
} |
Loading…
Reference in new issue