func (r *Resource) NewRoleWithReason(ctx context.Context, settings *discord.RoleSettings, reason string) (*discord.Role, error) {
	b, err := json.Marshal(settings)
	if err != nil {
		return nil, err
	}
	e := endpoint.CreateGuildRole(r.guildID)
	resp, err := r.client.DoWithHeader(ctx, e, rest.JSONPayload(b), rest.ReasonHeader(reason))
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return nil, discord.NewAPIError(resp)
	}
	var role discord.Role
	if err = json.NewDecoder(resp.Body).Decode(&role); err != nil {
		return nil, err
	}
	return &role, nil
}
NewRole creates a new role for the guild. Requires the 'MANAGE_ROLES'
permission. Fires a Guild Role Create Gateway event.
The given reason will be set in the audit log entry for this action.
package guild
import (
	"context"
	"encoding/json"
	"net/http"
	"github.com/skwair/harmony/discord"
	"github.com/skwair/harmony/internal/endpoint"
	"github.com/skwair/harmony/internal/rest"
)
func (r *Resource) Roles(ctx context.Context) ([]discord.Role, error) {
	e := endpoint.GetGuildRoles(r.guildID)
	resp, err := r.client.Do(ctx, e, nil)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return nil, discord.NewAPIError(resp)
	}
	var roles []discord.Role
	if err = json.NewDecoder(resp.Body).Decode(&roles); err != nil {
		return nil, err
	}
	return roles, nil
}
func (r *Resource) NewRole(ctx context.Context, settings *discord.RoleSettings) (*discord.Role, error) {
	return r.NewRoleWithReason(ctx, settings, "")
}