type StrapiClassic struct {
// contains filtered or unexported fields
}
func NewStrapiWithLogin(url, identifier, password string) (*StrapiClassic, error)
NewStrapiWithLogin initializes a new StrapiClassic instance with login credentials.
Parameters: url string - The URL of the Strapi instance. identifier string - The identifier for login. password string - The password for login. Return: *StrapiClassic - The initialized StrapiClassic instance. error - An error, if any.
func NewStrapiWithToken(url, token string) *StrapiClassic
NewStrapiWithToken creates a new instance of StrapiClassic with the given URL and token.
Parameters: url string - the URL for the Strapi instance. token string - the token for authentication. Returns: *StrapiClassic - a pointer to the newly created StrapiClassic instance.
func (strapi *StrapiClassic) Create(path string, data hctypes.Dict) (int, hctypes.Dict, error)
Create creates a new resource at the specified path.
path string, data hctypes.Dict int, hctypes.Dict, error
func (strapi *StrapiClassic) CreateBase(path string, data hctypes.Dict) (int, hctypes.Dict, error)
CreateBase creates a new resource at the specified path with the given data.
Parameters: - path: the path of the resource. - data: a dictionary of data to be created.
Returns: - int: the status code of the response. - hctypes.Dict: the response data. - error: an error, if any.
func (strapi *StrapiClassic) Delete(path string, id int64) (int, hctypes.Dict, error)
Delete deletes an item at the specified path and ID.
path: a string representing the path id: an int64 representing the ID Returns an int, hctypes.Dict, and an error
func (strapi *StrapiClassic) Find(path string, params hctypes.Dict) (int, hctypes.Dict, error)
Find finds the specified resource.
path - the path of the resource. params - a dictionary of parameters. Returns int, Dict, error.
func (strapi *StrapiClassic) FindOne(path string, id int64) (int, hctypes.Dict, error)
FindOne description of the Go function.
path string, id int64 int, hctypes.Dict, error
func (strapi *StrapiClassic) GetToken() string
func (strapi *StrapiClassic) Login(identifier, password string) (int, hctypes.Dict, error)
Login performs a login operation with the given identifier and password.
Parameters: identifier string - the identifier for the login password string - the password for the login Return type(s): int - the status code of the response hctypes.Dict - the response data error - any error that occurred during the operation
func (strapi *StrapiClassic) Update(path string, id int64, data hctypes.Dict) (int, hctypes.Dict, error)
Update updates the specified resource at the given path with the provided data.
Parameters:
path string - the path of the resource id int64 - the id of the resource data hctypes.Dict - the data to be updated
Returns:
int - the status code hctypes.Dict - the updated data error - an error, if any
func (strapi *StrapiClassic) UpdateBase(path string, id int64, data hctypes.Dict) (int, hctypes.Dict, error)
UpdateBase updates a resource at the specified path with the provided data.
Parameters: - path: the path of the resource to be updated. - id: the ID of the resource to be updated. - data: the data to update the resource with.
Returns: - int: the status code of the response. - hctypes.Dict: the updated data. - error: an error, if any.
func (strapi *StrapiClassic) Upload(file_name string, buffer hctypes.Buffer) (int, hctypes.List, error)
func (strapi *StrapiClassic) UsersCount() (int, int64, error)
UsersCount retrieves the count of users from the Strapi API.
It sends a GET request to the "users/count" endpoint and returns the status code, the count of users, and any error encountered. The status code is an integer representing the HTTP status code of the response. The count of users is an int64 representing the number of users. The error is an error object, which is nil if there are no errors.
func (strapi *StrapiClassic) UsersCreate(username string, email string, password string, confirmed bool, blocked bool, role int64) (int, hctypes.Dict, error)
UsersCreate creates a new user with the provided username, email, password, confirmed status, blocked status, and role.
Parameters: - username string - the username of the user - email string - the email of the user - password string - the password of the user - confirmed bool - the confirmation status of the user - blocked bool - the block status of the user - role int64 - the role of the user Returns: - int - the status code of the response - hctypes.Dict - the response data - error - an error, if any
func (strapi *StrapiClassic) UsersDelete(id int64) (int, hctypes.Dict, error)
UsersDelete deletes a user with the given ID in the Strapi API.
Parameters: - id: an int64 representing the ID of the user to be deleted.
Returns: - int: the status code of the response. - hctypes.Dict: the response data. - error: an error, if any.
func (strapi *StrapiClassic) UsersFind() (int, hctypes.List, error)
UsersFind finds all users.
Returns int, hctypes.List, error.
func (strapi *StrapiClassic) UsersFindOne(id int64) (int, hctypes.Dict, error)
UsersFindOne retrieves a single user by their ID.
Parameters: - id: the ID of the user to retrieve (int64)
Returns: - status code (int) - user data (hctypes.Dict) - error (error)
func (strapi *StrapiClassic) UsersMe() (int, hctypes.Dict, error)
UsersMe retrieves information about the current user.
No parameters. Returns int, hctypes.Dict, error.
func (strapi *StrapiClassic) UsersUpdate(id int64, data hctypes.Dict) (int, hctypes.Dict, error)
UsersUpdate updates a user with the given ID in the Strapi API.
Parameters: - id: an int64 representing the ID of the user to be updated. - data: a hctypes.Dict representing the data to update the user with.
Returns: - int: the status code of the response. - hctypes.Dict: the updated user data. - error: an error, if any.