Add mail form when creating shares

This commit is contained in:
eikek
2021-10-08 10:15:19 +02:00
parent 337293128d
commit 16ccddab9f
22 changed files with 535 additions and 56 deletions

View File

@ -146,6 +146,7 @@ module Api exposing
, shareAttachmentPreviewURL
, shareFileURL
, shareItemBasePreviewURL
, shareSendMail
, startClassifier
, startEmptyTrash
, startOnceNotifyDueItems
@ -233,6 +234,7 @@ import Api.Model.ShareList exposing (ShareList)
import Api.Model.ShareSecret exposing (ShareSecret)
import Api.Model.ShareVerifyResult exposing (ShareVerifyResult)
import Api.Model.SimpleMail exposing (SimpleMail)
import Api.Model.SimpleShareMail exposing (SimpleShareMail)
import Api.Model.SourceAndTags exposing (SourceAndTags)
import Api.Model.SourceList exposing (SourceList)
import Api.Model.SourceTagIn
@ -2312,6 +2314,20 @@ itemDetailShare flags token itemId receive =
}
shareSendMail :
Flags
-> { conn : String, mail : SimpleShareMail }
-> (Result Http.Error BasicResult -> msg)
-> Cmd msg
shareSendMail flags opts receive =
Http2.authPost
{ url = flags.config.baseUrl ++ "/api/v1/sec/share/email/send/" ++ opts.conn
, account = getAccount flags
, body = Http.jsonBody (Api.Model.SimpleShareMail.encode opts.mail)
, expect = Http.expectJson receive Api.Model.BasicResult.decoder
}
shareAttachmentPreviewURL : String -> String
shareAttachmentPreviewURL id =
"/api/v1/share/attachment/" ++ id ++ "/preview?withFallback=true"