Skip to content

Instantly share code, notes, and snippets.

View qgadrian's full-sized avatar
🛰️

Adrián Q qgadrian

🛰️
View GitHub Profile
Fcmex.push("/topics/test_topic",
data: %{
title: "hi!",
body: "this is a message",
click_action: "open",
icon: "new"
}
)
System.put_env("FCM_SERVER_KEY", "my_project_id")
alias GoogleApi.PubSub.V1.Api.Projects
pull_request = %GoogleApi.PubSub.V1.Model.PullRequest{maxMessages: 10}
Projects.pubsub_projects_subscriptions_pull(client, “my_google_project”, “test_subscription”, [body: pull_request])
alias GoogleApi.PubSub.V1.Api.Projects
Projects.pubsub_projects_topics_publish(
client, “my_google_project”, “test_topic”, [body: publish_request])
alias GoogleApi.PubSub.V1.Model
data = Base.encode64(“pub sub test message”)
message = %Model.PubsubMessage{data: data}
publish_request = %Model.PublishRequest{messages: [message]}
alias GoogleApi.PubSub.V1.Api.Projects
topics = Projects.pubsub_projects_topics_list(client, “my_google_project”)
alias GoogleApi.PubSub.V1.Api.Projects
{:ok, topic} = Projects.pubsub_projects_topics_create(
client, “my_gcloud_project”, “test_topic”, [body: %{}])
{:ok, token} = Goth.Token.for_scope(“https://www.googleapis.com/auth/pubsub")
client = token |> Map.get(:token) |> GoogleApi.PubSub.V1.Connection.new()
{:ok, token} = Goth.Token.for_scope(“https://www.googleapis.com/auth/pubsub")
client = token |> Map.get(:token) |> GoogleApi.PubSub.V1.Connection.new()