class Org(): """Org api class for py-flowdock.""" def __init__(self): """Org api module for py-flowdock.""" self.Configuration = Configuration self.ApiClient = ApiClient(Configuration) def list_org(self): """ List organizations of the authenticated user. """ return self.ApiClient.client( self.Configuration.organizations.get('list_org')) def get_org(self, org_id): """ Parameters: org_id (int): flowdock org id. Get information about an organization using the parameterized name. The authenticated user must belong to the organization. """ qdata = self.Configuration.organizations.get('find_org') qdata.update({'api': qdata['api'].format(id=org_id)}) return self.ApiClient.client(qdata)
class Private(): """Private api module for py-flowdock.""" def __init__(self): """Private api module for py-flowdock.""" self.Configuration = Configuration self.ApiClient = ApiClient(Configuration) def list_private_conversations(self): """ Lists the private conversations of the authenticated user. """ return self.ApiClient.client( self.Configuration.private.get('list_private_conversations')) def get_private_conversations(self, msg_id): """ Parameters: msg_id (int): flowdock private conversations id Get a private conversation. If no existing conversation between users is found, \ a new conversation is automatically created with open attribute set to false. """ qdata = self.Configuration.private.get('get_private_conversations') qdata.update({'api': qdata['api'].format(id=msg_id)}) return self.ApiClient.client(qdata)
class Flow(): """flow api class for py-flowdock.""" def __init__(self): """flow api module for py-flowdock.""" self.Configuration = Configuration self.ApiClient = ApiClient(Configuration) def list_flows(self): """ Lists the flows that the authenticated user is a member of. """ return self.ApiClient.client(self.Configuration.flow.get('list')) def list_all_flows(self): """ Lists the flows that the authenticated user has access to or can join. """ return self.ApiClient.client(self.Configuration.flow.get('list_all')) def get_flow(self, name=None, flow_id=None): """ Parameters: name (str): flowdock flow name. flow_id (int): flowdock flow id Get a single flow. Single flow information always includes the flow’s user list. """ resp = {} if flow_id: qdata = self.Configuration.flow.get('get_flow_id') qdata.update({'api': qdata['api'].format(flow=flow_id)}) resp = self.ApiClient.client(qdata) else: qdata = self.Configuration.flow.get('get_flow_name_org') qdata.update({'api': qdata['api'].format(flow=name)}) resp = self.ApiClient.client(qdata) return resp def create_flow(self, name): """ Parameters: name (str): flowdock flow name. Create a flow for the specified organization. """ qdata = self.Configuration.flow.get('create_flow') qdata.update({'payload': {'name': name}}) return self.ApiClient.client(qdata)
def __init__(self): """Messages api module for py-flowdock.""" self.Configuration = Configuration self.ApiClient = ApiClient(Configuration)
class User(): """user api module for py-flowdock.""" def __init__(self): """user api module for py-flowdock.""" self.Configuration = Configuration self.ApiClient = ApiClient(Configuration) def list_users(self): """ List all users visible to the authenticated user """ return self.ApiClient.client(self.Configuration.user.get('list')) def list_flow_users(self, flow): """ Parameters: flow (str): flowdock user id List the users of a flow. \ The user must belong to the organization and have access to the flow """ qdata = self.Configuration.user.get('list_flow_users') qdata.update({'api': qdata['api'].format(flow=flow)}) return self.ApiClient.client(qdata) def org_users(self): """ List the users of an organization. """ return self.ApiClient.client( self.Configuration.user.get('list_org_users')) def get_user(self, user_id): """ Parameters: user_id (int): flowdock user id Get information about a single user. The requesting user must be belong to same organization as the target user. """ qdata = self.Configuration.user.get('get_user') qdata.update({'api': qdata['api'].format(id=user_id)}) return self.ApiClient.client(qdata) def delete_user(self, user_id): """ Parameters: user_id (int): flowdock user id To remove a user from an organization,\ you will need to have administrator rights to the organization. """ qdata = self.Configuration.user.get('delete_users') qdata.update({'api': qdata['api'].format(id=user_id)}) return self.ApiClient.client(qdata) def add_user_flow(self, flow, user_id): """ Parameters: flow (int): flowdock flow name user_id (int): flowdock user id Add a user to a flow. The authenticated user and the target user must be members of the organization. """ qdata = self.Configuration.user.get('add_user_flow') qdata.update({'api': qdata['api'].format(flow=flow)}) qdata.update({'payload': {'id': user_id}}) return self.ApiClient.client(qdata)