sfapi

package module
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2023 License: MIT Imports: 3 Imported by: 0

README

Here is a detailed GitHub markdown document for the SFAPI code:

SFAPI

Overview

The SFAPI provides an API client for interacting with the SFACG website. It allows retrieving book information, searching for novels, getting user account info etc.

Usage

Import
import "github.com/catnovelapi/sfapi"
Create Client
client := sfapi.NewSfClient()
Client Options

Set debug mode:

client.SetDebug()

Set cookie:

client.SetCookie(sfCommunity, sessionApp) 

Set proxy:

client.SetProxy(proxyURL)

Set device token:

client.SetDeviceToken(token)

Set auth:

client.SetAuth(username, password)

Set user agent:

client.SetUserAgent(userAgent)

Set retry count:

client.SetRetryCount(count)

Set base URL:

client.SetBaseURL(url)

Set device ID:

client.SetDeviceId(deviceID) 

Set API version:

client.SetVersion(version)

API Methods

Get Book Info
client.SF.GetBookInfoApi(bookID)

Parameters:

  • bookID: book ID

Returns book info in gjson.Result

Get Account Info
client.SF.GetAccountInApi() 

Returns user account info in gjson.Result

Get Money Info
client.SF.AccountInMoneyApi()

Returns user money info in gjson.Result

Login
client.SF.LoginUsernameApi(username, password)

Parameters:

  • username: username
  • password: password

Returns *resty.Response

Search Novels
client.SF.SearchNovelsResultApi(keyword, page)  

Parameters:

  • keyword: search keyword
  • page: result page number

Returns search result in gjson.Result

Get Chapter Content
client.SF.GetContentInfoApi(chapterID)

Parameters:

  • chapterID: chapter ID

Returns chapter content in gjson.Result

Get Chapter List
client.SF.GetChapterDirApi(bookID)

Parameters:

  • bookID: book ID

Returns chapter list in gjson.Result

Get Bookshelf
client.SF.GetBookShelfApi()  

Returns bookshelf info in gjson.Result

Get Book List
client.SF.BookListApi(bookID)

Parameters:

  • bookID: book ID

Returns book list in gjson.Result

Update Books List
client.SF.UpdateBooksList(page)

Parameters:

  • page: page number

Returns updated book list in gjson.Result

Get Ad Works
client.SF.AdpworksApi(bookID)

Parameters:

  • bookID: book ID

Returns ad works in gjson.Result

Get Position
client.SF.GetPositionApi()

Returns position info in gjson.Result

Get Special Push
client.SF.GetSpecialPushApi() 

Returns special push info in gjson.Result

Get Welfare Config
client.SF.GetWelfareCfgApi()

Returns welfare config in gjson.Result

Get Static Resources
client.SF.GetStaticsResourceApi()

Returns static resources in gjson.Result

Get User Welfare Store
client.SF.GetUserWelfareStoreitemsLatestApi()

Returns user welfare store info in gjson.Result

Get Essay Novels

Get short novels:

client.SF.EssayShortNovelApi(page)  

Get novellas:

client.SF.EssayNovellaApi(page)

Get long novels:

client.SF.EssayLongNovelApi(page)

Parameters:

  • page: page number

Returns essay novels in gjson.Result

Get System Recommend
client.SF.SystemRecommendApi()

Returns system recommended books in gjson.Result

Get Act Config
client.SF.GetActConfigApi()

Returns act config in gjson.Result

Post Conversions
client.SF.PostConversionsApi() 

Returns conversions result in gjson.Result

Get Version Info
client.SF.VersionInformation()

Returns version info in gjson.Result

Pre Order
client.SF.PreOrderApi()

Returns *resty.Response

Post Special Push
client.SF.PostSpecialPushApi()

Returns *resty.Response

APP Methods

Get Chapter List
client.APP.GetChapterDirList(bookID)

Parameters:

  • bookID: book ID

Returns chapter list in []gjson.Result

Get Chapter Content
client.APP.GetChapterContentText(chapterID)

Parameters:

  • chapterID: chapter ID

Returns chapter content text as string

client.APP.GetCookie(username, password)  

Parameters:

  • username: username
  • password: password

Returns cookie string

Search Novels
client.APP.GetSearchNovelsResult(keyword, page)

Parameters:

  • keyword: search keyword
  • page: page number

Returns search result novels in []gjson.Result

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SFClient

type SFClient struct {
	Api *api.API
	App *app.APP
}

func NewSfClient

func NewSfClient() *SFClient

func (*SFClient) R added in v1.3.3

func (sfClient *SFClient) R() *SFClient

func (*SFClient) SetAndroidKey added in v1.0.5

func (sfClient *SFClient) SetAndroidKey(androidKey string) *SFClient

func (*SFClient) SetAuth

func (sfClient *SFClient) SetAuth(username string, password string) *SFClient

func (*SFClient) SetBaseURL

func (sfClient *SFClient) SetBaseURL(baseURL string) *SFClient

func (*SFClient) SetCookie

func (sfClient *SFClient) SetCookie(sfCommunity string, sessionApp string) *SFClient

func (*SFClient) SetDebug

func (sfClient *SFClient) SetDebug() *SFClient

func (*SFClient) SetDeviceId

func (sfClient *SFClient) SetDeviceId(deviceId string) *SFClient

func (*SFClient) SetNewSem added in v1.1.2

func (sfClient *SFClient) SetNewSem(maxConcurrentRequests int) *SFClient

func (*SFClient) SetProxy

func (sfClient *SFClient) SetProxy(proxy string) *SFClient

func (*SFClient) SetRetryCount

func (sfClient *SFClient) SetRetryCount(retryCount int) *SFClient

func (*SFClient) SetUserAgent

func (sfClient *SFClient) SetUserAgent(userAgent string) *SFClient

func (*SFClient) SetVersion

func (sfClient *SFClient) SetVersion(version string) *SFClient

Directories

Path Synopsis
sfapi
api
app

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL