// 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/xrpc"
)

// 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 *xrpc.Client, aud string, exp int64, lxm string) (*ServerGetServiceAuth_Output, error) {
	var out ServerGetServiceAuth_Output

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

	return &out, nil
}
