Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 278358d

Browse files
committed
feat: replace (hopefully) all snake_case with camelCase
1 parent 1799eed commit 278358d

File tree

6 files changed

+56
-52
lines changed

6 files changed

+56
-52
lines changed

polyproto/chat/models/main.tsp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace polyproto.chat.models {
1212
}
1313
@added(Version.`v0.1.0-alpha.0`)
1414
model ChannelData {
15-
parent_id: string;
15+
parentId: string;
1616
type: uint8;
1717
position: uint32;
1818
name: string;
@@ -32,11 +32,11 @@ namespace polyproto.chat.models {
3232
@added(Version.`v0.1.0-alpha.0`)
3333
model Guild {
3434
id: string;
35-
display_name: string;
35+
displayName: string;
3636
description?: string;
3737
icon?: url;
38-
owner_id: string;
39-
created_at: offsetDateTime;
38+
ownerId: string;
39+
createdAt: offsetDateTime;
4040
}
4141
}
4242

@@ -74,7 +74,7 @@ namespace polyproto.chat.models {
7474
@added(Version.`v0.1.0-alpha.0`)
7575
model Actor {
7676
fid: string;
77-
display_name?: string;
77+
displayName?: string;
7878
pronouns?: string;
7979
about?: string;
8080
avatar?: url;
@@ -104,6 +104,6 @@ namespace polyproto.chat.models {
104104
""")
105105
model EncryptedMessageData {
106106
data: string;
107-
dest_id: string;
107+
destId: string;
108108
}
109109
}

polyproto/core/models/main.tsp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
namespace polyproto.core.Models {
1+
namespace polyproto.core.models {
22
model EncryptedPKM {
33
/**
44
* Custom variant of the X.509 `SubjectPublicKeyInfo`, where the `subject_public_key`
55
* field stores the encrypted private key, instead of a public key. Otherwise equal to
66
* `SubjectPublicKeyInfo`. Also referred to as `PrivateKeyInfo`.
77
*/
8-
key_data: string;
8+
keyData: string;
99

1010
@doc("The serial number of the ID-Cert this key material is associated with.")
1111
serialNumber: uint64;
@@ -64,6 +64,9 @@ namespace polyproto.core.Models {
6464
@doc("The signature produced by signing the key trial string using a private identity key.")
6565
signature: string;
6666

67+
@doc("The federation ID of the actor who completed this key trial.")
68+
fid: string;
69+
6770
@doc("The serial number of the ID-Cert corresponding to the private identity key used to sign the key trial string.")
6871
serialNumber: uint64;
6972
}
@@ -192,7 +195,7 @@ namespace polyproto.core.Models {
192195
@example("------BEGIN CERTIFICATE------...")
193196
idCertPem: string;
194197

195-
@doc("UNIX timestamp that specifies when this specific id_cert has been marked as invalidated by the server. An ID-Cert is considered invalidated, if the server or actor choose to revoke the validity of the ID-Cert before the lifetime of the certificate was scheduled to end. If this property does not exist, the ID-Cert has not been invalidated.")
198+
@doc("UNIX timestamp that specifies when this specific idCert has been marked as invalidated by the server. An ID-Cert is considered invalidated, if the server or actor choose to revoke the validity of the ID-Cert before the lifetime of the certificate was scheduled to end. If this property does not exist, the ID-Cert has not been invalidated.")
196199
@example(1736610000)
197200
invalidatedAt?: uint64;
198201

polyproto/core/routes/main.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ namespace polyproto.core;
2626

2727
enum Version {
2828
`v1.0-beta.3`,
29+
`v1.0-beta.4`,
2930
}

polyproto/core/routes/migration.tsp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ namespace polyproto.core.Routes.Migration {
3737

3838
@doc("A list of completed `KeyTrial`s.")
3939
@header(#{ name: "X-P2-core-keytrial" })
40-
keyTrial: polyproto.core.Models.KeyTrialCompleted[],
40+
keyTrial: polyproto.core.models.KeyTrialCompleted[],
4141
): {
4242
@statusCode statusCode: 200 | 202;
4343
};
@@ -79,7 +79,7 @@ namespace polyproto.core.Routes.Migration {
7979
@header(#{ name: "X-P2-Sensitive-Solution" })
8080
sensitiveSolution: string,
8181

82-
@body importData?: polyproto.core.Models.P2Export,
82+
@body importData?: polyproto.core.models.P2Export,
8383
): {
8484
@statusCode statusCode: 202;
8585

@@ -160,7 +160,7 @@ namespace polyproto.core.Routes.Migration {
160160

161161
@doc("A list of completed `KeyTrial`s.")
162162
@header(#{ name: "X-P2-core-keytrial" })
163-
keyTrial: polyproto.core.Models.KeyTrialCompleted[],
163+
keyTrial: polyproto.core.models.KeyTrialCompleted[],
164164
): {
165165
@statusCode statusCode: 200 | 403;
166166
};
@@ -183,7 +183,7 @@ namespace polyproto.core.Routes.Migration {
183183
@added(Version.`v1.0-beta.3`)
184184
@summary("Commit re-signed messages")
185185
op commitMessages(
186-
@body messages: polyproto.core.Models.MessageBatch<string>[],
186+
@body messages: polyproto.core.models.MessageBatch<string>[],
187187
): {
188188
@statusCode statusCode: 200;
189189

@@ -197,7 +197,7 @@ namespace polyproto.core.Routes.Migration {
197197

198198
@doc("Another message batch, if there are still messages left to re-sign.")
199199
@body
200-
message?: polyproto.core.Models.MessageBatch<string>[];
200+
message?: polyproto.core.models.MessageBatch<string>[];
201201
} | {
202202
@statusCode _: 400 | 403;
203203
};
@@ -225,7 +225,7 @@ namespace polyproto.core.Routes.Migration {
225225
@header(#{ name: "X-P2-Return-Body-Size-Limit " })
226226
sizeLimit?: string;
227227

228-
@body message: polyproto.core.Models.MessageBatch<string>[];
228+
@body message: polyproto.core.models.MessageBatch<string>[];
229229
} | {
230230
@statusCode statusCode: 403;
231231
};
@@ -268,10 +268,10 @@ namespace polyproto.core.Routes.Migration {
268268
} | {
269269
@statusCode statusCode: 200;
270270
@body response?: {
271-
keyTrial: polyproto.core.Models.KeyTrial;
271+
keyTrial: polyproto.core.models.KeyTrial;
272272

273273
@minItems(1)
274-
keyTrialCompletion: polyproto.core.Models.KeyTrialCompleted[];
274+
keyTrialCompletion: polyproto.core.models.KeyTrialCompleted[];
275275
}[];
276276
};
277277

@@ -293,7 +293,7 @@ namespace polyproto.core.Routes.Migration {
293293

294294
@doc("A list of completed `KeyTrial`s.")
295295
@header(#{ name: "X-P2-core-keytrial" })
296-
keyTrial: polyproto.core.Models.KeyTrialCompleted[],
296+
keyTrial: polyproto.core.models.KeyTrialCompleted[],
297297
): {
298298
@statusCode statusCode: 204;
299299

@@ -322,10 +322,10 @@ namespace polyproto.core.Routes.Migration {
322322
op exportData(
323323
@doc("A list of completed `KeyTrial`s")
324324
@header(#{ name: "X-P2-core-keytrial" })
325-
keyTrial: polyproto.core.Models.KeyTrialCompleted[],
325+
keyTrial: polyproto.core.models.KeyTrialCompleted[],
326326
): {
327327
@statusCode statusCode: 200;
328-
@body body: polyproto.core.Models.P2Export;
328+
@body body: polyproto.core.models.P2Export;
329329
} | {
330330
@statusCode statusCode: 204;
331331

polyproto/core/routes/rawr.tsp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,25 @@ using TypeSpec.Versioning;
1212
namespace polyproto.core.Routes.ResourceAddressingWithRelativeRoots {
1313
@tag("Resource addressing with relative roots - Registration not required")
1414
namespace Unregistered {
15+
/**
16+
* Get information about how much storage you are allowed to use, and see how much storage you
17+
* are currently using.
18+
*/
19+
@route("/usage")
20+
@get
21+
@added(Version.`v1.0-beta.3`)
22+
@summary("Retrieve information about your storage usage")
23+
op getStorageLimitInfo(): {
24+
@statusCode _s: 200;
25+
@body _b: {
26+
@doc("How many bytes of storage you are allowed to upload in total")
27+
limit: uint64;
28+
29+
@doc("How many bytes of storage you are currently using")
30+
used: uint64;
31+
};
32+
};
33+
1534
/**
1635
* Retrieve a [RawR](https://docs.polyphony.chat/Protocol%20Specifications/core/#731-resource-addressing-with-relative-roots)
1736
* resource by specifying the ID of the resource.
@@ -55,7 +74,7 @@ namespace polyproto.core.Routes.ResourceAddressingWithRelativeRoots {
5574
@summary("Retrieve information about a RawR resource")
5675
op getResourceInfos(@path rid: string): {
5776
@statusCode statusCode: 200;
58-
@body body: polyproto.core.Models.ResourceInformation[];
77+
@body body: polyproto.core.models.ResourceInformation[];
5978
} | {
6079
@statusCode _: 308;
6180

@@ -93,7 +112,7 @@ namespace polyproto.core.Routes.ResourceAddressingWithRelativeRoots {
93112
contentLength: uint64,
94113

95114
@query
96-
resourceAccessProperties: polyproto.core.Models.ResourceAccessProperties,
115+
resourceAccessProperties: polyproto.core.models.ResourceAccessProperties,
97116

98117
@body file: File,
99118
):
@@ -152,7 +171,7 @@ namespace polyproto.core.Routes.ResourceAddressingWithRelativeRoots {
152171
@path rid: string,
153172

154173
@body
155-
resourceAccessProperties: polyproto.core.Models.ResourceAccessProperties,
174+
resourceAccessProperties: polyproto.core.models.ResourceAccessProperties,
156175
): {
157176
@header(#{ name: "Content-Length" })
158177
contentLength: 0;
@@ -171,15 +190,15 @@ namespace polyproto.core.Routes.ResourceAddressingWithRelativeRoots {
171190
@summary("List your uploaded resources")
172191
op getResourceList(
173192
@query limit?: uint32 = 50,
174-
@query sort?: polyproto.core.Models.ResourceListSorting,
193+
@query sort?: polyproto.core.models.ResourceListSorting,
175194

176195
@doc("Whether to request content previews for supported file formats")
177196
@query
178197
previews?: boolean = false,
179198
): {
180199
@statusCode statusCode: 200;
181200
@body body: {
182-
resourceInformation: polyproto.core.Models.ResourceInformation;
201+
resourceInformation: polyproto.core.models.ResourceInformation;
183202

184203
@doc("Only present, if `previews` was set to `true` in the request, and if the response contains preview-supported file types.")
185204
preview?: File;
@@ -191,25 +210,6 @@ namespace polyproto.core.Routes.ResourceAddressingWithRelativeRoots {
191210
contentLength: 0;
192211
};
193212
}
194-
195-
/**
196-
* Get information about how much storage you are allowed to use, and see how much storage you
197-
* are currently using.
198-
*/
199-
@route("/usage")
200-
@get
201-
@added(Version.`v1.0-beta.3`)
202-
@summary("Retrieve information about your storage usage")
203-
op getStorageLimitInfo(): {
204-
@statusCode _s: 200;
205-
@body _b: {
206-
@doc("How many bytes of storage you are allowed to upload in total")
207-
limit: uint64;
208-
209-
@doc("How many bytes of storage you are currently using")
210-
used: uint64;
211-
};
212-
};
213213
}
214214

215215
// rawr x3

polyproto/core/routes/services.tsp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ namespace polyproto.core.Routes.Services {
2121
@added(Version.`v1.0-beta.3`)
2222
@returnsDoc("A singular service object, representing the service that was added.")
2323
@errorsDoc("Returned, if the service and URL combination already exists in the list of discoverable services.")
24-
op registerService(service: polyproto.core.Models.Service): {
24+
op registerService(service: polyproto.core.models.Service): {
2525
@statusCode statusCode: 201;
26-
@body body: polyproto.core.Models.Service;
26+
@body body: polyproto.core.models.Service;
2727
} | {
2828
@statusCode statusCode: 409;
2929
};
@@ -53,7 +53,7 @@ namespace polyproto.core.Routes.Services {
5353
@statusCode statusCode: 200;
5454
@body returnedBody?: {
5555
service: string;
56-
new_primary: url;
56+
newPrimary: url;
5757
}[];
5858
} | {
5959
@statusCode statusCode: 400 | 403 | 404;
@@ -89,7 +89,7 @@ namespace polyproto.core.Routes.Services {
8989
@maxItems(2)
9090
@minItems(1)
9191
@body
92-
body: polyproto.core.Models.Service[];
92+
body: polyproto.core.models.Service[];
9393
} | {
9494
@statusCode statusCode: 400 | 403;
9595
};
@@ -114,7 +114,7 @@ namespace polyproto.core.Routes.Services {
114114
@path fid: string,
115115
@query @minValue(1) limit?: uint64,
116116
):
117-
| polyproto.core.Models.Service[]
117+
| polyproto.core.models.Service[]
118118
| {
119119
@statusCode statusCode: 204;
120120

@@ -126,7 +126,7 @@ namespace polyproto.core.Routes.Services {
126126
}
127127
| {
128128
@statusCode statusCode: 200;
129-
@body body: polyproto.core.Models.Service[];
129+
@body body: polyproto.core.models.Service[];
130130
};
131131

132132
/**
@@ -147,7 +147,7 @@ namespace polyproto.core.Routes.Services {
147147
@path service: string,
148148
@query @minValue(1) limit?: uint64,
149149
):
150-
| polyproto.core.Models.Service[]
150+
| polyproto.core.models.Service[]
151151
| {
152152
@statusCode statusCode: 204;
153153

@@ -159,7 +159,7 @@ namespace polyproto.core.Routes.Services {
159159
}
160160
| {
161161
@statusCode statusCode: 200;
162-
@body body: polyproto.core.Models.Service[];
162+
@body body: polyproto.core.models.Service[];
163163
};
164164
}
165165
}

0 commit comments

Comments
 (0)