Basic search view for shares

This commit is contained in:
eikek
2021-10-05 01:06:52 +02:00
parent a286556116
commit 83dd675e4f
12 changed files with 577 additions and 23 deletions

View File

@ -113,6 +113,7 @@ module Api exposing
, restoreAllItems
, restoreItem
, saveClientSettings
, searchShare
, sendMail
, setAttachmentName
, setCollectiveSettings
@ -155,6 +156,7 @@ module Api exposing
, upload
, uploadAmend
, uploadSingle
, verifyShare
, versionInfo
)
@ -223,6 +225,8 @@ import Api.Model.SentMails exposing (SentMails)
import Api.Model.ShareData exposing (ShareData)
import Api.Model.ShareDetail exposing (ShareDetail)
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.SourceAndTags exposing (SourceAndTags)
import Api.Model.SourceList exposing (SourceList)
@ -2264,6 +2268,26 @@ deleteShare flags id receive =
}
verifyShare : Flags -> ShareSecret -> (Result Http.Error ShareVerifyResult -> msg) -> Cmd msg
verifyShare flags secret receive =
Http2.authPost
{ url = flags.config.baseUrl ++ "/api/v1/open/share/verify"
, account = getAccount flags
, body = Http.jsonBody (Api.Model.ShareSecret.encode secret)
, expect = Http.expectJson receive Api.Model.ShareVerifyResult.decoder
}
searchShare : Flags -> String -> ItemQuery -> (Result Http.Error ItemLightList -> msg) -> Cmd msg
searchShare flags token search receive =
Http2.sharePost
{ url = flags.config.baseUrl ++ "/api/v1/share/search"
, token = token
, body = Http.jsonBody (Api.Model.ItemQuery.encode search)
, expect = Http.expectJson receive Api.Model.ItemLightList.decoder
}
--- Helper