// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.

package atproto

// schema: com.atproto.server.getServiceAuth

import (
	"context"

	"github.com/bluesky-social/indigo/lex/util"
)

// ServerGetServiceAuth_Output is the output of a com.atproto.server.getServiceAuth call.
type ServerGetServiceAuth_Output struct {
	Token string `json:"token" cborgen:"token"`
}

// ServerGetServiceAuth calls the XRPC method "com.atproto.server.getServiceAuth".
//
// aud: The DID of the service that the token will be used to authenticate with
// exp: The time in Unix Epoch seconds that the JWT expires. Defaults to 60 seconds in the future. The service may enforce certain time bounds on tokens depending on the requested scope.
// lxm: Lexicon (XRPC) method to bind the requested token to
func ServerGetServiceAuth(ctx context.Context, c util.LexClient, aud string, exp int64, lxm string) (*ServerGetServiceAuth_Output, error) {
	var out ServerGetServiceAuth_Output

	params := map[string]interface{}{}
	params["aud"] = aud
	if exp != 0 {
		params["exp"] = exp
	}
	if lxm != "" {
		params["lxm"] = lxm
	}
	if err := c.LexDo(ctx, util.Query, "", "com.atproto.server.getServiceAuth", params, nil, &out); err != nil {
		return nil, err
	}

	return &out, nil
}
