-
Notifications
You must be signed in to change notification settings - Fork 407
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User invite codes #757
User invite codes #757
Changes from 11 commits
2673f01
8dcf2dd
c2f10e8
6f76fac
d8cdf85
0f38130
feebfee
7d9c61c
28b9a26
3da72c2
7539b5d
55978c7
504cac6
8cb3a65
34fba27
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.disableInviteCodes", | ||
"defs": { | ||
"main": { | ||
"type": "procedure", | ||
"description": "Disable some set of codes and/or all codes associated with a set of users", | ||
"input": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"properties": { | ||
"codes": { | ||
"type": "array", | ||
"items": {"type": "string"} | ||
}, | ||
"accounts": { | ||
"type": "array", | ||
"items": {"type": "string"} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.getInviteCodeUsage", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "High level stats about invite code usage", | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["total", "user", "admin"], | ||
"properties": { | ||
"total": { "type": "ref", "ref": "#codesDetail" }, | ||
"user": { "type": "ref", "ref": "#codesDetail" }, | ||
"admin": { "type": "ref", "ref": "#codesDetail" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's on the horizon to switch-up how admin auth works, and certain user accounts may be marked as admins. Just tossing that out there for a gut check that this API will still match-up with that nicely, given that there could be overlap between "user" and "admin". I think it still could work— "user" would just have to be specifically for non-admin accounts. Or another way to think about it is whether the invite code is generated from |
||
} | ||
} | ||
} | ||
}, | ||
"codesDetail": { | ||
"type": "object", | ||
"required": ["count", "available", "used", "disabled"], | ||
"properties": { | ||
"count": {"type": "integer"}, | ||
"available": {"type": "integer"}, | ||
"used": {"type": "integer"}, | ||
"disabled": {"type": "integer"} | ||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.admin.getInviteCodes", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "Admin view of invite codes", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"sort": { | ||
"type": "string", | ||
"knownValues": [ | ||
"recent", | ||
"usage" | ||
], | ||
"default": "recent" | ||
}, | ||
"limit": {"type": "integer", "minimum": 1, "maximum": 500, "default": 100}, | ||
"cursor": {"type": "string"} | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["codes"], | ||
"properties": { | ||
"cursor": {"type": "string"}, | ||
"codes": { | ||
"type": "array", | ||
"items": {"type": "ref", "ref": "#codeDetail"} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"codeDetail": { | ||
"type": "object", | ||
"required": ["code", "available", "disabled", "forAccount", "createdBy", "createdAt", "uses"], | ||
"properties": { | ||
"code": {"type": "string"}, | ||
"available": {"type": "integer"}, | ||
"disabled": {"type": "boolean"}, | ||
"forAccount": {"type": "string"}, | ||
"createdBy": {"type": "string"}, | ||
"createdAt": {"type": "string"}, | ||
dholms marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"uses": { | ||
"type": "array", | ||
"items": {"type": "ref", "ref": "#codeUse"} | ||
} | ||
} | ||
}, | ||
"codeUse": { | ||
"type": "object", | ||
"required": ["usedBy", "usedAt"], | ||
"properties": { | ||
"usedBy": {"type": "string"}, | ||
"usedAt": {"type": "string"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could toss a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
{ | ||
"lexicon": 1, | ||
"id": "com.atproto.server.getAccountInviteCodes", | ||
"defs": { | ||
"main": { | ||
"type": "query", | ||
"description": "Get all invite codes for a given account", | ||
"parameters": { | ||
"type": "params", | ||
"properties": { | ||
"includeUsed": { "type": "boolean", "default": true }, | ||
"createAvailable": { "type": "boolean", "default": true } | ||
} | ||
}, | ||
"output": { | ||
"encoding": "application/json", | ||
"schema": { | ||
"type": "object", | ||
"required": ["codes"], | ||
"properties": { | ||
"codes": { | ||
"type": "array", | ||
"items": { | ||
"type": "ref", | ||
"ref": "#invite" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"errors": [ | ||
{"name": "DuplicateCreate"} | ||
] | ||
}, | ||
"invite": { | ||
"type": "object", | ||
"required": ["code", "available", "uses", "disabled"], | ||
"properties": { | ||
"code": { "type": "string" }, | ||
"available": { "type": "integer" }, | ||
"uses": { "type": "integer" }, | ||
"disabled": { "type": "boolean" } | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be useful to add timespan parameters to this query, if that's not too difficult. Then in the dashboard we could give (last week, last month, all time) on these stats