(ctx context.Context, data wshrpc.CommandReadAppFileData)
| 1003 | } |
| 1004 | |
| 1005 | func (ws *WshServer) ReadAppFileCommand(ctx context.Context, data wshrpc.CommandReadAppFileData) (*wshrpc.CommandReadAppFileRtnData, error) { |
| 1006 | if data.AppId == "" { |
| 1007 | return nil, fmt.Errorf("must provide an appId to ReadAppFileCommand") |
| 1008 | } |
| 1009 | fileData, err := waveappstore.ReadAppFile(data.AppId, data.FileName) |
| 1010 | if err != nil { |
| 1011 | if errors.Is(err, os.ErrNotExist) { |
| 1012 | return &wshrpc.CommandReadAppFileRtnData{ |
| 1013 | NotFound: true, |
| 1014 | }, nil |
| 1015 | } |
| 1016 | return nil, fmt.Errorf("failed to read app file: %w", err) |
| 1017 | } |
| 1018 | return &wshrpc.CommandReadAppFileRtnData{ |
| 1019 | Data64: base64.StdEncoding.EncodeToString(fileData.Contents), |
| 1020 | ModTs: fileData.ModTs, |
| 1021 | }, nil |
| 1022 | } |
| 1023 | |
| 1024 | func (ws *WshServer) WriteAppFileCommand(ctx context.Context, data wshrpc.CommandWriteAppFileData) error { |
| 1025 | if data.AppId == "" { |
nothing calls this directly
no test coverage detected