github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/libfs/update_history.go (about)

     1  // Copyright 2017 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package libfs
     6  
     7  import (
     8  	"encoding/json"
     9  	"time"
    10  
    11  	"github.com/keybase/client/go/kbfs/data"
    12  	"github.com/keybase/client/go/kbfs/kbfsmd"
    13  	"github.com/keybase/client/go/kbfs/libkbfs"
    14  	"golang.org/x/net/context"
    15  )
    16  
    17  // GetEncodedUpdateHistory returns a JSON-encoded version of a TLF's
    18  // complete update history.
    19  func GetEncodedUpdateHistory(
    20  	ctx context.Context, config libkbfs.Config,
    21  	folderBranch data.FolderBranch, start, end kbfsmd.Revision) (
    22  	data []byte, t time.Time, err error) {
    23  	history, err := config.KBFSOps().GetUpdateHistory(
    24  		ctx, folderBranch, start, end)
    25  	if err != nil {
    26  		return nil, time.Time{}, err
    27  	}
    28  
    29  	data, err = json.Marshal(history)
    30  	if err != nil {
    31  		return nil, time.Time{}, err
    32  	}
    33  
    34  	data = append(data, '\n')
    35  	return data, time.Time{}, nil
    36  }