chore: merge /api/
This commit is contained in:
parent
efe707fd16
commit
fec344dc45
|
@ -22,7 +22,7 @@ func PostAPIRequest[T I_Response | AuthSessionGenerate_Response | AuthSessionUse
|
||||||
apiEndpointPath string, reqBody any,
|
apiEndpointPath string, reqBody any,
|
||||||
) (*T, error) {
|
) (*T, error) {
|
||||||
// Prepare request
|
// Prepare request
|
||||||
apiEndpoint := fmt.Sprintf("https://%s%s", config.Config.Misskey.Instance, apiEndpointPath)
|
apiEndpoint := fmt.Sprintf("https://%s/api/%s", config.Config.Misskey.Instance, apiEndpointPath)
|
||||||
|
|
||||||
reqBodyBytes, err := json.Marshal(reqBody)
|
reqBodyBytes, err := json.Marshal(reqBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -13,7 +13,7 @@ type AuthSessionGenerate_Response struct {
|
||||||
|
|
||||||
func GenerateAuthSession() (*AuthSessionGenerate_Response, error) {
|
func GenerateAuthSession() (*AuthSessionGenerate_Response, error) {
|
||||||
|
|
||||||
return PostAPIRequest[AuthSessionGenerate_Response]("/api/auth/session/generate", &AuthSessionGenerate_Request{
|
return PostAPIRequest[AuthSessionGenerate_Response]("auth/session/generate", &AuthSessionGenerate_Request{
|
||||||
AppSecret: config.Config.Misskey.Application.Secret,
|
AppSecret: config.Config.Misskey.Application.Secret,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ type I_Request struct {
|
||||||
type I_Response = types.MisskeyUser
|
type I_Response = types.MisskeyUser
|
||||||
|
|
||||||
func GetUserinfo(accessToken string) (*I_Response, error) {
|
func GetUserinfo(accessToken string) (*I_Response, error) {
|
||||||
return PostAPIRequest[I_Response]("/api/i", &I_Request{
|
return PostAPIRequest[I_Response]("i", &I_Request{
|
||||||
I: accessToken,
|
I: accessToken,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ type AuthSessionUserkey_Response struct {
|
||||||
|
|
||||||
func GetUserkey(token string) (*AuthSessionUserkey_Response, error) {
|
func GetUserkey(token string) (*AuthSessionUserkey_Response, error) {
|
||||||
|
|
||||||
return PostAPIRequest[AuthSessionUserkey_Response]("/api/auth/session/userkey", &AuthSessionUserkey_Request{
|
return PostAPIRequest[AuthSessionUserkey_Response]("auth/session/userkey", &AuthSessionUserkey_Request{
|
||||||
AppSecret: config.Config.Misskey.Application.Secret,
|
AppSecret: config.Config.Misskey.Application.Secret,
|
||||||
Token: token,
|
Token: token,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue