Code Monkey home page Code Monkey logo

garara's Introduction

garara

gararaはアララメッセージを利用するためのサードパーティライブラリです。

MIT License

APIs

v1

API Description Implements Method
配信予約API
(キューイングモード)
配信予約及び即時配信指示を行います 100% SendQueueMode
配信予約削除API 配信予約中の配信データを削除することができる API です。
配信予約データ削除機能、重複処理抑止機能があります。
100% DeleteReservationByDeliverIDs
DeleteReservationByRequestIDs
配信ステータス取得API 配信や削除処理などの、処理結果を取得するAPIです。 100% GetStatusByDeliverIDs
GetStatusByRequestIDs
GetStatusByTerms
配信結果リスト取得API 実際に配信処理を行ったメールアドレスの配信結果を取得するAPIです。 100% GetResultListByDeliverIDs
エラーリスト取得API 配信を行った結果、エラーとなったアドレスについての情報を取得するAPIです。 100% GetErrorListByDeliverIDs
GetErrorListByTerms
クリックカウントログ取得API クリックカウント・開封確認の詳細ログ取得APIとなります。 100% GetClickLog
エラーフィルターリスト取得API 管理画面のエラーリスト管理、配信除外リスト管理に登録されていメールアドレスを取得するAPIです。登録済みの全データを取得します。 100% GetErrorFilter

配信結果リスト取得APIの実装でRequestID, 期間での結果取得を行うと、詳細リストが取得できない ※1 ので実装見送り。 ※1 : 私の環境では取得できない状態だった。

V1Clientへの追加メソッド

  • ResDeliverySplitErrors
    • 配信ステータス取得APIではレスポンスコードが200の場合でもレスポンス内に個別にエラーが入っている。
    • 上記メソッドを噛ますことで、成功と失敗をそれぞれにレスポンスを分離する。

追加メソッド

  • SimpleV1SendListBuilder
    • メールアドレスのstring sliceからSendListを作成する。
    • Addressのdevice type は0(NONE)を付与する。
  • SimpleV1SendListDataBuilder
    • id, deviceType, メールアドレス, intText, exttext, extImageの各string slice, keyFieldを引数に取り、SendListのDataを一つ作成する
    • intText, exttext, extImageの各string sliceはIDを0から自動採番する。
    • device typeは存在しない番号を入力するとエラーを返す
  • SimpleV1MailContentsBuilder
    • メール配信のためのContentsを作成します。
    • imagesはContent.Imageにid,0から順番にデータを作成します。
    • textsはContent.Textにid,0から順番にデータを作成します。
    • filesがattachMaxFileSize(現仕様では3)よりデータ量が大きい場合エラーを返却します。
  • SimpleV1SettingBuilder
    • メール配信のためのsetting structを作成します。
    • S/MIME, Openedの指定が範囲外の場合エラーを返却します。
  • V1MailDeliveryBuilder
    • メール配信のためのdelivery structを作成します。
  • AttrIdCDataBuilder, AttrIdStringsBuilder
    • []stringから[]AttrIdCdata, []AttrIdStringを作成します。
    • idは0から順に振られます。

v1 api usage

メール送信

  c := garara.NewDefaultV1Client(
    [API User], 
    [API Password], 
    [ManageSiteUser], 
    [ManageSitePassword], 
    [SiteID], 
    [ServiceID],
    )
  
  var r garara.V1MailRequest
  u, _ := uuid.NewRandom()
  s, _ := garara.SimpleV1SettingBuilder(
    "now",
    "From Name",
    "[email protected]",
    "",
    0,
    garara.UNUSE,
    garara.USE,
    garara.Option{},
  )
  
  subject := "test message"
  body := `
<html>
  <head></head>
  <body>
    Hello Message!!
  </body>
</html>
`
  cont, _ := garara.SimpleV1MailContentsBuilder(subject, body, garara.HTML, nil, nil, nil)
  l := garara.SimpleV1SendListBuilder([]string{"[email protected]", "[email protected]"})
  r.Delivery = garara.V1MailDeliveryBuilder(1, u.String(), s, cont, l)
  
  ctx := context.Background()
  res, _ := c.SendQueueMode(ctx, r, [RequestHostName])

※他のAPIはある程度直感的な使い方ができるかと思います。

garara's People

Contributors

unagiya avatar

Watchers

 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.