mirror of
https://github.com/ente-io/ente.git
synced 2025-05-22 11:20:30 +00:00
42 lines
941 B
Go
42 lines
941 B
Go
package api
|
|
|
|
import (
|
|
"context"
|
|
"github.com/ente-io/cli/internal/api/models"
|
|
"strconv"
|
|
)
|
|
|
|
func (c *Client) GetAuthKey(ctx context.Context) (*models.AuthKey, error) {
|
|
var res models.AuthKey
|
|
r, err := c.restClient.R().
|
|
SetContext(ctx).
|
|
SetResult(&res).
|
|
Get("/authenticator/key")
|
|
if r.IsError() {
|
|
return nil, &ApiError{
|
|
StatusCode: r.StatusCode(),
|
|
Message: r.String(),
|
|
}
|
|
}
|
|
return &res, err
|
|
}
|
|
|
|
func (c *Client) GetDiff(ctx context.Context, sinceTime int64, limit int64) ([]models.AuthEntity, error) {
|
|
var res struct {
|
|
Diff []models.AuthEntity `json:"diff"`
|
|
}
|
|
r, err := c.restClient.R().
|
|
SetContext(ctx).
|
|
SetQueryParam("sinceTime", strconv.FormatInt(sinceTime, 10)).
|
|
SetQueryParam("limit", strconv.FormatInt(limit, 10)).
|
|
SetResult(&res).
|
|
Get("/authenticator/entity/diff")
|
|
if r.IsError() {
|
|
return nil, &ApiError{
|
|
StatusCode: r.StatusCode(),
|
|
Message: r.String(),
|
|
}
|
|
}
|
|
return res.Diff, err
|
|
}
|