from upstash_qstash import Client
client = Client("<QSTASH_TOKEN>")
topics = client.topics()
topics.upsert_or_add_endpoints(
{
"name": "topic_name",
"endpoints": [
{"url": "https://my-endpoint-1"},
{"url": "https://my-endpoint-2"}
],
}
)
from upstash_qstash import Client
client = Client("<QSTASH_TOKEN>")
topics = client.topics()
topic = topics.get("topic_name")
print(topic["name"], topic["endpoints"])
from upstash_qstash import Client
client = Client("<QSTASH_TOKEN>")
topics = client.topics()
all_topics = topics.list()
for topic in all_topics:
print(topic["name"], topic["endpoints"])
from upstash_qstash import Client
client = Client("<QSTASH_TOKEN>")
topics = client.topics()
topics.remove_endpoints(
{
"name": "topic_name",
"endpoints": [
{"url": "https://my-endpoint-1"},
],
}
)
from upstash_qstash import Client
client = Client("<QSTASH_TOKEN>")
topics = client.topics()
topics.delete("topic_name")