// Code generated by glex; DO NOT EDIT. // Lexicon schema: place.stream.access.createGrant package placestream import ( "context" "io" glex "github.com/streamplace/glex/runtime" cbg "github.com/whyrusleeping/cbor-gen" ) type AccessCreateGrant_Input struct { LexiconTypeID string `json:"$type,omitempty"` Note *string `json:"note,omitempty"` Role string `json:"role"` // subject: The account to grant to, as a DID or a handle. Handles are resolved to DIDs before the grant is written. Subject string `json:"subject"` } // RecordTypeID implements glex.Record. func (t *AccessCreateGrant_Input) RecordTypeID() string { return "place.stream.access.createGrant" } func (t *AccessCreateGrant_Input) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "place.stream.access.createGrant" return glex.MarshalCBOR(w, &cp) } func (t *AccessCreateGrant_Input) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } type AccessCreateGrant_Output struct { LexiconTypeID string `json:"$type,omitempty"` Grant AccessDefs_GrantView `json:"grant"` } // RecordTypeID implements glex.Record. func (t *AccessCreateGrant_Output) RecordTypeID() string { return "place.stream.access.createGrant" } func (t *AccessCreateGrant_Output) MarshalCBOR(w io.Writer) error { if t == nil { _, err := w.Write(cbg.CborNull) return err } // stamp $type on a copy so marshal never mutates the record cp := *t cp.LexiconTypeID = "place.stream.access.createGrant" return glex.MarshalCBOR(w, &cp) } func (t *AccessCreateGrant_Output) UnmarshalCBOR(r io.Reader) error { return glex.UnmarshalCBOR(r, t) } // AccessCreateGrant calls the XRPC method "place.stream.access.createGrant". // // Grant a role to an account. Requires the admin role. Idempotent: granting a role an account already holds returns the existing grant. func AccessCreateGrant(ctx context.Context, c glex.LexClient, input *AccessCreateGrant_Input) (*AccessCreateGrant_Output, error) { var out AccessCreateGrant_Output if err := c.LexDo(ctx, glex.Procedure, "application/json", "place.stream.access.createGrant", nil, input, &out); err != nil { return nil, err } return &out, nil }