|
|
|
@ -10,12 +10,13 @@ import ( |
|
|
|
|
|
|
|
|
|
func main() { |
|
|
|
|
|
|
|
|
|
jschanClient := jschan.NewClient("https://fatchan.org") |
|
|
|
|
jschanClient := jschan.NewClient("http://dev-jschan") |
|
|
|
|
ctx := context.Background() |
|
|
|
|
|
|
|
|
|
loginOptions := &jschan.PostLoginOptions{ |
|
|
|
|
Username: "123", |
|
|
|
|
Password: "123", |
|
|
|
|
//Credentials for a private dev jschan
|
|
|
|
|
Username: "admin", |
|
|
|
|
Password: "gN2gtLUWZCaMm5t16ALq0J7LwEg=", |
|
|
|
|
Twofactor: "", |
|
|
|
|
} |
|
|
|
|
err := jschanClient.Login(ctx, loginOptions) |
|
|
|
@ -40,7 +41,7 @@ func main() { |
|
|
|
|
fmt.Printf("Fetched overboard catalog with %d threads\n", len(res.Threads)) |
|
|
|
|
|
|
|
|
|
getCatalogOptions := &jschan.GetCatalogOptions{ |
|
|
|
|
Board: "t", |
|
|
|
|
Board: "test", |
|
|
|
|
} |
|
|
|
|
res2, err2 := jschanClient.GetCatalog(ctx, getCatalogOptions) |
|
|
|
|
if err2 != nil { |
|
|
|
@ -50,8 +51,8 @@ func main() { |
|
|
|
|
fmt.Printf("Fetched board %s catalog with %d threads\n", getCatalogOptions.Board, len(res2)) |
|
|
|
|
|
|
|
|
|
getThreadOptions := &jschan.GetThreadOptions{ |
|
|
|
|
Board: "t", |
|
|
|
|
ThreadId: 1392, |
|
|
|
|
Board: "test", |
|
|
|
|
ThreadId: 19, |
|
|
|
|
} |
|
|
|
|
res3, err3 := jschanClient.GetThread(ctx, getThreadOptions) |
|
|
|
|
if err3 != nil { |
|
|
|
@ -61,7 +62,7 @@ func main() { |
|
|
|
|
fmt.Printf("Fetched /%s/ thread %d with %d replies\n", getThreadOptions.Board, getThreadOptions.ThreadId, len(res3.Replies)) |
|
|
|
|
|
|
|
|
|
getLogsListOptions := &jschan.GetLogsListOptions{ |
|
|
|
|
Board: "t", |
|
|
|
|
Board: "test", |
|
|
|
|
} |
|
|
|
|
res4, err4 := jschanClient.GetLogsList(ctx, getLogsListOptions) |
|
|
|
|
if err4 != nil { |
|
|
|
@ -71,11 +72,11 @@ func main() { |
|
|
|
|
fmt.Printf("Fetched /%s/ logs with %d entries\n", getLogsListOptions.Board, len(res4)) |
|
|
|
|
|
|
|
|
|
getLogsOptions := &jschan.GetLogsOptions{ |
|
|
|
|
Board: "t", |
|
|
|
|
Board: "test", |
|
|
|
|
Date: models.LogDate{ |
|
|
|
|
Year: 2022, |
|
|
|
|
Month: 11, |
|
|
|
|
Day: 02, |
|
|
|
|
Year: res4[0].Date.Year, |
|
|
|
|
Month: res4[0].Date.Month, |
|
|
|
|
Day: res4[0].Date.Day, |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
res5, err5 := jschanClient.GetLogs(ctx, getLogsOptions) |
|
|
|
@ -86,7 +87,7 @@ func main() { |
|
|
|
|
fmt.Printf("Fetched /%s/ logs for date %s with %d entries\n", getLogsOptions.Board, getLogsOptions.Date.String(), len(res5)) |
|
|
|
|
|
|
|
|
|
getSettingsOptions := &jschan.GetSettingsOptions{ |
|
|
|
|
Board: "t", |
|
|
|
|
Board: "test", |
|
|
|
|
} |
|
|
|
|
res6, err6 := jschanClient.GetSettings(ctx, getSettingsOptions) |
|
|
|
|
if err6 != nil { |
|
|
|
@ -96,7 +97,7 @@ func main() { |
|
|
|
|
fmt.Printf("Fetched /%s/ settings. Custompages are: [\"%s\"]\n", getLogsOptions.Board, strings.Join(res6.CustomPages, `", "`)) |
|
|
|
|
|
|
|
|
|
getCustomPageOptions := &jschan.GetCustomPageOptions{ |
|
|
|
|
Board: "t", |
|
|
|
|
Board: "test", |
|
|
|
|
CustomPage: res6.CustomPages[0], |
|
|
|
|
} |
|
|
|
|
res7, err7 := jschanClient.GetCustomPage(ctx, getCustomPageOptions) |
|
|
|
@ -107,7 +108,7 @@ func main() { |
|
|
|
|
fmt.Printf("Fetched /%s/ custompage \"%s\" published on: %s\n", getCustomPageOptions.Board, getCustomPageOptions.CustomPage, res7.Date.String()) |
|
|
|
|
|
|
|
|
|
getBannersOptions := &jschan.GetBannersOptions{ |
|
|
|
|
Board: "t", |
|
|
|
|
Board: "test", |
|
|
|
|
} |
|
|
|
|
res8, err8 := jschanClient.GetBanners(ctx, getBannersOptions) |
|
|
|
|
if err8 != nil { |
|
|
|
@ -119,24 +120,26 @@ func main() { |
|
|
|
|
res9, err9 := jschanClient.GetWebring(ctx) |
|
|
|
|
if err9 != nil { |
|
|
|
|
fmt.Println(err9) |
|
|
|
|
return |
|
|
|
|
//return
|
|
|
|
|
} |
|
|
|
|
if res9 != nil { |
|
|
|
|
fmt.Printf("Fetched webring, following: [\"%s\"]\n", strings.Join(res9.Following, `", "`)) |
|
|
|
|
} |
|
|
|
|
fmt.Printf("Fetched webring, following: [\"%s\"]\n", strings.Join(res9.Following, `", "`)) |
|
|
|
|
|
|
|
|
|
// makePostOptions := &jschan.MakePostOptions{
|
|
|
|
|
// Board: "test",
|
|
|
|
|
// Thread: 277,
|
|
|
|
|
// Name: "Test",
|
|
|
|
|
// Message: ">test",
|
|
|
|
|
// Email: "sage",
|
|
|
|
|
// PostPassword: "123",
|
|
|
|
|
makePostOptions := &jschan.MakePostOptions{ |
|
|
|
|
Board: "test", |
|
|
|
|
Thread: 19, |
|
|
|
|
Name: "Test", |
|
|
|
|
Message: ">test", |
|
|
|
|
Email: "sage", |
|
|
|
|
PostPassword: "123", |
|
|
|
|
// Files: []string{"./image.png", "./image.png"},
|
|
|
|
|
// }
|
|
|
|
|
// err10 := jschanClient.MakePost(ctx, makePostOptions)
|
|
|
|
|
// if err10 != nil {
|
|
|
|
|
// fmt.Println(err10)
|
|
|
|
|
// return
|
|
|
|
|
// }
|
|
|
|
|
} |
|
|
|
|
err10 := jschanClient.MakePost(ctx, makePostOptions) |
|
|
|
|
if err10 != nil { |
|
|
|
|
fmt.Println(err10) |
|
|
|
|
return |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
getManageRecentOptions := &jschan.GetManageRecentOptions{ |
|
|
|
|
Board: "test", |
|
|
|
|