Oauth Lookup

enum q2_sdk.hq.db.oauth_lookup.TokenType(value)[source]

Bases: Enum

Valid values are as follows:

Access = <TokenType.Access: 'Access'>
Authorization = <TokenType.Authorization: 'Authorization'>
Refresh = <TokenType.Refresh: 'Refresh'>
class q2_sdk.hq.db.oauth_lookup.OAuthLookupDataRow[source]

Bases: RepresentationRowBase

OAuthLookupKeyID: IntElement = 'OAuthLookupKeyID'
OAuthLookupKeyName: StringElement = 'OAuthLookupKeyName'
UserID_: IntElement = 'UserID_'
CustomerID_: IntElement = 'CustomerID_'
accessToken: StringElement = 'accessToken'
Expiry: StringElement = 'Expiry'
class q2_sdk.hq.db.oauth_lookup.OAuthLookup(logger, hq_credentials=None, ret_table_obj=None)[source]

Bases: DbObject

Programmatic access to the Q2 database. Not as flexible as a true ORM, but takes the guesswork out of database schemas and ensures safety in the transactions.

Parameters:
  • logger – Reference to calling request’s logger (self.logger in your extension)

  • hq_credentials (Optional[HqCredentials]) – HQ Connectivity Information (Defaults to settings file)

  • ret_table_obj (Optional[bool]) – Flag to return list of LXML elements if False or TableRow objects from DB calls if True (Defaults to settings file)

REPRESENTATION_ROW_CLASS

alias of OAuthLookupDataRow

add_arguments(parser)[source]

Hook for subclassed DbObjects to add custom arguments.

async get(clientid, user_id=None, customer_id=None, token_type='Access', enabled_only='True', no_trunc=False, serialize_for_cli=False)[source]
Return type:

List[OAuthLookupDataRow]

async get_by_user(user_id=None, customer_id=None, no_trunc=False, serialize_for_cli=False)[source]
async get_by_id(oauth_lookup_id, no_trunc=False, serialize_for_cli=False)[source]
async get_by_value(clientid, access_token, enabled_only='True', token_type='Access', no_trunc=False, serialize_for_cli=False)[source]
Return type:

List[OAuthLookupDataRow]

async add_update(customer_id, user_id, clientid, access_token, token_type='Access', scope=None, expiry=None)[source]
async enable(customer_id=-1, user_id=-1, clientid=None, access_token=None, token_type='Access', oauthtokenid=-1)[source]
async disable(customer_id=-1, user_id=-1, clientid=None, access_token=None, token_type='Access', oauthtokenid=-1)[source]
async delete(clientid, customer_id, user_id, access_token, online_session, online_user, token_type='Access')[source]