1+ /* eslint-disable */
2+ import type {
3+ RulesMap ,
4+ Session ,
5+ RuleValue ,
6+ MacaroonPermission
7+ } from './lit-sessions' ;
8+
9+ export interface AddAutopilotSessionRequest {
10+ /** A human readable label to assign to the session. */
11+ label : string ;
12+ /** The unix timestamp at which this session should be revoked. */
13+ expiryTimestampSeconds : string ;
14+ /** The address of the mailbox server to connect to for this session. */
15+ mailboxServerAddr : string ;
16+ /** Set to true if tls should be skipped for when connecting to the mailbox. */
17+ devServer : boolean ;
18+ /**
19+ * The features that the session should subscribe to. Each feature maps to
20+ * a FeatureConfig that should be applied to that feature.
21+ */
22+ features : { [ key : string ] : FeatureConfig } ;
23+ /**
24+ * Rules that apply to the entire session. By default, no rules will apply
25+ * to the entire session.
26+ */
27+ sessionRules : RulesMap | undefined ;
28+ /** Set to true of the session should not make use of the privacy mapper. */
29+ noPrivacyMapper : boolean ;
30+ }
31+
32+ export interface AddAutopilotSessionRequest_FeaturesEntry {
33+ key : string ;
34+ value : FeatureConfig | undefined ;
35+ }
36+
37+ export interface FeatureConfig {
38+ /**
39+ * The RulesMap acts as an override map. In other words, by default the rules
40+ * values recommended by the Auto Pilot server will be used but the RulesMap
41+ * can be used to override the defaults.
42+ */
43+ rules : RulesMap | undefined ;
44+ /** Serialised configuration for the feature. */
45+ config : Uint8Array | string ;
46+ }
47+
48+ export interface ListAutopilotSessionsRequest { }
49+
50+ export interface ListAutopilotSessionsResponse {
51+ /** A list of the Autopilot sessions. */
52+ sessions : Session [ ] ;
53+ }
54+
55+ export interface AddAutopilotSessionResponse {
56+ /** Details of the session that was just created. */
57+ session : Session | undefined ;
58+ }
59+
60+ export interface ListAutopilotFeaturesRequest { }
61+
62+ export interface ListAutopilotFeaturesResponse {
63+ /** A map of feature names to Feature objects describing the feature. */
64+ features : { [ key : string ] : Feature } ;
65+ }
66+
67+ export interface ListAutopilotFeaturesResponse_FeaturesEntry {
68+ key : string ;
69+ value : Feature | undefined ;
70+ }
71+
72+ export interface RevokeAutopilotSessionRequest {
73+ localPublicKey : Uint8Array | string ;
74+ }
75+
76+ export interface RevokeAutopilotSessionResponse { }
77+
78+ export interface Feature {
79+ /** Name is the name of the Autopilot feature. */
80+ name : string ;
81+ /** A human readable description of what the feature offers. */
82+ description : string ;
83+ /**
84+ * A map of rules that make sense for this feature. Each rule is accompanied
85+ * with appropriate default values for the feature along with minimum and
86+ * maximum values for the rules.
87+ */
88+ rules : { [ key : string ] : RuleValues } ;
89+ /** A list of URI permissions required by the feature. */
90+ permissionsList : Permissions [ ] ;
91+ /**
92+ * A boolean indicating if the user would need to upgrade their Litd version in
93+ * order to subscribe to the Autopilot feature. This will be true if the
94+ * feature rules set contains a rule that Litd is unaware of.
95+ */
96+ requiresUpgrade : boolean ;
97+ }
98+
99+ export interface Feature_RulesEntry {
100+ key : string ;
101+ value : RuleValues | undefined ;
102+ }
103+
104+ export interface RuleValues {
105+ /** Whether or not the users version of Litd is aware of this rule. */
106+ known : boolean ;
107+ /**
108+ * The default values for the rule that the Autopilot server recommends for
109+ * the associated feature.
110+ */
111+ defaults : RuleValue | undefined ;
112+ /** The minimum sane value for this rule for the associated feature. */
113+ minValue : RuleValue | undefined ;
114+ /** The maximum sane value for this rule for the associated feature. */
115+ maxValue : RuleValue | undefined ;
116+ }
117+
118+ export interface Permissions {
119+ /** The URI in question. */
120+ method : string ;
121+ /** A list of the permissions required for this method. */
122+ operations : MacaroonPermission [ ] ;
123+ }
124+
125+ export interface Autopilot {
126+ listAutopilotFeatures (
127+ request ?: DeepPartial < ListAutopilotFeaturesRequest >
128+ ) : Promise < ListAutopilotFeaturesResponse > ;
129+ addAutopilotSession (
130+ request ?: DeepPartial < AddAutopilotSessionRequest >
131+ ) : Promise < AddAutopilotSessionResponse > ;
132+ listAutopilotSessions (
133+ request ?: DeepPartial < ListAutopilotSessionsRequest >
134+ ) : Promise < ListAutopilotSessionsResponse > ;
135+ revokeAutopilotSession (
136+ request ?: DeepPartial < RevokeAutopilotSessionRequest >
137+ ) : Promise < RevokeAutopilotSessionResponse > ;
138+ }
139+
140+ type Builtin =
141+ | Date
142+ | Function
143+ | Uint8Array
144+ | string
145+ | number
146+ | boolean
147+ | undefined ;
148+
149+ type DeepPartial < T > = T extends Builtin
150+ ? T
151+ : T extends Array < infer U >
152+ ? Array < DeepPartial < U > >
153+ : T extends ReadonlyArray < infer U >
154+ ? ReadonlyArray < DeepPartial < U > >
155+ : T extends { }
156+ ? { [ K in keyof T ] ?: DeepPartial < T [ K ] > }
157+ : Partial < T > ;
158+
0 commit comments