Skip to content
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

Admin account state endpoints #1725

Closed
wants to merge 12 commits into from
17 changes: 17 additions & 0 deletions lexicons/com/atproto/admin/defs.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
"lexicon": 1,
"id": "com.atproto.admin.defs",
"defs": {
"statusAttr": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swapped out "state" for "status" (inspired by Foysal's PR #1617)

As well, differentiated between the names of these two:
"status attribute": an individual attribute of a subject's status. For instance, it's current takedown status
"status": all attributes of a subject's status

"type": "object",
"required": ["applied"],
"properties": {
"applied": { "type": "boolean" },
"ref": { "type": "string" }
}
},
"actionView": {
"type": "object",
"required": [
Expand Down Expand Up @@ -257,6 +265,15 @@
"did": { "type": "string", "format": "did" }
}
},
"repoBlobRef": {
"type": "object",
"required": ["did", "cid"],
"properties": {
"did": { "type": "string", "format": "did" },
"cid": { "type": "string", "format": "cid" },
"recordUri": { "type": "string", "format": "at-uri" }
}
},
"recordView": {
"type": "object",
"required": [
Expand Down
39 changes: 39 additions & 0 deletions lexicons/com/atproto/admin/getSubjectStatus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"lexicon": 1,
"id": "com.atproto.admin.getSubjectStatus",
"defs": {
"main": {
"type": "query",
"description": "Fetch the service-specific the admin status of a subject (account, record, or blob)",
"parameters": {
"type": "params",
"properties": {
"did": { "type": "string", "format": "did" },
"uri": { "type": "string", "format": "at-uri" },
"blob": { "type": "string", "format": "cid" }
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["subject"],
"properties": {
"subject": {
"type": "union",
"refs": [
"com.atproto.admin.defs#repoRef",
"com.atproto.repo.strongRef",
"com.atproto.admin.defs#repoBlobRef"
]
},
"takedown": {
"type": "ref",
"ref": "com.atproto.admin.defs#subjectStatus"
}
}
}
}
}
}
}
52 changes: 52 additions & 0 deletions lexicons/com/atproto/admin/updateSubjectStatus.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"lexicon": 1,
"id": "com.atproto.admin.updateSubjectStatus",
"defs": {
"main": {
"type": "procedure",
"description": "Update the service-specific admin status of a subject (account, record, or blob)",
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["subject"],
"properties": {
"subject": {
"type": "union",
"refs": [
"com.atproto.admin.defs#repoRef",
"com.atproto.repo.strongRef",
"com.atproto.admin.defs#repoBlobRef"
]
},
"takedown": {
"type": "ref",
"ref": "com.atproto.admin.defs#statusAttr"
}
}
}
},
"output": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["subject"],
"properties": {
"subject": {
"type": "union",
"refs": [
"com.atproto.admin.defs#repoRef",
"com.atproto.repo.strongRef",
"com.atproto.admin.defs#repoBlobRef"
]
},
"takedown": {
"type": "ref",
"ref": "com.atproto.admin.defs#statusAttr"
}
}
}
}
}
}
}
26 changes: 26 additions & 0 deletions packages/api/src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ import * as ComAtprotoAdminGetModerationReport from './types/com/atproto/admin/g
import * as ComAtprotoAdminGetModerationReports from './types/com/atproto/admin/getModerationReports'
import * as ComAtprotoAdminGetRecord from './types/com/atproto/admin/getRecord'
import * as ComAtprotoAdminGetRepo from './types/com/atproto/admin/getRepo'
import * as ComAtprotoAdminGetSubjectStatus from './types/com/atproto/admin/getSubjectStatus'
import * as ComAtprotoAdminResolveModerationReports from './types/com/atproto/admin/resolveModerationReports'
import * as ComAtprotoAdminReverseModerationAction from './types/com/atproto/admin/reverseModerationAction'
import * as ComAtprotoAdminSearchRepos from './types/com/atproto/admin/searchRepos'
import * as ComAtprotoAdminSendEmail from './types/com/atproto/admin/sendEmail'
import * as ComAtprotoAdminTakeModerationAction from './types/com/atproto/admin/takeModerationAction'
import * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/updateAccountEmail'
import * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle'
import * as ComAtprotoAdminUpdateSubjectStatus from './types/com/atproto/admin/updateSubjectStatus'
import * as ComAtprotoIdentityResolveHandle from './types/com/atproto/identity/resolveHandle'
import * as ComAtprotoIdentityUpdateHandle from './types/com/atproto/identity/updateHandle'
import * as ComAtprotoLabelDefs from './types/com/atproto/label/defs'
Expand Down Expand Up @@ -151,13 +153,15 @@ export * as ComAtprotoAdminGetModerationReport from './types/com/atproto/admin/g
export * as ComAtprotoAdminGetModerationReports from './types/com/atproto/admin/getModerationReports'
export * as ComAtprotoAdminGetRecord from './types/com/atproto/admin/getRecord'
export * as ComAtprotoAdminGetRepo from './types/com/atproto/admin/getRepo'
export * as ComAtprotoAdminGetSubjectStatus from './types/com/atproto/admin/getSubjectStatus'
export * as ComAtprotoAdminResolveModerationReports from './types/com/atproto/admin/resolveModerationReports'
export * as ComAtprotoAdminReverseModerationAction from './types/com/atproto/admin/reverseModerationAction'
export * as ComAtprotoAdminSearchRepos from './types/com/atproto/admin/searchRepos'
export * as ComAtprotoAdminSendEmail from './types/com/atproto/admin/sendEmail'
export * as ComAtprotoAdminTakeModerationAction from './types/com/atproto/admin/takeModerationAction'
export * as ComAtprotoAdminUpdateAccountEmail from './types/com/atproto/admin/updateAccountEmail'
export * as ComAtprotoAdminUpdateAccountHandle from './types/com/atproto/admin/updateAccountHandle'
export * as ComAtprotoAdminUpdateSubjectStatus from './types/com/atproto/admin/updateSubjectStatus'
export * as ComAtprotoIdentityResolveHandle from './types/com/atproto/identity/resolveHandle'
export * as ComAtprotoIdentityUpdateHandle from './types/com/atproto/identity/updateHandle'
export * as ComAtprotoLabelDefs from './types/com/atproto/label/defs'
Expand Down Expand Up @@ -471,6 +475,17 @@ export class AdminNS {
})
}

getSubjectStatus(
params?: ComAtprotoAdminGetSubjectStatus.QueryParams,
opts?: ComAtprotoAdminGetSubjectStatus.CallOptions,
): Promise<ComAtprotoAdminGetSubjectStatus.Response> {
return this._service.xrpc
.call('com.atproto.admin.getSubjectStatus', params, undefined, opts)
.catch((e) => {
throw ComAtprotoAdminGetSubjectStatus.toKnownErr(e)
})
}

resolveModerationReports(
data?: ComAtprotoAdminResolveModerationReports.InputSchema,
opts?: ComAtprotoAdminResolveModerationReports.CallOptions,
Expand Down Expand Up @@ -547,6 +562,17 @@ export class AdminNS {
throw ComAtprotoAdminUpdateAccountHandle.toKnownErr(e)
})
}

updateSubjectStatus(
data?: ComAtprotoAdminUpdateSubjectStatus.InputSchema,
opts?: ComAtprotoAdminUpdateSubjectStatus.CallOptions,
): Promise<ComAtprotoAdminUpdateSubjectStatus.Response> {
return this._service.xrpc
.call('com.atproto.admin.updateSubjectStatus', opts?.qp, data, opts)
.catch((e) => {
throw ComAtprotoAdminUpdateSubjectStatus.toKnownErr(e)
})
}
}

export class IdentityNS {
Expand Down
134 changes: 134 additions & 0 deletions packages/api/src/client/lexicons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@ export const schemaDict = {
lexicon: 1,
id: 'com.atproto.admin.defs',
defs: {
statusAttr: {
type: 'object',
required: ['applied'],
properties: {
applied: {
type: 'boolean',
},
ref: {
type: 'string',
},
},
},
actionView: {
type: 'object',
required: [
Expand Down Expand Up @@ -444,6 +456,24 @@ export const schemaDict = {
},
},
},
repoBlobRef: {
type: 'object',
required: ['did', 'cid'],
properties: {
did: {
type: 'string',
format: 'did',
},
cid: {
type: 'string',
format: 'cid',
},
recordUri: {
type: 'string',
format: 'at-uri',
},
},
},
recordView: {
type: 'object',
required: [
Expand Down Expand Up @@ -1026,6 +1056,55 @@ export const schemaDict = {
},
},
},
ComAtprotoAdminGetSubjectStatus: {
lexicon: 1,
id: 'com.atproto.admin.getSubjectStatus',
defs: {
main: {
type: 'query',
description:
'Fetch the service-specific the admin status of a subject (account, record, or blob)',
parameters: {
type: 'params',
properties: {
did: {
type: 'string',
format: 'did',
},
uri: {
type: 'string',
format: 'at-uri',
},
blob: {
type: 'string',
format: 'cid',
},
},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['subject'],
properties: {
subject: {
type: 'union',
refs: [
'lex:com.atproto.admin.defs#repoRef',
'lex:com.atproto.repo.strongRef',
'lex:com.atproto.admin.defs#repoBlobRef',
],
},
takedown: {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#subjectStatus',
},
},
},
},
},
},
},
ComAtprotoAdminResolveModerationReports: {
lexicon: 1,
id: 'com.atproto.admin.resolveModerationReports',
Expand Down Expand Up @@ -1326,6 +1405,59 @@ export const schemaDict = {
},
},
},
ComAtprotoAdminUpdateSubjectStatus: {
lexicon: 1,
id: 'com.atproto.admin.updateSubjectStatus',
defs: {
main: {
type: 'procedure',
description:
'Update the service-specific admin status of a subject (account, record, or blob)',
input: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['subject'],
properties: {
subject: {
type: 'union',
refs: [
'lex:com.atproto.admin.defs#repoRef',
'lex:com.atproto.repo.strongRef',
'lex:com.atproto.admin.defs#repoBlobRef',
],
},
takedown: {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
},
},
},
output: {
encoding: 'application/json',
schema: {
type: 'object',
required: ['subject'],
properties: {
subject: {
type: 'union',
refs: [
'lex:com.atproto.admin.defs#repoRef',
'lex:com.atproto.repo.strongRef',
'lex:com.atproto.admin.defs#repoBlobRef',
],
},
takedown: {
type: 'ref',
ref: 'lex:com.atproto.admin.defs#statusAttr',
},
},
},
},
},
},
},
ComAtprotoIdentityResolveHandle: {
lexicon: 1,
id: 'com.atproto.identity.resolveHandle',
Expand Down Expand Up @@ -7335,6 +7467,7 @@ export const ids = {
ComAtprotoAdminGetModerationReports: 'com.atproto.admin.getModerationReports',
ComAtprotoAdminGetRecord: 'com.atproto.admin.getRecord',
ComAtprotoAdminGetRepo: 'com.atproto.admin.getRepo',
ComAtprotoAdminGetSubjectStatus: 'com.atproto.admin.getSubjectStatus',
ComAtprotoAdminResolveModerationReports:
'com.atproto.admin.resolveModerationReports',
ComAtprotoAdminReverseModerationAction:
Expand All @@ -7344,6 +7477,7 @@ export const ids = {
ComAtprotoAdminTakeModerationAction: 'com.atproto.admin.takeModerationAction',
ComAtprotoAdminUpdateAccountEmail: 'com.atproto.admin.updateAccountEmail',
ComAtprotoAdminUpdateAccountHandle: 'com.atproto.admin.updateAccountHandle',
ComAtprotoAdminUpdateSubjectStatus: 'com.atproto.admin.updateSubjectStatus',
ComAtprotoIdentityResolveHandle: 'com.atproto.identity.resolveHandle',
ComAtprotoIdentityUpdateHandle: 'com.atproto.identity.updateHandle',
ComAtprotoLabelDefs: 'com.atproto.label.defs',
Expand Down
Loading
Loading