R
Size: a a a
R
оГ
оГ
оГ
оГ
R
оГ
R
R
R
R
Д
Д
AH
let tryUploadFileAsync fileType =
async {
match fileType with
| "image" ->
return Some 1L |> Result.Ok // 1L is file id
| "uploading_not_required" -> return None |> Result.Ok
| _ -> return Result.Error (sprintf "%s uploading is not supported" fileType)
}
let files = []
let uploadedFiles = System.Collections.Generic.List<int64>(files.Length)
for file in files do
let! uploadResult = tryUploadFileAsync file
match uploadResult with
| Result.Ok (Some r) ->
uploadedFiles.Add(r)
| Result.Ok None ->
uploadedFiles.Add(-1L)
| Result.Error e -> return e |> Result.Error
m.UploadedFiles <- uploadedFiles
return serialize m |> Result.Ok
let tryUploadFileAsync fileType =
async {
match fileType with
| "image" ->
return Some 1L |> Result.Ok // 1L is file id
| "uploading_not_required" -> return None |> Result.Ok
| _ -> return Result.Error (sprintf "%s uploading is not supported" fileType)
}
let files = []
let maybeAsyncUploadedFiles: Async<Result<ResizeArray<int64>, string>> =
AsyncSeq.ofSeq files
|> AsyncSeq.mapAsync tryUploadFileAsync
|> AsyncSeq.fold(fun maybeList file ->
maybeList
|> Result.bind (fun (list: ResizeArray<_>) ->
match file with
| Result.Ok (Some r) -> list.Add r ; Result.Ok list
| Result.Ok None -> list.Add -1L; Result.Ok list
| Result.Error e -> Result.Error e)
) (Result.Ok(ResizeArray()))
оГ
let tryUploadFileAsync fileType =
async {
match fileType with
| "image" ->
return Some 1L |> Result.Ok // 1L is file id
| "uploading_not_required" -> return None |> Result.Ok
| _ -> return Result.Error (sprintf "%s uploading is not supported" fileType)
}
let files = []
let maybeAsyncUploadedFiles: Async<Result<ResizeArray<int64>, string>> =
AsyncSeq.ofSeq files
|> AsyncSeq.mapAsync tryUploadFileAsync
|> AsyncSeq.fold(fun maybeList file ->
maybeList
|> Result.bind (fun (list: ResizeArray<_>) ->
match file with
| Result.Ok (Some r) -> list.Add r ; Result.Ok list
| Result.Ok None -> list.Add -1L; Result.Ok list
| Result.Error e -> Result.Error e)
) (Result.Ok(ResizeArray()))
IC
NM
let tryUploadFileAsync fileType =
async {
match fileType with
| "image" ->
return Some 1L |> Result.Ok // 1L is file id
| "uploading_not_required" -> return None |> Result.Ok
| _ -> return Result.Error (sprintf "%s uploading is not supported" fileType)
}
let files = []
let maybeAsyncUploadedFiles: Async<Result<ResizeArray<int64>, string>> =
AsyncSeq.ofSeq files
|> AsyncSeq.mapAsync tryUploadFileAsync
|> AsyncSeq.fold(fun maybeList file ->
maybeList
|> Result.bind (fun (list: ResizeArray<_>) ->
match file with
| Result.Ok (Some r) -> list.Add r ; Result.Ok list
| Result.Ok None -> list.Add -1L; Result.Ok list
| Result.Error e -> Result.Error e)
) (Result.Ok(ResizeArray()))
Д
Д
AH