Skip to content

Commit

Permalink
Update lexicons fetched from 2768fb9 committed 2023-06-20T14:36:09Z (#75
Browse files Browse the repository at this point in the history
)
  • Loading branch information
MarshalX authored Jun 23, 2023
1 parent 4a775c9 commit 973c7e2
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@


@dataclass
class Params(base.ParamsModelBase):
class Data(base.DataModelBase):

"""Parameters model for :obj:`com.atproto.sync.notifyOfUpdate`."""
"""Input data model for :obj:`com.atproto.sync.notifyOfUpdate`."""

hostname: str #: Hostname of the service that is notifying of update.
4 changes: 2 additions & 2 deletions atproto/xrpc_client/models/com/atproto/sync/request_crawl.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@


@dataclass
class Params(base.ParamsModelBase):
class Data(base.DataModelBase):

"""Parameters model for :obj:`com.atproto.sync.requestCrawl`."""
"""Input data model for :obj:`com.atproto.sync.requestCrawl`."""

hostname: str #: Hostname of the service that is requesting to be crawled.
22 changes: 12 additions & 10 deletions atproto/xrpc_client/namespaces/async_ns.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,13 +1008,11 @@ async def list_repos(
)
return get_response_model(response, models.ComAtprotoSyncListRepos.Response)

async def notify_of_update(
self, params: t.Union[dict, 'models.ComAtprotoSyncNotifyOfUpdate.Params'], **kwargs
) -> bool:
async def notify_of_update(self, data: t.Union[dict, 'models.ComAtprotoSyncNotifyOfUpdate.Data'], **kwargs) -> bool:
"""Notify a crawling service of a recent update. Often when a long break between updates causes the connection with the crawling service to break.
Args:
params: Parameters.
data: Input data.
**kwargs: Arbitrary arguments to HTTP request.
Returns:
Expand All @@ -1024,15 +1022,17 @@ async def notify_of_update(
:class:`atproto.exceptions.AtProtocolError`: Base exception.
"""

params_model = get_or_create_model(params, models.ComAtprotoSyncNotifyOfUpdate.Params)
response = await self._client.invoke_query('com.atproto.sync.notifyOfUpdate', params=params_model, **kwargs)
data_model = get_or_create_model(data, models.ComAtprotoSyncNotifyOfUpdate.Data)
response = await self._client.invoke_procedure(
'com.atproto.sync.notifyOfUpdate', data=data_model, input_encoding='application/json', **kwargs
)
return get_response_model(response, bool)

async def request_crawl(self, params: t.Union[dict, 'models.ComAtprotoSyncRequestCrawl.Params'], **kwargs) -> bool:
async def request_crawl(self, data: t.Union[dict, 'models.ComAtprotoSyncRequestCrawl.Data'], **kwargs) -> bool:
"""Request a service to persistently crawl hosted repos.
Args:
params: Parameters.
data: Input data.
**kwargs: Arbitrary arguments to HTTP request.
Returns:
Expand All @@ -1042,8 +1042,10 @@ async def request_crawl(self, params: t.Union[dict, 'models.ComAtprotoSyncReques
:class:`atproto.exceptions.AtProtocolError`: Base exception.
"""

params_model = get_or_create_model(params, models.ComAtprotoSyncRequestCrawl.Params)
response = await self._client.invoke_query('com.atproto.sync.requestCrawl', params=params_model, **kwargs)
data_model = get_or_create_model(data, models.ComAtprotoSyncRequestCrawl.Data)
response = await self._client.invoke_procedure(
'com.atproto.sync.requestCrawl', data=data_model, input_encoding='application/json', **kwargs
)
return get_response_model(response, bool)


Expand Down
20 changes: 12 additions & 8 deletions atproto/xrpc_client/namespaces/sync_ns.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,11 +1008,11 @@ def list_repos(
)
return get_response_model(response, models.ComAtprotoSyncListRepos.Response)

def notify_of_update(self, params: t.Union[dict, 'models.ComAtprotoSyncNotifyOfUpdate.Params'], **kwargs) -> bool:
def notify_of_update(self, data: t.Union[dict, 'models.ComAtprotoSyncNotifyOfUpdate.Data'], **kwargs) -> bool:
"""Notify a crawling service of a recent update. Often when a long break between updates causes the connection with the crawling service to break.
Args:
params: Parameters.
data: Input data.
**kwargs: Arbitrary arguments to HTTP request.
Returns:
Expand All @@ -1022,15 +1022,17 @@ def notify_of_update(self, params: t.Union[dict, 'models.ComAtprotoSyncNotifyOfU
:class:`atproto.exceptions.AtProtocolError`: Base exception.
"""

params_model = get_or_create_model(params, models.ComAtprotoSyncNotifyOfUpdate.Params)
response = self._client.invoke_query('com.atproto.sync.notifyOfUpdate', params=params_model, **kwargs)
data_model = get_or_create_model(data, models.ComAtprotoSyncNotifyOfUpdate.Data)
response = self._client.invoke_procedure(
'com.atproto.sync.notifyOfUpdate', data=data_model, input_encoding='application/json', **kwargs
)
return get_response_model(response, bool)

def request_crawl(self, params: t.Union[dict, 'models.ComAtprotoSyncRequestCrawl.Params'], **kwargs) -> bool:
def request_crawl(self, data: t.Union[dict, 'models.ComAtprotoSyncRequestCrawl.Data'], **kwargs) -> bool:
"""Request a service to persistently crawl hosted repos.
Args:
params: Parameters.
data: Input data.
**kwargs: Arbitrary arguments to HTTP request.
Returns:
Expand All @@ -1040,8 +1042,10 @@ def request_crawl(self, params: t.Union[dict, 'models.ComAtprotoSyncRequestCrawl
:class:`atproto.exceptions.AtProtocolError`: Base exception.
"""

params_model = get_or_create_model(params, models.ComAtprotoSyncRequestCrawl.Params)
response = self._client.invoke_query('com.atproto.sync.requestCrawl', params=params_model, **kwargs)
data_model = get_or_create_model(data, models.ComAtprotoSyncRequestCrawl.Data)
response = self._client.invoke_procedure(
'com.atproto.sync.requestCrawl', data=data_model, input_encoding='application/json', **kwargs
)
return get_response_model(response, bool)


Expand Down
15 changes: 9 additions & 6 deletions lexicons/com.atproto.sync.notifyOfUpdate.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
"id": "com.atproto.sync.notifyOfUpdate",
"defs": {
"main": {
"type": "query",
"type": "procedure",
"description": "Notify a crawling service of a recent update. Often when a long break between updates causes the connection with the crawling service to break.",
"parameters": {
"type": "params",
"required": ["hostname"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the service that is notifying of update."}
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["hostname"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the service that is notifying of update."}
}
}
}
}
Expand Down
15 changes: 9 additions & 6 deletions lexicons/com.atproto.sync.requestCrawl.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
"id": "com.atproto.sync.requestCrawl",
"defs": {
"main": {
"type": "query",
"type": "procedure",
"description": "Request a service to persistently crawl hosted repos.",
"parameters": {
"type": "params",
"required": ["hostname"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the service that is requesting to be crawled."}
"input": {
"encoding": "application/json",
"schema": {
"type": "object",
"required": ["hostname"],
"properties": {
"hostname": {"type": "string", "description": "Hostname of the service that is requesting to be crawled."}
}
}
}
}
Expand Down

0 comments on commit 973c7e2

Please sign in to comment.