Class: Broadcast::Resources::Discovery

Inherits:
Base
  • Object
show all
Defined in:
lib/broadcast/resources/discovery.rb

Overview

Introspection endpoints. Primarily built for AI agents and CLIs that need to discover what a token can do before acting, but equally useful for health checks and for failing fast on a misconfigured deploy.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Broadcast::Resources::Base

Instance Method Details

#primeObject

Full capability manifest: platform version, token permissions, channel status, the endpoint list the token can reach, rate limit, and usage tips.



24
25
26
# File 'lib/broadcast/resources/discovery.rb', line 24

def prime
  get('/api/v1/prime')
end

#skillObject

Plain-text agent skill manifest (Markdown with YAML front matter), including the safety rules agents are expected to follow. Returns a String, not a Hash — this endpoint serves text/plain.



31
32
33
# File 'lib/broadcast/resources/discovery.rb', line 31

def skill
  @client.request(:get, '/api/v1/skill', nil, raw: true)
end

#statusObject

Channel sender config, subscriber counts, and per-feature transmission readiness. Worth calling before a send — readiness.broadcasts == false means the channel has no usable email server or sender identity.



18
19
20
# File 'lib/broadcast/resources/discovery.rb', line 18

def status
  get('/api/v1/status')
end

#whoamiObject

Identity of the current token: label, type (channel_scoped or admin_cross_channel), per-resource permissions, and the resolved channel.



11
12
13
# File 'lib/broadcast/resources/discovery.rb', line 11

def whoami
  get('/api/v1/whoami')
end