chore: merge /api/

This commit is contained in:
Nya Candy 2023-02-17 23:24:00 +08:00
parent efe707fd16
commit fec344dc45
No known key found for this signature in database
GPG Key ID: 8B1BE5E86F2E66AE
4 changed files with 4 additions and 4 deletions

View File

@ -22,7 +22,7 @@ func PostAPIRequest[T I_Response | AuthSessionGenerate_Response | AuthSessionUse
apiEndpointPath string, reqBody any,
) (*T, error) {
// 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)
if err != nil {

View File

@ -13,7 +13,7 @@ type AuthSessionGenerate_Response struct {
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,
})

View File

@ -9,7 +9,7 @@ type I_Request struct {
type I_Response = types.MisskeyUser
func GetUserinfo(accessToken string) (*I_Response, error) {
return PostAPIRequest[I_Response]("/api/i", &I_Request{
return PostAPIRequest[I_Response]("i", &I_Request{
I: accessToken,
})
}

View File

@ -17,7 +17,7 @@ type AuthSessionUserkey_Response struct {
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,
Token: token,
})