Skip to content

Commit

Permalink
create interface using v3 and get interface types using v3
Browse files Browse the repository at this point in the history
  • Loading branch information
laurapanzariello committed May 22, 2018
1 parent 05023ad commit 49472b2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions networkapiclient/ApiInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,27 @@ def remove(self, ids, **kwargs):
url = build_uri_with_ids('api/v3/interface/%s/', ids)

return super(ApiInterfaceRequest, self).delete(self.prepare_url(url, kwargs))

def create(self, interface):
"""
Method to add an interface.
:param interface: List containing interface's desired to be created on database.
:return: Id.
"""

data = {'interfaces': interface}
return super(ApiInterfaceRequest, self).post('api/v3/interface/', data)

def get_interface_type(self, ids=None, **kwargs):
"""
Method to get interfaces by their ids.
:param ids: List containing identifiers of interfaces.
:return: Dict containing interfaces.git
"""

url = 'api/v3/interfacetype/'

if ids:
url = build_uri_with_ids(url, ids)

return super(ApiInterfaceRequest, self).get(self.prepare_url(url, kwargs))

0 comments on commit 49472b2

Please sign in to comment.