ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - craigp/elixir-gmail: A Gmail API client for Elixir
A Gmail API client for Elixir. Contribute to craigp/elixir-gmail development by creating an account on GitHub.
Visit Site

GitHub - craigp/elixir-gmail: A Gmail API client for Elixir

GitHub - craigp/elixir-gmail: A Gmail API client for Elixir

elixir-gmail

Build Status Coverage Status hex.pm version hex.pm downloads Inline docs

A simple Gmail REST API client for Elixir.

You can find the hex package here, and the docs here.

You can find documentation for Gmail's API at https://developers.google.com/gmail/api/

Usage

First, add the client to your mix.exs dependencies:

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

Then run $ mix do deps.get, compile to download and compile your dependencies.

Finally, add the :gmail application as your list of applications in mix.exs:

def application do
  [applications: [:logger, :gmail]]
end

Before you can work with mail for a user you'll need to start a process for them.

{:ok, pid} = Gmail.User.start_mail("[email protected]", "user-refresh-token")

When a user process starts it will automatically fetch a new access token for that user. Then you can start playing with mail:

# fetch a list of threads
{:ok, threads, next_page_token} = Gmail.User.threads("[email protected]")

# fetch the next page of threads using a page token
{:ok, _, _} = Gmail.User.threads("[email protected]", %{page_token: next_page_token})

# fetch a thread by ID
{:ok, thread} = Gmail.User.thread("[email protected]", "1233454566")

# fetch a list of labels
{:ok, labels} = Gmail.User.labels("[email protected]")

Check the docs for a more complete list of functionality.

API Support

  • Threads
    • get
    • list
    • modify
    • delete
    • trash
    • untrash
  • Messages
    • delete
    • get
    • insert
    • list
    • modify
    • send
    • trash
    • untrash
    • import
    • batchDelete
  • Labels
    • create
    • delete
    • list
    • update
    • get
    • update
    • patch
  • Drafts
    • list
    • get
    • delete
    • update
    • create
    • send
    • send (with upload)
  • History
    • list
  • Attachments
    • get (thanks to @killtheliterate)

Auth

As of now the library doesn't do the initial auth generation for you; you'll need to create an app on the Google Developer Console to get a client ID and secret and authorize a user to get an authorization code, which you can trade for an access token.

The library will however, when you supply a refresh token, use that to refresh an expired access token for you. Take a look in the dev.exs.sample config file to see what your config should look like.

TODO

  • Stop mocking HTTP requests and use Bypass instead
  • Add format option when fetching threads
  • .. and messages
  • .. and drafts
  • Batched requests
  • Document the config (specifically pool size)

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory