github.com/elves/elvish@v0.15.0/pkg/daemon/internal/api/api.go (about)

     1  // Package api defines types and constants useful for the API between the daemon
     2  // service and client.
     3  package api
     4  
     5  import (
     6  	"github.com/elves/elvish/pkg/store"
     7  )
     8  
     9  // ServiceName is the name of the RPC service exposed by the daemon.
    10  const ServiceName = "Daemon"
    11  
    12  // Basic requests.
    13  
    14  type VersionRequest struct{}
    15  
    16  type VersionResponse struct {
    17  	Version int
    18  }
    19  
    20  type PidRequest struct{}
    21  
    22  type PidResponse struct {
    23  	Pid int
    24  }
    25  
    26  // Cmd requests.
    27  
    28  type NextCmdSeqRequest struct{}
    29  
    30  type NextCmdSeqResponse struct {
    31  	Seq int
    32  }
    33  
    34  type AddCmdRequest struct {
    35  	Text string
    36  }
    37  
    38  type AddCmdResponse struct {
    39  	Seq int
    40  }
    41  
    42  type DelCmdRequest struct {
    43  	Seq int
    44  }
    45  
    46  type DelCmdResponse struct {
    47  }
    48  
    49  type CmdRequest struct {
    50  	Seq int
    51  }
    52  
    53  type CmdResponse struct {
    54  	Text string
    55  }
    56  
    57  type CmdsRequest struct {
    58  	From int
    59  	Upto int
    60  }
    61  
    62  type CmdsResponse struct {
    63  	Cmds []string
    64  }
    65  
    66  type CmdsWithSeqRequest struct {
    67  	From int
    68  	Upto int
    69  }
    70  
    71  type CmdsWithSeqResponse struct {
    72  	Cmds []store.Cmd
    73  }
    74  
    75  type NextCmdRequest struct {
    76  	From   int
    77  	Prefix string
    78  }
    79  
    80  type NextCmdResponse struct {
    81  	Seq  int
    82  	Text string
    83  }
    84  
    85  type PrevCmdRequest struct {
    86  	Upto   int
    87  	Prefix string
    88  }
    89  
    90  type PrevCmdResponse struct {
    91  	Seq  int
    92  	Text string
    93  }
    94  
    95  // Dir requests.
    96  
    97  type AddDirRequest struct {
    98  	Dir       string
    99  	IncFactor float64
   100  }
   101  
   102  type AddDirResponse struct{}
   103  
   104  type DelDirRequest struct {
   105  	Dir string
   106  }
   107  
   108  type DelDirResponse struct{}
   109  
   110  type DirsRequest struct {
   111  	Blacklist map[string]struct{}
   112  }
   113  
   114  type DirsResponse struct {
   115  	Dirs []store.Dir
   116  }
   117  
   118  // SharedVar requests.
   119  
   120  type SharedVarRequest struct {
   121  	Name string
   122  }
   123  
   124  type SharedVarResponse struct {
   125  	Value string
   126  }
   127  
   128  type SetSharedVarRequest struct {
   129  	Name  string
   130  	Value string
   131  }
   132  
   133  type SetSharedVarResponse struct{}
   134  
   135  type DelSharedVarRequest struct {
   136  	Name string
   137  }
   138  
   139  type DelSharedVarResponse struct{}