Skip to content

Commit baf4f07

Browse files
authored
Merge pull request #76 from biglocalnews/api-changes
Update queries to fit changes made during Squarelet migration
2 parents eceec18 + 398afae commit baf4f07

2 files changed

Lines changed: 1 addition & 393 deletions

File tree

bln/client.py

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -98,18 +98,6 @@ def personalTokens(self):
9898
"""Return the current user's personal tokens."""
9999
return self._gql(q.query_personalTokens)
100100

101-
def oauth2Codes(self):
102-
"""Return the current user's OAuth2 codes (authorized plugins)."""
103-
return self._gql(q.query_oauth2Codes)
104-
105-
def oauth2Tokens(self):
106-
"""Return the current user's OAuth2 tokens (authorized plugins)."""
107-
return self._gql(q.query_oauth2Tokens)
108-
109-
def oauth2Clients(self):
110-
"""Return the current user's owned OAuth2 clients (plugins)."""
111-
return self._gql(q.query_oauth2Clients)
112-
113101
def userNames(self):
114102
"""Return a list of the user names on the platform."""
115103
return self._gql(q.query_userNames)
@@ -122,18 +110,6 @@ def openProjects(self):
122110
"""Return a list of open projects."""
123111
return self._gql(q.query_openProjects)
124112

125-
def oauth2ClientsPublic(self):
126-
"""Return a list of Public OAuth2 Clients, i.e. plugins."""
127-
return self._gql(q.query_oauth2ClientsPublic)
128-
129-
def authorizeOauth2Client(self, id, state):
130-
"""Authorize an OAuth2 client by id with state."""
131-
return self._gql(q.mutation_authorizeOauth2Client, locals())
132-
133-
def authorizeWithPkceOauth2Client(self, id, state, codeChallenge):
134-
"""Authorize an OAuth2 client by id with state and code challenge."""
135-
return self._gql(q.mutation_authorizeWithPkceOauth2Client, locals())
136-
137113
def createFileDownloadUri(self, projectId, fileName):
138114
"""Create a file download uri with a projectId and fileName."""
139115
return self._gql(q.mutation_createFileDownloadUri, locals())
@@ -167,37 +143,6 @@ def createGroup(
167143
variables = {k: v for k, v in locals().items() if v}
168144
return self._gql(q.mutation_createGroup, variables)
169145

170-
def createOauth2Client(
171-
self,
172-
name,
173-
description,
174-
redirectUris,
175-
contact=None,
176-
contactMethod=None,
177-
scopes=None,
178-
pkceRequired=False,
179-
):
180-
"""Create an OAuth2 Client (plugin).
181-
182-
Args:
183-
name: Client name; must be unique.
184-
description: Plugin description
185-
redirectUris: Where to redirect user to for authorization.
186-
contact: A phone number with format "+X (XXX) XXX-XXXX" or email;
187-
defaults to author's contact value.
188-
contactMethod: PHONE or EMAIL; defaults to author's contact method.
189-
scopes: {project,group,user}_{read,write} -- user_write and
190-
group_write are not allowed for clients; defaults to
191-
[user_read, project_read, project_write].
192-
pkceRequired: Whether to use PKCE. Required for mobile/SPAs;
193-
defaults to False.
194-
195-
Returns:
196-
client: the resulting client or None if error.
197-
"""
198-
variables = {k: v for k, v in locals().items() if v}
199-
return self._gql(q.mutation_createOauth2Client, variables)
200-
201146
def createPersonalToken(self):
202147
"""Create a personal token."""
203148
return self._gql(q.mutation_createPersonalToken)
@@ -274,30 +219,10 @@ def deleteProject(self, id):
274219
"""Delete project `projectId`."""
275220
return self._gql(q.mutation_deleteProject, locals())
276221

277-
def deleteOauth2Client(self, id):
278-
"""Delete OAuth2 Client with id `id`."""
279-
return self._gql(q.mutation_deleteOauth2Client, locals())
280-
281-
def exchangeOauth2CodeForToken(self, code):
282-
"""Exchange an OAuth2 code for a token."""
283-
return self._gql(q.mutation_exchangeOauth2CodeForToken, locals())
284-
285-
def exchangeOauth2CodeWithPkceForToken(self, code, codeVerifier):
286-
"""Exchange an OAuth2 code and code verifier for a token."""
287-
return self._gql(q.mutation_exchangeOauth2CodeForToken, locals())
288-
289-
def revokeOauth2Token(self, token):
290-
"""Revoke an OAuth2 token (used by clients)."""
291-
return self._gql(q.mutation_revokeOauth2Token, locals())
292-
293222
def revokePersonalTokens(self, token):
294223
"""Revoke a Personal Tokens."""
295224
return self._gql(q.mutation_revokePersonalToken, locals())
296225

297-
def unauthorizeOauth2Client(self, id):
298-
"""Unauthorize an OAuth2 client by id."""
299-
return self._gql(q.mutation_unauthorizeOauth2Client, locals())
300-
301226
def updateGroup(
302227
self,
303228
id,
@@ -323,21 +248,6 @@ def updateGroup(
323248
variables = {k: v for k, v in locals().items() if v}
324249
return self._gql(q.mutation_updateGroup, variables)
325250

326-
def updateOauth2Client(
327-
self,
328-
id,
329-
name=None,
330-
description=None,
331-
redirectUris=None,
332-
contact=None,
333-
contactMethod=None,
334-
scopes=None,
335-
pkceRequired=False,
336-
):
337-
"""Update an OAuth2 Client (plugin)."""
338-
variables = {k: v for k, v in locals().items() if v}
339-
return self._gql(q.mutation_updateOauth2Client, variables)
340-
341251
def updateProject(
342252
self,
343253
id,
@@ -375,31 +285,6 @@ def updateProject(
375285
self.upload_files(id, files or [])
376286
return self._gql(q.mutation_updateProject, variables)
377287

378-
def updateUser(
379-
self,
380-
id,
381-
name=None,
382-
displayName=None,
383-
contact=None,
384-
contactMethod=None,
385-
):
386-
"""Update a user.
387-
388-
Args:
389-
id: id of user to update.
390-
name: a valid user name.
391-
displayName: display name of user.
392-
contact: a phone number with format "+X (XXX) XXX-XXXX" or email.
393-
contactMethod: PHONE or EMAIL.
394-
395-
Returns:
396-
user: the resulting user or None if error.
397-
"""
398-
variables = {k: v for k, v in locals().items() if v}
399-
return self._gql(q.mutation_updateUser, variables)
400-
401-
# python SDK convenience functions
402-
403288
def get_project_by_id(self, id: str):
404289
"""Get the project with the provided id.
405290

0 commit comments

Comments
 (0)