Code Monkey home page Code Monkey logo

ex_idobata's Introduction

ExIdobata

An Idobata.io (Japanese) client in Elixir.

Installation

If available in Hex, the package can be installed by adding ex_idobata to your list of dependencies in mix.exs:

def deps do
  [
    {:ex_idobata, "~> 0.1"}
  ]
end

Hook

To post messages or images to use hook API.

Usage

alias ExIdobata.Hook
# room UUID, it's the last part of hook API,
# for examle https://idobata.io/hook/custom/00000000-0000-0000-0000-000000000000

room_uuid = "00000000-0000-0000-0000-000000000000"
# post plain text message

Hook.contents()
|> Hook.source("Hi")
|> Hook.post(room_uuid)

# post Markdown message

Hook.contents()
|> Hook.source("# Hi")
|> Hook.markdown()
|> Hook.post(room_uuid)

# post HTML message

Hook.contents()
|> Hook.source("<h1>Hi</h1>")
|> Hook.html()
|> Hook.post(room_uuid)

# post message with image

Hook.contents()
|> Hook.source("hi")
|> Hook.image("./hello.gif")
|> Hook.post(room_uuid)

Use environment variable

If room_uuid omitted, the function post uses a value of environemnt variable IDOBATA_HOOK_ROOM_UUID as UUID. To use another environment variable, pass a tuple with :system and the variable name (e.g., {:system, "ANOTHER_ROOM_UUID"}).

GraphQL API

Gets an access token

access_token = ExIdobata.API.AccessToken.get(email, password)

This access token used API functions described below.

Gets a viewer

viewer = ExIdobata.API.Viewer.get(access_token)
# `viewer.name` is an account user name

Gets rooms

rooms = ExIdobata.API.Room.get(access_token)

Posts a message

To post a plain text message.

ExIdobata.API.post(access_token, room, "Hi")

It's same as bellow.

ExIdobata.API.post(access_token, room, "Hi", :plain)

To post a Markdown message.

ExIdobata.API.post(access_token, room, "*Hi*", :markdown)

To post a HTML message.

ExIdobata.API.post(access_token, room, "<h1>Hi</h1>", :html)

ex_idobata's People

Contributors

mattsan avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.