···11export * from "./block";
22export * from "./branding";
33+export * from "./ingest";
34export * from "./moderation";
45export * from "./moderator-management";
56export * from "./stream";
+32
js/components/src/streamplace-store/ingest.tsx
···11+import { PlaceStreamIngestDefs } from "streamplace";
22+import { useDID, useStreamplaceStore } from "./streamplace-store";
33+import { usePDSAgent } from "./xrpc";
44+55+export default function useGetIngests() {
66+ const pdsAgent = usePDSAgent();
77+ const did = useDID();
88+ const setIngests = useStreamplaceStore((state) => state.setIngests);
99+1010+ return async () => {
1111+ if (!pdsAgent || !did) {
1212+ throw new Error("No PDS agent or DID available");
1313+ }
1414+1515+ const result = await pdsAgent.place.stream.ingest.getIngestUrls();
1616+ if (!result.success) {
1717+ throw new Error("Failed to get ingests");
1818+ }
1919+2020+ const ingests = result.data.ingests
2121+ .map((ingest) => {
2222+ if (PlaceStreamIngestDefs.isIngest(ingest)) {
2323+ return ingest;
2424+ }
2525+ console.error("Invalid ingest", ingest);
2626+ return null;
2727+ })
2828+ .filter((ingest) => ingest !== null);
2929+3030+ setIngests(ingests);
3131+ };
3232+}
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+// Lexicon schema: place.stream.ingest.defs
44+55+package streamplace
66+77+// IngestDefs_Ingest is a "ingest" in the place.stream.ingest.defs schema.
88+//
99+// An ingest URL for a Streamplace station.
1010+type IngestDefs_Ingest struct {
1111+ LexiconTypeID string `json:"$type" cborgen:"$type,const=place.stream.ingest.defs#ingest"`
1212+ // type: The type of ingest endpoint, currently 'rtmp' and 'whip' are supported.
1313+ Type string `json:"type" cborgen:"type"`
1414+ // url: The URL of the ingest endpoint.
1515+ Url string `json:"url" cborgen:"url"`
1616+}
+57
pkg/streamplace/ingestgetIngestUrls.go
···11+// Code generated by cmd/lexgen (see Makefile's lexgen); DO NOT EDIT.
22+33+// Lexicon schema: place.stream.ingest.getIngestUrls
44+55+package streamplace
66+77+import (
88+ "context"
99+ "encoding/json"
1010+ "fmt"
1111+1212+ lexutil "github.com/bluesky-social/indigo/lex/util"
1313+)
1414+1515+// IngestGetIngestUrls_Output is the output of a place.stream.ingest.getIngestUrls call.
1616+type IngestGetIngestUrls_Output struct {
1717+ Ingests []*IngestGetIngestUrls_Output_Ingests_Elem `json:"ingests" cborgen:"ingests"`
1818+}
1919+2020+type IngestGetIngestUrls_Output_Ingests_Elem struct {
2121+ IngestDefs_Ingest *IngestDefs_Ingest
2222+}
2323+2424+func (t *IngestGetIngestUrls_Output_Ingests_Elem) MarshalJSON() ([]byte, error) {
2525+ if t.IngestDefs_Ingest != nil {
2626+ t.IngestDefs_Ingest.LexiconTypeID = "place.stream.ingest.defs#ingest"
2727+ return json.Marshal(t.IngestDefs_Ingest)
2828+ }
2929+ return nil, fmt.Errorf("can not marshal empty union as JSON")
3030+}
3131+3232+func (t *IngestGetIngestUrls_Output_Ingests_Elem) UnmarshalJSON(b []byte) error {
3333+ typ, err := lexutil.TypeExtract(b)
3434+ if err != nil {
3535+ return err
3636+ }
3737+3838+ switch typ {
3939+ case "place.stream.ingest.defs#ingest":
4040+ t.IngestDefs_Ingest = new(IngestDefs_Ingest)
4141+ return json.Unmarshal(b, t.IngestDefs_Ingest)
4242+ default:
4343+ return nil
4444+ }
4545+}
4646+4747+// IngestGetIngestUrls calls the XRPC method "place.stream.ingest.getIngestUrls".
4848+func IngestGetIngestUrls(ctx context.Context, c lexutil.LexClient) (*IngestGetIngestUrls_Output, error) {
4949+ var out IngestGetIngestUrls_Output
5050+5151+ params := map[string]interface{}{}
5252+ if err := c.LexDo(ctx, lexutil.Query, "", "place.stream.ingest.getIngestUrls", params, nil, &out); err != nil {
5353+ return nil, err
5454+ }
5555+5656+ return &out, nil
5757+}